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));
        }
Ejemplo n.º 2
0
        private static string UserRegistrationBody(UserMasters model, string Password)
        {
            string Body = "";

            try
            {
                Body += "Thank you for registering. ";
                Body += "<br /><br />";
                Body += "Please find credentials to login.";
                Body += "<br />";
                Body += "<b>User Name: </b>" + model.USERNAME;
                Body += "<br />";
                Body += "<b>Password: </b>" + AESEncrytDecry.DecryptStringAES(Password);
                Body += "<br /><br />";
                Body += "<b>URL: </b>" + ConfigurationManager.AppSettings["WebSite"].ToString().Trim();
                Body += "<br /><br />";
                Body += "Note:- Please change your password after successful login.";
            }
            catch (Exception ex)
            {
                ExecptionLogger.FileHandling("BALMail(Header)", "Error_014", ex, "BALMail");
                Body = "";
            }
            return(Body);
        }
Ejemplo n.º 3
0
 //[ValidateAntiForgeryToken]
 //[OutputCache(NoStore = true, Duration = 0, VaryByParam = "None")]
 public ActionResult Login(LoginModel model, string returnUrl)
 {
     try
     {
         //WebSecurity.CurrentUserName
         // WebSecurity.CurrentUserId
         //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();
             BALCommon CSvc = new BALCommon(ConStr);
             try
             {
                 UserMasters userMasters = CSvc.getUserProfile(model.UserName);
                 //CF.Close();
                 if (!userMasters.ISACTIVE)
                 {
                     TempData["Msg"] = "Please Contact To Technical Team.";
                     WebSecurity.Logout();
                 }
                 else
                 {
                     if (model.FID > 0 && CSvc.InsertUpdateSession(model.UserName, model.FID) == 1)
                     {
                         return(RedirectToAction("Index", "Home"));
                     }
                     else
                     {
                         WebSecurity.Logout();
                     }
                 }
             }
             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);
     return(RedirectToAction("Login"));
 }
Ejemplo n.º 4
0
        public ActionResult ResetPassword()
        {
            BALCommon           CSvc     = new BALCommon(ConStr);
            UserMasters         _umaster = CSvc.GetByUserId(WebSecurity.CurrentUserId);
            ResetForgotPassword obj      = new ResetForgotPassword
            {
                UserId   = WebSecurity.CurrentUserId,
                UserName = WebSecurity.CurrentUserName,
                Name     = _umaster.FISRTNAME,
                Lastname = _umaster.LASTNAME,
                IMAGE    = _umaster.IMAGE,
                Mobile   = _umaster.Mobile,
                EmailId  = _umaster.EMAILID
            };

            return(View(obj));
        }
Ejemplo n.º 5
0
        private static string ResetOTPBody(UserMasters userMasters, string OTP)
        {
            string Body = "";

            try
            {
                Body += "<b>User Name: </b>" + userMasters.USERNAME;
                Body += "<br />";
                Body += "<b>OTP: </b>" + AESEncrytDecry.DecryptStringAES(OTP);
                Body += "<br /><br />";
            }
            catch (Exception ex)
            {
                ExecptionLogger.FileHandling("BALMail(Header)", "Error_014", ex, "BALMail");
                Body = "";
            }
            return(Body);
        }
Ejemplo n.º 6
0
        public UserMasters GetUserProfile(string UserName)
        {
            UserMasters obj = new UserMasters();

            obj.ISACTIVE = false;
            ds           = new DataSet();
            try
            {
                cmd             = new SqlCommand("USP_GetUserProfile");
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@UserName", UserName);
                ds = DBHelper.ExecuteDataSet(cmd);
                if (ds != null && ds.Tables.Count == 1)
                {
                    if (ds.Tables[0].Rows.Count == 1)
                    {
                        obj.ADDRESS    = Convert.ToString(ds.Tables[0].Rows[0]["ADDRESS"]);
                        obj.CITY_ID    = Convert.ToInt32(ds.Tables[0].Rows[0]["CITY_ID"]);
                        obj.COUNTRY_ID = Convert.ToInt32(ds.Tables[0].Rows[0]["COUNTRY_ID"]);
                        obj.CREATEDBY  = Convert.ToString(ds.Tables[0].Rows[0]["UpdatedBy"]);
                        obj.EMAILID    = Convert.ToString(ds.Tables[0].Rows[0]["EmailId"]);
                        obj.FISRTNAME  = Convert.ToString(ds.Tables[0].Rows[0]["Name"]);
                        obj.IMAGE      = Convert.ToString(ds.Tables[0].Rows[0]["IMAGE"]);

                        obj.LASTNAME = Convert.ToString(ds.Tables[0].Rows[0]["Lastname"]);
                        // //obj.MenuPermissionList = !string.IsNullOrEmpty(Convert.ToString(ds.Tables[0].Rows[0]
                        obj.ROLE_ID  = Convert.ToInt32(ds.Tables[0].Rows[0]["RoleId"]);
                        obj.STATE_ID = Convert.ToInt32(ds.Tables[0].Rows[0]["STATE_ID"]);
                        obj.USERNAME = Convert.ToString(ds.Tables[0].Rows[0]["UserName"]);
                        obj.UserId   = Convert.ToInt32(ds.Tables[0].Rows[0]["UserId"]);
                        obj.ISACTIVE = Convert.ToBoolean(ds.Tables[0].Rows[0]["ISACTIVE"]);
                    }
                }
            }
            catch (Exception ex)
            {
                ExecptionLogger.FileHandling("DALCommon(GetUserProfile)", "Error_014", ex, "DALCommon");
            }
            finally
            {
                cmd.Dispose();
            }
            return(obj);
        }
