public bool AddBookmark(Bookmark bookmark) { try { myDB.Bookmarks.Add(bookmark); myDB.SaveChanges(); return(true); } catch (Exception) { return(false); } }
public bool AddMessage(Conversation_Reply conversationReply) { try { var result = myDB.Conversation_Reply.Add(conversationReply); myDB.SaveChanges(); return(true); } catch (Exception) { return(false); } }
public bool AddNotification(Notification notification) { try { myDB.Notifications.Add(notification); myDB.SaveChanges(); return(true); } catch (Exception) { return(false); } }
protected void btnSend_Click(object sender, EventArgs e) { List <Dictionary <string, object> > newAddedList = Grid1.GetNewAddedList(); if (newAddedList.Count == 0) { ShowNotify("没有要提交的数据"); return; } String status = GetQueryValue("status"); for (int i = 0; i < newAddedList.Count; i++) { string barcode = newAddedList[i]["barcode"].ToString(); MYDB.purchaseorderDetail.Where(u => u.BarCode == barcode).Update(u => new PurchaseOrderDetail { Status = int.Parse(status) }); } MYDB.SaveChanges(); ShowNotify("提交成功"); //清除页面数据 PageContext.RegisterStartupScript("clearLocalStorage()"); }
protected void btnSend_Click(object sender, EventArgs e) { List <Dictionary <string, object> > newAddedList = Grid1.GetNewAddedList(); if (newAddedList.Count == 0) { ShowNotify("没有要提交的数据"); return; } String status = GetQueryValue("status"); for (int i = 0; i < newAddedList.Count; i++) { result r = result.合格; string res = newAddedList[i]["result"].ToString(); switch (res) { case "合格": r = result.合格; break; case "不合格": r = result.合格; break; case "特采": r = result.特采; break; } decimal choujianqut = decimal.Parse(newAddedList[i]["choujianqut"].ToString()); string barcode = newAddedList[i]["barcode"].ToString(); MYDB.purchaseorderDetail.Where(u => u.BarCode == barcode).Update(u => new PurchaseOrderDetail { Status = int.Parse(status), result = r, ChoujianQut = choujianqut, CheckDate = DateTime.Now }); } MYDB.SaveChanges(); ShowNotify("提交成功"); //清除页面数据 PageContext.RegisterStartupScript("clearLocalStorage()"); }
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(); }
protected void btnSend_Click(object sender, EventArgs e) { string mark = GetQueryValue("mark"); List <Dictionary <string, object> > newAddedList = Grid1.GetNewAddedList(); if (newAddedList.Count == 0) { ShowNotify("没有要提交的数据"); return; } StockHeader stockHeader = new StockHeader(); if (mark == "02") { stockHeader.title = "委外进货单"; } else if (mark == "03") { stockHeader.title = "委外出货单"; } stockHeader.optdate = DateTime.Now; //执行存储过程获取流水号 SQLHelper.DbHelperSQL.SetConnectionString(""); object[] obj = new object[] { "WW" }; DataTable dt = SQLHelper.DbHelperSQL.ExecuteProc_ReturnDataTable("GetSeq", obj, 10); string prosn = dt.Rows[0][0].ToString(); string StockHeaderProsn = "WW" + prosn; ShowNotify(StockHeaderProsn); stockHeader.StockHeaderProsn = StockHeaderProsn; stockHeader.jingbanren = GetChineseName(); MYDB.StockHeaders.Add(stockHeader); for (int i = 0; i < newAddedList.Count; i++) { SendOutStockList item = new SendOutStockList(); item.Barcode = newAddedList[i]["barcode"].ToString(); //订单号 item.StockOrderNo = newAddedList[i]["saleno"].ToString(); item.SendOutOrderNo = newAddedList[i]["orderno"].ToString(); item.ItemNo = newAddedList[i]["itemno"].ToString(); item.ProNo = newAddedList[i]["prono"].ToString(); item.ItemName = newAddedList[i]["itemname"].ToString(); item.Spec = newAddedList[i]["spec"].ToString(); item.Quantity = decimal.Parse(newAddedList[i]["qut"].ToString()); item.Space = newAddedList[i]["space"].ToString(); item.Remark = newAddedList[i]["remark"].ToString(); if (mark == "02") { item.SendOutProperties = SendOutProperties.委外入库; } else { item.SendOutProperties = SendOutProperties.委外出库; } item.Mark = mark; item.Unit = newAddedList[i]["unit"].ToString(); item.PDate = DateTime.Now; item.StockHeaderProsn = StockHeaderProsn; MYDB.SendOutStockLists.Add(item); } MYDB.SaveChanges(); ShowNotify("提交成功"); //清除页面数据 PageContext.RegisterStartupScript("clearLocalStorage()"); }
protected void btnSend_Click(object sender, EventArgs e) { List <Dictionary <string, object> > newAddedList = Grid1.GetNewAddedList(); if (newAddedList.Count == 0) { ShowNotify("没有要提交的数据"); return; } String status = GetQueryValue("status"); for (int i = 0; i < newAddedList.Count; i++) { string barcode = newAddedList[i]["barcode"].ToString(); MYDB.purchaseorderDetail.Where(u => u.BarCode == barcode).Update(u => new PurchaseOrderDetail { Status = int.Parse(status) }); } StockHeader stockHeader = new StockHeader(); stockHeader.title = "采购进货单"; stockHeader.optdate = DateTime.Now; //执行存储过程获取流水号 SQLHelper.DbHelperSQL.SetConnectionString(""); object[] obj = new object[] { "JH" }; DataTable dt = SQLHelper.DbHelperSQL.ExecuteProc_ReturnDataTable("GetSeq", obj, 10); string prosn = dt.Rows[0][0].ToString(); string StockHeaderProsn = "JH" + prosn; ShowNotify(StockHeaderProsn); stockHeader.StockHeaderProsn = StockHeaderProsn; stockHeader.jingbanren = GetChineseName(); MYDB.StockHeaders.Add(stockHeader); for (int i = 0; i < newAddedList.Count; i++) { PurchaseStockList item = new PurchaseStockList(); string barcode = newAddedList[i]["barcode"].ToString(); var purdetail = MYDB.purchaseorderDetail.Where(u => u.BarCode == barcode).FirstOrDefault(); item.Barcode = newAddedList[i]["barcode"].ToString(); //订单号 item.StockOrderNo = newAddedList[i]["saleno"].ToString(); item.PurOrderNo = newAddedList[i]["orderno"].ToString(); item.ItemNo = newAddedList[i]["itemno"].ToString(); item.ProNo = newAddedList[i]["prono"].ToString(); item.ItemName = newAddedList[i]["itemname"].ToString(); item.Spec = newAddedList[i]["spec"].ToString(); item.result = purdetail.result; item.ChoujianQut = purdetail.ChoujianQut; item.checkDate = purdetail.CheckDate; item.Quantity = decimal.Parse(newAddedList[i]["qut"].ToString()); item.Space = newAddedList[i]["space"].ToString(); item.Remark = newAddedList[i]["remark"].ToString(); item.PurchaseProperties = PurchaseProperties.采购入库; item.Mark = "02"; item.Unit = newAddedList[i]["unit"].ToString(); item.PDate = DateTime.Now; item.StockHeaderProsn = StockHeaderProsn; MYDB.PurchaseStockLists.Add(item); } MYDB.SaveChanges(); ShowNotify("提交成功"); //清除页面数据 PageContext.RegisterStartupScript("clearLocalStorage()"); }