예제 #1
0
 public JsonResult SaveShareTransfer(ShareTransferDetail objMFD)
 {
     objMFD.FirstShareTrans  = Microsoft.Security.Application.Sanitizer.GetSafeHtmlFragment(objMFD.FirstShareTrans);
     objMFD.DateofResolution = Microsoft.Security.Application.Sanitizer.GetSafeHtmlFragment(objMFD.DateofResolution);
     objMFD.MemberName       = Microsoft.Security.Application.Sanitizer.GetSafeHtmlFragment(objMFD.MemberName);
     objMFD.MemberId         = Convert.ToInt32(Microsoft.Security.Application.Sanitizer.GetSafeHtmlFragment(Convert.ToString(objMFD.MemberId)));
     objMFD.FatherName       = Microsoft.Security.Application.Sanitizer.GetSafeHtmlFragment(objMFD.FatherName);
     objMFD.Address1         = Microsoft.Security.Application.Sanitizer.GetSafeHtmlFragment(objMFD.Address1);
     objMFD.Address2         = Microsoft.Security.Application.Sanitizer.GetSafeHtmlFragment(objMFD.Address2);
     objMFD.PostOffice       = Microsoft.Security.Application.Sanitizer.GetSafeHtmlFragment(objMFD.PostOffice);
     objMFD.NomineeName      = Microsoft.Security.Application.Sanitizer.GetSafeHtmlFragment(objMFD.NomineeName);
     objMFD.EmailId          = Microsoft.Security.Application.Sanitizer.GetSafeHtmlFragment(objMFD.EmailId);
     objMFD.OccupationVal    = Microsoft.Security.Application.Sanitizer.GetSafeHtmlFragment(objMFD.OccupationVal);
     objMFD.MemberName       = XCCPrevent.FilterBadchars1(objMFD.MemberName);
     objMFD.FatherName       = XCCPrevent.FilterBadchars1(objMFD.FatherName);
     objMFD.Address1         = XCCPrevent.FilterBadchars1(objMFD.Address1);
     objMFD.Address2         = XCCPrevent.FilterBadchars1(objMFD.Address2);
     objMFD.PostOffice       = XCCPrevent.FilterBadchars1(objMFD.PostOffice);
     objMFD.NomineeName      = XCCPrevent.FilterBadchars1(objMFD.NomineeName);
     objMFD.EmailId          = XCCPrevent.FilterBadchars1(objMFD.EmailId);
     objMFD.Dob = Microsoft.Security.Application.Sanitizer.GetSafeHtmlFragment(objMFD.Dob);
     objMFD.ShareTransferAppLetterNo  = Microsoft.Security.Application.Sanitizer.GetSafeHtmlFragment(objMFD.ShareTransferAppLetterNo);
     objMFD.ShareTransferApprovalDate = Convert.ToString(Microsoft.Security.Application.Sanitizer.GetSafeHtmlFragment(Convert.ToString(objMFD.ShareTransferApprovalDate)));
     objMFD.ExistingMemberName        = Microsoft.Security.Application.Sanitizer.GetSafeHtmlFragment(objMFD.ExistingMemberName);
     objMFD.BrowserName    = GetWebBrowserName();
     objMFD.Updatedby      = Convert.ToInt32(Session["UserId"]);
     objMFD.IPAddress      = GetIPAddress();
     objMFD.SocietyTransID = Convert.ToString(Session["SocietyTransID"]);
     if (!string.IsNullOrEmpty(objMFD.SocietyTransID))
     {
         if (string.IsNullOrEmpty(objMFD.EmailId))
         {
             objMFD.EmailId = "";
         }
         if (!string.IsNullOrEmpty(objMFD.AadharNo))
         {
             objMFD.AadharNo = objGBI.Encrypt(objMFD.AadharNo, Convert.ToString(Session["EncrptedDecruptedKey"]));
         }
         else
         {
             objMFD.AadharNo = "";
         }
         if (Session["MemberPhoto"] != null)
         {
             objMFD.Imgg = (Byte[])Session["MemberPhoto"];
             //objMFD.Extension = Convert.ToString(Session["FileExtension"]);
             objMFD.Fullpath        = Convert.ToString(Session["FilePath"]);
             Session["MemberPhoto"] = (byte[])null;
             Session["FilePath"]    = "";
         }
         else
         {
             objMFD.Imgg = objBdata.GetImageByteForShare(objMFD.SocietyTransID, objMFD.ShareTransferID);
         }
         objMFD.MemberSNo = 0;
         return(Json(objBdata.SaveShareTransfer(objMFD), JsonRequestBehavior.AllowGet));
     }
     return(Json("Kindly fill the first form then you can add committe members", JsonRequestBehavior.AllowGet));
 }
