Пример #1
0
        public override void Refresh()
        {
            if (this._atParameterSet == null)
            {
                this.AddNew();
                this.action = "insert";
            }
            else
            {
                if (this.action == "view")
                {
                    this._atParameterSet = this._atParameterManager.Get(this._atParameterSet.AtParameterSetId);
                }
            }

            this.spinKuaiJiNianDu.EditValue    = this._atParameterSet.AtCurrentlyYear.HasValue ? this._atParameterSet.AtCurrentlyYear.Value : DateTime.Now.Year;
            this.DateEditAtBeginDate.EditValue = this._atParameterSet.AtBeginDate;
            this.DateEditAtEndDate.EditValue   = this._atParameterSet.AtEndDate;

            this.nccACMoneySubject.EditValue    = this._atParameterSet.ACMoneySubject;
            this.nccAtOldSunYiSubject.EditValue = this._atParameterSet.AtOldSunYiSubject;
            this.nccAtSunYiSubject.EditValue    = this._atParameterSet.AtSunYiSubject;

            this.chkIsThisYear.Checked = this._atParameterSet.IsThisYear.HasValue ? this._atParameterSet.IsThisYear.Value : false;

            base.Refresh();
        }
Пример #2
0
 protected override void MovePrev()
 {
     Model.AtParameterSet atPara = this._atParameterManager.GetPrev(this._atParameterSet);
     if (atPara == null)
     {
         throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows);
     }
     this._atParameterSet = this._atParameterManager.Get(atPara.AtParameterSetId);
 }
Пример #3
0
 public void Update(Model.AtParameterSet atParameterSet)
 {
     Validate(atParameterSet);
     if (atParameterSet != null)
     {
         if (atParameterSet.IsThisYear.Value)
         {
             this.UpdateIsThisYear(atParameterSet.AtParameterSetId);
         }
         atParameterSet.UpdateTime = DateTime.Now;
         accessor.Update(atParameterSet);
     }
 }
