Esempio n. 1
0
        /*[ValidateAntiForgeryToken]*/
        public ActionResult User_Login(string UserCode, string Password, string UserType, string returnUrl)
        {
            using (Auth_Svc.UserAuthenticationServiceClient iGstSvc = new Auth_Svc.UserAuthenticationServiceClient())
            {
                try
                {
                    UserInfo objUserInfo = iGstSvc.User_Login(UserCode, Password, UserType, out ErrorMessage);
                    //return Json("Error during login=>iuyiuyiuyiyi"+ objUserInfo.UserCode, JsonRequestBehavior.AllowGet);

                    if (objUserInfo != null && objUserInfo.UserCode != null)
                    {
                        SignInStatus UserAccountSatus = SignInStatus.Success;

                        Session["UserDetails"] = objUserInfo;
                        string UserName = System.Web.HttpContext.Current.User.Identity.Name;

                        switch (UserAccountSatus)
                        {
                        case SignInStatus.Success:
                            return(Json("Ok", JsonRequestBehavior.AllowGet));

                        case SignInStatus.LockedOut:
                            return(View("~/Views/MasterPages/Lockout.cshtml"));

                        case SignInStatus.RequiresVerification:
                            return(RedirectToAction("SendCode", new { ReturnUrl = returnUrl }));

                        case SignInStatus.Failure:
                        default:
                            return(Json("Invalid login attempt.", JsonRequestBehavior.AllowGet));
                        }
                    }
                }
                catch (Exception ex)
                {
                    return(Json(ex.Message + ex.StackTrace + ex.InnerException, JsonRequestBehavior.AllowGet));
                    //Common.ErrorLog.LogSQLErrors_Comments(null, "Login-User-Method-wscall", ex);
                }
            }

            return(Json(ErrorMessage, JsonRequestBehavior.AllowGet));
        }
Esempio n. 2
0
        public ActionResult User_Registration(string UserType, string FirstName, string MidName, string LastName, string OrganizaionName, string UserID, string Street1, string EmailID, string Mobile, string City, string State, string Country, string Password)
        {
            using (Auth_Svc.UserAuthenticationServiceClient iGstSvc = new Auth_Svc.UserAuthenticationServiceClient())
            {
                UserInfo objUserInfoToBeSaved = new UserInfo();

                objUserInfoToBeSaved.UserCode = "";
                objUserInfoToBeSaved.UserType = UserType.Trim().ToUpper();
                //objUserInfoToBeSaved.IsMainUser = (IsMainUser != null && IsMainUser.Trim().ToUpper() == "Y");
                objUserInfoToBeSaved.IsActive   = true;
                objUserInfoToBeSaved.IsApproved = false;

                objUserInfoToBeSaved.OrganizationCode = "";
                objUserInfoToBeSaved.OrganizationName = OrganizaionName;
                objUserInfoToBeSaved.Title            = "";
                objUserInfoToBeSaved.First_Name       = FirstName;
                objUserInfoToBeSaved.Last_Name        = LastName;
                objUserInfoToBeSaved.Middle_Name      = MidName;
                objUserInfoToBeSaved.Street1          = Street1;
                objUserInfoToBeSaved.City             = City;
                objUserInfoToBeSaved.State            = State;
                objUserInfoToBeSaved.Country          = Country;
                objUserInfoToBeSaved.EmailID          = EmailID;
                objUserInfoToBeSaved.MobileNumber     = Mobile;
                objUserInfoToBeSaved.Functions        = "";
                objUserInfoToBeSaved.Password         = Password;

                if (iGstSvc.Save_UserModerate(false, objUserInfoToBeSaved, "", "", out ErrorMessage))
                {
                    //return Json("Ok", JsonRequestBehavior.AllowGet);
                    //return new NormalLoginController().User_Login(EmailID, Password, UserType.Trim().ToUpper(), "");

                    //return RedirectToAction("processlogin", "NormalLogin", new { UserCode = EmailID, Password = Password, UserType = UserType.Trim().ToUpper(), returnUrl = "" });

                    UserInfo objUserInfo = iGstSvc.User_Login(EmailID, Password, UserType, out ErrorMessage);
                    //return Json("Error during login=>iuyiuyiuyiyi"+ objUserInfo.UserCode, JsonRequestBehavior.AllowGet);

                    if (objUserInfo != null && objUserInfo.UserCode != null)
                    {
                        SignInStatus UserAccountSatus = SignInStatus.Success;

                        Session["UserDetails"] = objUserInfo;
                        string UserName = System.Web.HttpContext.Current.User.Identity.Name;

                        switch (UserAccountSatus)
                        {
                        case SignInStatus.Success:
                            return(Json("Ok", JsonRequestBehavior.AllowGet));

                        case SignInStatus.LockedOut:
                            return(View("~/Views/MasterPages/Lockout.cshtml"));

                        case SignInStatus.RequiresVerification:
                            return(RedirectToAction("SendCode", new { ReturnUrl = "" }));

                        case SignInStatus.Failure:
                        default:
                            return(Json("Invalid login attempt.", JsonRequestBehavior.AllowGet));
                        }
                    }
                }

                return(Json(ErrorMessage, JsonRequestBehavior.AllowGet));
            }
        }