コード例 #1
0
        public bool CustomerSignUp(CUSTOMER_PROFILE CustomerProfile)
        {
            bool customerAdded = false;

            SqlConnection con     = new SqlConnection(ConnectionString);
            string        command = "CUSTOMER_PROFILE_CustomerSignUp";
            SqlCommand    cmd     = new SqlCommand(command, con);

            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.Add("@Cust_ID", SqlDbType.UniqueIdentifier).Value = CustomerProfile.CUST_ID;
            cmd.Parameters.Add("@FirstName", SqlDbType.NChar).Value          = CustomerProfile.FIRST_NAME;
            cmd.Parameters.Add("@LastName", SqlDbType.NChar).Value           = CustomerProfile.LAST_NAME;
            cmd.Parameters.Add("@Address", SqlDbType.NChar).Value            = CustomerProfile.ADDRESS;
            cmd.Parameters.Add("@Email", SqlDbType.NChar).Value       = CustomerProfile.EMAIL;
            cmd.Parameters.Add("@Phone", SqlDbType.NVarChar).Value    = CustomerProfile.PHONE_NO;
            cmd.Parameters.Add("@Gender", SqlDbType.NChar).Value      = CustomerProfile.GENDER;
            cmd.Parameters.Add("@PassWord", SqlDbType.NVarChar).Value = CustomerProfile.PASSWORD;

            try
            {
                con.Open();
                cmd.ExecuteNonQuery();
                customerAdded = true;
            }
            catch (Exception ex)
            {
                throw;
            }

            con.Close();
            return(customerAdded);
        }
コード例 #2
0
        public bool CustomerUpdate(CUSTOMER_PROFILE updateCustomer)
        {
            bool customerUpdated = false;

            SqlConnection con     = new SqlConnection(ConnectionString);
            string        command = "[dbo].[CUSTOMER_PROFILE_Edit]";
            SqlCommand    cmd     = new SqlCommand(command, con);

            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.Add("@CustID", SqlDbType.UniqueIdentifier).Value = updateCustomer.CUST_ID;
            cmd.Parameters.Add("@FirstName", SqlDbType.NChar).Value         = updateCustomer.FIRST_NAME;
            cmd.Parameters.Add("@LastName", SqlDbType.NChar).Value          = updateCustomer.LAST_NAME;
            cmd.Parameters.Add("@Gender", SqlDbType.NChar).Value            = updateCustomer.GENDER;
            cmd.Parameters.Add("@Address", SqlDbType.NChar).Value           = updateCustomer.ADDRESS;
            cmd.Parameters.Add("@Email", SqlDbType.NChar).Value             = updateCustomer.EMAIL;
            cmd.Parameters.Add("@PhNO", SqlDbType.NVarChar).Value           = updateCustomer.PHONE_NO;
            cmd.Parameters.Add("@PassWord", SqlDbType.NVarChar).Value       = updateCustomer.PASSWORD;

            try
            {
                con.Open();
                cmd.ExecuteNonQuery();

                customerUpdated = true;
            }
            catch
            {
                customerUpdated = false;
                throw;
            }

            return(customerUpdated);
        }