Пример #4
0
 protected override void Delete()
 {
     if (this._atParameterSet == null)
     {
         return;
     }
     if (MessageBox.Show(Properties.Resources.ConfirmToDelete, this.Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
     {
         return;
     }
     this._atParameterManager.Delete(this._atParameterSet.AtParameterSetId);
     this._atParameterSet = this._atParameterManager.GetNext(this._atParameterSet);
     if (this._atParameterSet == null)
     {
         this._atParameterSet = this._atParameterManager.GetLast();
     }
 }
Пример #5
0
 private void TiGuiExists(Model.AtParameterSet model)
 {
     if (this.ExistsPrimary(model.AtParameterSetId))
     {
         //设置KEY值
         string invoiceKind   = this.GetInvoiceKind().ToLower();
         string sequencekey_y = string.Format("{0}-y-{1}", invoiceKind, model.InsertTime.Value.Year);
         string sequencekey_m = string.Format("{0}-m-{1}-{2}", invoiceKind, model.InsertTime.Value.Year, model.InsertTime.Value.Month);
         string sequencekey_d = string.Format("{0}-d-{1}", invoiceKind, model.InsertTime.Value.ToString("yyyy-MM-dd"));
         string sequencekey   = string.Format(invoiceKind);
         SequenceManager.Increment(sequencekey_y);
         SequenceManager.Increment(sequencekey_m);
         SequenceManager.Increment(sequencekey_d);
         SequenceManager.Increment(sequencekey);
         model.AtParameterSetId = this.GetId(model.InsertTime.Value);
         TiGuiExists(model);
     }
 }
Пример #6
0
        private void Validate(Model.AtParameterSet atParameterSet)
        {
            if (string.IsNullOrEmpty(atParameterSet.AtParameterSetId))
            {
                throw new Helper.RequireValueException(Model.AtParameterSet.PRO_AtParameterSetId);
            }
            if (string.IsNullOrEmpty(atParameterSet.ACMoneySubjectId))
            {
                throw new Helper.RequireValueException(Model.AtParameterSet.PRO_ACMoneySubjectId);
            }
            if (!atParameterSet.AtBeginDate.HasValue)
            {
                throw new Helper.RequireValueException(Model.AtParameterSet.PRO_AtBeginDate);
            }
            if (!atParameterSet.AtCurrentlyYear.HasValue)
            {
                throw new Helper.RequireValueException(Model.AtParameterSet.PRO_AtCurrentlyYear);
            }
            if (!atParameterSet.AtEndDate.HasValue)
            {
                throw new Helper.RequireValueException(Model.AtParameterSet.PRO_AtEndDate);
            }
            if (string.IsNullOrEmpty(atParameterSet.AtOldSunYiSubjectId))
            {
                throw new Helper.RequireValueException(Model.AtParameterSet.PRO_AtOldSunYiSubjectId);
            }
            if (string.IsNullOrEmpty(atParameterSet.AtSunYiSubjectId))
            {
                throw new Helper.RequireValueException(Model.AtParameterSet.PRO_AtSunYiSubjectId);
            }
            IList <Model.AtParameterSet> atplist = this.Select();

            foreach (Model.AtParameterSet d in atplist)
            {
                if (atParameterSet.AtCurrentlyYear.Value == d.AtCurrentlyYear.Value && atParameterSet.AtParameterSetId != d.AtParameterSetId)
                {
                    throw new Helper.InvalidValueException(Model.AtParameterSet.PRO_AtCurrentlyYear + "_Exists");
                }
            }
        }
Пример #7
0
        public void Insert(Model.AtParameterSet atParameterSet)
        {
            Validate(atParameterSet);
            try
            {
                BL.V.BeginTransaction();

                atParameterSet.InsertTime = DateTime.Now;
                atParameterSet.UpdateTime = DateTime.Now;
                TiGuiExists(atParameterSet);

                string invoiceKind   = this.GetInvoiceKind().ToLower();
                string sequencekey_y = string.Format("{0}-y-{1}", invoiceKind, atParameterSet.InsertTime.Value.Year);
                string sequencekey_m = string.Format("{0}-m-{1}-{2}", invoiceKind, atParameterSet.InsertTime.Value.Year, atParameterSet.InsertTime.Value.Month);
                string sequencekey_d = string.Format("{0}-d-{1}", invoiceKind, atParameterSet.InsertTime.Value.ToString("yyyy-MM-dd"));
                string sequencekey   = string.Format(invoiceKind);

                SequenceManager.Increment(sequencekey_y);
                SequenceManager.Increment(sequencekey_m);
                SequenceManager.Increment(sequencekey_d);
                SequenceManager.Increment(sequencekey);

                if (atParameterSet.IsThisYear.Value)
                {
                    this.UpdateIsThisYear(atParameterSet.AtParameterSetId);
                }
                accessor.Insert(atParameterSet);

                BL.V.CommitTransaction();
            }
            catch
            {
                BL.V.RollbackTransaction();
                throw;
            }
        }
Пример #8
0
 public void Insert(Model.AtParameterSet e)
 {
     this.Insert <Model.AtParameterSet>(e);
 }
Пример #9
0
 public Model.AtParameterSet GetNext(Model.AtParameterSet e)
 {
     return(accessor.GetNext(e));
 }
Пример #10
0
 public Model.AtParameterSet GetPrev(Model.AtParameterSet e)
 {
     return(accessor.GetPrev(e));
 }
Пример #11
0
 public bool HasRowsAfter(Model.AtParameterSet e)
 {
     return(accessor.HasRowsAfter(e));
 }
Пример #12
0
 public bool HasRowsBefore(Model.AtParameterSet e)
 {
     return(accessor.HasRowsBefore(e));
 }
Пример #13
0
 protected override void MoveLast()
 {
     this._atParameterSet = this._atParameterManager.Get(this._atParameterManager.GetLast() == null ? "" : this._atParameterManager.GetLast().AtParameterSetId);
 }
Пример #14
0
 public void Update(Model.AtParameterSet e)
 {
     this.Update <Model.AtParameterSet>(e);
 }
Пример #15
0
 public bool HasRowsBefore(Model.AtParameterSet e)
 {
     return(sqlmapper.QueryForObject <bool>("AtParameterSet.has_rows_before", e));
 }
Пример #16
0
 protected override void AddNew()
 {
     this._atParameterSet = new Book.Model.AtParameterSet();
     this._atParameterSet.AtParameterSetId = this._atParameterManager.GetId();
 }
Пример #17
0
 public Model.AtParameterSet GetPrev(Model.AtParameterSet e)
 {
     return(sqlmapper.QueryForObject <Model.AtParameterSet>("AtParameterSet.get_prev", e));
 }
Пример #18
0
 public Model.AtParameterSet GetNext(Model.AtParameterSet e)
 {
     return(sqlmapper.QueryForObject <Model.AtParameterSet>("AtParameterSet.get_next", e));
 }
Пример #19
0
 public bool HasRowsAfter(Model.AtParameterSet e)
 {
     return(sqlmapper.QueryForObject <bool>("AtParameterSet.has_rows_after", e));
 }