protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string k = GetQueryValue("k"); foreach (Control ctrl in SimpleForm1.Controls) { if (ctrl.GetType().Name == "FormRow") { foreach (Control subctrl in ctrl.Controls) { //Alert.Show(subctrl.GetType().Name); if (subctrl.GetType().Name == "TextBox") { FineUIPro.TextBox tb = (FineUIPro.TextBox)subctrl; if (tb.ID != "txtQuantity" && tb.ID != "txtUsingQuantity") { tb.Readonly = true; } } else if (subctrl.GetType().Name == "NumberBox") { NumberBox numbox = (NumberBox)subctrl; if (numbox.ID != "txtQuantity") { numbox.Readonly = true; } } else if (subctrl.GetType().Name == "TextArea") { FineUIPro.TextArea tb = (FineUIPro.TextArea)subctrl; tb.Readonly = true; } } } } using (var appdb = new AppContext()) { int sn = GetQueryIntValue("id"); int fsn = GetQueryIntValue("fsn"); BomHeader item = appdb.bombase .Where(u => u.SN == fsn).FirstOrDefault(); txtOrderNo.Text = item.OrderNo; txtProNo.Text = item.ProNo; txtProName.Text = item.ProName; //txtClinetNo.Text = item.ClientNo; txtQuantity.Text = ""; BomDetail current = appdb.bomdtl .Where(u => u.SN == sn).FirstOrDefault(); if (current == null) { // 参数错误,首先弹出Alert对话框然后关闭弹出窗口 Alert.Show("参数错误!", String.Empty, ActiveWindow.GetHideReference()); return; } txtItemNo.Text = current.ItemNo; txtItemName.Text = current.ItemName; txtMaterial.Text = current.Material; txtSclass.Text = current.Sclass; txtSpec.Text = current.Spec; txtSurfaceDeal.Text = current.SurfaceDeal; txtUsingQuantity.Text = current.OrderUsingQuantity.ToString(); txtMakeThod.Text = current.MainFrom; //Instruction ins = appdb.instruction // .Where(u => u.OrderNo == item.OrderNo && u.ProNo == item.ProNo && u.ItemNo == current.ItemNo).FirstOrDefault() ; //var instructionsql = from a in appdb.instruction // where a.OrderNo == item.OrderNo && a.ProNo == item.ProNo && a.ItemNo == current.ItemNo // group a by new // { // a.ItemNo // } into g // select new // { // g.Key.ItemNo, // confirmquantity = (double)g.Sum(p => p.ConfirmQuantity) // }; //double? cfq= appdb.instruction.SqlQuery("select itemno,sum(ConfirmQuantity) from instruction where orderno='"+item.OrderNo+"' and prono='"+item.ProNo+"' and itemno='"+current.ItemNo+"' group by itemno",new object[]{}).FirstOrDefault().ConfirmQuantity; SQLHelper.DbHelperSQL.SetConnectionString(""); string sql = "select sum(ConfirmQuantity) from instruction where orderno='" + item.OrderNo + "' and prono='" + item.ProNo + "' and itemno='" + current.ItemNo + "'"; object sq = SQLHelper.DbHelperSQL.GetSingle(sql); if (sq != null) { txtUsingQuantity.Text = (current.OrderUsingQuantity - (double.Parse(sq.ToString()))).ToString(); } else { txtUsingQuantity.Text = current.OrderUsingQuantity.ToString(); } //if(instructionsql!=null) //{ // var ss = instructionsql.FirstOrDefault(); // if (ss != null) // { // txtUsingQuantity.Text = (current.UsingQuantity - ss.confirmquantity).ToString(); // } //} } LoadData(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string k = GetQueryValue("k"); log.Info("p:::::" + GetQueryValue("p")); if (k == "1") { btnSave.Hidden = true; btnSaveClose.Hidden = true; foreach (Control ctrl in SimpleForm1.Controls) { if (ctrl.GetType().Name == "FormRow") { foreach (Control subctrl in ctrl.Controls) { //Alert.Show(subctrl.GetType().Name); if (subctrl.GetType().Name == "TextBox") { FineUIPro.TextBox tb = (FineUIPro.TextBox)subctrl; tb.Readonly = true; } else if (subctrl.GetType().Name == "NumberBox") { NumberBox numbox = (NumberBox)subctrl; numbox.Readonly = true; } else if (subctrl.GetType().Name == "TextArea") { FineUIPro.TextArea tb = (FineUIPro.TextArea)subctrl; tb.Readonly = true; } } } } } else { } txtID.Text = GetQueryValue("id"); using (var appdb = new AppContext()) { int sn = int.Parse(txtID.Text); OrderDetail current = appdb.orderdetail .Where(u => u.SN == sn).FirstOrDefault(); if (current == null) { // 参数错误,首先弹出Alert对话框然后关闭弹出窗口 Alert.Show("参数错误!", String.Empty, ActiveWindow.GetHideReference()); return; } txtOrderNo.Text = current.OrderNo; txtItemNo.Text = current.ItemNo; txtItemName.Text = current.ItemName; txtClinetNo.Text = current.ClinetNo; txtQuantity.Text = current.Quantity.ToString(); txtColor.Text = current.Color; txtUnit.Text = current.Unit; rbtIsChange.SelectedValue = current.IsChange.Trim(); rbtIsNew.SelectedValue = current.IsNew.Trim(); rbtIspacking.SelectedValue = current.IsPackingmaterials.Trim(); txtConutryVer.Text = current.CountryPackVer; txtInputer.Text = current.Inputer; tbxDemand1.Text = current.Demand1; tbxDemand10.Text = current.Demand10; tbxDemand11.Text = current.Demand11; tbxDemand12.Text = current.Demand12; tbxDemand2.Text = current.Demand2; tbxDemand3.Text = current.Demand3; tbxDemand4.Text = current.Demand4; tbxDemand5.Text = current.Demand5; tbxDemand6.Text = current.Demand6; tbxDemand7.Text = current.Demand7; tbxDemand8.Text = current.Demand8; tbxDemand9.Text = current.Demand9; tbxRemark.Text = current.Remark; } LoadData(); } }