public BomHeader UpdateBomHeader(BomHeader bom) { return(ExecuteOnDatabase(delegate(LiteDatabase database) { database.GetCollection <BomHeader>().Update(bom); return bom; })); }
public BomHeader CreateBomWithChildren(BomHeader bom) { return(ExecuteOnDatabase(delegate(LiteDatabase database) { database.GetCollection <BomHeader>().Insert(bom); foreach (var bomRow in bom.BomRows) { CreateBomRow(bomRow); } return bom; })); }
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(); } }