public bool insertNewEitity(BuyReturnDetail b) { int rowsAffected = 0; SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@BuyReturnID", 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 = b.BuyReturnID; parameters[1].Value = b.ProductsID; parameters[2].Value = b.SupplierID; parameters[3].Value = b.Quantity; parameters[4].Value = b.Price; parameters[5].Value = b.Description; SQLHelper.RunProcedure("p_BuyReturnDetail_insertNewEntity", parameters, out rowsAffected); return(1 == rowsAffected); }
public bool AuditingBuyReturnOrder(string BuyReturnID) { bool flag = false; try { List <VBuyReturnDetail> list = new List <VBuyReturnDetail>(); ProductsStockDAL kdal = new ProductsStockDAL(); BuyReturn return2 = new BuyReturnDAL().getByID(BuyReturnID); if (return2 == null) { return(false); } list = new BuyReturnDetailDAL().getBuyReturnDetailByBuyReturnID(BuyReturnID); for (int i = 0; i < list.Count; i++) { ProductsStock stock; BuyReturnDetail detail = list[i]; if (kdal.isHaveEitity(return2.HouseDetailID, detail.ProductsID)) { stock = new ProductsStock(); stock.HouseDetailID = return2.HouseDetailID; stock.ProductsID = detail.ProductsID; stock.Num = detail.Quantity; kdal.updateCutNum(stock); } else { stock = new ProductsStock(); stock.HouseDetailID = return2.HouseDetailID; stock.ProductsID = detail.ProductsID; stock.Num = -detail.Quantity; kdal.insertNewEitity(stock); } } flag = true; } catch { } return(flag); }
public bool insertNewEntity(BuyReturn b) { int rowsAffected = 0; float num2 = float.Parse("0.00"); if (b.Identitys == 0) { BuyReturnDetailDAL ldal = new BuyReturnDetailDAL(); List <VBuyReceiptDetail> list = new List <VBuyReceiptDetail>(); list = new BuyReceiptDetailDAL().getBuyReceiptDetailByReceiptOrderID(b.ReceiptOrderID); for (int i = 0; i < list.Count; i++) { BuyReturnDetail detail = new BuyReturnDetail(); VBuyReceiptDetail detail2 = list[i]; detail.Description = detail2.Description; detail.Price = detail2.Price; detail.ProductsID = detail2.ProductsID; detail.Quantity = detail2.Quantity; detail.SupplierID = detail2.SupplierID; detail.BuyReturnID = b.BuyReturnID; ldal.insertNewEitity(detail); num2 += detail.Quantity * detail.Price; } } SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@BuyReturnID", SqlDbType.NVarChar), new SqlParameter("@BuyReturnDate", SqlDbType.NVarChar), new SqlParameter("@StoreHouseID", SqlDbType.Int), new SqlParameter("@HouseDetailID", SqlDbType.Int), new SqlParameter("@ReceiptOrderID", SqlDbType.NVarChar), new SqlParameter("@UserName", SqlDbType.NVarChar), new SqlParameter("@TotalPrice", SqlDbType.Money), new SqlParameter("@TradeDate", SqlDbType.NVarChar), new SqlParameter("@Identitys", SqlDbType.Int), new SqlParameter("@AlreadyPay", SqlDbType.Money), new SqlParameter("@Description", SqlDbType.NVarChar), new SqlParameter("@State", SqlDbType.Int) }; parameters[0].Value = b.BuyReturnID; parameters[1].Value = b.BuyReturnDate; parameters[2].Value = b.StoreHouseID; parameters[3].Value = b.HouseDetailID; parameters[4].Value = b.ReceiptOrderID; parameters[5].Value = b.UserName; parameters[6].Value = num2; parameters[7].Value = b.TradeDate; parameters[8].Value = b.Identitys; parameters[9].Value = b.AlreadyPay; parameters[10].Value = b.Description; parameters[11].Value = b.State; SQLHelper.RunProcedure("p_BuyReturn_insertNewEntity", parameters, out rowsAffected); return(1 == rowsAffected); }
protected void init() { string action = Request.Form["action"].ToString(); if (action.Equals("load")) { string str0 = Request.Form["BuyReturnID"].ToString(); loadinit(str0); } else if (action.Equals("getNode")) { string str1 = Request.Form["DetailID"].ToString(); getNode(int.Parse(str1)); } 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["BuyReturnID"].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(); BuyReturnDetail b = new BuyReturnDetail(); b.BuyReturnID = 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.Buy.Factory.getBuyReturnDetailDAL().insertNewEitity(b)) { Response.Write("添加成功"); Response.End(); } else { Response.Write("添加失败"); Response.End(); } #endregion } else if (action.Equals("edit")) { #region string str = Request.Form["DetailID"].ToString(); string str0 = Request.Form["BuyReturnID"].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(); BuyReturnDetail b = new BuyReturnDetail(); b.DetailID = int.Parse(str); b.BuyReturnID = 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.Buy.Factory.getBuyReturnDetailDAL().updateEitity(b)) { Response.Write("修改成功"); Response.End(); } else { Response.Write("修改失败"); Response.End(); } #endregion } }