protected void Button1_Click(object sender, EventArgs e) { try { ValidateForceSaleValue(); try { ValidateIssurance(); RobotTableAdapters.CollateralType_PropertyTableAdapter robot = new RobotTableAdapters.CollateralType_PropertyTableAdapter(); RobotTableAdapters.InsuranceTableAdapter robotInsuranceTable = new RobotTableAdapters.InsuranceTableAdapter(); //initialize values int collateralId = Convert.ToInt32(Request.QueryString["collateralId"]); int CollateralTypeId = Convert.ToInt32(Request.QueryString["CollateralTypeId"]); double varForceSaleValue = 0; double varOpenMarketValue = 0; varForceSaleValue = Convert.ToDouble(ForceSaleValue.Text); varOpenMarketValue = Convert.ToDouble(OpenMarketValue.Text); //insert values into CollateralType_Property and retrieve max id as collateralDetailsId int collateralDetailsId = Convert.ToInt32(robot.Proc_insert_property(OwnershipLink.Text, Location.Text, Convert.ToInt32(state_id.SelectedValue), Name_ColDocument.Text, RefNo_ColDocument.Text, AddressWithLandMark.Text, Convert.ToInt32(PropertyType_id.SelectedValue), varForceSaleValue, varOpenMarketValue, "NULL", Convert.ToDateTime(DateOfValuation.Value), Convert.ToInt32(PropertyDevelopmentStatus.SelectedValue), OccupancyStatus_id.SelectedValue, collateralId, -1, Convert.ToInt32(NameOfValuer.SelectedValue), -1, property_desc.Text, "NULL")); hiddenDetailsId.Text = collateralDetailsId.ToString(); //see if he filled the insurance form, then run the block of code that will do the insrt into insurance table if (insuranceStatusId.SelectedValue == "1") { int varPeriodOfInsuranceCover = 0; double varAmountInsured = 0; varPeriodOfInsuranceCover = Convert.ToInt32(PeriodOfInsuranceCover.Text); varAmountInsured = Convert.ToDouble(AmountInsured.Text); robotInsuranceTable.Insert(Convert.ToInt32(insuranceStatusId.SelectedValue), Convert.ToInt32(InsuranceCover_id.SelectedValue), collateralDetailsId, CollateralTypeId, InsuranceCompany.Text, Convert.ToDateTime(DateOfInsurance.Value), varPeriodOfInsuranceCover, varAmountInsured, keyClause.Text, -1, Convert.ToInt32(InsuranceCompany.SelectedValue)); } else { robotInsuranceTable.Insert(Convert.ToInt32(insuranceStatusId.SelectedValue), null, collateralDetailsId, CollateralTypeId, null, DateTime.Now, null, null, null, Smart.GetEmployeeID(), null); } //enable and move focus to next tab, disable current tab ASPxPageControl1.TabPages[1].Enabled = true; //documenttype_id.SelectedIndex = 2; ASPxPageControl1.ActiveTabIndex = 1; } catch (Exception ex) { _errorMessageProperty.Text = ex.Message; } } catch (Exception _ex) { _errorMessageProperty_1.Text = _ex.Message; } }
protected void Page_Load(object sender, EventArgs e) { String collateraldetails_id = Request.QueryString["collateraldetails_id"]; int insureID = 0; if (!IsPostBack) { // insuranceStatusId.SelectedIndex = 1; ASPxPageControl1.TabPages[0].Enabled = true; ASPxPageControl1.TabPages[1].Enabled = true; ASPxPageControl1.TabPages[2].Enabled = false; ASPxPageControl1.TabPages[3].Enabled = false; ASPxPageControl1.ActiveTabIndex = 0; int collateraldetailsid = Convert.ToInt32(Request.QueryString["collateraldetails_id"]); //this code is for population of fields when update mode is set RobotTableAdapters.CollateralType_PropertyTableAdapter propertyEngine = new RobotTableAdapters.CollateralType_PropertyTableAdapter(); DataTable propertyData = propertyEngine.getPropertyById(Convert.ToInt32(collateraldetails_id)); OwnershipLink.Text = propertyData.Rows[0]["OwnershipLink"].ToString(); Name_ColDocument.Text = propertyData.Rows[0]["Name_ColDocument"].ToString(); RefNo_ColDocument.Text = propertyData.Rows[0]["RefNo_ColDocument"].ToString(); OpenMarketValue.Text = propertyData.Rows[0]["OpenMarketValue"].ToString(); DateTime dt ; dt= Convert.ToDateTime(propertyData.Rows[0]["DateOfValuation"].ToString()); DateOfValuation.Value = ((DateTime)dt).ToString("MM/dd/yyyy"); AddressWithLandMark.Text = propertyData.Rows[0]["AddressWithLandMark"].ToString(); ForceSaleValue.Text = propertyData.Rows[0]["ForceSaleValue"].ToString(); property_desc.Text = propertyData.Rows[0]["property_desc"].ToString(); Location.Text = propertyData.Rows[0]["Location"].ToString(); //DROPDOWN if (propertyData.Rows[0]["documenttype_id"].ToString() != "-1") documenttype_id.SelectedValue = propertyData.Rows[0]["documenttype_id"].ToString(); OccupancyStatus_id.SelectedIndex = Convert.ToInt32(propertyData.Rows[0]["OccupancyStatus_id"].ToString()); PropertyDevelopmentStatus.SelectedValue = propertyData.Rows[0]["PropertyDevelopmentStatus_id"].ToString(); NameOfValuer.SelectedValue = propertyData.Rows[0]["valuer_id"].ToString(); state_id.SelectedValue = propertyData.Rows[0]["state_id"].ToString(); PropertyType_id.SelectedValue = propertyData.Rows[0]["PropertyType_id"].ToString(); // OwnershipLink.Text = propertyData.Rows[0]["OwnershipLink"].ToString(); try { RobotTableAdapters.InsuranceTableAdapter InsuranceEngine = new RobotTableAdapters.InsuranceTableAdapter(); DataTable InsuranceData = InsuranceEngine.proc_getInsuranceById(Convert.ToInt32(collateraldetails_id), 1); //TEXTBOXES InsuranceID.Value = InsuranceData.Rows[0]["Insurance_id"].ToString(); insuranceStatusId.SelectedValue = InsuranceData.Rows[0]["InsuranceStatus_id"].ToString(); if (InsuranceData.Rows[0]["InsuranceStatus_id"].ToString() == "1" || InsuranceData.Rows[0]["InsuranceStatus_id"].ToString() == "3") { PeriodOfInsuranceCover.Text = InsuranceData.Rows[0]["PeriodOfInsuranceCover"].ToString(); keyClause.Text = InsuranceData.Rows[0]["KeyClause"].ToString(); AmountInsured.Text = InsuranceData.Rows[0]["AmountInsured"].ToString(); DateTime dt1; dt1 = Convert.ToDateTime(InsuranceData.Rows[0]["DateOfInsurance"].ToString()); DateOfInsurance.Value = ((DateTime)dt1).ToString("MM/dd/yyyy"); //DROPDOWNS InsuranceCompany.SelectedValue = InsuranceData.Rows[0]["insuranceCompany_id"].ToString(); InsuranceCover_id.SelectedValue = InsuranceData.Rows[0]["InsuranceCover_id"].ToString(); } } catch (Exception) { } } CheckBoxList1_Load(); }
protected void Button1_Click(object sender, EventArgs e) { try { ValidateForceSaleValue(); try { ValidateIssurance(); RobotTableAdapters.CollateralType_PropertyTableAdapter robot = new RobotTableAdapters.CollateralType_PropertyTableAdapter(); RobotTableAdapters.InsuranceTableAdapter robotInsuranceTable = new RobotTableAdapters.InsuranceTableAdapter(); String collateraldetails_id = Request.QueryString["collateraldetails_id"]; int collateraldetailsid = Convert.ToInt32(Request.QueryString["collateraldetails_id"]); //initialize values int collateralId = Convert.ToInt32(Request.QueryString["collateralId"]); int CollateralTypeId = Convert.ToInt32(Request.QueryString["CollateralTypeId"]); double varForceSaleValue = 0; double varOpenMarketValue = 0; varForceSaleValue = Convert.ToDouble(ForceSaleValue.Text); varOpenMarketValue = Convert.ToDouble(OpenMarketValue.Text); robot.Update(OwnershipLink.Text, Location.Text, Convert.ToInt32(state_id.SelectedValue), Name_ColDocument.Text, RefNo_ColDocument.Text, AddressWithLandMark.Text, Convert.ToInt32(PropertyType_id.SelectedValue), Convert.ToDouble(ForceSaleValue.Text), Convert.ToDouble(OpenMarketValue.Text), NameOfValuer.SelectedValue, Convert.ToDateTime(DateOfValuation.Value), Convert.ToInt32(PropertyDevelopmentStatus.SelectedValue), OccupancyStatus_id.SelectedValue, collateralId, Smart.GetEmployeeID(), Convert.ToInt32(NameOfValuer.SelectedValue), -1, property_desc.Text, "NULL", collateraldetailsid); //insert values into CollateralType_Property and retrieve max id as collateralDetailsId hiddenDetailsId.Text = collateraldetailsid.ToString(); //see if he filled the insurance form, then run the block of code that will do the insrt into insurance table int varPeriodOfInsuranceCover = 0; double varAmountInsured = 0; //varPeriodOfInsuranceCover = Convert.ToInt32(PeriodOfInsuranceCover.Text.ToString()); //varAmountInsured = Convert.ToDouble(AmountInsured.Text); if (insuranceStatusId.SelectedValue == "2") { robotInsuranceTable.Update(Convert.ToInt32(insuranceStatusId.SelectedValue), null, collateraldetailsid, CollateralTypeId, null, null, null, null, null, Smart.GetEmployeeID(), null, Convert.ToInt32(InsuranceID.Value)); } else { robotInsuranceTable.Update(Convert.ToInt32(insuranceStatusId.SelectedValue), Convert.ToInt32(InsuranceCover_id.SelectedValue), collateraldetailsid, CollateralTypeId, InsuranceCompany.Text, Convert.ToDateTime(DateOfInsurance.Value), Convert.ToInt32(PeriodOfInsuranceCover.Text.ToString()), Convert.ToDouble(AmountInsured.Text), keyClause.Text, Smart.GetEmployeeID(), Convert.ToInt32(InsuranceCompany.SelectedValue), Convert.ToInt32(InsuranceID.Value)); } ///Taking care of the checkboxes // //initialize values int CollateralDetailsId = Convert.ToInt32(hiddenDetailsId.Text); RobotTableAdapters.documents_submittedTableAdapter robotDocs = new RobotTableAdapters.documents_submittedTableAdapter(); RobotTableAdapters.documents_attachmentTableAdapter robotAttachment = new RobotTableAdapters.documents_attachmentTableAdapter(); //delete should happen before insert, just incase the guy goes back to check or uncheck documents in the checklist tab robotDocs.DeleteExistingCheckedDocs(collateralId, CollateralDetailsId, CollateralTypeId); DataTable checkDocs = robotDocs.getSubmitedDocumentsById(collateralId, CollateralDetailsId, CollateralTypeId); foreach (DataRow row in checkDocs.Rows) { foreach (ListItem item in CheckBoxList1.Items) { if (row["document_id"].ToString() == item.Value) item.Selected = true; } } //enable and move focus to next tab, disable current tab ASPxPageControl1.TabPages[1].Enabled = true; //documenttype_id.SelectedIndex = 2; ASPxPageControl1.ActiveTabIndex = 1; CheckBoxList1_Load(); } catch (Exception ex) { _errorMessageProperty.Text = ex.Message; } } catch (Exception _ex) { _errorMessageProperty_1.Text = _ex.Message; } }