protected void btnShipment_Click(object sender, EventArgs e) { try { LC_Shipment sLC_Shipment = new LC_Shipment(); sLC_Shipment.PO_No = lblOrderNo.Text; sLC_Shipment.LC_No = txtLCNumber.Text; sLC_Shipment.LC_ReceiveDate = Convert.ToDateTime(txtLCReceiveDate.Text); sLC_Shipment.Feeder_Vessel = txtFeederVessel.Text; sLC_Shipment.FETD = Convert.ToDateTime(txtETD.Text); sLC_Shipment.FETA = Convert.ToDateTime(txtETA.Text); sLC_Shipment.Actual_Ship_Qty = Convert.ToDouble(txtActualShipQuantity.Text); sLC_Shipment.Airway_Bill = txtAirwayBill.Text; sLC_Shipment.Export_License_No = txtExportLicenseNumber.Text; sLC_Shipment.GSP_Form = txtGSPForm.Text; sLC_Shipment.Courier_No = txtCourierNumber.Text; sLC_Shipment.Debit_Note_No = txtDebitNoteNo.Text; sLC_Shipment.Document_Receive_Date = Convert.ToDateTime(txtDocumentReceiveDate.Text); sLC_Shipment.Actual_FCR_Date = Convert.ToDateTime(txtActualFCRDate.Text); sLC_Shipment.LC_Date = Convert.ToDateTime(txtLCDate.Text); sLC_Shipment.LC_Expiry_Date = Convert.ToDateTime(txtLCExpiryDate.Text); sLC_Shipment.Mother_Vessel = txtMotherVessel.Text; sLC_Shipment.METD = Convert.ToDateTime(txtETD1.Text); sLC_Shipment.META = Convert.ToDateTime(txtETA1.Text); sLC_Shipment.Invoice_No = txtInvoiceNumber.Text; sLC_Shipment.Container_No = txtContainerNumber.Text; sLC_Shipment.Certificate_Of_Origin = txtCertificateOfOrigin.Text; sLC_Shipment.Commission_Rate = Convert.ToDouble(txtCommissionRate.Text); sLC_Shipment.Courier_Date = Convert.ToDateTime(txtCourierDate.Text); sLC_Shipment.Inspection_Certificate_No = txtInspectionCertificationNo.Text; sLC_Shipment.Packing_List_No = txtPackingListNumber.Text; sLC_Shipment.Others = txtOther.Text; sLC_Shipment.Create_Date = DateTime.Today; sLC_Shipment.Create_User = ((SessionUser)Session["SessionUser"]).UserId; sLC_Shipment.OCODE = ((SessionUser)Session["SessionUser"]).OCode; if (btnShipment.Text == "Save") { var result = masterBLL.InsertShipment(sLC_Shipment); if (result == 1) { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Saved Successfully')", true); } } else { int id = Convert.ToInt32(hidshipmentid.Value); var result = masterBLL.UpdateShipment(sLC_Shipment, id); if (result == 1) { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Updated Successfully')", true); if (btnShipment.Text == "Update") { btnShipment.Text = "Save"; } } } GetShipmentDetails(); ShipmentClear(); } catch (Exception ex) { throw ex; } }