public ActionResult LogIn(StaffLogin login)
        {
            if (!String.IsNullOrEmpty(login.StaffCode) || !String.IsNullOrEmpty(login.StaffPassword))
            {
                if (Session["iuser"] == null)
                {
                    try
                    {
                        CustomersData data = new CustomersData();
                        login                 = data.GetStaffLogin(login);
                        Session["iuser"]      = login.StaffID;
                        Session["iusername"]  = login.StaffName;
                        Session["istaffrole"] = login.StaffRoleID;
                        Session["imageUrl"]   = login.ImageUrl;


                        StaffData st = new StaffData();
                        List <StaffPermissionGroup> item = new List <StaffPermissionGroup>();
                        item = st.GetStaffMenu(login.StaffRoleID);
                        string menu = st.GetMenu(item);

                        Session["imenu"] = menu;
                        return(RedirectToAction("Index"));
                    }
                    catch (Exception ex)
                    {
                        TempData["error"] = ex.Message;
                        return(View());
                    }
                }
                else
                {
                    return(RedirectToAction("Index"));
                }
            }
            else
            {
                if (String.IsNullOrEmpty(login.StaffCode) || String.IsNullOrEmpty(login.StaffPassword))
                {
                    TempData["error"] = "กรุณากรอกรหัสพนักงานและรหัสผ่าน";
                    return(View());
                }
                else if (String.IsNullOrEmpty(login.StaffCode))
                {
                    TempData["error"] = "กรุณากรอกรหัสพนักงาน";
                    return(View());
                }
                else if (String.IsNullOrEmpty(login.StaffPassword))
                {
                    TempData["error"] = "กรุณากรอกรหัสผ่าน";
                    return(View());
                }
                else
                {
                    TempData["error"] = "ไม่มีข้อมูลพนักงาน";
                    return(View());
                }
            }
        }