protected void btnSubmit_Click(object sender, EventArgs e) { List<DocRepository> lstDocs = new List<DocRepository>(); UserRequest lstUserRequest = new UserRequest() { EmailId = txtEmailId.Text, FirstName = txtFirstName.Text, LastName = txtLastName.Text, Address1 = txtAddress1.Text, Address2 = txtAddress2.Text, ZipCode = Convert.ToInt32(txtZipCode.Text), CityName = txtCity.Text, StateId = Convert.ToInt32(ddlState.SelectedValue), PrimaryPhoneNo = txtPrimaryPhoneNumber.Text, PrimaryPhoneType = ddlPrimaryPhoneType.SelectedValue, PrimaryMobileProvider = ddlMobileProvider.SelectedValue, SecondaryPhoneNo = txtSecondaryPhoneNumber.Text, SecondaryPhoneType = ddlSecondaryPhoneType.SelectedValue, SecondaryMobileProvider = ddlSecondaryMobileProvider.SelectedValue, PrefContactMethod = ddlPrefContactMethod.SelectedValue, CreateDate = DateTime.UtcNow, ProblemLocation = txtProbLocation.Text, ShortDescription = txtShortDescProblem.Text, LongDescription = txtLongDescProblem.Text, EmailConfirmation = chkConfirm.Checked, AttachedDocName = null, Status = "O" }; RequestStatus lstRequestStatus = new RequestStatus() { Status = "O", UpdateDate = DateTime.UtcNow }; objBll = new WarringtonBll.WarringtonBll(); if (chkOptLogin.Checked) { if (objBll.IsUserRegistered(txtPrimaryPhoneNumber.Text)) { if (!Utility.GetSessionValue<bool>(Constants._USERISLOGGEDIN)) { Utility.SetSessionValue(Constants._REQUESTDATA, lstUserRequest); Utility.SetSessionValue(Constants._REQUESTSTATUSDATA, lstRequestStatus); Utility.SetSessionValue(Constants._REQUESTDOCS, lstDocs); Utility.SetSessionValue(Constants._POSTEDFILES, fileUpload.PostedFiles); Response.Redirect("Login.aspx?P=" + (int)PageEnum.RequestSubmissionPage); } } else { Utility.SetSessionValue(Constants._REQUESTDATA, lstUserRequest); Utility.SetSessionValue(Constants._REQUESTSTATUSDATA, lstRequestStatus); Utility.SetSessionValue(Constants._REQUESTDOCS, lstDocs); Utility.SetSessionValue(Constants._POSTEDFILES, fileUpload.PostedFiles); Response.Redirect("UserRegistration.aspx?D=1"); } } IList<HttpPostedFile> postedFiles = null; if (fileUpload.HasFile) { postedFiles = fileUpload.PostedFiles; } else { postedFiles = Utility.GetSessionValue<IList<HttpPostedFile>>(Constants._POSTEDFILES); } foreach (HttpPostedFile postedFile in postedFiles) { if (!string.IsNullOrEmpty(postedFile.FileName)) { postedFile.SaveAs(Server.MapPath(@"~\DocRepository\") + postedFile.FileName); lstDocs.Add(new DocRepository() { FileName = postedFile.FileName, FilePath = Server.MapPath(@"~\DocRepository\"), UploadDate = DateTime.UtcNow }); } } bool isSaved = objBll.SaveUserRequest(lstUserRequest, lstRequestStatus, lstDocs); if (isSaved) { ClearControl(); hdnFileName.Value = ""; Utility.SetSessionValue(Constants._REQUESTDATA, null); Utility.SetSessionValue(Constants._REQUESTDOCS, null); Utility.SetSessionValue(Constants._POSTEDFILES,null); ScriptManager.RegisterStartupScript(this, this.GetType(), "msg", "alert('User Request successfully submited...')", true); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "msg", "alert('There are some error...')", true); } }
protected void btnSendRequest_Click(object sender, EventArgs e) { objBll = new WarringtonBll.WarringtonBll(); List<DocRepository> lstDocs = new List<DocRepository>(); UserRequest lstUserRequest = new UserRequest() { RequestId=Convert.ToInt32(hdnReqId.Value), CreateDate = DateTime.UtcNow, ProblemLocation = txtAddress.Text, ShortDescription = txtShortDesc.Text, LongDescription = txtLongDesc.Text, EmailConfirmation = chkConfirmEmail.Checked, Status = "U", UpdateDate=DateTime.UtcNow }; RequestStatus lstRequestStatus = new RequestStatus() { Status = "U", UpdateDate = DateTime.UtcNow }; IList<HttpPostedFile> postedFiles = null; if (fuploadDocs.HasFile) { postedFiles = fuploadDocs.PostedFiles; foreach (HttpPostedFile postedFile in postedFiles) { if (!string.IsNullOrEmpty(postedFile.FileName)) { postedFile.SaveAs(Server.MapPath(@"~\DocRepository\") + postedFile.FileName); lstDocs.Add(new DocRepository() { FileName = postedFile.FileName, FilePath = Server.MapPath(@"~\DocRepository\"), UploadDate = DateTime.UtcNow }); } } } bool isSaved = objBll.SaveUserRequest(lstUserRequest, lstRequestStatus, lstDocs); if (isSaved) { ClearControl(); hdnFileList.Value = ""; BindSearchGrid(); pnlEdit.Visible = false; ScriptManager.RegisterStartupScript(this, this.GetType(), "msg", "alert('User Request successfully submited...')", true); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "msg", "alert('There are some error...')", true); } }