Exemplo n.º 1
0
        protected int validatePersonel()
        {
            int id = 0;

            try { id = int.Parse(Request.Headers.GetValues("PersonelId").FirstOrDefault()); }
            catch
            {
                throw F_ExeptionFactory.MakeExeption("کاربر مورد نظر در سیستم وجود ندارد",
                                                     ((int)E_ErrorCodes.NOT_FOUND) + S_Seprators.ErrorFieldNameSeprator.ToString() + "UserId", Enums.Loging.E_LogType.SYSTEM_ERROR);
            }
            string unicKey = "";

            try { unicKey = Request.Headers.GetValues("UnicKey").FirstOrDefault(); }
            catch
            {
                throw F_ExeptionFactory.MakeExeption("کاربر مورد نظر در سیستم وجود ندارد",
                                                     ((int)E_ErrorCodes.NOT_FOUND) + S_Seprators.ErrorFieldNameSeprator.ToString() + "UserId", Enums.Loging.E_LogType.SYSTEM_ERROR);
            }
            var user = new B_Personels().GetPersonelById(id);

            if (user == null)
            {
                throw F_ExeptionFactory.MakeExeption("کاربر مورد نظر در سیستم وجود ندارد",
                                                     ((int)E_ErrorCodes.NOT_FOUND) + S_Seprators.ErrorFieldNameSeprator.ToString() + "UserId", Enums.Loging.E_LogType.SYSTEM_ERROR);
            }
            if (user.UnicKey != unicKey)
            {
                throw F_ExeptionFactory.MakeExeption("کاربر مورد نظر در سیستم وجود ندارد",
                                                     ((int)E_ErrorCodes.NOT_FOUND) + S_Seprators.ErrorFieldNameSeprator.ToString() + "UserId", Enums.Loging.E_LogType.SYSTEM_ERROR);
            }
            return(id);
        }
Exemplo n.º 2
0
        public ActionResult Add(M_Personels Personel, M_CarInfo CareInfo, M_BoothInfo BoothInfo)
        {
            object result = "";

            try
            {
                B_Personels bPersonel = new B_Personels();
                var         personel  = bPersonel.Add(Personel);

                if (Personel.PersonelType == E_PublicCategory.PERSONEL_TYPE.DRIVER)
                {
                    CareInfo.PersonelId = personel.Id;
                    new B_CarInfo().Add(CareInfo);
                }
                else if (Personel.PersonelType == E_PublicCategory.PERSONEL_TYPE.INTEGRATION_CENTER || Personel.PersonelType == E_PublicCategory.PERSONEL_TYPE.SUM_CENER)
                {
                    BoothInfo.PersonelId = personel.Id;
                    new B_Booth().Add(BoothInfo);
                }
                result = "Success";
            }
            catch (Exception ex)
            {
                M_SystemLog exx = new M_SystemLog(E_SystemType.SHAHRDARI_WEB_APPLICATION, E_LogType.ERROR, ex);
                result = "Error";
                if (ex.Source == E_LogType.SYSTEM_ERROR.ToString())
                {
                    exx.LogType = E_LogType.SYSTEM_ERROR;
                    result      = exx;
                }
                L_Log.SubmitLog(exx);
            }
            return(Json(result));
        }
