private void SaveData(string EqEstId) { if (chkDamage.Checked || chkpOnHold.Checked) { // ClearControls(); } else if (!checkContainerStatus(true)) { return; } if (DisableControls() == 1 && txtAppUser.Text.Trim() == "" && (txtLabourApp.Text != "" || txtMaterialApp.Text != ""))//ddlUser.SelectedIndex == 0) { lblError.Text = "Approver name cannot be blank"; return; } IEqpRepairing iequip = new EquipmentRepairEntity(); iequip.pk_RepairID = Convert.ToInt32(EqEstId); iequip.locId = Convert.ToInt32(ddlLoc.SelectedValue); iequip.ContainerNo = txtContainerNo.Text; iequip.EstimateReference = txtEstimateRef.Text; iequip.RepLabourBilled = txtLabourBill.Text.Trim() == "" ? 0 : Convert.ToDecimal(txtLabourBill.Text); iequip.RepLabourEst = txtLabourEst.Text.Trim() == "" ? 0 : Convert.ToDecimal(txtLabourEst.Text); iequip.RepLabourAppr = txtLabourApp.Text.Trim() == "" ? 0 : Convert.ToDecimal(txtLabourApp.Text); iequip.RepMaterialAppr = txtMaterialApp.Text.Trim() == "" ? 0 : Convert.ToDecimal(txtMaterialApp.Text); iequip.RepMaterialBilled = txtMaterialBill.Text.Trim() == "" ? 0 : Convert.ToDecimal(txtMaterialBill.Text); iequip.RepMaterialEst = txtMaterialEst.Text.Trim() == "" ? 0 : Convert.ToDecimal(txtMaterialEst.Text); iequip.Reason = txtReason.Text; iequip.RealeasedOn = txtReleasedOn.Text.Trim() == "" ? (Nullable <DateTime>)null : Convert.ToDateTime(txtReleasedOn.Text); iequip.StockReturnDate = txtStockRetDate.Text.Trim() == "" ? (Nullable <DateTime>)null : Convert.ToDateTime(txtStockRetDate.Text); iequip.TransactionDate = txtTransactionDate.Text.Trim() == "" ? (Nullable <DateTime>)null : Convert.ToDateTime(txtTransactionDate.Text); iequip.ProspectID = Convert.ToInt32(ddlLine.SelectedValue); iequip.locId = Convert.ToInt32(ddlLoc.SelectedValue); iequip.NVOCCId = Convert.ToInt32(ddlLine.SelectedValue); try { iequip.fk_UserApproved = _userId;// Convert.ToInt32(txtAppUser.Text);// Convert.ToInt32(ddlUser.SelectedValue); } catch { iequip.fk_UserApproved = null; } iequip.onHold = chkpOnHold.Checked; iequip.Damaged = chkDamage.Checked; //if (iequip.RepLabourBilled < iequip.RepLabourAppr || iequip.RepMaterialBilled < iequip.RepMaterialAppr) //{ // // GeneralFunctions.RegisterAlertScript(this, "Approved amount cannot be greater then Billable amount"); // lblError.Text = "Approved amount cannot be greater then Billable amount"; // return; //} if (iequip.RepLabourEst < iequip.RepLabourAppr || iequip.RepMaterialEst < iequip.RepMaterialAppr) { // GeneralFunctions.RegisterAlertScript(this, "Approved amount cannot be greater then Billable amount"); lblError.Text = "Approved amount cannot be greater then Estimate amount"; return; } bool isedit = EqEstId != "-1" ? true : false; int result = EquipmentBLL.AddEditEquipEstimate(_userId, isedit, iequip); if (result > 0) { Response.Redirect("~/Equipment/RepairingEstimate.aspx"); } else { GeneralFunctions.RegisterAlertScript(this, "Error Occured"); } }