public bool insertNewEitity(OutStockDetail s) { int rowsAffected = 0; SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@OutID", SqlDbType.NVarChar), new SqlParameter("@ProductsID", SqlDbType.Int), new SqlParameter("@Quantity", SqlDbType.Int), new SqlParameter("@Price", SqlDbType.Money), new SqlParameter("@Description", SqlDbType.NVarChar) }; parameters[0].Value = s.OutID; parameters[1].Value = s.ProductsID; parameters[2].Value = s.Quantity; parameters[3].Value = s.Price; parameters[4].Value = s.Description; SQLHelper.RunProcedure("p_OutStockDetail_insertNewEntity", parameters, out rowsAffected); return(0 < rowsAffected); }
protected void init() { string action = Request.Form["action"].ToString(); if (action.Equals("load")) { string str0 = Request.Form["OutID"].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["OutID"].ToString(); string str1 = Request.Form["ProductsID"].ToString(); string str3 = Request.Form["Quantity"].ToString(); string str6 = Request.Form["Descriptions"].ToString(); string str7 = Request.Form["Price"].ToString(); OutStockDetail b = new OutStockDetail(); b.OutID = str0; b.ProductsID = int.Parse(str1); b.Quantity = int.Parse(str3); b.Description = str6; b.Price = float.Parse(str7); if (Leyp.SQLServerDAL.Stock.Factory.getOutStockDetailDAL().insertNewEitity(b)) { Response.Write("添加成功"); Response.End(); } else { Response.Write("添加失败"); Response.End(); } #endregion } }
public bool AuditingOutStockOrder(string OutStockID) { bool flag = false; try { VOutStock stock = new VOutStock(); List <VOutStockDetail> list = new List <VOutStockDetail>(); ProductsStockDAL kdal = new ProductsStockDAL(); stock = new OutStockDAL().getByID(OutStockID); list = new OutStockDetailDAL().getListByOutID(OutStockID); for (int i = 0; i < list.Count; i++) { ProductsStock stock2; OutStockDetail 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.updateCutNum(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); }