Exemplo n.º 1
0
        public int CreateNewUser(CustomerPersonalInfo customerInfo)
        {

            LoginBLL bll = new LoginBLL();
           return(bll.insertNewUser(customerInfo));
            

        }
Exemplo n.º 2
0
        //public int Login
        public int insertNewUser(CustomerPersonalInfo customer)
        {


            try
            {
                string otp = generateOTP();
                
                SqlCommand cmd = new SqlCommand(PROCEDURES.INSERT_CUSTOMER_INFORMATION, con);
                cmd.CommandType = CommandType.StoredProcedure;
                SqlParameter[] param = new SqlParameter[11];
                param[0] = new SqlParameter(CONSTANT.MOBILE_NO, customer.MobileNo1);
                param[1] = new SqlParameter(CONSTANT.PASSWORD_INFO, customer.Password);
                param[2] = new SqlParameter(CONSTANT.EMAIL, customer.Email);
                param[3] = new SqlParameter(CONSTANT.FIRST_NAME, customer.FirstName);
                param[4] = new SqlParameter(CONSTANT.LAST_NAME, customer.LastName);
                param[5] = new SqlParameter(CONSTANT.LOCALITY, customer.Locality);
                param[6] = new SqlParameter(CONSTANT.ADDRESS, customer.Address);
                param[7] = new SqlParameter(CONSTANT.PIN_CODE, customer.PinCode);
                param[8] = new SqlParameter(CONSTANT.IS_ACTIVE, customer.IsActive);
                param[9] = new SqlParameter(CONSTANT.OTP, otp);
                param[10] = new SqlParameter(CONSTANT.NOTIFICATION, SqlDbType.Int);
                cmd.Parameters.AddRange(param);
                cmd.Parameters[CONSTANT.NOTIFICATION].Direction = ParameterDirection.Output;
                con.Open();
                cmd.ExecuteNonQuery();
                con.Close();
                int notification = Convert.ToInt32(cmd.Parameters[CONSTANT.NOTIFICATION].Value);
                if (notification == 1)
                {
                    string SMStemp = "Hi " + customer.FirstName + "," + "You have sucessfully Registetred on Grocerspoint.com " + " Your OTP is " + otp;
                    string sendSMS = "http://bhashsms.com/api/sendmsg.php?user=pradeep23&pass=123456&sender=GROPNT&phone=" + customer.MobileNo1 + "&text=" + SMStemp + "&priority=ndnd&stype=normal";
                    SendOtp(sendSMS);

                }

                return (notification);
            }
            catch (Exception ex)
            {

                return 0;

            }

            finally 
            {
               
            }
        }
Exemplo n.º 3
0
        public ActionResult DoLogin(CustomerPersonalInfo customerInfo)
        {
            
            string requestId = customerInfo.LoginRequestType.ToString();
            if(requestId =="LOG IN")
            {
                string flag = Logincheck(customerInfo.MobileNo, customerInfo.Password1);
                if (flag == "NE")
                {
                    ViewBag.ErrorMessage = "Invalid Login Credential";
                    return View();
                }
                if (flag == "")
                {
                    ViewBag.ErrorMessage = "Invalid Login Credential";
                    return View();
                }
                else
                {
                    Session["CustomerMobileNo"] = customerInfo.MobileNo;
                    Session["CustomerName"] = flag;
                    //Response.Redirect(Request.UrlReferrer.ToString());
                    return RedirectToAction("ViewCart", "ShoppingCart");
                }

            }
            else
	        {
                    int res = CreateNewUser(customerInfo);
                    if (res == 1)
                    {
                        Session["CustomerMobileNo"] = customerInfo.MobileNo1;
                        Session["CustomerName"] = customerInfo.FirstName;
                      return RedirectToAction("OTPConfirmation","Login");
                    }
                    if (res == 2)
                    {
                        ViewBag.ErrorMessage = "This Mobile No is already Register.";
                        ViewBag.ErrorMessage2 = "Please Login and Enjoy Shopping";
                       
                    }
	        }

            return View();
        }