/// <summary> /// 保存采购对账单 /// </summary> /// <param name="ps"></param> /// <param name="psds"></param> /// <returns></returns> public int SavePurchaseStatement(PurchaseStatement ps, PurchaseStatementDetail[] psds) { PurchaseStatement purchaseStatement = new PurchaseStatement(); purchaseStatement.BranchId = ps.BranchId; purchaseStatement.Id = ps.Id; purchaseStatement.Memo = ps.Memo; purchaseStatement.PaidMoney = ps.PaidMoney; purchaseStatement.PayStatus = ps.PayStatus; purchaseStatement.SumMoney = ps.SumMoney; purchaseStatement.SupplierId = ps.SupplierId; purchaseStatement.UpdateTime = DateTime.Now; purchaseStatement.UserId = ps.UserId; int id = purchaseStatement.Save(); if (id > 0) { for (int i = 0; i < psds.Length; i++) { PurchaseStatementDetail psd = new PurchaseStatementDetail(); psd.Id = 0; psd.PurchaseId = psds[i].PurchaseId; psd.PurchaseStatementId = id; if (psd.Save() > 0) { Purchase p = new Purchase(); p.Id = psds[i].PurchaseId; p.Load(); p.IsPaid = 2; p.Save(); } } } return(id); }
public bool Delete() { this.Load(); PurchaseStatement ps = new PurchaseStatement(); ps.Id = this.PurchaseStatementId; string sql = string.Format(" delete from PurchasePay where Id={0} ", this.Id); if (m_dbo.ExecuteNonQuery(sql)) { ps.UpdateStatus(); return(true); } else { return(false); } }
public int Save() { ArrayList arrayList = new ArrayList(); if (m_Id > 0) { arrayList.Add(new SqlParameter("@Id", m_Id)); } arrayList.Add(new SqlParameter("@BranchId", m_BranchId)); arrayList.Add(new SqlParameter("@PurchaseStatementId", m_PurchaseStatementId)); arrayList.Add(new SqlParameter("@PayMoney", Math.Round(m_PayMoney, 2))); arrayList.Add(new SqlParameter("@PayStatus", m_PayStatus)); arrayList.Add(new SqlParameter("@BankAccountId", m_BankAccountId)); arrayList.Add(new SqlParameter("@PayType", m_PayType)); arrayList.Add(new SqlParameter("@Memo", m_Memo)); arrayList.Add(new SqlParameter("@UserId", m_UserId)); arrayList.Add(new SqlParameter("@PayDate", m_PayDate)); arrayList.Add(new SqlParameter("@UpdateTime", m_UpdateTime)); arrayList.Add(new SqlParameter("@ChargeOff", Math.Round(m_ChargeOff, 2))); if (this.Id > 0) { m_dbo.UpdateData("PurchasePay", (SqlParameter[])arrayList.ToArray(typeof(SqlParameter))); //新增 } else { this.Id = m_dbo.InsertData("PurchasePay", (SqlParameter[])arrayList.ToArray(typeof(SqlParameter))); //修改 } if (this.Id > 0) { PurchaseStatement ps = new PurchaseStatement(); ps.Id = this.PurchaseStatementId; ps.UpdateStatus(); } return(this.Id); }