public RO_Backup(Model.AtCashAccount model) : this() { this.lblCompanyName.Text = BL.Settings.CompanyChineseName; this.lblReportDate.Text += DateTime.Now.ToString("yyyy-MM-dd"); //this.lblMonth.Text = model.AtCashAccountMonth.Value.ToString("yyyy-MM-dd"); if (model.Detail.Count > 0) { //this.lblStartBalance.Text = model.Detail[0].Subject.TheBalance == null ? "" : model.Detail[0].Subject.TheBalance.Value.ToString("F2"); this.lblIncome.Text = model.IncomeTotal == null ? "" : model.IncomeTotal.Value.ToString("F2"); } this.lblPay.Text = model.PayTotal == null ? "" : model.PayTotal.Value.ToString("F2"); this.lblBalance.Text = model.BalanceTotal == null ? "" : model.BalanceTotal.Value.ToString("F2"); this.DataSource = model.Detail; //this.TCTime.DataBindings.Add("Text", this.DataSource, Model.AtCashAccountDetail.PRO_AtCashAccountDetaiDate, "{0:yyyy-MM-dd}"); //this.TCId.DataBindings.Add("Text", this.DataSource, "Subject." + Model.AtAccountSubject.PRO_Id); //this.TCName.DataBindings.Add("Text", this.DataSource, "Subject." + Model.AtAccountSubject.PRO_SubjectName); this.TCNote.DataBindings.Add("Text", this.DataSource, Model.AtCashAccountDetail.PRO_Note); this.TCIncome.DataBindings.Add("Text", this.DataSource, Model.AtCashAccountDetail.PRO_Income, "{0:F2}"); this.TCPay.DataBindings.Add("Text", this.DataSource, Model.AtCashAccountDetail.PRO_Pay, "{0:F2}"); //this.TCBalance.DataBindings.Add("Text", this.DataSource, Model.AtCashAccountDetail.PRO_Balance, "{0:F2}"); }
public RO(Model.AtCashAccount model) : this() { this.lblCompanyName.Text = BL.Settings.CompanyChineseName; this.lblReportDate.Text += DateTime.Now.ToString("yyyy-MM-dd"); this.lbl_DateRange.Text = model.HeaderDateRange; this.lblLastBalance.Text = model.LastBalance == null ? "" : model.LastBalance.Value.ToString("N0"); if (model.Detail.Count > 0) { this.lblTotalIncome.Text = model.Detail.Sum(d => d.Income).HasValue ? model.Detail.Sum(d => d.Income).Value.ToString("N0") : "0"; this.lblTotalPay.Text = model.Detail.Sum(d => d.Pay).HasValue ? model.Detail.Sum(d => d.Pay).Value.ToString("N0") : "0"; this.lblBalance.Text = model.Detail[model.Detail.Count - 1].Balance.HasValue ? model.Detail[model.Detail.Count - 1].Balance.Value.ToString("N0") : "0"; } this.DataSource = model.Detail; this.TCDate.DataBindings.Add("Text", this.DataSource, Model.AtCashAccountDetail.PRO_AtCashAccountDetaiDate, "{0:MM/dd}"); this.TCAtSubject.DataBindings.Add("Text", this.DataSource, "Subject." + Model.AtAccountSubject.PRO_SubjectName); this.TCSummary.DataBindings.Add("Text", this.DataSource, Model.AtCashAccountDetail.PRO_Summary); this.TCIncome.DataBindings.Add("Text", this.DataSource, Model.AtCashAccountDetail.PRO_Income, "{0:N0}"); this.TCPay.DataBindings.Add("Text", this.DataSource, Model.AtCashAccountDetail.PRO_Pay, "{0:N0}"); this.TCBalance.DataBindings.Add("Text", this.DataSource, Model.AtCashAccountDetail.PRO_Balance, "{0:N0}"); this.TCNote.DataBindings.Add("Text", this.DataSource, Model.AtCashAccountDetail.PRO_Note); }
/// <summary> /// Insert a AtCashAccount. /// </summary> public void Insert(Model.AtCashAccount atCashAccount) { ValiDate(atCashAccount); try { BL.V.BeginTransaction(); atCashAccount.InsertTime = DateTime.Now; atCashAccount.UpdateTime = DateTime.Now; accessor.Insert(atCashAccount); foreach (var item in atCashAccount.Detail) { item.AtCashAccountId = atCashAccount.AtCashAccountId; detailaccessor.Insert(item); } BL.V.CommitTransaction(); } catch { BL.V.RollbackTransaction(); throw; } }
public EditForm(Model.AtCashAccount model) : this() { this._atCashAccount = model; this.action = "view"; flag = 1; }
public override void Refresh() { if (this._atCashAccount == null) { this.AddNew(); } else if (this.action == "view") { this._atCashAccount = this.manager.GetDetail(this._atCashAccount.AtCashAccountId); } isRefresh = true; this.date_Begin.EditValue = this._atCashAccount.DateBegin; isRefresh = true; this.date_End.EditValue = this._atCashAccount.DateEnd; this.spe_LastBalance.EditValue = this._atCashAccount.LastBalance; this.spe_BalanceTotal.EditValue = this._atCashAccount.BalanceTotal; this.bindingSourceDetail.DataSource = this._atCashAccount.Detail; this.gridControl1.DataSource = this.bindingSourceDetail.DataSource; this.gridControl1.RefreshDataSource(); base.Refresh(); this.spe_LastBalance.Properties.ReadOnly = true; this.spe_BalanceTotal.Properties.ReadOnly = true; }
public Model.AtCashAccount GetDetail(string Id) { Model.AtCashAccount model = this.Get(Id); if (model != null) model.Detail = new BL.AtCashAccountDetailManager().SelectByHeaderId(Id); return model; }
protected override void AddNew() { this._atCashAccount = new Book.Model.AtCashAccount(); this._atCashAccount.AtCashAccountId = Guid.NewGuid().ToString(); if (this._atCashAccount.Detail == null) { this._atCashAccount.Detail = new List <Model.AtCashAccountDetail>(); } //Model.AtCashAccountDetail detail = new Book.Model.AtCashAccountDetail(); //detail.AtCashAccountDetailId = Guid.NewGuid().ToString(); ////detail.AtCashAccountDetaiDate = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM")); ////Model.AtAccountSubject subject; ////if (subjectList.Any(d => d.Id == "9999000")) ////{ //// subject = subjectList.First(d => d.Id == "9999000"); //// detail.SubjectId = subject.SubjectId; //// if (this.HasRows()) //// detail.Balance = this.manager.GetBalance(); //// else //// detail.Balance = subject.TheBalance; ////} //this._atCashAccount.Detail.Add(detail); //this._atCashAccount.BalanceTotal = detail.Balance; this.action = "insert"; }
public bool ISExistsMonth(Model.AtCashAccount model) { Hashtable ht = new Hashtable(); ht.Add("Date", model.AtCashAccountMonth); ht.Add("Id", model.AtCashAccountId); return(sqlmapper.QueryForObject <bool>("AtCashAccount.ISExistsMonth", ht)); }
protected override void MovePrev() { Model.AtCashAccount model = this.manager.GetPrev(this._atCashAccount); if (model == null) { throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows); } this._atCashAccount = model; }
protected override void MoveLast() { if (this.flag == 1) { this.flag = 0; return; } this._atCashAccount = this.manager.GetLast(); }
public override void Refresh() { if (this._atCashAccount == null) { this.AddNew(); } else if (this.action == "view") { this._atCashAccount = this.manager.GetDetail(this._atCashAccount.AtCashAccountId); } this.data_Month.EditValue = this._atCashAccount.AtCashAccountMonth; this.spe_IncomeTotal.EditValue = this._atCashAccount.IncomeTotal; this.spe_PayTotal.EditValue = this._atCashAccount.PayTotal; this.spe_BalanceTotal.EditValue = this._atCashAccount.BalanceTotal; this.bindingSourceDetail.DataSource = this._atCashAccount.Detail; base.Refresh(); this.spe_IncomeTotal.Properties.ReadOnly = true; this.spe_PayTotal.Properties.ReadOnly = true; this.spe_BalanceTotal.Properties.ReadOnly = true; }
protected override void Delete() { if (this._atCashAccount == null) { return; } if (MessageBox.Show(Properties.Resources.ConfirmToDelete, this.Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK) { return; } Model.AtCashAccount model = this.manager.GetNext(this._atCashAccount); this.manager.Delete(this._atCashAccount.AtCashAccountId); if (model == null) { this._atCashAccount = this.manager.GetLast(); } else { this._atCashAccount = model; } }
public void Insert(Model.AtCashAccount e) { this.Insert <Model.AtCashAccount>(e); }
protected override void MoveFirst() { this._atCashAccount = this.manager.GetFirst(); }
public Model.AtCashAccount GetNext(Model.AtCashAccount e) { return(accessor.GetNext(e)); }
public void Update(Model.AtCashAccount e) { this.Update <Model.AtCashAccount>(e); }
public bool HasRowsBefore(Model.AtCashAccount e) { return(sqlmapper.QueryForObject <bool>("AtCashAccount.has_rows_before", e)); }
public Model.AtCashAccount GetPrev(Model.AtCashAccount e) { return(sqlmapper.QueryForObject <Model.AtCashAccount>("AtCashAccount.get_prev", e)); }
public Model.AtCashAccount GetNext(Model.AtCashAccount e) { return(sqlmapper.QueryForObject <Model.AtCashAccount>("AtCashAccount.get_next", e)); }
public bool HasRowsAfter(Model.AtCashAccount e) { return(sqlmapper.QueryForObject <bool>("AtCashAccount.has_rows_after", e)); }
public bool ISExistsMonth(Model.AtCashAccount model) { return(accessor.ISExistsMonth(model)); }
public bool HasRowsAfter(Model.AtCashAccount e) { return(accessor.HasRowsAfter(e)); }
public bool HasRowsBefore(Model.AtCashAccount e) { return(accessor.HasRowsBefore(e)); }
public Model.AtCashAccount GetPrev(Model.AtCashAccount e) { return(accessor.GetPrev(e)); }