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; } }
protected void btnRegister_Click(object sender, EventArgs e) { strErrorMessage = ""; intVaidError = 0; CheckValidation(); if (intVaidError == 0) { string path = string.Empty; string strImgFinalPath = ""; string finalPath = string.Empty; string filePath = string.Empty; string sFilename = ""; 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 = 0; objCusDetails.Email = txtEmail.Value.ToString(); objCusDetails.FirstName = txtFirstname.Value.ToString(); objCusDetails.LastName = txtLastname.Value.ToString(); objCusDetails.Gender = Request.Form["rdoGender"].ToString();// rdoGender.Value.ToString(); objCusDetails.LoginName = txtUsername.Value.ToString(); objCusDetails.LoginPassword = txtPassword.Value.ToString(); objCusDetails.Mobile = txtMobile.Value.ToString(); objCusDetails.StateId = Convert.ToInt32(ddlState.SelectedItem.Value.ToString()); objCusDetails.StreetName = txtStreet.Value.ToString(); objCusDetails.ZipCode = txtZipcode.Value.ToString(); objCusDetails.ImagePath = ""; objService = new ServeAtDoorstepService(); int intCusId = objService.AddCustomerRegister(objCusDetails); if (fileProfile.PostedFile != null) { HttpPostedFile myFile = fileProfile.PostedFile; int nFileLen = myFile.ContentLength; if (nFileLen != 0) { DirectoryInfo dirInfo = null; string fileSavePath = "/Data/SDCUS_"+intCusId.ToString()+"/Images/"; path = Server.MapPath("~" + fileSavePath); if (!Directory.Exists(path)) { dirInfo = Directory.CreateDirectory(path); } sFilename = System.IO.Path.GetFileName(myFile.FileName); path = path + "/" + sFilename; fileProfile.PostedFile.SaveAs(path); finalPath = Path.Combine(fileSavePath, sFilename); } } strImgFinalPath = finalPath; ServeAtDoorstepData.CustomerDetails cusDet = new ServeAtDoorstepData.CustomerDetails(); cusDet.CustomerID = intCusId; cusDet.ImagePath = strImgFinalPath; objService.UpdateCustomerImage(cusDet); ServeAtDoorstepData.CusBankDetails objBankdet = new ServeAtDoorstepData.CusBankDetails(); objBankdet.BankId = 0; objBankdet.CustomerId = intCusId; objBankdet.BankName = txtBankname.Value.ToString(); objBankdet.CardHolderName = txtCardholdername.Value.ToString(); objBankdet.CreditCardNumber = txtCredCardnumber.Value.ToString(); objBankdet.CVCNumber = txtCVC.Value.ToString(); int intCusBankId = objService.AddCustomerBankdet(objBankdet); SendMailtoUser(intCusId); lblEmailId.Text = txtEmail.Value.ToString(); this.ModalPopupSuccess.Show(); //Response.Redirect("Success.aspx?type=cus"); } else { divErrorMessage.InnerHtml = strErrorMessage; } }