/// <summary> /// 控件绑定 /// </summary> #region ///ComboBox 控件绑定 Author:Micro (2011-09-27) void ControlsBinder() { hidSeed.Text = Request["seed"] == null ? "" : Request["seed"]; hidIDList.Text = Server.UrlDecode(Request["IDList"] == null ? "" : Request["IDList"]); //txtMBL.Focus(true); CmbGroup.Focus(true); DataSet dsGetItem = dal.FactoryDAL(PageHelper.ConnectionStrings, "FW_GetItem_SP", new List <IFields> { dal.CreateIFields() .Append("Option", "GetItem").Append("STAT", FSecurityHelper.CurrentUserDataGET()[12]).Append("SYS", "O") }).GetList(); StoreGetItem.DataSource = dsGetItem; StoreGetItem.DataBind(); ControlBinder.CmbBinder(StoreUnit, "UnitBinding", SYS[0].ToString()); ControlBinder.CmbBinder(StoreKind, "QtyKindBinding", SYS[0].ToString()); ControlBinder.CmbBinder(StoreSalesman, "SalesList", SYS[0].ToString()); ControlBinder.CmbBinder(StoreVessel, "VesselList"); ControlBinder.CmbBinder(StorePPCC, "PPCCList", SYS[0].ToString()); ControlBinder.CmbBinder(StoreAgentLocal, "PPCC", SYS[0].ToString()); ControlBinder.CmbBinder(StoreLocation, "LocationList", SYS[0].ToString()); ControlBinder.CmbBinder(StoreMode, "ServerMode", SYS[0].ToString()); ControlBinder.CmbBinder(StoreGroup, "GetSmGroup", SYS[0].ToString()); ControlBinder.CmbBinder(StoreCurrInvoice, "CurrencysInvoice", SYS[0].ToString()); cmbVesselText.Template.Html = TempVoyage.Html; cmbpreVoyage.Template.Html = TempVoyage.Html; }
/// <summary> /// 数据绑定 /// </summary> #region ///Grid 数据绑定 Author:Micro (2011-09-27) void DataBinder() { //tooltip.Html = ControlBinder.GetCostTotal(hidSeed.Text); DataSet ds = dal.FactoryDAL(PageHelper.ConnectionStrings, "FW_OceanExport_MBL_SP", new List <IFields>() { dal.CreateIFields() .Append("Option", "Single") .Append("o_Seed", hidSeed.Text == ""?null:hidSeed.Text) .Append("str", hidIDList.Text) .Append("o_STAT", FSecurityHelper.CurrentUserDataGET()[12]) .Append("o_LocPOL", FSecurityHelper.CurrentUserDataGET()[4]) }).GetList(); if (ds != null && hidSeed.Text.Length > 1) { DataBinder(ds.Tables[0]); if (ds.Tables[1].Rows.Count > 0) { storeHBL.DataSource = ds.Tables[1]; storeHBL.DataBind(); double GWT = 0.000, Pieces = 0, CBM = 0.000, wm = 0.000; for (int i = 0; i < ds.Tables[1].Rows.Count; i++) { GWT += Convert.ToDouble(ds.Tables[1].Rows[i]["o_WT"].ToString() == "" ? "0.000" : ds.Tables[1].Rows[i]["o_WT"].ToString()); Pieces += Convert.ToDouble(ds.Tables[1].Rows[i]["o_PKGS"].ToString() == "" ? "0" : ds.Tables[1].Rows[i]["o_PKGS"].ToString()); CBM += Convert.ToDouble(ds.Tables[1].Rows[i]["o_CBM"].ToString() == "" ? "0.000" : ds.Tables[1].Rows[i]["o_CBM"].ToString()); wm += Convert.ToDouble(ds.Tables[1].Rows[i]["o_WM"].ToString() == "" ? "0.000" : ds.Tables[1].Rows[i]["o_WM"].ToString()); } if (Pieces.ToString() != "0") { txtAPiece.Text = Pieces.ToString(); } if (GWT.ToString() != "0") { txtAGWT.Text = GWT.ToString(); } if (CBM.ToString() != "0") { txtACBM.Text = CBM.ToString(); } if (wm.ToString() != "0") { txtAWM.Text = wm.ToString(); } totalPiece.Text = txtAPiece.Text; totalGWT.Text = txtAGWT.Text; totalCBM.Text = txtACBM.Text; } StoreInvoice.DataSource = ds.Tables[2]; StoreInvoice.DataBind(); } else if (ds != null && hidSeed.Text == "") { if (ds.Tables[0].Rows.Count > 0) { CmbUnit.Value = ds.Tables[0].Rows[0]["Unit"].ToString(); cmbPPD.SelectedItem.Value = ds.Tables[0].Rows[0]["PPD"].ToString(); cmbLoading.Value = ds.Tables[0].Rows[0]["Loading"].ToString(); cmbShipperCode.setValue(ds.Tables[0].Rows[0]["Shipper"].ToString()); cmbShipperCode.Text = ds.Tables[0].Rows[0]["ShipperName"].ToString(); } if (ds.Tables[1].Rows.Count > 0) { storeHBL.DataSource = ds.Tables[1]; storeHBL.DataBind(); double GWT = 0.000, Pieces = 0, CBM = 0.000, wm = 0.000; for (int i = 0; i < ds.Tables[1].Rows.Count; i++) { GWT += Convert.ToDouble(ds.Tables[1].Rows[i]["o_WT"].ToString() == "" ? "0.000" : ds.Tables[1].Rows[i]["o_WT"].ToString()); Pieces += Convert.ToDouble(ds.Tables[1].Rows[i]["o_PKGS"].ToString() == "" ? "0" : ds.Tables[1].Rows[i]["o_PKGS"].ToString()); CBM += Convert.ToDouble(ds.Tables[1].Rows[i]["o_CBM"].ToString() == "" ? "0.000" : ds.Tables[1].Rows[i]["o_CBM"].ToString()); wm += Convert.ToDouble(ds.Tables[1].Rows[i]["o_WM"].ToString() == "" ? "0.000" : ds.Tables[1].Rows[i]["o_WM"].ToString()); } if (Pieces.ToString() != "0") { txtAPiece.Text = Pieces.ToString(); } if (GWT.ToString() != "0") { txtAGWT.Text = GWT.ToString(); } if (CBM.ToString() != "0") { txtACBM.Text = CBM.ToString(); } if (wm.ToString() != "0") { txtAWM.Text = wm.ToString(); } totalPiece.Text = txtAPiece.Text; totalGWT.Text = txtAGWT.Text; totalCBM.Text = txtACBM.Text; } ControlBinder.pageTitleMsg(false, "OE-M New", "<p>Status : New Blank MBL. </p>", div_bottom); } else { ControlBinder.pageTitleMsg(false, "OE-M New", "<p>Status : New Blank MBL. </p>", div_bottom); } //txtMBL.Focus(true); CmbGroup.Focus(true); }
protected void btnSave_Click(object sender, EventArgs e) { string strStat = ""; for (int i = 0; i < tblChkGroup.Items.Count(); ++i) { if (!tblChkGroup.Items[i].Checked) { strStat += tblChkGroup.Items[i].Tag.Trim() + ","; } } strStat = strStat.Length > 0 ? strStat.Substring(0, strStat.Length - 1) : strStat; if (txtCode.Text.Trim() == "") { //X.Msg.Alert("Information", "Code can't be empty!").Show(); div_bottom.Html = "<p class=\"error\">Status : Saved failed , code can't be empty ! </p>"; txtCode.Focus(); } if (txtisocode.Text.Trim() == "") { //X.Msg.Alert("Information", "Code can't be empty!").Show(); div_bottom.Html = "<p class=\"error\">Status : Saved failed , EDI Code can't be empty ! </p>"; txtisocode.Focus(); } else if (CmbGroup.SelectedItem.Value == null) { //X.Msg.Alert("Information", "Group can't be empty!").Show(); div_bottom.Html = "<p class=\"error\">Status : Saved failed , group can't be empty ! </p>"; CmbGroup.Focus(); } else if (BaseCheckCode.Check("CONTAINER SIZE", txtCode.Text.ToUpper().Trim(), sys, txtRowID.Text) == "N") { txtCode.Focus(true); div_bottom.Html = "<p class=\"error\">Status : Saved failed , the code already exists ! </p>"; //X.Msg.Alert("Information", "The code already exists!").Show(); return; } else { string a = FSecurityHelper.CurrentUserDataGET()[12].ToString(); DataFactory dal = new DataFactory(); bool b = dal.FactoryDAL(PageHelper.ConnectionStrings, "FW_BasicData_ContainerSize_SP", new List <IFields>() { dal.CreateIFields().Append("Option", "Update") .Append("ctnr_Code", txtCode.Text.Trim().ToUpper()) .Append("ctnr_EDI", txtisocode.Text.Trim().ToUpper()) .Append("ctnr_Description", txtDes.Text.Trim().ToUpper()) .Append("ctnr_ContainerType", CmbCalc.SelectedItem.Value) .Append("ctnr_Group", CmbGroup.SelectedItem.Value) .Append("ctnr_Length", string.IsNullOrEmpty(txtLong.Text.Trim().ToUpper()) ? DBNull.Value : (object)txtLong.Text.Trim().ToUpper()) .Append("ctnr_Active", ChbActive.Checked?"1":"0") .Append("ctnr_STAT", FSecurityHelper.CurrentUserDataGET()[12]) .Append("ctnr_User", FSecurityHelper.CurrentUserDataGET()[0]) .Append("ctnr_ROWID", txtRowID.Text) .Append("statstr", strStat) .Append("dept", FSecurityHelper.CurrentUserDataGET()[28].ToUpper()) }).Update(); if (b) { //X.Msg.Alert("status", " Saved successfully").Show(); if (!string.IsNullOrEmpty(Request["control"])) { X.AddScript("window.parent.ChildCallBack(Request(\"control\"), $(\"#txtCode\").val());"); return; } if (i == 1) { InitCotrol(); txtCode.Disabled = false; CheckGroupChecked(); } else { txtCode.Disabled = true; txtRowID.Text = dal.FactoryDAL(PageHelper.ConnectionStrings, "FW_BasicData_ContainerSize_SP", new List <IFields>() { dal.CreateIFields() .Append("Option", "List") .Append("ctnr_STAT", FSecurityHelper.CurrentUserDataGET()[12]) .Append("dept", FSecurityHelper.CurrentUserDataGET()[28].ToUpper()) .Append("ctnr_Code", txtCode.Text) .Append("isGetId", 1) }).GetTable().Rows[0][0].ToString(); } //X.Msg.Alert("Status", " saved successful ! ").Show(); div_bottom.Html = "<p class='success'>Status: Saved successful . </p>"; } else { div_bottom.Html = "<p class='error'>Status: Saved failed , please check the data ! </p>"; //X.Msg.Alert("status", " Save failed ").Show(); } DataBinder(); txtCode.Focus(); } }