protected void btnSave_Click(object sender, DirectEventArgs e) { if (string.IsNullOrEmpty(CmbShipperCode.Value.Trim())) { div_bottom.Html = "<p class='error'> Save failed, Shipper can't be empty!</p>"; CmbShipperCode.Focus(); return; } if (string.IsNullOrEmpty(CmbConsignee.Value.Trim())) { div_bottom.Html = "<p class='error'> Save failed, Consignee can't be empty!</p>"; CmbConsignee.Focus(); return; } if (GridFlightList.Store.Count == 0) { div_bottom.Html = "<p class='error'> Save failed, Flight Routing is no data!</p>"; l_flightno.Focus(); return; } List <IFields> UpdateHAWB = new List <IFields>(); UpdateHAWB.Add(dal.CreateIFields().Append("Option", "Update") .Append("air_Seed", hidSeed.Text == "" ? null : hidSeed.Text) .Append("air_MAWB", txtMAWB.Text.Trim().Replace(" ", "").ToUpper()) .Append("air_LotNo", hidLotNo.Text) //.Append("air_LocReceived",CmbDeparture.Value) //.Append("air_LocFinal", CmbFinalDest.Value) .Append("air_Sales", CmbSalesman.Value) .Append("air_Shipper", CmbShipperCode.Value) .Append("air_Consignee", CmbConsignee.Value) .Append("air_Carrier", CmbCarrierRight.Value) .Append("air_Flight", txtFlightRight.Text.ToUpper()) .Append("air_LocLoad", CmbFromRight.Value) .Append("air_LocDischarge", CmbToRight.Value) .Append("air_ETD", ControlBinder.getDate(txtETD.RawText.Trim().ToUpper().StartsWith("0001") ? DBNull.Value : (object)txtETD.RawText.Trim())) .Append("air_ETA", ControlBinder.getDate(txtETA.RawText.Trim().ToUpper().StartsWith("0001") ? DBNull.Value : (object)txtETA.RawText.Trim())) .Append("air_ATD", ControlBinder.getDate(txtATD.RawText.Trim().ToUpper().StartsWith("0001") ? DBNull.Value : (object)txtATD.RawText.Trim())) .Append("air_ATA", ControlBinder.getDate(txtATA.RawText.Trim().ToUpper().StartsWith("0001") ? DBNull.Value : (object)txtATA.RawText.Trim())) .Append("air_GWT", string.IsNullOrEmpty(txtGWT.Text) ? DBNull.Value : (object)txtGWT.Text) .Append("air_VWT", string.IsNullOrEmpty(txtVWT.Text) ? DBNull.Value : (object)txtVWT.Text) .Append("air_CWT", string.IsNullOrEmpty(txtCWT.Text) ? DBNull.Value : (object)txtCWT.Text) .Append("air_Piece", string.IsNullOrEmpty(txtPiece.Text) ? DBNull.Value : (object)txtPiece.Text) .Append("air_Pallet", string.IsNullOrEmpty(txtPallet.Text) ? DBNull.Value : (object)txtPallet.Text) .Append("air_Rate", string.IsNullOrEmpty(txtRate.Text) ? DBNull.Value : (object)txtRate.Text) .Append("air_Remark", txtRemark.Text.Trim()) .Append("air_OperationRemark", txtOperation.Text.Trim()) .Append("air_AccountRemark", txtAccount.Text.Trim()) .Append("code", FSecurityHelper.CurrentUserDataGET()[4].ToString() + sys) .Append("code1", FSecurityHelper.CurrentUserDataGET()[4].ToString() + sys + "SN") .Append("air_STAT", FSecurityHelper.CurrentUserDataGET()[12].ToString()) .Append("air_SYS", sys) .Append("type", typename) .Append("User", FSecurityHelper.CurrentUserDataGET()[0].ToString()) ); try { DataSet ds = GetDs("FW_AirExport_DirectMAWB_SP", UpdateHAWB); hidSeed.Text = ds.Tables[0].Rows[0][0].ToString(); string newFlag = ds.Tables[0].Rows[0][1].ToString(); hidLotNo.Text = ds.Tables[0].Rows[0][2].ToString(); #region FlightRouting var ShipmentRoute = JSON.Deserialize <List <ShipmentRoute> >(e.ExtraParams["p_safety_l"]); List <IFields> Routelist = new List <IFields>(); string RouteID = ""; for (int i = 0; i < ShipmentRoute.Count; ++i) { Routelist.Add(dal.CreateIFields().Append("Option", "Update"). Append("sr_Stat", FSecurityHelper.CurrentUserDataGET()[12].ToString()). Append("sr_ToMaster", hidSeed.Text). Append("sr_ShipKind", "FREIGHT"). Append("sr_Carrier", ShipmentRoute[i].Carrier). Append("sr_OrderID", i). Append("User", FSecurityHelper.CurrentUserDataGET()[0].ToString()). Append("sr_Flight", ShipmentRoute[i].FlightNo.ToUpper()). Append("sr_From", ShipmentRoute[i].From). Append("sr_To", ShipmentRoute[i].To). Append("sr_ETD", ControlBinder.getDate(ShipmentRoute[i].ETD.ToString().StartsWith("0001") ? DBNull.Value : (object)ShipmentRoute[i].ETD)). Append("sr_ETA", ControlBinder.getDate(ShipmentRoute[i].ETA.ToString().StartsWith("0001") ? DBNull.Value : (object)ShipmentRoute[i].ETA)). Append("sr_ATD", ControlBinder.getDate(ShipmentRoute[i].ATD.ToString().StartsWith("0001") ? DBNull.Value : (object)ShipmentRoute[i].ATD)). Append("sr_ATA", ControlBinder.getDate(ShipmentRoute[i].ATA.ToString().StartsWith("0001") ? DBNull.Value : (object)ShipmentRoute[i].ATA)). Append("sr_ROWID", ShipmentRoute[i].RowID)); RouteID += "," + ShipmentRoute[i].RowID; } if (RouteID.Length > 1) { RouteID = RouteID.Substring(1, RouteID.Length - 1); } dal.FactoryDAL(PageHelper.ConnectionStrings, "FW_AirExport_ShipmentRoute_SP", new List <IFields> { dal.CreateIFields().Append("Option", "Delete").Append("sr_ToMaster", hidSeed.Text).Append("str", RouteID) }).Update(); bool b = dal.FactoryDAL(PageHelper.ConnectionStrings, "FW_AirExport_ShipmentRoute_SP", Routelist).Update(); #endregion #region LocalInvoice //var InvocieList = JSON.Deserialize<List<Invocie>>(e.ExtraParams["p_safety_2"]); //string InvoiceID = ""; //for (int i = 0; i < InvocieList.Count; ++i) //{ // InvoiceID += "," + InvocieList[i].RowID; //} //if (InvoiceID.Length > 1) //{ // InvoiceID = InvoiceID.Substring(1, InvoiceID.Length - 1); //} //bool inv = dal.FactoryDAL(PageHelper.ConnectionStrings, "FW_AirExport_DirectMAWB_SP", new List<IFields>() { dal.CreateIFields().Append("Option", "DeleteInvoice") //.Append("air_ToMAWB",hidSeed.Text) //.Append("str",InvoiceID)}).Update(); #endregion //X.AddScript("saveCost('" + hidSeed.Text + "');"); ucCost.costseed = hidSeed.Text; ucCost.btnCostEvent(sender, e); #region Foreign var Foreign = JSON.Deserialize <List <Foreign> >(e.ExtraParams["p_safety_4"]); List <IFields> Foreignlist = new List <IFields>(); string ForeignID = ""; for (int i = 0; i < Foreign.Count; ++i) { if (Foreign[i].CompanyCode.Trim() != "" && Foreign[i].Item.Trim() != "" && Foreign[i].CalcKind.Trim() != "") { Foreignlist.Add(dal.CreateIFields().Append("Option", "UpdateForeign"). Append("si_BillTo", Foreign[i].CompanyCode.Trim().ToUpper()). Append("si_Total", string.IsNullOrEmpty(Foreign[i].Total) ? DBNull.Value : (object)Foreign[i].Total). Append("si_Item", Foreign[i].Item.Trim().ToUpper()). Append("si_Description", Foreign[i].Description). Append("si_QtyKind", Foreign[i].CalcKind.Trim().ToUpper()). //Append("si_Currency", CmbForeign.SelectedItem.Value == null ? "USD" : CmbForeign.SelectedItem.Value). Append("si_Currency", string.IsNullOrEmpty(Foreign[i].Currency) ? "USD" : (object)Foreign[i].Currency). Append("si_Quantity", string.IsNullOrEmpty(txtCWT.Text) ? null : (object)txtCWT.Text). Append("si_Unit", Foreign[i].Unit). Append("si_ExRate", string.IsNullOrEmpty(Foreign[i].EX) ? DBNull.Value : (object)Foreign[i].EX). Append("si_Rate", string.IsNullOrEmpty(Foreign[i].Rate) ? DBNull.Value : (object)Foreign[i].Rate). Append("si_Amount", string.IsNullOrEmpty(Foreign[i].Amount) ? DBNull.Value : (object)Foreign[i].Amount). Append("si_Min", string.IsNullOrEmpty(Foreign[i].Min) ? DBNull.Value : (object)Foreign[i].Min). Append("si_ShowIn", Foreign[i].Show.Trim().ToUpper()) .Append("si_ROWID", Foreign[i].RowID) .Append("si_ToMaster", hidSeed.Text) .Append("si_Stat", FSecurityHelper.CurrentUserDataGET()[12].ToString()) .Append("si_Sys", sys) .Append("si_User", FSecurityHelper.CurrentUserDataGET()[0].ToString()) ); ForeignID += "," + Foreign[i].RowID; } } //delete if (ForeignID.Length > 1) { ForeignID = ForeignID.Substring(1, ForeignID.Length - 1); } dal.FactoryDAL(PageHelper.ConnectionStrings, "FW_AirExport_ShipmentItemForDirectMAWB_SP", new List <IFields> { dal.CreateIFields().Append("Option", "DeleteActualForeign").Append("si_Seed", hidSeed.Text).Append("str", ForeignID) }).Update(); bool resultForeign = dal.FactoryDAL(PageHelper.ConnectionStrings, "FW_AirExport_ShipmentItemForDirectMAWB_SP", Foreignlist).Update(); #endregion #region Foreign Freight dal.FactoryDAL(PageHelper.ConnectionStrings, "FW_AirExport_ShipmentItemForDirectMAWB_SP", new List <IFields> { dal.CreateIFields().Append("Option", "UpdateForFreight").Append("si_ROWID", string.IsNullOrEmpty(hidForeignID.Text) ? null : (object)hidForeignID.Text) .Append("si_User", FSecurityHelper.CurrentUserDataGET()[0].ToString()).Append("si_Sys", sys).Append("si_Stat", FSecurityHelper.CurrentUserDataGET()[12].ToString()).Append("si_ToMaster", hidSeed.Text) .Append("si_BillTo", CmbCompany.Value).Append("si_Min", string.IsNullOrEmpty(txtFor.Text) ? "0" : (object)txtFor.Text).Append("si_Currency", CmbForeign.SelectedItem.Value == null ? "USD" : CmbForeign.SelectedItem.Value).Append("si_Quantity", string.IsNullOrEmpty(txtCWT.Text) ? null : (object)txtCWT.Text).Append("si_Unit", "") }).Update(); #endregion #region Local var Local = JSON.Deserialize <List <Local> >(e.ExtraParams["p_safety_5"]); List <IFields> Locallist = new List <IFields>(); string LocalID = ""; for (int i = 0; i < Local.Count; ++i) { if (Local[i].CompanyCode.Trim() != "" && Local[i].Item.Trim() != "" && Local[i].CalcKind.Trim() != "") { Locallist.Add(dal.CreateIFields().Append("Option", "UpdateLocal"). Append("si_BillTo", Local[i].CompanyCode.Trim().ToUpper()). Append("si_Total", string.IsNullOrEmpty(Local[i].Total) ? DBNull.Value : (object)Local[i].Total). Append("si_Item", Local[i].Item.Trim().ToUpper()). Append("si_Description", Local[i].Description). Append("si_QtyKind", Local[i].CalcKind.Trim().ToUpper()). Append("si_Currency", CmbLocal.SelectedItem.Value == null ? "HKD" : CmbLocal.SelectedItem.Value). Append("si_Quantity", string.IsNullOrEmpty(txtCWT.Text) ? null : (object)txtCWT.Text). Append("si_Unit", Local[i].Unit). Append("si_ExRate", string.IsNullOrEmpty(Local[i].EX) ? DBNull.Value : (object)Local[i].EX). Append("si_Rate", string.IsNullOrEmpty(Local[i].Rate) ? DBNull.Value : (object)Local[i].Rate). Append("si_Amount", string.IsNullOrEmpty(Local[i].Amount) ? DBNull.Value : (object)Local[i].Amount). Append("si_Min", string.IsNullOrEmpty(Local[i].Min) ? DBNull.Value : (object)Local[i].Min). Append("si_ShowIn", Local[i].Show.Trim().ToUpper()) .Append("si_ROWID", Local[i].RowID) .Append("si_ToMaster", hidSeed.Text) .Append("si_Stat", FSecurityHelper.CurrentUserDataGET()[12].ToString()) .Append("si_Sys", sys) .Append("si_User", FSecurityHelper.CurrentUserDataGET()[0].ToString()) ); LocalID += "," + Local[i].RowID; } } //delete if (LocalID.Length > 1) { LocalID = LocalID.Substring(1, LocalID.Length - 1); } dal.FactoryDAL(PageHelper.ConnectionStrings, "FW_AirExport_ShipmentItemForDirectMAWB_SP", new List <IFields> { dal.CreateIFields().Append("Option", "DeleteActualLocal").Append("si_Seed", hidSeed.Text).Append("str", LocalID) }).Update(); bool resultLocal = dal.FactoryDAL(PageHelper.ConnectionStrings, "FW_AirExport_ShipmentItemForDirectMAWB_SP", Locallist).Update(); #endregion #region Local Freight dal.FactoryDAL(PageHelper.ConnectionStrings, "FW_AirExport_ShipmentItemForDirectMAWB_SP", new List <IFields> { dal.CreateIFields().Append("Option", "UpdateLocFreight").Append("si_ROWID", string.IsNullOrEmpty(hidLocalID.Text) ? null : (object)hidLocalID.Text) .Append("si_User", FSecurityHelper.CurrentUserDataGET()[0].ToString()).Append("si_Sys", sys).Append("si_Stat", FSecurityHelper.CurrentUserDataGET()[12].ToString()).Append("si_ToMaster", hidSeed.Text) .Append("si_BillTo", CmbCompany1.Value).Append("si_Min", string.IsNullOrEmpty(txtLoc.Text) ? "0" : (object)txtLoc.Text).Append("si_Currency", CmbLocal.SelectedItem.Value == null ? "HKD" : CmbLocal.SelectedItem.Value).Append("si_Quantity", string.IsNullOrEmpty(txtCWT.Text) ? null : (object)txtCWT.Text).Append("si_Unit", "") }).Update(); #endregion #region WTForeign var WTForeign = JSON.Deserialize <List <WTForeign> >(e.ExtraParams["p_safety_6"]); List <IFields> WTForeignlist = new List <IFields>(); string WTForeignID = ""; for (int i = 0; i < WTForeign.Count; ++i) { if (WTForeign[i].Rate != null) { WTForeignlist.Add(dal.CreateIFields().Append("Option", "UpdateSellRateForeign"). Append("aer_Weight", string.IsNullOrEmpty(WTForeign[i].WT) ? "0.000" : (object)WTForeign[i].WT). Append("aer_Rate", string.IsNullOrEmpty(WTForeign[i].Rate) ? DBNull.Value : (object)WTForeign[i].Rate) .Append("aer_ROWID", WTForeign[i].RowID) .Append("aer_Seed", hidSeed.Text) .Append("aer_Stat", FSecurityHelper.CurrentUserDataGET()[12].ToString()) .Append("aer_Sys", sys) .Append("aer_User", FSecurityHelper.CurrentUserDataGET()[0].ToString()) ); WTForeignID += "," + WTForeign[i].RowID; } } //delete if (WTForeignID.Length > 1) { WTForeignID = WTForeignID.Substring(1, WTForeignID.Length - 1); } dal.FactoryDAL(PageHelper.ConnectionStrings, "FW_AirExport_ShipmentItemForDirectMAWB_SP", new List <IFields> { dal.CreateIFields().Append("Option", "DeleteActualSellRateForeign").Append("aer_Seed", hidSeed.Text).Append("str", WTForeignID) }).Update(); bool resultWTForeign = dal.FactoryDAL(PageHelper.ConnectionStrings, "FW_AirExport_ShipmentItemForDirectMAWB_SP", WTForeignlist).Update(); #endregion #region WTLocal var WTLocal = JSON.Deserialize <List <WTLocal> >(e.ExtraParams["p_safety_7"]); List <IFields> WTLocallist = new List <IFields>(); string WTLocalID = ""; for (int i = 0; i < WTLocal.Count; ++i) { if (WTLocal[i].Rate != null) { WTLocallist.Add(dal.CreateIFields().Append("Option", "UpdateSellRateLocal"). Append("aer_Weight", string.IsNullOrEmpty(WTLocal[i].WT) ? "0.000" : (object)WTLocal[i].WT). Append("aer_Rate", string.IsNullOrEmpty(WTLocal[i].Rate) ? DBNull.Value : (object)WTLocal[i].Rate) .Append("aer_ROWID", WTLocal[i].RowID) .Append("aer_Seed", hidSeed.Text) .Append("aer_Stat", FSecurityHelper.CurrentUserDataGET()[12].ToString()) .Append("aer_Sys", sys) .Append("aer_User", FSecurityHelper.CurrentUserDataGET()[0].ToString()) ); WTLocalID += "," + WTLocal[i].RowID; } } //delete if (WTLocalID.Length > 1) { WTLocalID = WTLocalID.Substring(1, WTLocalID.Length - 1); } dal.FactoryDAL(PageHelper.ConnectionStrings, "FW_AirExport_ShipmentItemForDirectMAWB_SP", new List <IFields> { dal.CreateIFields().Append("Option", "DeleteActualSellRateLocal").Append("aer_Seed", hidSeed.Text).Append("str", WTLocalID) }).Update(); bool resultWTLocal = dal.FactoryDAL(PageHelper.ConnectionStrings, "FW_AirExport_ShipmentItemForDirectMAWB_SP", WTLocallist).Update(); #endregion #region updateFreightTotal string type1 = "N", type2 = "N"; if (CmbCompany.Value != "") { type1 = "Y"; } if (CmbCompany1.Value != "") { type2 = "Y"; } dal.FactoryDAL(PageHelper.ConnectionStrings, "FW_AirExport_CoLoaderInFreight_SP", new List <IFields> { dal.CreateIFields().Append("Option", "UpdateTotal").Append("air_Seed", hidSeed.Text).Append("CWT", string.IsNullOrEmpty(txtCWT.Text) ? "0" : txtCWT.Text) .Append("Type1", type1).Append("Type2", type2).Append("F_Min", string.IsNullOrEmpty(txtFor.Text) ? "0" : txtFor.Text).Append("L_Min", string.IsNullOrEmpty(txtLoc.Text) ? "0" : txtLoc.Text).Append("M", "Y") }).Update(); #endregion //update cost(Qty,unit,total) //ControlBinder.UpdateCostData(hidSeed.Text, "AE", "MAWB"); if (newFlag == "N") { //--- DataBindList(); X.AddScript("if(window.opener!=null){if(typeof(window.opener.RefreshList)!='undefined'){window.opener.RefreshList();}}"); ControlBinder.pageTitleMsg(false, showname + ":" + hidLotNo.Text, "<p class=\"success\">Status : Save successfully ! </p>", div_bottom); } } catch { ControlBinder.pageTitleMsg(false, showname + ":" + hidLotNo.Text, "<p class=\"error\">Status : Save failed, please check the data !</p>", div_bottom); } }
protected void btnSave_Click(object sender, DirectEventArgs e) { if (string.IsNullOrEmpty(CmbShipperCode.Value.Trim())) { div_bottom.Html = "<p class='error'> Save failed, Shipper can't be empty!</p>"; CmbShipperCode.Focus(); return; } if (string.IsNullOrEmpty(CmbConsignee.Value.Trim())) { div_bottom.Html = "<p class='error'> Save failed, Consignee can't be empty!</p>"; CmbConsignee.Focus(); return; } if (GridFlightList.Store.Count == 0) { div_bottom.Html = "<p class='error'> Save failed, Flight Routing is no data!</p>"; l_flightno.Focus(); return; } List <IFields> UpdateHAWB = new List <IFields>(); UpdateHAWB.Add(dal.CreateIFields().Append("Option", "Update") .Append("air_Seed", hidSeed.Text == "" ? null : hidSeed.Text) .Append("air_MAWB", txtMAWB.Text.Trim().Replace(" ", "").ToUpper()) //.Append("air_LocReceived",CmbDeparture.Value) //.Append("air_LocFinal", CmbFinalDest.Value) .Append("air_Sales", CmbSalesman.Value) .Append("air_Shipper", CmbShipperCode.Value) //.Append("air_Shipper", CmbShipperName.SelectedItem.Value) .Append("air_Consignee", CmbConsignee.Value) //.Append("air_Consignee", CmbConsigneeName.SelectedItem.Value) .Append("air_CoLoader", CmbColoader.Value) .Append("air_Carrier", CmbCarrierRight.Value) .Append("air_Flight", txtFlightRight.Text.ToUpper()) .Append("air_LocLoad", CmbFromRight.Value) .Append("air_LocDischarge", CmbToRight.Value) .Append("air_ETD", ControlBinder.getDate(txtETD.RawText.Trim().ToUpper().StartsWith("0001") ? DBNull.Value : (object)txtETD.RawText.Trim())) .Append("air_ETA", ControlBinder.getDate(txtETA.RawText.Trim().ToUpper().StartsWith("0001") ? DBNull.Value : (object)txtETA.RawText.Trim())) .Append("air_ATD", ControlBinder.getDate(txtATD.RawText.Trim().ToUpper().StartsWith("0001") ? DBNull.Value : (object)txtATD.RawText.Trim())) .Append("air_ATA", ControlBinder.getDate(txtATA.RawText.Trim().ToUpper().StartsWith("0001") ? DBNull.Value : (object)txtATA.RawText.Trim())) .Append("air_GWT", string.IsNullOrEmpty(txtGWT.Text) ? DBNull.Value : (object)txtGWT.Text) .Append("air_VWT", string.IsNullOrEmpty(txtVWT.Text) ? DBNull.Value : (object)txtVWT.Text) .Append("air_CWT", string.IsNullOrEmpty(txtCWT.Text) ? DBNull.Value : (object)txtCWT.Text) .Append("air_Piece", string.IsNullOrEmpty(txtPiece.Text) ? DBNull.Value : (object)txtPiece.Text) .Append("air_Pallet", string.IsNullOrEmpty(txtPallet.Text) ? DBNull.Value : (object)txtPallet.Text) .Append("air_Rate", string.IsNullOrEmpty(txtRate.Text) ? DBNull.Value : (object)txtRate.Text) .Append("code", FSecurityHelper.CurrentUserDataGET()[4].ToString() + sys) .Append("code1", FSecurityHelper.CurrentUserDataGET()[4].ToString() + sys + "SN") .Append("air_STAT", FSecurityHelper.CurrentUserDataGET()[12].ToString()) .Append("air_SYS", sys) .Append("type", typename) .Append("air_Remark", string.IsNullOrEmpty(txtRemark.Text) ? "" : txtRemark.Text.Trim().ToUpper()) .Append("User", FSecurityHelper.CurrentUserDataGET()[0].ToString()) ); try { DataSet ds = GetDs("FW_AirExport_ViewConsol_SP", UpdateHAWB); hidSeed.Text = ds.Tables[0].Rows[0][0].ToString(); string newFlag = ds.Tables[0].Rows[0][1].ToString(); hidLotNo.Text = ds.Tables[0].Rows[0][2].ToString(); #region FlightRouting var ShipmentRoute = JSON.Deserialize <List <ShipmentRoute> >(e.ExtraParams["p_safety_l"]); List <IFields> Routelist = new List <IFields>(); string RouteID = ""; for (int i = 0; i < ShipmentRoute.Count; ++i) { Routelist.Add(dal.CreateIFields().Append("Option", "Update"). Append("sr_Stat", FSecurityHelper.CurrentUserDataGET()[12].ToString()). Append("sr_ToMaster", hidSeed.Text). Append("sr_ShipKind", "FREIGHT"). Append("sr_Carrier", ShipmentRoute[i].Carrier). Append("sr_OrderID", i). Append("User", FSecurityHelper.CurrentUserDataGET()[0].ToString()). Append("sr_Flight", ShipmentRoute[i].FlightNo.ToUpper()). Append("sr_From", ShipmentRoute[i].From). Append("sr_To", ShipmentRoute[i].To). Append("sr_ETD", ControlBinder.getDate(ShipmentRoute[i].ETD.ToString().StartsWith("0001") ? DBNull.Value : (object)ShipmentRoute[i].ETD)). Append("sr_ETA", ControlBinder.getDate(ShipmentRoute[i].ETA.ToString().StartsWith("0001") ? DBNull.Value : (object)ShipmentRoute[i].ETA)). Append("sr_ATD", ControlBinder.getDate(ShipmentRoute[i].ATD.ToString().StartsWith("0001") ? DBNull.Value : (object)ShipmentRoute[i].ATD)). Append("sr_ATA", ControlBinder.getDate(ShipmentRoute[i].ATA.ToString().StartsWith("0001") ? DBNull.Value : (object)ShipmentRoute[i].ATA)). Append("sr_ROWID", ShipmentRoute[i].RowID)); RouteID += "," + ShipmentRoute[i].RowID; } if (RouteID.Length > 1) { RouteID = RouteID.Substring(1, RouteID.Length - 1); } dal.FactoryDAL(PageHelper.ConnectionStrings, "FW_AirExport_ShipmentRoute_SP", new List <IFields> { dal.CreateIFields().Append("Option", "Delete").Append("sr_ToMaster", hidSeed.Text).Append("str", RouteID) }).Update(); bool b = dal.FactoryDAL(PageHelper.ConnectionStrings, "FW_AirExport_ShipmentRoute_SP", Routelist).Update(); #endregion #region HAWBList var HAWBList = JSON.Deserialize <List <HAWBList> >(e.ExtraParams["p_safety_2"]); List <IFields> HAWBLists = new List <IFields>(); string RowID = ""; for (int i = 0; i < HAWBList.Count; ++i) { // HAWBLists.Add(dal.CreateIFields().Append("Option", "UpdateEmptyHAWB"). // Append("air_ROWID", HAWBList[i].RowID) // .Append("air_ToMAWB", hidSeed.Text)); RowID += HAWBList[i].RowID.ToString() + ","; } bool result = dal.FactoryDAL(PageHelper.ConnectionStrings, "FW_AirExport_ViewConsol_SP", new List <IFields> { dal.CreateIFields().Append("Option", "AddMakeConsolByIDList").Append("air_LotNo", hidLotNo.Text) .Append("str", RowID).Append("User", FSecurityHelper.CurrentUserDataGET()[0].ToString()).Append("air_ToMAWB", hidSeed.Text).Append("air_MAWB", txtMAWB.Text.Trim().Replace(" ", "").ToUpper()) }).Update(); dal.FactoryDAL(PageHelper.ConnectionStrings, "FW_AirExport_ViewConsol_SP", HAWBLists).Update(); #endregion #region LocalInvoice //var InvocieList = JSON.Deserialize<List<Invocie>>(e.ExtraParams["p_safety_3"]); //string InvoiceID = ""; //for (int i = 0; i < InvocieList.Count; ++i) //{ // InvoiceID += "," + InvocieList[i].RowID; //} //if (InvoiceID.Length > 1) //{ // InvoiceID = InvoiceID.Substring(1, InvoiceID.Length - 1); //} //bool inv = dal.FactoryDAL(PageHelper.ConnectionStrings, "FW_AirExport_ViewConsol_SP", new List<IFields>() { dal.CreateIFields().Append("Option", "DeleteInvoice") //.Append("air_ToMAWB",hidSeed.Text) //.Append("str",InvoiceID)}).Update(); #endregion #region Costing //X.AddScript("saveCost('" + hidSeed.Text + "');"); ucCost.costseed = hidSeed.Text; ucCost.btnCostEvent(sender, e); #endregion //update cost(Qty,unit,total) //ControlBinder.UpdateCostData(hidSeed.Text, "AE", "MAWB"); if (newFlag == "N") { DataBindList(); X.AddScript("if(window.opener!=null){if(typeof(window.opener.RefreshList)!='undefined'){window.opener.RefreshList();}}"); ControlBinder.pageTitleMsg(false, showname + ":" + hidLotNo.Text, "<p class=\"success\">Status : Save successfully ! </p>", div_bottom); } else { X.AddScript("if(window.opener!=null){if(typeof(window.opener.RefreshList)!='undefined'){window.opener.RefreshList();}}"); ControlBinder.pageTitleMsg(false, showname + ":" + hidLotNo.Text, "<p class=\"success\">Status : Save successfully ! </p>", div_bottom); X.Redirect("List.aspx?type=" + typename + "&seed=" + ds.Tables[0].Rows[0][0]); } } catch { ControlBinder.pageTitleMsg(false, showname + ":" + hidLotNo.Text, "<p class=\"error\">Status : Save failed, please check the data !</p>", div_bottom); } }
protected void btnSave_Click(object sender, DirectEventArgs e) { if (string.IsNullOrEmpty(CmbReceipt.Value.Trim())) { div_bottom.Html = "<p class='error'> Save failed, From can't be empty!</p>"; CmbReceipt.Focus(); return; } if (string.IsNullOrEmpty(CmbFinalDest.Value.Trim())) { div_bottom.Html = "<p class='error'> Save failed, To can't be empty!</p>"; CmbFinalDest.Focus(); return; } if (string.IsNullOrEmpty(txtEst.RawText.Trim())) { div_bottom.Html = "<p class='error'> Save failed, Est Receipt can't be empty!</p>"; txtEst.Focus(true); return; } if (string.IsNullOrEmpty(CmbShipperCode.Value.Trim())) { div_bottom.Html = "<p class='error'> Save failed, Shipper can't be empty!</p>"; CmbShipperCode.Focus(); return; } if (string.IsNullOrEmpty(CmbConsignee.Value.Trim())) { div_bottom.Html = "<p class='error'> Save failed, Consignee can't be empty!</p>"; CmbConsignee.Focus(); return; } if (string.IsNullOrEmpty(CmbSalesman.Value.Trim())) { div_bottom.Html = "<p class='error'> Save failed, Salesman can't be empty!</p>"; CmbSalesman.Focus(); return; } if (string.IsNullOrEmpty(txtPiece.Text.Trim())) { div_bottom.Html = "<p class='error'> Save failed, Piece(s) can't be empty!</p>"; txtPiece.Focus(true); return; } List <IFields> UpdateHAWB = new List <IFields>(); UpdateHAWB.Add(dal.CreateIFields().Append("Option", "Update") .Append("air_Seed", hidSeed.Text == ""?null:hidSeed.Text) .Append("air_ToMAWB", hidMAWB.Text == ""?null:hidMAWB.Text) .Append("air_HAWB", txtHawb.Text.Trim().ToUpper()) .Append("air_CompanyReferance", txtReference.Text.Trim().ToUpper()) .Append("air_SpecicalDeal", chkSpecial.Checked ? "Y" : "N") .Append("air_LocReceived", CmbReceipt.Value) .Append("air_LocFinal", CmbFinalDest.Value) .Append("air_EReceipt", ControlBinder.getDate(txtEst.RawText.Trim().ToUpper().StartsWith("0001") ? DBNull.Value : (object)txtEst.RawText.Trim())) .Append("air_AReceipt", ControlBinder.getDate(txtAct.RawText.Trim().ToUpper().StartsWith("0001") ? DBNull.Value : (object)txtAct.RawText.Trim())) .Append("air_Sales", CmbSalesman.Value) //.Append("air_CSMode",txtCS.Text) .Append("air_NP", CmbNP.SelectedItem.Value) .Append("air_Shipper", CmbShipperCode.Value) //.Append("air_Shipper", CmbShipperName.SelectedItem.Value) .Append("air_Consignee", CmbConsignee.Value) //.Append("air_Consignee", CmbConsigneeName.SelectedItem.Value) .Append("air_PartyA", CmbNotify1.Value) //.Append("air_PartyA", CmbNotify1Name.SelectedItem.Value) .Append("air_PartyB", CmbNotify2.Value) //.Append("air_PartyB", CmbNotify2Name.SelectedItem.Value) .Append("air_GWT", string.IsNullOrEmpty(txtGWT.Text) ? DBNull.Value : (object)txtGWT.Text) .Append("air_VWT", string.IsNullOrEmpty(txtVWT.Text) ? DBNull.Value : (object)txtVWT.Text) .Append("air_CWT", string.IsNullOrEmpty(txtCWT.Text) ? DBNull.Value : (object)txtCWT.Text) .Append("air_Piece", string.IsNullOrEmpty(txtPiece.Text) ? DBNull.Value : (object)txtPiece.Text) .Append("air_Unit", CmbUnit.Value) .Append("air_Pallet", string.IsNullOrEmpty(txtPallet.Text) ? DBNull.Value : (object)txtPallet.Text) .Append("air_CBM", string.IsNullOrEmpty(txtCbf.Text) ? DBNull.Value : (object)txtCbf.Text) .Append("code", FSecurityHelper.CurrentUserDataGET()[4].ToString() + sys) .Append("code1", FSecurityHelper.CurrentUserDataGET()[4].ToString() + sys + "SN") .Append("air_STAT", FSecurityHelper.CurrentUserDataGET()[12].ToString()) .Append("air_SYS", sys) .Append("User", FSecurityHelper.CurrentUserDataGET()[0].ToString()) ); try { DataSet ds = GetDs("FW_AirExport_SubShipment_SP", UpdateHAWB); hidSeed.Text = ds.Tables[0].Rows[0][0].ToString(); string newFlag = ds.Tables[0].Rows[0][1].ToString(); #region HAWBList var HAWBList = JSON.Deserialize <List <HAWBList> >(e.ExtraParams["p_safety_2"]); List <IFields> HAWBLists = new List <IFields>(); string RowID = ""; for (int i = 0; i < HAWBList.Count; ++i) { HAWBLists.Add(dal.CreateIFields().Append("Option", "UpdateEmptyHAWB"). Append("air_ROWID", HAWBList[i].RowID) .Append("air_ToHAWB", hidSeed.Text)); RowID += "," + HAWBList[i].RowID.ToString(); } bool result = dal.FactoryDAL(PageHelper.ConnectionStrings, "FW_AirExport_SubShipment_SP", new List <IFields> { dal.CreateIFields().Append("Option", "AddSubShipmentByIDList") .Append("str", RowID).Append("User", FSecurityHelper.CurrentUserDataGET()[0].ToString()).Append("air_ToHAWB", hidSeed.Text) }).Update(); dal.FactoryDAL(PageHelper.ConnectionStrings, "FW_AirExport_SubShipment_SP", HAWBLists).Update(); #endregion #region Costing //X.AddScript("saveCost('" + hidSeed.Text + "');"); ucCost.costseed = hidSeed.Text; ucCost.btnCostEvent(sender, e); #endregion #region LocalInvoice //var InvocieList = JSON.Deserialize<List<Invocie>>(e.ExtraParams["p_safety_invoice"]); //string InvoiceID = ""; //for (int i = 0; i < InvocieList.Count; ++i) //{ // InvoiceID += "," + InvocieList[i].RowID; //} //if (InvoiceID.Length > 1) //{ // InvoiceID = InvoiceID.Substring(1, InvoiceID.Length - 1); //} //bool inv = dal.FactoryDAL(PageHelper.ConnectionStrings, "FW_AirExport_SubShipment_SP", new List<IFields>() { dal.CreateIFields().Append("Option", "DeleteInvoice") //.Append("air_ToHAWB",hidSeed.Text) //.Append("str",InvoiceID)}).Update(); #endregion //update cost(Qty,unit,total) //ControlBinder.UpdateCostData(hidSeed.Text, "AE", "HAWB"); if (newFlag == "N") { DataBindList(); X.AddScript("if(window.opener!=null){if(typeof(window.opener.RefreshList)!='undefined'){window.opener.RefreshList();}}"); ControlBinder.pageTitleMsg(false, "AE-H:" + hidLotNo.Text, "<p class=\"success\">Status : Save successfully ! </p>", div_bottom); } else { X.AddScript("if(window.opener!=null){if(typeof(window.opener.RefreshList)!='undefined'){window.opener.RefreshList();}}"); ControlBinder.pageTitleMsg(false, "AE-H:" + hidLotNo.Text, "<p class=\"success\">Status : Save successfully ! </p>", div_bottom); X.Redirect("List.aspx?seed=" + ds.Tables[0].Rows[0][0] + "&MAWB=" + hidMAWB.Value); } } catch { ControlBinder.pageTitleMsg(false, "AE-H:" + hidLotNo.Text, "<p class=\"error\">Status : Save failed, please check the data !</p>", div_bottom); } }