Exemplo n.º 1
0
        internal static bool UpdateCustomerDetails(CustomerDetails customer)
        {
            bool result = true;
            try
            {
                SqlParameter email = new SqlParameter() { ParameterName = "Email", Value = customer.Email };
                SqlParameter firstName = new SqlParameter() { ParameterName = "FirstName", Value = customer.FirstName };
                SqlParameter lastName = new SqlParameter() { ParameterName = "LastName", Value = customer.LastName };
                SqlParameter dateOfBirth = new SqlParameter() { ParameterName = "DateOfBirth", Value = customer.DateOfBirth };
                SqlParameter gender = new SqlParameter() { ParameterName = "Gender", Value = customer.Gender };
                SqlParameter phoneNumber = new SqlParameter() { ParameterName = "PhoneNumber", Value = customer.PhoneNumber };
                SqlParameter userID = new SqlParameter() { ParameterName = "UserID", Value = customer.UserID };
                SqlParameter userImage = new SqlParameter() { ParameterName = "UserImage", Value = customer.Image };

                DBHelper.ExecuteStoredProcedure(StoredProcedure.UpdateCustomer, email, firstName, lastName, dateOfBirth, gender, phoneNumber, userID, userImage);
            }
            catch (Exception ex)
            {
                result = false;
                throw ex;
            }
            return result;
        }
Exemplo n.º 2
0
        internal static bool CreateNewCustomer(CustomerDetails newCustomer)
        {
            bool result = true;
            try
            {
                SqlParameter email = new SqlParameter() { ParameterName = "Email", Value = newCustomer.Email };
                SqlParameter firstName = new SqlParameter() { ParameterName = "FirstName", Value = newCustomer.FirstName };
                SqlParameter lastName = new SqlParameter() { ParameterName = "LastName", Value = newCustomer.LastName };
                SqlParameter dateOfBirth = new SqlParameter() { ParameterName = "DateOfBirth", Value = newCustomer.DateOfBirth };
                SqlParameter gender = new SqlParameter() { ParameterName = "Gender", Value = newCustomer.Gender };
                SqlParameter phoneNumber = new SqlParameter() { ParameterName = "PhoneNumber", Value = newCustomer.PhoneNumber };
                SqlParameter password = new SqlParameter() { ParameterName = "Password", Value = newCustomer.Password };
                SqlParameter image = new SqlParameter() { ParameterName = "UserImage", Value = newCustomer.Image };

                DBHelper.ExecuteStoredProcedure(StoredProcedure.SignUpNewCustomer, email, firstName, lastName, dateOfBirth, gender, phoneNumber, password, image);
            }
            catch (Exception ex)
            {
                result = false;
                throw ex;
            }
            return result;
        }
Exemplo n.º 3
0
        internal static bool CreateNewTempCustomer(CustomerDetails newCustomer)
        {
            bool result = true;
            try
            {
                SqlParameter email = new SqlParameter() { ParameterName = "Email", Value = newCustomer.Email };
                SqlParameter firstName = new SqlParameter() { ParameterName = "FirstName", Value = newCustomer.FirstName };
                SqlParameter lastName = new SqlParameter() { ParameterName = "LastName", Value = newCustomer.LastName };
                SqlParameter dateOfBirth = new SqlParameter() { ParameterName = "DateOfBirth", Value = newCustomer.DateOfBirth };
                SqlParameter gender = new SqlParameter() { ParameterName = "Gender", Value = newCustomer.Gender };
                SqlParameter phoneNumber = new SqlParameter() { ParameterName = "PhoneNumber", Value = newCustomer.PhoneNumber };
                SqlParameter password = new SqlParameter() { ParameterName = "Password", Value = newCustomer.Password };
                SqlParameter image = null;
                if (newCustomer.Image == null)
                {
                    image = new SqlParameter();
                    image.ParameterName = "UserImage";
                    image.SqlDbType = SqlDbType.Image;
                    image.Value = new byte[0];
                }
                else
                {
                    image = new SqlParameter() { ParameterName = "UserImage", Value = newCustomer.Image };
                }
                SqlParameter activationToken = new SqlParameter() { ParameterName = "ActivationToken", Value = newCustomer.ActivationToken };
                SqlParameter createdDate = new SqlParameter() { ParameterName = "CreatedDate", Value = newCustomer.CreatedDate };

                DBHelper.ExecuteStoredProcedure(StoredProcedure.SignUpNewTempCustomer, email, firstName, lastName, dateOfBirth, gender, phoneNumber, password, image, activationToken, createdDate);
            }
            catch (Exception ex)
            {
                result = false;
                throw ex;
            }
            return result;
        }
Exemplo n.º 4
0
        internal static bool CreateNewTempCustomer(CustomerDetails newCustomer)
        {
            bool result = true;

            try
            {
                SqlParameter email = new SqlParameter()
                {
                    ParameterName = "Email", Value = newCustomer.Email
                };
                SqlParameter firstName = new SqlParameter()
                {
                    ParameterName = "FirstName", Value = newCustomer.FirstName
                };
                SqlParameter lastName = new SqlParameter()
                {
                    ParameterName = "LastName", Value = newCustomer.LastName
                };
                SqlParameter dateOfBirth = new SqlParameter()
                {
                    ParameterName = "DateOfBirth", Value = newCustomer.DateOfBirth
                };
                SqlParameter gender = new SqlParameter()
                {
                    ParameterName = "Gender", Value = newCustomer.Gender
                };
                SqlParameter phoneNumber = new SqlParameter()
                {
                    ParameterName = "PhoneNumber", Value = newCustomer.PhoneNumber
                };
                SqlParameter password = new SqlParameter()
                {
                    ParameterName = "Password", Value = newCustomer.Password
                };
                SqlParameter image = null;
                if (newCustomer.Image == null)
                {
                    image = new SqlParameter();
                    image.ParameterName = "UserImage";
                    image.SqlDbType     = SqlDbType.Image;
                    image.Value         = new byte[0];
                }
                else
                {
                    image = new SqlParameter()
                    {
                        ParameterName = "UserImage", Value = newCustomer.Image
                    };
                }
                SqlParameter activationToken = new SqlParameter()
                {
                    ParameterName = "ActivationToken", Value = newCustomer.ActivationToken
                };
                SqlParameter createdDate = new SqlParameter()
                {
                    ParameterName = "CreatedDate", Value = newCustomer.CreatedDate
                };

                DBHelper.ExecuteStoredProcedure(StoredProcedure.SignUpNewTempCustomer, email, firstName, lastName, dateOfBirth, gender, phoneNumber, password, image, activationToken, createdDate);
            }
            catch (Exception ex)
            {
                result = false;
                throw ex;
            }
            return(result);
        }