Exemplo n.º 3
0
        /// <summary>
        /// اعتبارسنجی کاربر یا پرسنل
        /// </summary>
        /// <returns>شناسه کاربر اهراز شده و نوع آن</returns>
        protected Tuple <int, MFValidationUserRole> validateUserOrPersonel()
        {
            int id = 0;

            try { id = int.Parse(Request.Headers.GetValues("UserId").FirstOrDefault()); }
            catch
            {
                throw F_ExeptionFactory.MakeExeption("کاربر مورد نظر در سیستم وجود ندارد",
                                                     ((int)E_ErrorCodes.NOT_FOUND) + S_Seprators.ErrorFieldNameSeprator.ToString() + "UserId", Enums.Loging.E_LogType.SYSTEM_ERROR);
            }
            string unicKey = "";

            try { unicKey = Request.Headers.GetValues("UnicKey").FirstOrDefault(); }
            catch
            {
                throw F_ExeptionFactory.MakeExeption("کاربر مورد نظر در سیستم وجود ندارد",
                                                     ((int)E_ErrorCodes.NOT_FOUND) + S_Seprators.ErrorFieldNameSeprator.ToString() + "UserId", Enums.Loging.E_LogType.SYSTEM_ERROR);
            }

            var user = new B_Users().GetUsers(id);

            if (user != null && user.UnicKey == unicKey)
            {
                return(Tuple.Create(id, MFValidationUserRole.USER));
            }
            var personel = new B_Personels().GetPersonels(unicKey, id);

            if (personel != null)
            {
                return(Tuple.Create(id, MFValidationUserRole.PERSONEL));
            }
            throw F_ExeptionFactory.MakeExeption("کاربر مورد نظر در سیستم وجود ندارد",
                                                 ((int)E_ErrorCodes.NOT_FOUND) + S_Seprators.ErrorFieldNameSeprator.ToString() + "UserId", Enums.Loging.E_LogType.SYSTEM_ERROR);
        }
Exemplo n.º 4
0
        public ActionResult Modify(int Id)
        {
            ViewBag.Route = new List <MFRoute>
            {
                new MFRoute {
                    ActionName = "Index", ControllerName = "Personels", Title = "لیست کارکنان", Priority = 1
                }
            };
            B_Personels bRole    = new B_Personels();
            var         personel = bRole.GetPersonelById(Id);

            if (personel == null || personel.Id == CurrentUser.Id)
            {
                return(RedirectToAction("Index"));
            }
            B_PersonelRoles bRoleVal = new B_PersonelRoles();

            ViewBag.Roles       = bRoleVal.GetPersonelRoles();
            ViewBag.VehicleType = new B_PublicCategory().GetPublicCategory(E_PublicCategory.PUBLIC_CATEGORY_PARENT.CAR_TYPE);
            ViewBag.PlaqColor   = new B_PublicCategory().GetPublicCategory(E_PublicCategory.PUBLIC_CATEGORY_PARENT.TAG_COLOR);

            ViewBag.Booth = new B_Booth().GetBoothByPersonelId(personel.Id);
            ViewBag.Car   = new B_CarInfo().GetCarInfoByPersonelId(personel.Id);

            return(View(personel));
        }
Exemplo n.º 5
0
        public ActionResult Index()
        {
            B_Personels bPersonel = new B_Personels();

            ViewBag.Roles = new B_PersonelRoles().GetPersonelRoles();
            return(View(bPersonel.GetPersonels().Where(c => c.Id != CurrentUser.Id).ToList()));
        }
Exemplo n.º 6
0
        public ActionResult RevertUser(int Id)
        {
            object result = "";

            try
            {
                B_Personels bPersonel = new B_Personels();
                var         personel  = bPersonel.GetPersonelById(Id);
                personel.IsDeleted = false;
                bPersonel.Edit(personel);
                result = "Success";
            }
            catch (Exception ex)
            {
                M_SystemLog exx = new M_SystemLog(E_SystemType.SHAHRDARI_WEB_APPLICATION, E_LogType.ERROR, ex);
                result = "Error";
                if (ex.Source == E_LogType.SYSTEM_ERROR.ToString())
                {
                    exx.LogType = E_LogType.SYSTEM_ERROR;
                    result      = exx;
                }
                L_Log.SubmitLog(exx);
            }
            return(Json(result));
        }
