/// <summary> /// 删除 /// </summary> /// <param name="userModel"></param> /// <param name="model"></param> /// <param name="msg"></param> /// <returns></returns> public virtual bool DeleteBuyPay(UserModel userModel, BuyPay model, out string msg) { var m = Da.Get <BuyPay>(model.BuyPayId); if (m == null || m.BuyOrderId != model.BuyOrderId) { msg = "记录不存在"; return(false); } var order = Da.Get <BuyOrder>(m.BuyOrderId); var b1 = CheckAuthOrder(userModel, order, out msg); if (!b1) { return(false); } var b2 = CheckAuthFinanceOrder(userModel, order, out msg); if (!b2) { return(false); } msg = null; return(Da.Delete(m)); }
/// <summary> /// 更新 /// </summary> /// <param name="userModel"></param> /// <param name="model"></param> /// <param name="msg"></param> /// <returns></returns> public virtual bool UpdateBuyPay(UserModel userModel, BuyPay model, out string msg) { var m = Da.Get <BuyPay>(model.BuyPayId); if (m == null) { msg = "收款记录已不存在"; return(false); } var order = Da.Get <BuyOrder>(m.BuyOrderId); var b1 = CheckAuthOrder(userModel, order, out msg); if (!b1) { return(false); } var b2 = CheckAuthFinanceOrder(userModel, order, out msg); if (!b2) { return(false); } var account = Da.Get <Account>(model.AccountId); var b3 = CheckAuthAccount(userModel, account, out msg); if (!b3) { return(false); } var currency = Da.Get <Currency>(model.CurrencyId); var b4 = CheckAuthCurrency(userModel, currency, out msg); if (!b4) { return(false); } m.AccountInfo = $"{account.AccountBank}({account.AccountNumber})"; m.Amount = model.Amount; m.CurrencySymbol = currency.CurrencySymbol; m.CurrencyRate = currency.CurrencyRate; m.Amount = model.Amount; m.TransactionNumber = model.TransactionNumber; m.Remark = model.Remark; m.CreateName = userModel.UserNickName; m.CreateDate = DateTime.Now; m.CurrencyId = model.CurrencyId; m.AccountId = model.AccountId; return(Da.Update(m)); }
/// <summary> /// 添加 /// </summary> /// <param name="userModel"></param> /// <param name="model"></param> /// <param name="msg"></param> /// <returns></returns> public virtual bool AddBuyPay(UserModel userModel, BuyPay model, out string msg) { var order = Da.Get <BuyOrder>(model.BuyOrderId); var b1 = CheckAuthOrder(userModel, order, out msg); if (!b1) { return(false); } var b2 = CheckAuthFinanceOrder(userModel, order, out msg); if (!b2) { return(false); } var account = Da.Get <Account>(model.AccountId); var b3 = CheckAuthAccount(userModel, account, out msg); if (!b3) { return(false); } var currency = Da.Get <Currency>(model.CurrencyId); var b4 = CheckAuthCurrency(userModel, currency, out msg); if (!b4) { return(false); } var m = new BuyPay() { BuyPayId = SeqGuid.NewGuid(), BuyOrderId = model.BuyOrderId, AccountInfo = $"{account.AccountBank}({account.AccountNumber})", Amount = model.Amount, CurrencySymbol = currency.CurrencySymbol, CurrencyRate = currency.CurrencyRate, TransactionNumber = model.TransactionNumber, Remark = model.Remark, CreateName = userModel.UserNickName, CreateDate = DateTime.Now, AccountId = account.AccountId, CurrencyId = currency.CurrencyId, }; Da.Add <Guid, BuyPay>(m); return(true); }
public void init() { object action = Request.QueryString["action"].ToString(); if (action == null) { } else if (action.ToString().Equals("BuyPayLoad"))///在添加采购付款是使用 { string str0 = Request.QueryString["BuyReceiptID"].ToString(); float Total = float.Parse("0.00"); List <VBuyPay> list = new List <VBuyPay>(); BuyReceipt vb = new BuyReceipt(); vb = Leyp.SQLServerDAL.Buy.Factory.getBuyReceiptDAL().getByID(str0); list = Leyp.SQLServerDAL.Buy.Factory.getBuyPayDAL().getByBuyReceiptID(str0); for (int i = 0; i < list.Count; i++) { VBuyPay b = list[i]; Total = Total + b.RealPay; } Response.Write(vb.TotalPrice + "$$$" + Total.ToString()); Response.End(); } else if (action.ToString().Equals("BuyPayLoadAdd"))//添加一个采购单 { string str0 = Request.QueryString["BuyReceiptID"].ToString(); string str1 = Request.QueryString["Ticket"].ToString(); string str2 = Request.QueryString["CreateDate"].ToString(); string str3 = Request.QueryString["PayType"].ToString(); string str4 = Request.QueryString["RealPay"].ToString(); string str5 = Request.QueryString["AttachPay"].ToString(); string str6 = Request.QueryString["Description"].ToString(); BuyPay b = new BuyPay(); b.BuyReceiptID = str0; b.Ticket = str1; b.CreateDate = str2; b.PayType = str3; b.RealPay = float.Parse(str4); b.AttachPay = float.Parse(str5); b.Description = str6; b.UserName = "******"; Leyp.SQLServerDAL.Buy.Factory.getBuyPayDAL().insertNewEntity(b); Response.Write("添加成功"); Response.End(); } }
public bool insertNewEntity(BuyPay b) { int rowsAffected = 0; SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@BuyReceiptID", SqlDbType.NVarChar), new SqlParameter("@Ticket", SqlDbType.NVarChar), new SqlParameter("@CreateDate", SqlDbType.NVarChar), new SqlParameter("@UserName", SqlDbType.NVarChar), new SqlParameter("@PayType", SqlDbType.NVarChar), new SqlParameter("@RealPay", SqlDbType.Money), new SqlParameter("@AttachPay", SqlDbType.Money), new SqlParameter("@Description", SqlDbType.NVarChar), new SqlParameter("@State", SqlDbType.Int) }; parameters[0].Value = b.BuyReceiptID; parameters[1].Value = b.Ticket; parameters[2].Value = b.CreateDate; parameters[3].Value = b.UserName; parameters[4].Value = b.PayType; parameters[5].Value = b.RealPay; parameters[6].Value = b.AttachPay; parameters[7].Value = b.Description; parameters[8].Value = b.State; SQLHelper.RunProcedure("p_BuyPay_insertNewEntity", parameters, out rowsAffected); return(1 == rowsAffected); }
public IResponseResult DeleteBuyPay(BuyPay model) { var result = Biz.DeleteBuyPay(UserModel, model, out var msg); return(ReturnResult(result, msg)); }