//Update the details Updated by the User public int UpdateByPolicyNumber(int id, PolicyEndorsement data) { try { return updateDAL.UpdateByPolicyNumber(id, data); } catch(Exception ex) { throw ex; } }
//Update By Policy Number public int UpdateByPolicyNumber(int id, PolicyEndorsement data) { int n = 0; try { var query = (from t1 in policy.Customers join t2 in policy.Policies on t1.product_id equals t2.product_id join t3 in policy.InsuranceProducts on t2.product_id equals t3.Product_ID join t4 in policy.Documents on t2.Policy_number equals t4.Policy_number where t2.Policy_number == id select new { t1, t2, t3, t4 }); // n = 1; foreach (var item in query) { item.t1.Customer_name = data.customerName; item.t1.Date_of_Birth = data.customerDob; item.t1.gender = data.gender; item.t1.Customer_address = data.address; item.t2.nomineeName = data.nomineName; item.t2.Relationship = data.relationShip; item.t1.Smoker = data.smoker; item.t1.Mobile_number = data.mobile.ToString(); item.t2.paymentMode = data.paymentMode; item.t1.endorsementStatus = "Pending"; item.t4.idNumber = data.idNumber; item.t4.idDescription = data.idDescription; } n = 1; policy.SaveChanges(); } catch (Exception ex) { throw; } return(n); }
protected void btnUpdate_Click(object sender, EventArgs e) { PolicyEndorsement da = new PolicyEndorsement(); //Updating the details #region Updating the details if (rdbMale.Checked == true) { da.gender = "M"; } else if (rdbFemale.Checked == true) { da.gender = "F"; } if (rdbSmokeYes.Checked == true) { da.smoker = "Y"; } else { da.smoker = "N"; } if (rdbLife.Checked == true) { da.productDescription = "Life"; } else { da.productDescription = "NonLife"; } if (ddlIDProof.SelectedValue == "Passport") { da.idDescription = "Passport"; } else if (ddlIDProof.SelectedValue == "PAN") { da.idDescription = "PAN"; } else if (ddlIDProof.SelectedValue == "Voter Card") { da.idDescription = "Voter Card"; } else { da.idDescription = "Aadhar Card"; } if (ddlRelation.SelectedValue == "Father") { da.relationShip = "Father"; } else if (ddlRelation.SelectedValue == "Mother") { da.relationShip = "Mother"; } else if (ddlRelation.SelectedValue == "wife") { da.relationShip = "wife"; } else if (ddlRelation.SelectedValue == "Husband") { da.relationShip = "Husband"; } else { da.relationShip = "Others"; } if (ddlRelation.SelectedValue == "Quarterly") { da.paymentMode = "Quarterly"; } else if (ddlRelation.SelectedValue == "Monthly") { da.paymentMode = "Monthly"; } else if (ddlRelation.SelectedValue == "HalfYearly") { da.paymentMode = "HalfYearly"; } else { da.paymentMode = "Annually"; } da.customerId = int.Parse(txtCustomerId.Text); da.policyNumber = int.Parse(txtPolicyNumber.Text); da.address = txtAddress.Text; da.customerDob = DateTime.Parse(txtDOB.Text); da.customerName = txtInsuredName.Text; da.endo_Status = txtendo.Text; da.idNumber = txtIDProofNumber.Text; da.mobile = long.Parse(txtTelephoneNumber.Text); da.nomineName = txtNomineeName.Text; da.productName = txtProductName.Text; int m = int.Parse(txtPolicyNumber.Text); int n = ubll.UpdateByPolicyNumber(m, da); int num1 = int.Parse(txtCustomerId.Text); int num2 = int.Parse(txtPolicyNumber.Text); int l = ebll.EndorsementUpdate(num2, num1); if (n == 1) { Response.Write("<script type = 'text/javascript'>alert('Data Updated Successfully')</script>"); Response.Redirect("UserUpdateResult.aspx?Id=" + n); } else { Response.Write("<script type = 'text/javascript'>alert('Error while Updating.....Please contact Admin([email protected])')</script>"); } #endregion }