public bool insertNewEitity(AppendStockDetail s) { int rowsAffected = 0; SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@AppendID", SqlDbType.NVarChar), new SqlParameter("@ProductsID", SqlDbType.Int), new SqlParameter("@SupplierID", SqlDbType.Int), new SqlParameter("@Quantity", SqlDbType.Int), new SqlParameter("@Price", SqlDbType.Money), new SqlParameter("@Description", SqlDbType.NVarChar) }; parameters[0].Value = s.AppendID; parameters[1].Value = s.ProductsID; parameters[2].Value = s.SupplierID; parameters[3].Value = s.Quantity; parameters[4].Value = s.Price; parameters[5].Value = s.Description; SQLHelper.RunProcedure("p_AppendStockDetail_insertNewEntity", parameters, out rowsAffected); return(1 == rowsAffected); }
protected void init() { string action = Request.Form["action"].ToString(); if (action.Equals("load")) { string str0 = Request.Form["AppendID"].ToString(); loadinit(str0); } else if (action.Equals("del")) { string str1 = Request.Form["DetailID"].ToString(); deleteNode(int.Parse(str1)); } else if (action.Equals("add")) { #region add string str0 = Request.Form["AppendID"].ToString(); string str1 = Request.Form["ProductsID"].ToString(); string str2 = Request.Form["SupplierID"].ToString(); string str3 = Request.Form["Quantity"].ToString(); string str6 = Request.Form["Descriptions"].ToString(); string str7 = Request.Form["Price"].ToString(); AppendStockDetail b = new AppendStockDetail(); b.AppendID = str0; b.ProductsID = int.Parse(str1); b.SupplierID = int.Parse(str2); b.Quantity = int.Parse(str3); b.Description = str6; b.Price = float.Parse(str7); if (Leyp.SQLServerDAL.Stock.Factory.getAppendStockDetailDAL().insertNewEitity(b)) { Response.Write("添加成功"); Response.End(); } else { Response.Write("添加失败"); Response.End(); } #endregion } }
public bool AuditingAppendStockOrder(string AppendID) { bool flag = false; try { VAppendStock stock = new VAppendStock(); List <VAppendStockDetail> list = new List <VAppendStockDetail>(); ProductsStockDAL kdal = new ProductsStockDAL(); stock = new AppendStockDAL().getByID(AppendID); list = new AppendStockDetailDAL().getListByAppendID(AppendID); for (int i = 0; i < list.Count; i++) { ProductsStock stock2; AppendStockDetail detail = list[i]; if (kdal.isHaveEitity(stock.HouseDetailID, detail.ProductsID)) { stock2 = new ProductsStock(); stock2.HouseDetailID = stock.HouseDetailID; stock2.ProductsID = detail.ProductsID; stock2.Num = detail.Quantity; kdal.updateAddNum(stock2); } else { stock2 = new ProductsStock(); stock2.HouseDetailID = stock.HouseDetailID; stock2.ProductsID = detail.ProductsID; stock2.Num = detail.Quantity; kdal.insertNewEitity(stock2); } } flag = true; } catch { } return(flag); }