Exemplo n.º 7
0
 public ActionResult LoginRequest(string UName, string Pass, string Captcha)
 {
     try
     {
         string res = "Sussess";
         if (Captcha.ToLower() != ((MFCaptcha)Session[MFSessions.CAPTCHA_KEY]).TextValue.ToLower())
         {
             res = "کد امنیتی صحیح نیست";
         }
         else
         {
             B_Personels bPersonel = new B_Personels();
             M_Personels us        = bPersonel.GetPersonels(UName, Pass);
             if (us == null)
             {
                 res = "نام کاربری یا گذرواژه صحیح نیست";
             }
             else
             {
                 HttpCookie Coki = new HttpCookie(MFCookies.USER_KEY);
                 Coki.Value   = us.UnicKey.ToString();
                 Coki.Expires = DateTime.Now.AddYears(1);
                 Response.Cookies.Add(Coki);
             }
         }
         return(Content(res));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 8
0
        public ActionResult Deleted()
        {
            ViewBag.Route = new List <MFRoute>
            {
                new MFRoute {
                    ActionName = "Index", ControllerName = "Personels", Title = "لیست کارکنان", Priority = 1
                }
            };
            B_Personels bPersonel = new B_Personels();

            return(View(bPersonel.GetDeletedPersonel()));
        }
Exemplo n.º 9
0
        public ActionResult Modify(M_Personels Personel, M_CarInfo CareInfo, M_BoothInfo BoothInfo)
        {
            object result = "";

            try
            {
                B_Personels bPersonel   = new B_Personels();
                var         oldPersonel = bPersonel.GetPersonelById(Personel.Id);
                if (oldPersonel.ImageName.ToLower() != "default.jpg" && oldPersonel.ImageName.ToLower() != Personel.ImageName)
                {
                    System.IO.File.Delete(Server.MapPath("~/Areas/Admin/Images/Profile") + "/" + oldPersonel.ImageName);
                }
                bPersonel.Edit(Personel);
                if (CareInfo != null)
                {
                    if (CareInfo.Id == 0)
                    {
                        CareInfo.PersonelId = Personel.Id;
                        new B_CarInfo().Add(CareInfo);
                    }
                    else
                    {
                        new B_CarInfo().Edit(CareInfo);
                    }
                }
                if (BoothInfo != null)
                {
                    if (BoothInfo.Id == 0)
                    {
                        BoothInfo.PersonelId = Personel.Id;
                        new B_Booth().Add(BoothInfo);
                    }
                    else
                    {
                        new B_Booth().Edit(BoothInfo);
                    }
                }
                result = "Success";
            }
            catch (Exception ex)
            {
                M_SystemLog exx = new M_SystemLog(E_SystemType.SHAHRDARI_WEB_APPLICATION, E_LogType.ERROR, ex);
                result = "Error";
                if (ex.Source == E_LogType.SYSTEM_ERROR.ToString())
                {
                    exx.LogType = E_LogType.SYSTEM_ERROR;
                    result      = exx;
                }
                L_Log.SubmitLog(exx);
            }
            return(Json(result));
        }
Exemplo n.º 10
0
        public ActionResult RideModeProceed()
        {
            var request = new B_ServicesRequests().GetUserLastRequest(CurrentUser.Id, "CAR");

            if (request != null)
            {
                if (request.Status == E_PublicCategory.REQUEST_STATUS.CLOSED)
                {
                    return(RedirectToAction("RideMode"));
                }
                var driver = new B_Personels().GetPersonelById(request.PersonelId.HasValue ? (int)request.PersonelId : 0);
                if (driver != null)
                {
                    var car = new B_CarInfo().GetCarInfo(driver.Id);
                    ViewBag.DriverName  = driver.FirstName + " " + driver.LastName;
                    ViewBag.DriverCode  = "کد راننده : " + driver.Id;
                    ViewBag.DriverImage = new E_FTPRoutes(BaseUrl).PERSONELS + driver.ImageName;
                    ViewBag.Car         = car.Name + " - " + car.Color;
                    ViewBag.TagFirst    = car.TagFirst;
                    ViewBag.TagMiddle   = car.TagMiddle;
                    ViewBag.TagLast     = car.TagLast;
                    ViewBag.NationalTag = car.TagNational;
                    ViewBag.PhoneNumber = driver.MobileNumber;
                }
                else
                {
                    ViewBag.DriverName         = " --- ";
                    ViewBag.DriverImage        = new E_FTPRoutes(BaseUrl).PERSONELS + "Default.jpg";
                    ViewBag.DriverCode         = "کد راننده : ---";
                    ViewBag.Car                = " --- ";
                    ViewBag.LicensePlaceNumber = "------";
                    ViewBag.NationalTag        = "--";
                    ViewBag.PhoneNumber        = "";
                }
                ViewBag.Status             = getRequestStatus(request.Status);
                ViewBag.LatUser            = request.GeographicalCoordinates.Split(',')[0];
                ViewBag.LngUser            = request.GeographicalCoordinates.Split(',')[1];
                ViewBag.RequestId          = request.Id;
                ViewBag.Disrespectful      = (int)E_PublicCategory.FEEDBACK.DISRESPECTFUL_BEHAVIOR;
                ViewBag.PersonalReasons    = (int)E_PublicCategory.FEEDBACK.PERSONAL_REASONS;
                ViewBag.GetToYourPlaceLate = (int)E_PublicCategory.FEEDBACK.GET_TO_YOUR_PLACE_LATE;
                ViewBag.Request            = request;
                ViewBag.RequestItems       = new B_ServicesRequestItems().GetItems(request.Id, E_PublicCategory.SYSTEM_USER_TYPE.NORMAL_USER);
            }
            else
            {
                return(RedirectToAction("RideMode"));
            }
            return(View());
        }
Exemplo n.º 11
0
        public M_Personels LoginPersonel(string Username, string Password)
        {
            var personel = new B_Personels().GetPersonelByUserName(Username, Password);

            if (personel == null)
            {
                return(null);
            }
            var finalPersonel = B_PublicFunctions.GenericMaper <M_Personels, V_Personels>(new List <M_Personels> {
                personel
            }).FirstOrDefault();

            finalPersonel.ConnectionId = Context.ConnectionId;
            Personels.Add(finalPersonel);

            return(personel);
        }
Exemplo n.º 12
0
        public ActionResult StationModeProceed()
        {
            var request = new B_ServicesRequests().GetUserLastRequest(CurrentUser.Id, "BOOTH");

            if (request != null)
            {
                if (request.Status == E_PublicCategory.REQUEST_STATUS.CLOSED)
                {
                    return(RedirectToAction("StationMode"));
                }
                var personel = new B_Personels().GetPersonelById(request.PersonelId.HasValue ? (int)request.PersonelId : 0);
                var booth    = new B_Booth().GetBoothByPersonelId(request.PersonelId.HasValue ? (int)request.PersonelId : 0);
                if (booth != null)
                {
                    ViewBag.PersonelName  = personel.FirstName + " " + personel.LastName;
                    ViewBag.PersonelImage = new E_FTPRoutes(BaseUrl).PERSONELS + personel.ImageName;
                    ViewBag.StationName   = booth.Name;
                    ViewBag.PhoneNumber   = personel.MobileNumber;
                    ViewBag.BoothAddress  = booth.Address;
                    ViewBag.StationCode   = "کد مرکز : " + booth.Id;
                }
                else
                {
                    ViewBag.PersonelName  = "---";
                    ViewBag.PersonelImage = new E_FTPRoutes(BaseUrl).PERSONELS + personel.ImageName;
                    ViewBag.StationName   = "---";
                    ViewBag.PhoneNumber   = "";
                    ViewBag.StationCode   = "کد مرکز : ---";
                }
                ViewBag.Status          = getRequestStatus(request.Status).Replace("#", booth.Id.ToString());
                ViewBag.Lat             = request.GeographicalCoordinates.Split(',')[0];
                ViewBag.Lng             = request.GeographicalCoordinates.Split(',')[1];
                ViewBag.RequestId       = request.Id;
                ViewBag.Disrespectful   = (int)E_PublicCategory.FEEDBACK.DISRESPECTFUL_BEHAVIOR;
                ViewBag.PersonalReasons = (int)E_PublicCategory.FEEDBACK.PERSONAL_REASONS;
                ViewBag.Request         = request;
                ViewBag.RequestItems    = new B_ServicesRequestItems().GetItems(request.Id, E_PublicCategory.SYSTEM_USER_TYPE.NORMAL_USER);
            }
            else
            {
                return(RedirectToAction("StationMode"));
            }
            return(View());
        }
Exemplo n.º 13
0
        public ActionResult LoginSubmit(string PhoneNumber, string Password)
        {
            object result = "";

            try
            {
                PhoneNumber = B_PublicFunctions.ReplacePersianNums(PhoneNumber);
                Password    = B_PublicFunctions.ReplacePersianNums(Password);
                if (string.IsNullOrEmpty(PhoneNumber))
                {
                    throw F_ExeptionFactory.MakeExeption("نام کاربری را وارد کنید",
                                                         ((int)E_ErrorCodes.USERNAME_OR_PASSWORD) + S_Seprators.ErrorFieldNameSeprator.ToString() + "UserName", E_LogType.SYSTEM_ERROR);
                }
                if (string.IsNullOrEmpty(Password))
                {
                    throw F_ExeptionFactory.MakeExeption("گذرواژه را وارد کنید",
                                                         ((int)E_ErrorCodes.USERNAME_OR_PASSWORD) + S_Seprators.ErrorFieldNameSeprator.ToString() + "Password", E_LogType.SYSTEM_ERROR);
                }
                var user = new B_Personels().GetPersonelByUserName(PhoneNumber, Password);
                if (user == null)
                {
                    throw F_ExeptionFactory.MakeExeption("نام کاربری یا گذرواژه صحیح نسیت",
                                                         ((int)E_ErrorCodes.NOT_FOUND) + S_Seprators.ErrorFieldNameSeprator.ToString() + "User", E_LogType.SYSTEM_ERROR);
                }

                HttpCookie Coki = new HttpCookie(MFCookies.BOOTH_RIDER_KEY);
                Coki.Value   = user.UnicKey.ToString();
                Coki.Expires = DateTime.Now.AddYears(1);
                Response.Cookies.Add(Coki);
            }
            catch (Exception ex)
            {
                M_SystemLog exx = new M_SystemLog(E_SystemType.SHAHRDARI_BOOTH_RIDER_APPLICATION, E_LogType.ERROR, ex);
                result = "Error";
                if (ex.Source == E_LogType.SYSTEM_ERROR.ToString())
                {
                    exx.LogType = E_LogType.SYSTEM_ERROR;
                    result      = exx;
                }
                L_Log.SubmitLog(exx);
            }
            return(Json(result));
        }
Exemplo n.º 14
0
        private string getMapPupWindow(M_BoothInfo Stations)
        {
            var personel = new B_Personels().GetPersonelById(Stations.PersonelId);

            return($"<table class=\"tbList\" StationId=\"{Stations.Id}\">" +
                   $"<tr style=\"background:#FFF;text-align: center;\">" +
                   $"<td>{Stations.Name}</td>" +
                   $"</tr>" +
                   $"<tr style=\"background:#FFF;text-align: center;\">" +
                   $"<td>{personel.FirstName + " " + personel.LastName}</td>" +
                   $"</tr>" +
                   $"<tr style=\"background:#FFF;text-align: center;\">" +
                   $"<td>ظرفیت : {Stations.Capacity}</td>" +
                   $"</tr>" +
                   $"<tr style=\"background:#FFF;text-align: center;\">" +
                   $"<td><input type=\"button\" class=\"btn btnGreen\" onclick=\"SelectStation({Stations.Id});\" value=\"انتخاب\"/></td>" +
                   $"</tr>" +
                   $"</table>");
        }
        public ActionResult ShowDetails(int Id, bool FromNew)
        {
            var route = new List <MFRoute>
            {
                new MFRoute {
                    ActionName = "Index", ControllerName = "ServicesRequests", Title = "لیست درخواست ها", Priority = 1
                }
            };

            if (FromNew)
            {
                route.Add(new MFRoute {
                    ActionName = "NewRequests", ControllerName = "ServicesRequests", Title = "درخوات های جدید", Priority = 2
                });
            }
            ViewBag.Route = route;
            var requst = new B_ServicesRequests().GetFullServicesRequests(Id);

            if (requst == null)
            {
                return(RedirectToAction("Index"));
            }
            if (requst.PersonelId.HasValue)
            {
                requst.ResponsiblePersonel = new B_Personels().GetPersonelById(requst.PersonelId.Value);
            }
            ViewBag.UserList     = new B_ServicesRequestItems().GetItems(requst.Id, E_PublicCategory.SYSTEM_USER_TYPE.NORMAL_USER);
            ViewBag.PersonelList = new B_ServicesRequestItems().GetItems(requst.Id, E_PublicCategory.SYSTEM_USER_TYPE.PERSONEL);

            B_Personels bPersonel = new B_Personels();

            if (requst.ResponsiblePersonel != null)
            {
                ViewBag.DriverList = bPersonel.GetPersonels().Where(c => c.PersonelType == (requst.Pouriya_Type == "BOOTH" ? E_PublicCategory.PERSONEL_TYPE.SUM_CENER : E_PublicCategory.PERSONEL_TYPE.DRIVER) && c.Id != requst.ResponsiblePersonel.Id).ToList();
            }
            else
            {
                ViewBag.DriverList = bPersonel.GetPersonels().Where(c => c.PersonelType == (requst.Pouriya_Type == "BOOTH" ? E_PublicCategory.PERSONEL_TYPE.SUM_CENER : E_PublicCategory.PERSONEL_TYPE.DRIVER)).ToList();
            }

            return(View(requst));
        }
Exemplo n.º 16
0
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            if (filterContext.HttpContext.Request.Cookies[MFCookies.BOOTH_RIDER_KEY] != null)
            {
                string      key  = filterContext.HttpContext.Request.Cookies[MFCookies.BOOTH_RIDER_KEY].Value;
                M_Personels user = null;
                var         ub   = new B_Personels();
                try
                {
                    user = ub.GetPersonels(key);
                }
                catch { }

                if (user != null)
                {
                    return;
                }
            }
            filterContext.Result = new RedirectToRouteResult(new RouteValueDictionary(new { controller = "Default", action = "Login", area = "Booth" }));
            filterContext.Result.ExecuteResult(filterContext.Controller.ControllerContext);
        }
Exemplo n.º 17
0
        /// <summary>
        /// آدرس اتصال به SignalR
        /// </summary>
        // protected string SignalRUrl = System.Configuration.ConfigurationManager.AppSettings["SignalRUrl"];

        public BaseController()
        {
            if (System.Web.HttpContext.Current.Request.Cookies[MFCookies.USER_KEY] != null)
            {
                M_PersonelRoles role = null;
                string          key  = System.Web.HttpContext.Current.Request.Cookies[MFCookies.USER_KEY].Value;
                B_Personels     ub   = new B_Personels();
                CurrentUser = ub.GetPersonels(key);
                if (CurrentUser == null)
                {
                    return;
                }
                B_PersonelRoles ru = new B_PersonelRoles();
                role = ru.GetPersonelRoles(CurrentUser.PersonelRoleId);
                if (role == null)
                {
                    return;
                }
                ViewBag.LayoutPersonel         = CurrentUser;
                ViewBag.LayoutPersonelRole     = role;
                ViewBag.LayoutNewRequestCount  = new B_ServicesRequests().GetServicesRequestsCount(E_PublicCategory.REQUEST_STATUS.NEW_REQUEST);
                ViewBag.LayoutNewRedrawalCount = new B_UserPayment().GetPaymentCuontByStatus(E_PublicCategory.PAYMENT_STATUS.NEW);
            }
        }
Exemplo n.º 18
0
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            M_Personels                 user      = null;
            M_PersonelRoles             role      = null;
            List <M_PersonelRoleValues> roleValue = null;

            if (filterContext.HttpContext.Request.Cookies[MFCookies.USER_KEY] != null)
            {
                string      key = filterContext.HttpContext.Request.Cookies[MFCookies.USER_KEY].Value;
                B_Personels ub  = new B_Personels();
                try
                {
                    user = ub.GetPersonels(key);
                }
                catch { }

                if (user == null)
                {
                    filterContext.Result = new RedirectToRouteResult(new RouteValueDictionary(new { controller = "Login", action = "Index", area = "Admin" }));
                    filterContext.Result.ExecuteResult(filterContext.Controller.ControllerContext);
                }
                else
                {
                    B_PersonelRoles ru = new B_PersonelRoles();
                    role = ru.GetPersonelRoles(user.PersonelRoleId);
                    if (role == null)
                    {
                        filterContext.Result = new RedirectToRouteResult(new RouteValueDictionary(new { controller = "Dashboard", action = "NoPermission", area = "Admin" }));
                        filterContext.Result.ExecuteResult(filterContext.Controller.ControllerContext);
                    }

                    if (role.HasFullControl == true)
                    {
                        return;
                    }

                    B_PersonelRoleValues bRoleValue = new B_PersonelRoleValues();
                    roleValue = bRoleValue.GetPersonelRoleValues(role.Id);
                    if (roleValue == null || roleValue.Count == 0)
                    {
                        if (role == null)
                        {
                            filterContext.Result = new RedirectToRouteResult(new RouteValueDictionary(new { controller = "Dashboard", action = "NoPermission", area = "Admin" }));
                            filterContext.Result.ExecuteResult(filterContext.Controller.ControllerContext);
                        }
                    }

                    var    rd                = filterContext.HttpContext.Request.RequestContext.RouteData;
                    string currentAction     = rd.GetRequiredString("action");
                    string currentController = rd.GetRequiredString("controller") + "Controller";


                    Assembly asm    = Assembly.GetAssembly(typeof(Global));
                    var      action = asm.GetTypes()
                                      .Where(type => typeof(System.Web.Mvc.Controller).IsAssignableFrom(type) && type.Namespace.Contains("Shahrdari.WebApplication.Areas.Admin.Controllers"))
                                      .SelectMany(type => type.GetMethods(BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.Public))
                                      .Where(m => !m.GetCustomAttributes(typeof(System.Runtime.CompilerServices.CompilerGeneratedAttribute), true).Any() &&
                                             m.DeclaringType.Name == currentController && m.Name == currentAction)
                                      .Select(x => new { Attributes = x.GetCustomAttributes().ToList() }).FirstOrDefault();
                    if (action != null && action.Attributes.Where(c => c.GetType().Name.ToUpper().IndexOf("HTTPPOST") != -1).Count() > 0)
                    {
                        return;
                    }

                    if (roleValue.Where(c => c.AccessName.ToUpper() == (currentController + " | " + currentAction).ToUpper()).Count() == 0)
                    {
                        filterContext.Result = new RedirectToRouteResult(new RouteValueDictionary(new { controller = "Dashboard", action = "NoPermission", area = "Admin" }));
                        filterContext.Result.ExecuteResult(filterContext.Controller.ControllerContext);
                    }
                }
            }
            else
            {
                filterContext.Result = new RedirectToRouteResult(new RouteValueDictionary(new { controller = "Login", action = "Index", area = "Admin" }));
                filterContext.Result.ExecuteResult(filterContext.Controller.ControllerContext);
            }
        }