コード例 #3
0
        public CUSTOMER_PROFILE CustomerDetails(Guid CustID)
        {
            SqlConnection con     = new SqlConnection(ConnectionString);
            string        command = "[dbo].[CUSTOMER_PROFILE_Details]";
            SqlCommand    cmd     = new SqlCommand(command, con);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@CustID", SqlDbType.UniqueIdentifier).Value = CustID;
            SqlDataReader reader;

            CUSTOMER_PROFILE custprofile = new CUSTOMER_PROFILE();;

            try
            {
                con.Open();
                reader = cmd.ExecuteReader();
                if (reader.Read())
                {
                    custprofile.CUST_ID    = new Guid(reader["CUST_ID"].ToString());
                    custprofile.FIRST_NAME = reader["FIRST_NAME"].ToString();
                    custprofile.LAST_NAME  = reader["LAST_NAME"].ToString();
                    custprofile.GENDER     = reader["GENDER"].ToString();
                    custprofile.EMAIL      = reader["EMAIL"].ToString();
                    custprofile.ADDRESS    = reader["ADDRESS"].ToString();
                    custprofile.PHONE_NO   = reader["PHONE_NO"].ToString();
                    custprofile.PASSWORD   = reader["PASSWORD"].ToString();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(custprofile);
        }
コード例 #4
0
        public ActionResult customerLogin(string returnUrl)
        {
            CUSTOMER_PROFILE profileForLogin = new CUSTOMER_PROFILE();

            profileForLogin.extraLogin.ReturnUrl = returnUrl;

            if (SessionHandler.CurrentUser != null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            return(View(profileForLogin));
        }
コード例 #5
0
 public ActionResult Edit(CUSTOMER_PROFILE customerEdit)
 {
     if (customerEdit.customerUpdate())
     {
         ViewBag.Message = "Your information updated successfully !!";
     }
     else
     {
         ViewBag.Message = "Error occured while updateing the you information." + "\n[Customer_SignUpController.Edit {POST} ]";
     }
     return(View(customerEdit));
 }
コード例 #6
0
 public ActionResult customerLogin(CUSTOMER_PROFILE profile)
 {
     if (profile.CustomerLogin() != null)
     {
         if (profile.extraLogin.ReturnUrl == null)
         {
             return(RedirectToAction("Index", "Home"));
         }
         else
         {
             return(Redirect(profile.extraLogin.ReturnUrl));
         }
     }
     return(View());
 }
コード例 #7
0
        public CUSTOMER_PROFILE CustomerLogin(string email, string password)
        {
            SqlConnection con     = new SqlConnection(ConnectionString);
            string        command = "[dbo].[CUSTOMER_PROFILE_LogIn]";
            SqlCommand    cmd     = new SqlCommand(command, con);

            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.Add("@Email", SqlDbType.NChar).Value       = email;
            cmd.Parameters.Add("@PassWord", SqlDbType.NVarChar).Value = password;


            SqlDataReader    reader;
            CUSTOMER_PROFILE CustomerInfo = null;

            try
            {
                CustomerInfo = new CUSTOMER_PROFILE();

                con.Open();
                reader = cmd.ExecuteReader();

                if (reader.Read())
                {
                    CustomerInfo.CUST_ID    = new Guid(reader["CUST_ID"].ToString());
                    CustomerInfo.FIRST_NAME = reader["FIRST_NAME"].ToString();
                    CustomerInfo.LAST_NAME  = reader["LAST_NAME"].ToString();
                    CustomerInfo.GENDER     = reader["GENDER"].ToString();
                    CustomerInfo.ADDRESS    = reader["ADDRESS"].ToString();
                    CustomerInfo.PHONE_NO   = reader["PHONE_NO"].ToString();
                    CustomerInfo.EMAIL      = reader["EMAIL"].ToString();
                    CustomerInfo.STATUS     = reader["STATUS"].ToString();
                }
            }
            catch
            {
                CustomerInfo = null;
                throw;
            }

            return(CustomerInfo);
        }
コード例 #8
0
        public ActionResult CustomerSignUp(CUSTOMER_PROFILE CustomerProfile)
        {
            if (CustomerProfile.PASSWORD.Equals(CustomerProfile.CONFIRMPASSWORD))
            {
                if (CustomerProfile.CustomerSignUp())
                {
                    //direct login
                    FormsAuthentication.SetAuthCookie(CustomerProfile.EMAIL, CustomerProfile.extraLogin.RememberMe);
                    return(RedirectToAction("Index", "Home"));
                }
                else
                {
                }
            }
            else
            {
                ViewBag.Message = "Passwords do not match !!";
            }

            return(View());
        }
コード例 #9
0
        public ActionResult Edit(Guid custID)
        {
            CUSTOMER_PROFILE customerEdit = new CUSTOMER_PROFILE();

            return(View(customerEdit.CustomerDetails(custID)));
        }
コード例 #10
0
        //
        // GET: /Customer_SignUp/
        public ActionResult CustomerSignUp()
        {
            CUSTOMER_PROFILE SignUp = new CUSTOMER_PROFILE();

            return(View(SignUp));
        }