Beispiel #1
0
        public ActionResult Index(ReshimgathiMatrimony.Models.Login model)
        {
            throw new Exception("Manual exception thrown.");
            if (ModelState.IsValid)
            {
                LoginOperations loginOp     = new LoginOperations();
                bool            loginStatus = loginOp.IsLoggedUserPresent(model.UserName, model.Password);

                if (loginStatus)
                {
                    bool IsVerified = loginOp.IsLogInUserVerified(model.UserName, model.Password);
                    if (IsVerified)
                    {
                        UserType type        = loginOp.LoggedUserType(model.UserName, model.Password);
                        var      userDetails = loginOp.GetUserDetails(model.UserName, model.Password);
                        UserLoginId  = userDetails.Id;
                        BaseUserType = userDetails.UserType;
                        SetSession();

                        if (type == UserType.User)
                        {
                            return(RedirectToAction("Index", "Dashboard"));
                        }
                        else
                        {
                            //Admin user goes here.
                            return(RedirectToAction("Index", "Admin"));
                        }
                    }
                    else
                    {
                        //User is not verified. He/she needs to verify account by his/her email address or Phone number.
                        ModelState.AddModelError(string.Empty, "Logging user is not verified either by Email address or Phone number. Please verify the user.");
                    }
                }
                else
                {
                    //default Index Get view with ErrorMessage. Username and password are wrong.
                    ModelState.AddModelError(string.Empty, "Username or password are not correct. Please try again with the correct details.");
                }
            }

            return(View(model));
        }
Beispiel #2
0
        public ActionResult Index()
        {
            ReshimgathiMatrimony.Models.Login model = new ReshimgathiMatrimony.Models.Login();

            if (!string.IsNullOrEmpty(Session["SessionId"].ToString()))
            {
                if (BaseUserType == false)
                {
                    return(RedirectToAction("Index", "Dashboard"));
                }
                else if (BaseUserType == true)
                {
                    //Admin user goes here.
                    return(RedirectToAction("Index", "Admin"));
                }
            }

            return(View(model));
        }
Beispiel #3
0
        public ActionResult Index(ReshimgathiMatrimony.Models.Login model)
        {
            if (ModelState.IsValid)
            {
                //LoginOperations loginOp = new LoginOperations();

                //use this WSHttpBinding_ILoginService for http protocol communication
                LoginServices.LoginServiceClient client = new LoginServices.LoginServiceClient("WSHttpBinding_ILoginService");

                //in a similar pattern we are creating registration phase 1 service obj
                RegistrationPhaseI.RegistrationPhaseIClient regClient = new RegistrationPhaseI.RegistrationPhaseIClient("NetTcpBinding_IRegistrationPhaseI");
                regClient.IsRegistrationEnabledToday();
                //by the way above 2 lines code no use of it. But we are implemenetd how second service can be updated and invoked.


                //use this NetTcpBinding_ILoginService when we want communication should be carried out through TCP protocol.
                //LoginServices.LoginServiceClient client = new LoginServices.LoginServiceClient("NetTcpBinding_ILoginService");

                bool loginStatus = client.IsLoggedUserPresent(model.UserName, model.Password);
                //bool loginStatus = loginOp.IsLoggedUserPresent(model.UserName, model.Password);

                if (loginStatus)
                {
                    //WCF service call.
                    //bool IsVerified = loginOp.IsLogInUserVerified(model.UserName, model.Password);
                    bool IsVerified = client.IsLogInUserVerified(model.UserName, model.Password);

                    if (IsVerified)
                    {
                        UserType type        = (UserType)client.LoggedUserType(model.UserName, model.Password);
                        var      userDetails = client.GetUserDetails(model.UserName, model.Password);

                        UserLoginId  = userDetails.Id;
                        BaseUserType = userDetails.UserType;
                        SetSession();

                        if (type == UserType.User)
                        {
                            return(RedirectToAction("Index", "Dashboard"));
                        }
                        else
                        {
                            //Admin user goes here.
                            return(RedirectToAction("Index", "Admin"));
                        }
                    }
                    else
                    {
                        //User is not verified. He/she needs to verify account by his/her email address or Phone number.
                        ModelState.AddModelError(string.Empty, "Signing user is not verified either by Email address or Phone number. Please verify the user.");
                    }
                }
                else
                {
                    //default Index Get view with ErrorMessage. Username and password are wrong.
                    ModelState.AddModelError(string.Empty, "Username or password are not correct. Please try again with the correct details.");
                }
            }

            return(View(model));
        }