예제 #2
0
        //[ValidateAntiForgeryToken]
        public ActionResult Registration(FormCollection collection)
        {
            try
            {
                ResgirationModels objRM  = new ResgirationModels();
                EncryptionService objES  = new EncryptionService();
                Account           objAcc = new Account();
                var salt = objES.CreateSalt();
                objRM.Username = collection.Get("UserName");
                string pwd = collection.Get("Password");
                objRM.Password             = objES.EncryptPassword(pwd, salt);
                objRM.SecurityQuestionCode = collection.Get("SecurityQuestions");
                objRM.SecurityAnswer       = collection.Get("Anwser");
                objRM.Salt = salt;

                objRM.FirstName = collection.Get("Name");
                if (string.IsNullOrEmpty(objRM.FirstName))
                {
                    ModelState.AddModelError("Name", "Please Enter the Name");
                }
                objRM.Gender     = collection.Get("Gender");
                objRM.Age        = Convert.ToInt32(collection.Get("Age"));
                objRM.Mobile     = collection.Get("Mobile");
                objRM.EmailID    = collection.Get("Email");
                objRM.Address1   = collection.Get("Address");
                objRM.Address2   = collection.Get("HouseNoSectorNoRoad");
                objRM.PostOffice = collection.Get("PostOffice");
                objRM.PostalCode = collection.Get("PostalCode");
                objRM.DisCode    = collection.Get("District");

                objRM.UserTypeCode = 3;
                objRM.Role         = 1;
                objRM.CreatedBy    = "self";

                objRM.FirstName      = Microsoft.Security.Application.Sanitizer.GetSafeHtmlFragment(objRM.FirstName);
                objRM.EmailID        = Microsoft.Security.Application.Sanitizer.GetSafeHtmlFragment(objRM.EmailID);
                objRM.SecurityAnswer = Microsoft.Security.Application.Sanitizer.GetSafeHtmlFragment(objRM.SecurityAnswer);
                objRM.Address1       = Microsoft.Security.Application.Sanitizer.GetSafeHtmlFragment(objRM.Address1);
                objRM.Address2       = Microsoft.Security.Application.Sanitizer.GetSafeHtmlFragment(objRM.Address2);
                objRM.PostOffice     = Microsoft.Security.Application.Sanitizer.GetSafeHtmlFragment(objRM.PostOffice);

                objRM.FirstName      = XCCPrevent.FilterBadchars1(objRM.FirstName);
                objRM.EmailID        = XCCPrevent.FilterBadchars1(objRM.EmailID);
                objRM.SecurityAnswer = XCCPrevent.FilterBadchars1(objRM.SecurityAnswer);
                objRM.Address1       = XCCPrevent.FilterBadchars1(objRM.Address1);
                objRM.Address2       = XCCPrevent.FilterBadchars1(objRM.Address2);
                objRM.PostOffice     = XCCPrevent.FilterBadchars1(objRM.PostOffice);
                if (ModelState.IsValid)
                {
                    int result = objAcc.SaveResgiratedUser(objRM);
                    if (result == 1)
                    {
                        TempData["message"] = "Registered";
                        return(RedirectToAction("Login", "Account"));
                    }
                }
                else
                {
                    return(View());
                }
            }
            catch (Exception ex)
            {
                return(RedirectToAction("Error", "Unauthorised"));

                throw ex;
            }
            return(View());
        }
