protected void btnUpdate_Click(object sender, EventArgs e)
        {
            strErrorMessage = "";
            intVaidError = 0;
            CheckValidation();
            if (intVaidError == 0)
            {
                ServeAtDoorstepData.CustomerDetails objCusDetails = new ServeAtDoorstepData.CustomerDetails();
                objCusDetails.Address = txtAddress.Value.ToString();
                objCusDetails.CityId = Convert.ToInt32(ddlCity.SelectedItem.Value.ToString());
                objCusDetails.CountryId = Convert.ToInt32(ddlCountry.Value.ToString());
                objCusDetails.CustomerID = Convert.ToInt32(sCustomerId);
                objCusDetails.Email = txtEmail.Value.ToString().Trim();
                objCusDetails.FirstName = txtFirstName.Value.ToString();
                objCusDetails.LastName = txtLastName.Value.ToString();
                objCusDetails.Gender = rdoGender.SelectedValue.ToString();
                objCusDetails.LoginName = sLoginname;
                objCusDetails.LoginPassword = sPassword;
                objCusDetails.Mobile = txtMobile.Value.ToString();
                objCusDetails.StateId = Convert.ToInt32(ddlState.SelectedItem.Value.ToString());
                objCusDetails.StreetName = txtStreetname.Value.ToString();
                objCusDetails.ZipCode = txtZipcode.Value.ToString();
                objCusDetails.ImagePath = sImagePath;

                objService = new ServeAtDoorstepService();
                int intCusId = objService.AddCustomerRegister(objCusDetails);

                Response.Redirect("MyCustomerProfile.aspx");
            }
            else
            {
                divErrorMessage.InnerHtml = strErrorMessage;

            }
        }
 public int AddCustomerRegister(CustomerDetails customerDetails)
 {
     try
     {
         DALComponent objDALRegister = new DALComponent();
         objDALRegister.SetParameters("@CustomerID", SqlDbType.Int, 4, customerDetails.CustomerID);
         objDALRegister.SetParameters("@LoginName", SqlDbType.VarChar, 100, customerDetails.LoginName);
         objDALRegister.SetParameters("@ImagePath", SqlDbType.VarChar, 50, customerDetails.ImagePath);
         objDALRegister.SetParameters("@FirstName", SqlDbType.VarChar, 100, customerDetails.FirstName);
         objDALRegister.SetParameters("@LastName", SqlDbType.VarChar, 100, customerDetails.LastName);
         objDALRegister.SetParameters("@Gender", SqlDbType.Int, 4, customerDetails.Gender);
         objDALRegister.SetParameters("@LoginPassword", SqlDbType.VarChar, 50, customerDetails.LoginPassword);
         objDALRegister.SetParameters("@Email", SqlDbType.VarChar, 50, customerDetails.Email);
         objDALRegister.SetParameters("@Mobile", SqlDbType.VarChar, 50, customerDetails.Mobile);
         objDALRegister.SetParameters("@Address", SqlDbType.VarChar, 100, customerDetails.Address);
         objDALRegister.SetParameters("@StreetName", SqlDbType.VarChar, 50, customerDetails.StreetName);
         objDALRegister.SetParameters("@CityId", SqlDbType.Int, 4, customerDetails.CityId);
         objDALRegister.SetParameters("@StateId", SqlDbType.Int, 4, customerDetails.StateId);
         objDALRegister.SetParameters("@CountryId", SqlDbType.Int, 4, customerDetails.CountryId);
         objDALRegister.SetParameters("@ZipCode", SqlDbType.VarChar, 50, customerDetails.ZipCode);
         objDALRegister.SetParameters("@idvalue", SqlDbType.Int, true);
         objDALRegister.SqlCommandText = "[CreateCustomer]";
         int x = objDALRegister.CreateRecord();
         object y = objDALRegister.GetParameters("@idvalue");
         if (customerDetails.CustomerID != 0)
             return customerDetails.CustomerID;
         else
             return Int32.Parse(y.ToString());
     }
     catch (SqlException sqlEx)
     {
         throw new ApplicationException("Data error=" + sqlEx.Message.ToString());
     }
     catch (Exception ex)
     {
         throw new ApplicationException("Error=" + ex.Message.ToString());
     }
 }
 public void UpdateCustomerPassword(CustomerDetails cusDetails)
 {
     try
     {
         DALComponent objDAL = new DALComponent();
         objDAL.SetParameters("@customerId", SqlDbType.Int, 4, cusDetails.CustomerID);
         objDAL.SetParameters("@password", SqlDbType.VarChar, 100, cusDetails.LoginPassword);
         objDAL.SqlCommandText = "[UpdateCustomerPassword]";
         int x = objDAL.UpdateRecord();
     }
     catch (SqlException sqlEx)
     {
         throw new ApplicationException("Data error=" + sqlEx.Message.ToString());
     }
     catch (Exception ex)
     {
         throw new ApplicationException("Error=" + ex.Message.ToString());
     }
 }
        protected void btnSavePic_Click(object sender, EventArgs e)
        {
            string path = string.Empty;
            string finalPath = string.Empty;
            string filePath = string.Empty;
            string sFilename = "";
            string strErrorMessage = "";
            int intVaidError = 0;

            if (FileUpload1.PostedFile != null)
            {
                if (FileUpload1.PostedFile.ContentLength > (50 * 1024))
                {
                    strErrorMessage += "<img src='image/warning.png' height='25px' width='25px' />&nbsp;&nbsp;Image size exceeds maximum limit 50 KB.<br />";
                    intVaidError++;
                }
            }

            if (intVaidError == 0)
            {
                if (FileUpload1.PostedFile != null)
                {
                    HttpPostedFile myFile = FileUpload1.PostedFile;
                    int nFileLen = myFile.ContentLength;
                    if (nFileLen != 0)
                    {
                        DirectoryInfo dirInfo = null;
                        string fileSavePath = "/Data/SDCUS_" + sLoginId.ToString() + "/Images/";
                        path = Server.MapPath("~" + fileSavePath);
                        if (!Directory.Exists(path))
                        {
                            dirInfo = Directory.CreateDirectory(path);
                        }
                        sFilename = System.IO.Path.GetFileName(myFile.FileName);
                        path = path + "/" + sFilename;
                        FileUpload1.PostedFile.SaveAs(path);

                        finalPath = Path.Combine(fileSavePath, sFilename);
                    }
                }

                ServeAtDoorstepData.CustomerDetails cusDet = new ServeAtDoorstepData.CustomerDetails();
                cusDet.CustomerID = Convert.ToInt32(sLoginId);
                cusDet.ImagePath = finalPath;

                objService = new ServeAtDoorstepService();
                objService.UpdateCustomerImage(cusDet);

                this.modalpopPicture.Hide();
                LoadProfile();
            }
            else
            {
                divErrorPic.InnerHtml = strErrorMessage;
                this.modalpopPicture.Show();
            }
        }
        protected void btnSavePwd_Click(object sender, EventArgs e)
        {
            int intErrorPwd = 0;
            string strErrorPwd = "";
            if (txtNewPwd.Value.Trim()=="")
            {
                strErrorPwd += "<img src='image/warning.png' height='25px' width='25px' />&nbsp;&nbsp;Enter New Password.<br />";
                intErrorPwd++;
            }
            if (txtNewPwd.Value.Trim()!="" && txtNewPwd.Value.Length < 6)
            {
                strErrorPwd += "<img src='image/warning.png' height='25px' width='25px' />&nbsp;&nbsp;Password Length is minimum 6 characters.<br />";
                intErrorPwd++;
            }
            if (txtConPwd.Value.Trim() == "")
            {
                strErrorPwd += "<img src='image/warning.png' height='25px' width='25px' />&nbsp;&nbsp;Enter Confirm Password.<br />";
                intErrorPwd++;
            }
            if (txtNewPwd.Value.Trim() != txtConPwd.Value.Trim())
            {
                strErrorPwd += "<img src='image/warning.png' height='25px' width='25px' />&nbsp;&nbsp;Confirm Password is not match with password.<br />";
                intErrorPwd++;
            }

            if (intErrorPwd == 0)
            {
                ServeAtDoorstepData.CustomerDetails objCusdet = new ServeAtDoorstepData.CustomerDetails();
                objCusdet.LoginPassword = txtNewPwd.Value.Trim();
                objCusdet.CustomerID = Convert.ToInt32(sCustomerId);

                objService = new ServeAtDoorstepService();
                objService.UpdateCustomerPassword(objCusdet);

                this.modalpopPassword.Hide();
                LoadProfile();
            }
            else
            {
                this.modalpopPassword.Show();
                divErrorPwd.InnerHtml = strErrorPwd;
                pnlpopupPwd.Height = 260;
            }
        }