//添加采购退货 protected void init() { string str0 = Request.QueryString["BuyReturnID"].ToString(); string str1 = Request.QueryString["BuyReturnDate"].ToString(); string str2 = Request.QueryString["StoreHouseID"].ToString(); string str3 = Request.QueryString["HouseDetailID"].ToString(); string str4 = Request.QueryString["ReceiptOrderID"].ToString(); string str5 = Request.QueryString["Identitys"].ToString(); string str6 = Request.QueryString["TradeDate"].ToString(); string str7 = Request.QueryString["Description"].ToString(); BuyReturn b = new BuyReturn(); b.BuyReturnID = str0; b.Description = str7; b.HouseDetailID = int.Parse(str3); b.Identitys = int.Parse(str5); b.BuyReturnDate = str1; b.ReceiptOrderID = str4; b.StoreHouseID = int.Parse(str2); b.TradeDate = str6; b.UserName = "******";///////////////////////////////////////////////////////////????????????????? if (Leyp.SQLServerDAL.Buy.Factory.getBuyReturnDAL().insertNewEntity(b)) { Response.Write("0"); Response.End(); } else { Response.Write("1"); Response.End(); } }
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); }