예제 #3
0
        //[ValidateAntiForgeryToken]
        public ActionResult Login(FormCollection collection, string pwd)
        {
            try
            {
                Account             objA   = new Account();
                LoginAttemptsModels objLAM = new LoginAttemptsModels();

                string clientCaptcha = collection["clientCaptcha"];
                string serverCaptcha = Convert.ToString(Session["Captcha"]);

                if (!clientCaptcha.Equals(serverCaptcha))
                {
                    ViewBag.ShowCAPTCHA  = serverCaptcha;
                    ViewBag.CaptchaError = "Sorry, please write exact text as written above.";
                    Session["Captcha"]   = GetRandomText();
                    GetCaptchaImage();
                    return(View());
                }
                Session["Captcha"] = "";
                CS4HJ obj = new CS4HJ();
                obj.CreatSession();
                if (ModelState.IsValid)
                {
                    EncryptionService objES  = new EncryptionService();
                    GetBasicInfo      objGBI = new GetBasicInfo();
                    Login             objL   = new Login
                    {
                        UserName = Microsoft.Security.Application.Sanitizer.GetSafeHtmlFragment(collection.Get("username"))
                    };
                    objL.UserName = XCCPrevent.FilterBadchars1(objL.UserName);
                    objL.Salt     = objA.GetEncrptedSalt(objL.UserName);
                    if (!string.IsNullOrEmpty(objL.Salt))
                    {
                        GenerateHashKeyForStore();
                        objL.Password = collection.Get("Password");
                        objL.Password = Microsoft.Security.Application.Sanitizer.GetSafeHtmlFragment(objL.Password);
                        objL.Password = XCCPrevent.FilterBadchars1(objL.Password);
                        objL.Password = objES.EncryptPassword(objL.Password, objL.Salt);
                        Int64 result = objA.ValidateUser(objL);
                        if (result >= 1)
                        {
                            LoginUserDetails objLUD          = new LoginUserDetails();
                            LoginUserDetails objLUDCheckRole = new LoginUserDetails();
                            objLUDCheckRole = objA.GetRoleId(result);
                            if (objLUDCheckRole.Role == 5)
                            {
                                objLUD.Role               = 5;
                                objLUD.SocietyTransId     = objLUDCheckRole.SocietyTransId;
                                objLUD.BackLogResetStatus = objLUDCheckRole.BackLogResetStatus;
                                objLUD.UserId             = objLUDCheckRole.UserId;
                                objLUD.SocietyStatus      = objLUDCheckRole.SocietyStatus;
                            }
                            else
                            {
                                objLUD = objA.GetLoginUserDetails(result);
                            }
                            objLAM = objA.GetLoginAttempts(objL.UserName);
                            if (objLAM.IntervalPending <= 5 && objLAM.LoginAttempts >= 2)
                            {
                                int a = 5 - (objLAM.IntervalPending);
                                if (a == 0)
                                {
                                    ViewBag.Err = "you can try login after " + 1 + " mintues";
                                }
                                else
                                {
                                    ViewBag.Err = "you can try login after " + Convert.ToString(5 - (objLAM.IntervalPending)) + " mintues";
                                }
                                Session["Captcha"] = GetRandomText();
                                GetCaptchaImage();
                                return(View());
                            }
                            if (objLUD.Role == 1)
                            {
                                //UserInfo.CitizenInfo.Name = objLUD.Name.ToString();
                                //UserInfo.CitizenInfo.RoleId = objLUD.Role;
                                //UserInfo.CitizenInfo.UserId = objLUD.UserId;
                                //UserInfo.CitizenInfo.EncrptedDecruptedKey = "sblw-3hn8-sqoy19";
                                //= Convert.ToInt32(Session["SocietyStatus"]) = objLUD.SocietyStatus;
                                //UserInfo.CitizenInfo.StatusEditable = objLUD.StatusEditable;
                                //UserInfo.CitizenInfo.UserType = objLUD.UserType;
                                //UserInfo.CitizenInfo.FormE = objLUD.FormE;
                                Session["Name"]   = objLUD.Name.ToString();
                                Session["RoleId"] = objLUD.Role;
                                Session["UserId"] = objLUD.UserId;
                                Session["EncrptedDecruptedKey"] = "sblw-3hn8-sqoy19";
                                Session["SocietyStatus"]        = objLUD.SocietyStatus;
                                Session["StatusEditable"]       = objLUD.StatusEditable;
                                Session["UserType"]             = objLUD.UserType;
                                if (!string.IsNullOrEmpty(objLUD.SocietyTransId))
                                {
                                    //UserInfo.CitizenInfo.SocietyTransID = objLUD.SocietyTransId;
                                    Session["SocietyTransID"] = objLUD.SocietyTransId;
                                }
                                else
                                {
                                    Session["SocietyTransID"] = "0";
                                }
                                if (objLUD.Total > 0)
                                {
                                    //UserInfo.CitizenInfo.NoOfMembers = objLUD.Total;
                                    Session["NoOfMembers"] = objLUD.Total;
                                }
                                else
                                {
                                    Session["NoOfMembers"] = 0;
                                }
                                Session["FormE"] = objLUD.FormE;
                                return(RedirectToAction("Application", "Society"));
                            }
                            else if (objLUD.Role == 2)
                            {
                                //UserInfo.CitizenInfo.Name = objLUD.Name.ToString();
                                Session["Name"] = objLUD.Name.ToString();
                                //UserInfo.CitizenInfo.ARCSCode = objLUD.ARCSCode;
                                Session["ARCSCode"] = objLUD.ARCSCode;
                                //UserInfo.CitizenInfo.RoleId = objLUD.Role;
                                Session["RoleId"] = objLUD.Role;
                                //UserInfo.CitizenInfo.UserId = objLUD.UserId;
                                Session["UserId"] = objLUD.UserId;
                                //UserInfo.CitizenInfo.EncrptedDecruptedKey = "sblw-3hn8-sqoy19";
                                Session["EncrptedDecruptedKey"] = "sblw-3hn8-sqoy19";
                                //UserInfo.CitizenInfo.UserType = objLUD.UserType;
                                Session["UserType"] = objLUD.UserType;
                                return(RedirectToAction("Dashboard", "ARCS"));
                            }
                            else if (objLUD.Role == 3)
                            {
                                //UserInfo.CitizenInfo.Name = objLUD.Name.ToString();
                                Session["Name"] = objLUD.Name.ToString();
                                //Convert.ToInt32(Session["InsceptorCode"]) = objLUD.ARCSCode;
                                Session["InsceptorCode"] = objLUD.ARCSCode;
                                //UserInfo.CitizenInfo.RoleId = objLUD.Role;
                                Session["RoleId"] = objLUD.Role;
                                //UserInfo.CitizenInfo.UserId = objLUD.UserId;
                                Session["UserId"] = objLUD.UserId;
                                //UserInfo.CitizenInfo.UserType = objLUD.UserType;
                                Session["UserType"] = objLUD.UserType;
                                //UserInfo.CitizenInfo.EncrptedDecruptedKey = "sblw-3hn8-sqoy19";
                                Session["EncrptedDecruptedKey"] = "sblw-3hn8-sqoy19";
                                return(RedirectToAction("Dashboard", "Inspector"));
                            }
                            else if (objLUD.Role == 4)
                            {
                                //UserInfo.CitizenInfo.Name = objLUD.Name.ToString();
                                Session["Name"] = objLUD.Name.ToString();
                                //UserInfo.CitizenInfo.RoleId = objLUD.Role;
                                Session["RoleId"] = objLUD.Role;
                                //UserInfo.CitizenInfo.UserId = objLUD.UserId;
                                Session["UserId"] = objLUD.UserId;
                                //UserInfo.CitizenInfo.EncrptedDecruptedKey = "sblw-3hn8-sqoy19";
                                Session["EncrptedDecruptedKey"] = "sblw-3hn8-sqoy19";
                                //Convert.ToInt32(Session["SocietyStatus"]) = objLUD.SocietyStatus;
                                Session["SocietyStatus"] = objLUD.SocietyStatus;
                                //UserInfo.CitizenInfo.StatusEditable = objLUD.StatusEditable;
                                Session["StatusEditable"] = objLUD.StatusEditable;
                                //UserInfo.CitizenInfo.UserType = objLUD.UserType;
                                Session["UserType"] = objLUD.UserType;
                            }
                            else if (objLUD.Role == 5)
                            {
                                if (!string.IsNullOrEmpty(objLUD.SocietyTransId))
                                {
                                    //UserInfo.CitizenInfo.SocietyTransID = objLUD.SocietyTransId;
                                    Session["SocietyTransID"] = objLUD.SocietyTransId;
                                }
                                //UserInfo.CitizenInfo.RoleId = objLUD.Role;
                                Session["RoleId"] = objLUD.Role;
                                //UserInfo.CitizenInfo.Name= objLUD.Name.ToString();
                                Session["Name"] = objLUD.Name;
                                //UserInfo.CitizenInfo.UserId= objLUD.UserId;
                                Session["UserId"] = objLUD.UserId;
                                //UserInfo.CitizenInfo.UserType= objLUD.UserType;
                                //Convert.ToInt32(Session["SocietyStatus"]) = objLUD.SocietyStatus;
                                //UserInfo.CitizenInfo.BackLogResetStatus = objLUD.BackLogResetStatus;
                                Session["BackLogResetStatus"] = objLUD.BackLogResetStatus;
                                Session["SocietyStatus"]      = objLUD.SocietyStatus;
                                //UserInfo.CitizenInfo.EncrptedDecruptedKey = "sblw-3hn8-sqoy19";
                                Session["EncrptedDecruptedKey"] = "sblw-3hn8-sqoy19";
                                if (objLUD.BackLogResetStatus == 0)
                                {
                                    return(RedirectToAction("ResetPassword", "BackLog"));
                                }
                                else
                                {
                                    return(RedirectToAction("Dashboard", "BackLog"));
                                }
                            }
                        }
                        else if (result == 2)
                        {
                            Session["Captcha"] = GetRandomText();
                            GetCaptchaImage();
                            ViewBag.Err = "User doesn't exists!";
                            return(View());
                        }
                        else
                        {
                            objLAM        = objA.GetLoginAttempts(objL.UserName);
                            objLAM.UserId = objL.UserName;
                            if (objLAM.LoginAttempts >= 2)
                            {
                                Session["Captcha"] = GetRandomText();
                                GetCaptchaImage();
                                objLAM.LoginAttempts = objLAM.LoginAttempts + 1;
                                objA.UpdateLoginAttempts(objLAM);
                                ViewBag.Err = "Account has been locked, try after five mintues";
                                return(View());
                            }

                            if (objLAM.LoginAttempts >= 1)
                            {
                                objLAM.LoginAttempts = objLAM.LoginAttempts + 1;
                                objA.UpdateLoginAttempts(objLAM);
                            }
                            else
                            {
                                objLAM.LoginAttempts = 1;
                                objA.UpdateLoginAttempts(objLAM);
                            }
                            Session["Captcha"] = GetRandomText();
                            GetCaptchaImage();
                            ViewBag.Err = "invalid credentials!";
                            return(View());
                        }
                    }
                    else
                    {
                        Session["Captcha"] = GetRandomText();
                        GetCaptchaImage();
                        ViewBag.Err = "User doesn't exists!";
                        return(View());
                    }
                }
                return(View());
            }
            catch (Exception ex)
            {
                Session["Captcha"] = GetRandomText();
                GetCaptchaImage();
                return(View());

                throw ex;
            }
        }