Ejemplo n.º 7
0
        public static string TemplateUserRegistration(UserMasters model, string Password)
        {
            string HTML = "";

            try
            {
                HTML += Header(model.USERNAME);
                HTML += "<br /><br />";
                HTML += UserRegistrationBody(model, Password);
                HTML += "<br /><br /><br /><br />";
                HTML += Footer("igenussolution Team");
            }
            catch (Exception ex)
            {
                ExecptionLogger.FileHandling("BALMail(TemplateOrganisation)", "Error_014", ex, "BALMail");
                HTML = "";
            }
            return(HTML);
        }
Ejemplo n.º 8
0
        public static string TemplateResetOTP(UserMasters userMasters, string OTP)
        {
            string HTML = "";

            try
            {
                HTML += Header(userMasters.FISRTNAME + " " + userMasters.LASTNAME);
                HTML += "<br /><br />";
                HTML += ResetOTPBody(userMasters, OTP);
                HTML += "<br /><br /><br /><br />";
                HTML += Footer("igenussolution Team");
            }
            catch (Exception ex)
            {
                ExecptionLogger.FileHandling("BALMail(TemplateOrganisation)", "Error_014", ex, "BALMail");
                HTML = "";
            }
            return(HTML);
        }
Ejemplo n.º 9
0
        public JsonResult GetOTP(string UID)
        {
            BALCommon obj     = new BALCommon(ConStr);
            bool      res     = false;
            string    message = "";

            try
            {
                string OTP = Utility.GetRendomString(6, "N");
                res = obj.SetOTP(UID, OTP);
                #region SendMail
                if (res)
                {
                    BALCommon   CSvc         = new BALCommon(ConStr);
                    UserMasters userMasters  = CSvc.getUserProfile(UID);
                    MailDetails _MailDetails = new MailDetails();
                    _MailDetails.ToMailIDs = userMasters.EMAILID;
                    _MailDetails.HTMLBody  = true;
                    _MailDetails.Subject   = "Reset OTP";
                    _MailDetails.Body      = BALMail.TemplateResetOTP(userMasters, AESEncrytDecry.EncryptStringAES(OTP));
                    if (BALMail.SendMail(_MailDetails))
                    {
                        message = "OTP has been sent to your registered mail id.";
                    }
                    else
                    {
                        message = "Please contact technical team";
                    }
                }
                else
                {
                    message = "Please contact technical team";
                }
                #endregion SendMail
            }
            catch (Exception ex)
            {
                res = false;
            }
            return(Json(message, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 10
0
        public ActionResult ResetPassword(ResetForgotPassword model, FormCollection collection)
        {
            string             sResetToken = WebSecurity.GeneratePasswordResetToken(model.UserName, 30000);
            HttpPostedFileBase _profilepic = Request.Files["employeephotoimge"];
            string             folderpath  = Constants.USERPICK;
            BALCommon          CSvc        = new BALCommon(ConStr);
            UserMasters        _um         = CSvc.GetByUserId(WebSecurity.CurrentUserId);

            if (_profilepic.ContentLength > 0)
            {
                string guidstring = Guid.NewGuid().ToString();
                string _FileName  = Path.GetFileName(_profilepic.FileName);
                string filepath   = Path.Combine(Server.MapPath(folderpath) + guidstring + "_" + _FileName);
                string dbpath     = Path.Combine(folderpath + guidstring + "_" + _FileName);
                _profilepic.SaveAs(filepath);
                model.IMAGE = dbpath;
            }

            _um.UserId       = model.UserId;
            _um.USERNAME     = model.UserName;
            _um.FISRTNAME    = model.Name;
            _um.LASTNAME     = model.Lastname;
            _um.Mobile       = model.Mobile;
            _um.EMAILID      = model.EmailId;
            _um.MODIFIEDBY   = model.UserName;
            _um.MODIFIEDDATE = DateTime.Now;


            if (model.UserId == WebSecurity.CurrentUserId && WebSecurity.ResetPassword(sResetToken, model.NewPassword))
            {
                CSvc.AddUserprofile(_um, "UPD");
                TempData[Constants.MessageInfo.SUCCESS] = "Password reset successfully.";
            }
            else
            {
                TempData[Constants.MessageInfo.ERROR] = "Password could not reset.";
            }

            return(RedirectToAction("Index", "Home"));
        }
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            BALCommon CSvc = new BALCommon(ConStr);
            // HttpSessionStateBase session = filterContext.HttpContext.Session;
            UserMasters user = CSvc.GetByUserId(WebSecurity.CurrentUserId);   // _userRepository.GetByUserId(user.USER_ID);
            // 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 (!text.Contains("Account") && user == null)
            {
                if (filterContext.RequestContext.HttpContext.Request.IsAjaxRequest())
                {
                    filterContext.HttpContext.Response.Redirect("~/Account/SessionLogin", true);
                }
                else
                {
                    filterContext.HttpContext.Response.Redirect(url, true);
                }
            }
            Uri urlref = HttpContext.Current.Request.UrlReferrer;

            if (urlref == null)
            {
                filterContext.HttpContext.Response.Redirect("~/Account/Login");
            }
        }
Ejemplo n.º 12
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 int AddUserprofile(UserMasters _master, string Otype)
        {
            DALCommon dal = new DALCommon(ConStr);

            return(dal.AddUserprofile(_master, Otype));
        }
Ejemplo n.º 14
0
        public void Insert(UserMasters usermaster)
        {
            BALCommon bal = new BALCommon(ConStr);

            bal.Insert(usermaster);
        }
Ejemplo n.º 15
0
        public void UpdateUser(UserMasters UserMasters)
        {
            BALCommon bal = new BALCommon(ConStr);

            bal.UpdateUser(UserMasters);
        }
Ejemplo n.º 16
0
        public void AddUser(UserMasters UserMasters)
        {
            BALCommon bal = new BALCommon(ConStr);

            bal.AddUser(UserMasters);
        }
Ejemplo n.º 17
0
        public void Update(UserMasters usermaster)
        {
            BALCommon bal = new BALCommon(ConStr);

            bal.Update(usermaster);
        }
        public int UpdateUser(UserMasters UserMasters)
        {
            DALCommon dal = new DALCommon(ConStr);

            return(dal.UpdateUser(UserMasters));
        }
Ejemplo n.º 19
0
 public static UserMasters WithoutPassword(this UserMasters user)
 {
     user.Password = null;
     return(user);
 }
Ejemplo n.º 20
0
        public void UpdateUser(UserMasters UserMasters)
        {
            DALCommon dal = new DALCommon(ConStr);

            dal.UpdateUser(UserMasters);
        }
Ejemplo n.º 21
0
 public void UpdateUser(UserMasters UserMasters)
 {
 }
Ejemplo n.º 22
0
        public UserMasters GetByUserId(int userId)
        {
            UserMasters obj = new UserMasters();

            return(obj);
        }
Ejemplo n.º 23
0
        public UserMasters ValidateUser(string UserName, string Password)
        {
            UserMasters obj = new UserMasters();

            return(obj);
        }
Ejemplo n.º 24
0
 public void Insert(UserMasters usermaster)
 {
 }
        public void Update(UserMasters usermaster)
        {
            DALCommon dal = new DALCommon(ConStr);

            dal.Update(usermaster);
        }
        public void AddUser(UserMasters UserMasters)
        {
            DALCommon dal = new DALCommon(ConStr);

            dal.AddUser(UserMasters);
        }
Ejemplo n.º 27
0
 public void AddUser(UserMasters UserMasters)
 {
 }
        public void Insert(UserMasters usermaster)
        {
            DALCommon dal = new DALCommon(ConStr);

            dal.Insert(usermaster);
        }
Ejemplo n.º 29
0
 public void Update(UserMasters usermaster)
 {
 }