Tuesday, August 11, 2020

Cloud based POS system

oxrail™. It is an advanced point of sale and inventory control system that is made with unique cutting edge technologies to avail yourself to a new level of experience. oxrail™ is in cloud so you do not need to worry about getting in touch with your business details up to date or doing business from wherever you are around the globe using your smartphone, tab, laptop or any other devices with Internet browser.

Check it out: https://oxrail.com

Minimum Setup Cost

Stop thinking about implementation cost and effort. Just few steps to upgrade your business process in cloud with minimum setup cost

Minimum Hardware Requirements

You do not need POS specific hardware at all to minimize your hardware requirements. Make use of your old computer, a tab or even a smartphone that has a web browser.

Dedicated Support & Maintenance

We are dedicated to help you wherever and whenever you need support. Forget about worrying to maintain your data with backup & restore.

Thursday, December 17, 2015

FormAuthentication Logout

        [AllowAnonymous]
        public void Logout()
        {
            FormsAuthentication.SignOut(); 

            FormsAuthentication.RedirectToLoginPage();
        }

Base control to check access

// this will be executed after authorized
        protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            _Common.eUserAccess access;

            if (_Common.IsUserLoggedIn())   // check if any user logged in
            {
                string controller = filterContext.RouteData.Values["controller"].ToString();
                string action = filterContext.RouteData.Values["action"].ToString();

                // check if logged in user has access to controller/action
                if (_Common.IsUserHasAccess(controller, action))
                {
                    access = _Common.eUserAccess.AccessGranted;
                }
                else
                {
                    access = _Common.eUserAccess.AccessDenied;
                }
            }
            else
            {
                access = _Common.eUserAccess.NotLoggedIn;
            }

            // process request based on user access
            if (access == _Common.eUserAccess.NotLoggedIn)
            {
                filterContext.Result = RedirectToAction("Login", "Access");
            }
            else if (access == _Common.eUserAccess.AccessDenied)
            {
                filterContext.Result = RedirectToAction("NoAccess", "Access");
            }
            else
            {
                base.OnActionExecuting(filterContext);
            }
        }

Avoid Login / Logout Loop in ASP.NET FormAuthentication

If you are using ASP.NET Form Authentication redirect URL, you will come across a situation when you click logout form a page, you will be redirected to login page and your redirect url will be logout. So when you login, you will be immediately logged out since your redirect url is logout. To avoid this check if your redirect url is logout in the login view as follows;

@{
    var redirectURL = FormsAuthentication.GetRedirectUrl(User.Identity.Name, true);

    if (redirectURL == Url.Action("Logout", "User"))
    {
        redirectURL = "";
    }
}

<form id="login-form" action="@Url.Action("Login", "User")" method="post">
   <input type="hidden" value="@redirectURL" name="RedirectURL" />
   ...
</form>

Wednesday, December 9, 2015

MySql prepare historic data for reporting purpose

-- Prepare a table for days to get sequence of numbers from 1 to 32

CREATE TABLE ids (
id INT UNSIGNED AUTO_INCREMENT NOT NULL,
PRIMARY KEY (id)
) ENGINE=MyISAM;

INSERT INTO ids SET id = 1;           #      1      1  
INSERT INTO ids SELECT NULL FROM ids; #      2      2
INSERT INTO ids SELECT NULL FROM ids; #      4      4
INSERT INTO ids SELECT NULL FROM ids; #      8      8
INSERT INTO ids SELECT NULL FROM ids; #     10     16
INSERT INTO ids SELECT NULL FROM ids; #     20     32


set @enddate = "2015-12-01";
set @days = 15;

SELECT date(qb.date) as date, COALESCE(sum(net_amount), 0) as total from invoice qa
right join
(SELECT
(SELECT @enddate FROM invoice qc LIMIT 1) + INTERVAL 1 DAY - INTERVAL a.id DAY AS date
FROM test.ids a
    ) as qb
on date(qa.date) = qb.date
where qb.date > DATE_SUB(@enddate, INTERVAL @days day)
group by qb.date
order by qb.date asc;