private void UpdateDataRow(Dictionary <string, object> dictionary, ProduceOrderRec produceOrderRec) { //抽检数 if (dictionary.ContainsKey("choujianqut")) { produceOrderRec.choujianqut = decimal.Parse(dictionary["choujianqut"].ToString()); } if (dictionary.ContainsKey("result")) { //抽检结果 produceOrderRec.result = (result)int.Parse(dictionary["result"].ToString()); } produceOrderRec.State = true; }
protected void btnSend_Click(object sender, EventArgs e) { //首先查看该生产单的该物料是否已经品检完了 int ProduceOrderDetailSn = int.Parse(tbxSN.Text); //在扫描记录里面查询 ProduceOrderRec var q = MYDB.produceOrderRec.Where(u => u.ProduceOrderDetailSn == ProduceOrderDetailSn); //存在有审核状态未通过的,都不能够提交 或者 存在还未进行审核的 if (q.Any(u => u.State == false) || q.Any(u => u.State == null)) { ShowNotify("存在未通过品检的工序,不能提交!"); return; } //提交的数量 int subcount = int.Parse(nbQut.Text); //提交成功 using (var db = new AppContext()) { ProduceOrderRec item = new ProduceOrderRec(); item.ProduceOrderDetailSn = ProduceOrderDetailSn; item.optdate = DateTime.Now; item.Quantity = subcount; item.Role = (role)GetQueryIntValue("role"); item.State = null; db.produceOrderRec.Add(item); db.SaveChanges(); ShowNotify("提交成功"); tbxitemno.Text = ""; tbxitemname.Text = ""; tbxspec.Text = ""; nbPurQut.Text = ""; nbQut.Text = ""; } }
protected void btnpass_Click(object sender, EventArgs e) { Dictionary <int, Dictionary <string, object> > modifiedDict = Grid2.GetModifiedDict(); if (modifiedDict.Count == 0) { ShowNotify("没有任何数据修改!"); return; } foreach (int rowIndex in modifiedDict.Keys) { int SN = Convert.ToInt32(Grid2.DataKeys[rowIndex][0]); ProduceOrderRec produceOrderRec = MYDB.produceOrderRec.Where(u => u.SN == SN).FirstOrDefault(); UpdateDataRow(modifiedDict[rowIndex], produceOrderRec); } MYDB.SaveChanges(); BindGrid2(); }