Ejemplo n.º 1
0
        public JsonResult SaveFeeTerm(string FeeTerm, int Refundable, int Active)
        {
            FeeHead FH = new FeeHead();
            ChannelFactory <ICommonSrv> CF    = new ChannelFactory <ICommonSrv>("COMMON");
            ChannelFactory <IFeeSrv>    CFFee = new ChannelFactory <IFeeSrv>("FEE");
            ICommonSrv CSvc         = (ICommonSrv)CF.CreateChannel();
            IFeeSrv    CSFee        = (IFeeSrv)CFFee.CreateChannel();
            string     actionStatus = "";

            try
            {
                UserMasters userMasters = CSvc.getUserProfile(WebSecurity.CurrentUserName);
                FH.FeeTerm    = FeeTerm;
                FH.Refundable = Convert.ToBoolean(Refundable);
                FH.Active     = Convert.ToBoolean(Active);
                FH.Action     = "INS";
                FH.CreatedBy  = WebSecurity.CurrentUserName;
                FH.SchoolID   = userMasters.SchoolID;
                actionStatus  = CSFee.SaveFeeTerm(FH);
            }
            catch (Exception ex)
            {
                ExecptionLogger.FileHandling("Fee(SaveFeeTerm)", "Error_014", ex, "Fee");
            }
            finally
            {
                CF.Close();
                CFFee.Close();
            }
            return(Json(actionStatus, JsonRequestBehavior.AllowGet));
        }
        //public override void OnActionExecuting(ActionExecutingContext filterContext)
        //{
        //    HttpSessionStateBase session = filterContext.HttpContext.Session;
        //    UserMasters user = (UserMasters)session[Constants.Session.USER];
        //    string text = filterContext.ActionDescriptor.ControllerDescriptor.ControllerName.ToLower();
        //    string viewname = filterContext.ActionDescriptor.ActionName;
        //    string absolutePath = HttpContext.Current.Request.Url.AbsolutePath;
        //    string mailurl = HttpContext.Current.Request.Url.ToString();
        //    bool urlreffrer = HttpContext.Current.Request.Url.IsAbsoluteUri;
        //    Uri urlreffref = HttpContext.Current.Request.UrlReferrer;
        //    UrlHelper urlHelper = new UrlHelper(filterContext.RequestContext);
        //    string url = string.Empty;
        //    url = urlHelper.Content(mailurl);
        //    HttpBrowserCapabilities httpBrowser = HttpContext.Current.Request.Browser;
        //    if (!text.Contains("Account") && ((user == null && !session.IsNewSession) || session.IsNewSession))
        //    {
        //        if (filterContext.RequestContext.HttpContext.Request.IsAjaxRequest())
        //        {
        //            filterContext.HttpContext.Response.Redirect("~/Account/SessionLogin", true);

        //        }
        //        else
        //            filterContext.HttpContext.Response.Redirect(url, true);

        //    }
        //}
        public override void OnActionExecuted(ActionExecutedContext filterContext)
        {
            str = new StringBuilder();
            var model = (BaseModel)filterContext.Controller.ViewData.Model;

            if (model != null)
            {
                #region Get All Permitted Menu List
                ChannelFactory <ICommonSrv> CF = new ChannelFactory <ICommonSrv>("COMMON");
                ICommonSrv CSvc = (ICommonSrv)CF.CreateChannel();
                var        ALLMENUPERMISSION = CSvc.GetAllMenuListByUserId(WebSecurity.CurrentUserId);
                var        USERINFO          = CSvc.GetUserInfoByuserId(WebSecurity.CurrentUserId);
                CF.Close();
                #endregion Get All Permitted Menu List
                HttpSessionStateBase session = filterContext.HttpContext.Session;
                // List<MenuMaster> MenuList = (List<MenuMaster>)session[Constants.Session.MENUPERMISSION];
                menulist = ALLMENUPERMISSION;
                string     absolutePath = HttpContext.Current.Request.Url.AbsolutePath;
                MenuMaster reqMenu      = (from s in menulist
                                           where s.URL == absolutePath
                                           select s).FirstOrDefault();
                model.PermissionNameList = new List <string>();
                model.PermissionNameList.Add("Default");// its only for null checking
                if (reqMenu != null && reqMenu.PermissionNameList != null)
                {
                    model.PermissionNameList = reqMenu.PermissionNameList;
                }

                model.BaseUserInfo = USERINFO;
                model.usermenu     = GetUserMenuList(menulist);
            }
        }
 //[ValidateAntiForgeryToken]
 //[OutputCache(NoStore = true, Duration = 0, VaryByParam = "None")]
 public ActionResult Login(LoginModel model, string returnUrl)
 {
     try
     {
         //ChannelFactory<IMembershipSrv> CF = new ChannelFactory<IMembershipSrv>("MEMBERSHIP");
         //IMembershipSrv CSvc = (IMembershipSrv)CF.CreateChannel();
         //SHARED.UserProfile userProfile = new SHARED.UserProfile();
         //userProfile = CSvc.GetUserProfile(model.UserName);
         //CF.Close();
         if (ModelState.IsValid && WebSecurity.Login(model.UserName, AESEncrytDecry.DecryptStringAES(model.Password), persistCookie: model.RememberMe))
         {
             ChannelFactory <ICommonSrv> CF = new ChannelFactory <ICommonSrv>("COMMON");
             ICommonSrv CSvc = (ICommonSrv)CF.CreateChannel();
             try
             {
                 UserMasters userMasters = CSvc.getUserProfile(model.UserName);
                 CF.Close();
                 if (!userMasters.ISACTIVE)
                 {
                     TempData["Msg"] = "Please Contact To Technical Team.";
                     WebSecurity.Logout();
                 }
                 else
                 {
                     return(RedirectToAction("Index", "Home"));
                 }
             }
             catch (Exception ex)
             {
                 WebSecurity.Logout();
                 ExecptionLogger.FileHandling("Account(UserLogin_getUserProfilePost)", "Error_014", ex, "Account");
             }
         }
         else
         {
             TempData["Msg"] = "UserName and/or Password is incorrect.";
         }
     }
     catch (Exception ex)
     {
         WebSecurity.Logout();
         ExecptionLogger.FileHandling("Account(UserLoginPost)", "Error_014", ex, "Account");
     }
     return(View(model));
 }
Ejemplo n.º 4
0
        public ActionResult FeeHeads()
        {
            FeeHead FH = new FeeHead();
            ChannelFactory <ICommonSrv> CF    = new ChannelFactory <ICommonSrv>("COMMON");
            ChannelFactory <IFeeSrv>    CFFee = new ChannelFactory <IFeeSrv>("FEE");
            ICommonSrv CSvc  = (ICommonSrv)CF.CreateChannel();
            IFeeSrv    CSFee = (IFeeSrv)CFFee.CreateChannel();

            try
            {
                UserMasters userMasters = CSvc.getUserProfile(WebSecurity.CurrentUserName);
                FH.SchoolID   = userMasters.SchoolID;
                FH.CreatedBy  = WebSecurity.CurrentUserName;
                FH.Action     = "GET";
                FH.lstFeeHead = CSFee.GetFeeHeads(FH);
            }
            catch (Exception ex) { }
            finally
            {
                CF.Close();
                CFFee.Close();
            }
            return(View(FH));
        }
 public AccountController()
 {
     CSvc = (ICommonSrv)CF.CreateChannel();
 }