예제 #1
0
        public void Insert(Model.AtAccountSubject atAccountSubject)
        {
            Validate(atAccountSubject);
            atAccountSubject.SubjectId = Guid.NewGuid().ToString();
            try
            {
                atAccountSubject.InsertTime = DateTime.Now;
                BL.V.BeginTransaction();
                string invoiceKind   = this.GetInvoiceKind().ToLower();
                string sequencekey_y = string.Format("{0}-y-{1}", invoiceKind, atAccountSubject.InsertTime.Value.Year);
                string sequencekey_m = string.Format("{0}-m-{1}-{2}", invoiceKind, atAccountSubject.InsertTime.Value.Year, atAccountSubject.InsertTime.Value.Month);
                string sequencekey_d = string.Format("{0}-d-{1}", invoiceKind, atAccountSubject.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);
                accessor.Insert(atAccountSubject);
                BL.V.CommitTransaction();
            }
            catch
            {
                BL.V.RollbackTransaction();
                throw;
            }
        }
예제 #2
0
        protected override void Delete()
        {
            if (this.AtAccountSubject == null)
            {
                return;
            }
            if (MessageBox.Show(Properties.Resources.ConfirmToDelete, this.Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
            {
                return;
            }
            try
            {
                this.AtAccountSubjectManager.Delete(this.AtAccountSubject.SubjectId);
                this.AtAccountSubject = this.AtAccountSubjectManager.GetNext(this.AtAccountSubject);
                if (this.AtAccountSubject == null)
                {
                    this.AtAccountSubject = this.AtAccountSubjectManager.GetLast();
                }
            }
            catch
            {
                throw new Exception("");
            }

            return;
        }
예제 #3
0
        public bool ExistsExcept(Model.AtAccountSubject e)
        {
            Hashtable paras = new Hashtable();

            paras.Add("newId", e.Id);
            paras.Add("oldId", Get(e.SubjectId) == null?null:Get(e.SubjectId).Id);
            return(sqlmapper.QueryForObject <bool>("AtAccountSubject.existsexcept", paras));
        }
예제 #4
0
        public override void Refresh()
        {
            if (this.AtAccountSubject == null)
            {
                this.AtAccountSubject = new Book.Model.AtAccountSubject();
                this.action           = "insert";
            }
            this.bindingSource1.DataSource = this.AtAccountSubjectManager.Select();
            this.newChooseAccountingCategoryId.EditValue = this.AtAccountSubject.AccountingCategory;
            this.textEditSubjectId.Text       = this.AtAccountSubject.Id;
            this.textEditSubjectName.Text     = this.AtAccountSubject.SubjectName;
            this.textEditCommonSummary.Text   = this.AtAccountSubject.CommonSummary;
            this.spinEditTheBalance.EditValue = this.AtAccountSubject.TheBalance;
            if (this.AtAccountSubject.TheLending == "借")
            {
                this.radioGroupTheLending.SelectedIndex = 0;
            }
            else
            {
                this.radioGroupTheLending.SelectedIndex = 1;
            }
            switch (this.action)
            {
            case "insert":
                this.newChooseAccountingCategoryId.ShowButton     = true;
                this.newChooseAccountingCategoryId.ButtonReadOnly = false;
                this.textEditSubjectId.Properties.ReadOnly        = false;
                this.textEditSubjectName.Properties.ReadOnly      = false;
                this.textEditCommonSummary.Properties.ReadOnly    = false;
                this.spinEditTheBalance.Properties.ReadOnly       = false;
                this.radioGroupTheLending.Properties.ReadOnly     = false;
                break;

            case "update":
                this.newChooseAccountingCategoryId.ShowButton     = true;
                this.newChooseAccountingCategoryId.ButtonReadOnly = false;
                this.textEditSubjectId.Properties.ReadOnly        = false;
                this.textEditSubjectName.Properties.ReadOnly      = false;
                this.textEditCommonSummary.Properties.ReadOnly    = false;
                this.spinEditTheBalance.Properties.ReadOnly       = false;
                this.radioGroupTheLending.Properties.ReadOnly     = false;
                break;

            case "view":
                this.newChooseAccountingCategoryId.ShowButton     = false;
                this.newChooseAccountingCategoryId.ButtonReadOnly = true;
                this.textEditSubjectId.Properties.ReadOnly        = true;
                this.textEditSubjectName.Properties.ReadOnly      = true;
                this.textEditCommonSummary.Properties.ReadOnly    = true;
                this.spinEditTheBalance.Properties.ReadOnly       = true;
                this.radioGroupTheLending.Properties.ReadOnly     = true;
                break;

            default:
                break;
            }
            base.Refresh();
        }
예제 #5
0
        protected override void MoveNext()
        {
            Model.AtAccountSubject AtAccountSubject = this.AtAccountSubjectManager.GetNext(this.AtAccountSubject);
            if (AtAccountSubject == null)
            {
                throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows);
            }

            this.AtAccountSubject = AtAccountSubject;
        }
예제 #6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="item"></param>
        public void MyClick(ref ChooseItem item)
        {
            ChooseAccountSubjectForm f = new ChooseAccountSubjectForm();

            if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                Model.AtAccountSubject AtAccountSubject = f.SelectedItem as Model.AtAccountSubject;
                item = new ChooseItem(AtAccountSubject, AtAccountSubject.Id, AtAccountSubject.SubjectName);
            }
        }
예제 #7
0
        private void xrSubreport1_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            XRGeneralAccountDetail subreport = this.xrSubreport1.ReportSource as XRGeneralAccountDetail;

            Model.AtAccountSubject ataccountsubject = this.GetCurrentRow() as Model.AtAccountSubject;
            if (ataccountsubject != null)
            {
                subreport.ataccountsubject = ataccountsubject;
                this._calcSubjects.Add(subreport.ataccountsubject);
            }
        }
예제 #8
0
 private void Validate(Model.AtAccountSubject atAccountSubject)
 {
     if (string.IsNullOrEmpty(atAccountSubject.Id))
     {
         throw new Helper.RequireValueException(Model.AtAccountSubject.PRO_Id);
     }
     if (string.IsNullOrEmpty(atAccountSubject.SubjectName))
     {
         throw new Helper.RequireValueException(Model.AtAccountSubject.PRO_SubjectName);
     }
     if (string.IsNullOrEmpty(atAccountSubject.AccountingCategoryId))
     {
         throw new Helper.RequireValueException(Model.AtAccountSubject.PRO_AccountingCategoryId);
     }
 }
예제 #9
0
 public void MyLeave(ref ChooseItem item)
 {
     BL.AtAccountSubjectManager manager          = new Book.BL.AtAccountSubjectManager();
     Model.AtAccountSubject     AtAccountSubject = manager.GetById(item.ButtonText);
     if (AtAccountSubject != null)
     {
         item.EditValue  = AtAccountSubject;
         item.LabelText  = AtAccountSubject.SubjectName;
         item.ButtonText = AtAccountSubject.Id;
     }
     else
     {
         item.ErrorMessage = "物料類型錯誤";
     }
 }
예제 #10
0
        public decimal GET_ZFLZ_Yue(Model.AtAccountSubject subject, DateTime startdate)
        {
            Hashtable ht = new Hashtable();

            ht.Add("subjectid", subject == null ? null : subject.SubjectId);
            ht.Add("startdate", startdate);

            if (subject != null && subject.Id == "1101000")
            {
                return(sqlmapper.QueryForObject <decimal>("AtSummonDetail.GET_ZFLZ_YueXianJin", ht));
            }
            else
            {
                return(sqlmapper.QueryForObject <decimal>("AtSummonDetail.GET_ZFLZ_Yue", ht));
            }
        }
예제 #11
0
        private void gridView1_Click(object sender, EventArgs e)
        {
            GridView    view    = sender as GridView;
            GridHitInfo hitInfo = view.CalcHitInfo(view.GridControl.PointToClient(Cursor.Position));

            if (hitInfo.InRow && !view.IsGroupRow(hitInfo.RowHandle))
            {
                Model.AtAccountSubject productEpiboly = this.bindingSource1.Current as Model.AtAccountSubject;
                if (productEpiboly != null)
                {
                    this.AtAccountSubject = productEpiboly;
                    this.action           = "view";
                    this.Refresh();
                }
            }
        }
예제 #12
0
 public bool ExistsExcept(Model.AtAccountSubject e)
 {
     return(accessor.ExistsExcept(e));
 }
예제 #13
0
 protected override void MoveLast()
 {
     this.AtAccountSubject = this.AtAccountSubjectManager.GetLast();
 }
예제 #14
0
 public bool HasRowsBefore(Model.AtAccountSubject e)
 {
     return(accessor.HasRowsBefore(e));
 }
예제 #15
0
        public override void Refresh()
        {
            if (this.AtAccountSubject == null)
            {
                this.AddNew();
                this.action = "insert";
            }
            else if (this.AtAccountSubject != null)
            {
                this.AtAccountSubject = this.AtAccountSubjectManager.Get(this.AtAccountSubject.SubjectId);
            }

            //排序
            //this.bindingSource1.DataSource = this.MXsrot(this.AtAccountSubjectManager.Select());
            this.bindingSource1.DataSource = this.AtAccountSubjectManager.Select();

            this.newChooseAccountingCategoryId.EditValue = this.AtAccountSubject.AccountingCategory;
            this.textEditSubjectId.Text       = this.AtAccountSubject.Id;
            this.textEditSubjectName.Text     = this.AtAccountSubject.SubjectName;
            this.textEditCommonSummary.Text   = this.AtAccountSubject.CommonSummary;
            this.spinEditTheBalance.EditValue = this.AtAccountSubject.TheBalance;

            this.nccAtAccountSubject.EditValue = this.AtAccountSubjectManager.Get(this.AtAccountSubject.UnderSubject);
            this.comboBoxEditCash.EditValue    = this.AtAccountSubject.IsCash;
            this.ncc_Bank.EditValue            = this.AtAccountSubject.Bank;

            if (this.AtAccountSubject.TheLending == "借")
            {
                this.radioGroupTheLending.SelectedIndex = 0;
            }
            else
            {
                this.radioGroupTheLending.SelectedIndex = 1;
            }
            switch (this.action)
            {
            case "insert":
                this.newChooseAccountingCategoryId.ShowButton     = true;
                this.newChooseAccountingCategoryId.ButtonReadOnly = false;
                this.textEditSubjectId.Properties.ReadOnly        = false;
                this.textEditSubjectName.Properties.ReadOnly      = false;
                this.textEditCommonSummary.Properties.ReadOnly    = false;
                this.spinEditTheBalance.Properties.ReadOnly       = false;
                this.radioGroupTheLending.Properties.ReadOnly     = false;
                break;

            case "update":
                this.newChooseAccountingCategoryId.ShowButton     = true;
                this.newChooseAccountingCategoryId.ButtonReadOnly = false;
                this.textEditSubjectId.Properties.ReadOnly        = false;
                this.textEditSubjectName.Properties.ReadOnly      = false;
                this.textEditCommonSummary.Properties.ReadOnly    = false;
                this.spinEditTheBalance.Properties.ReadOnly       = false;
                this.radioGroupTheLending.Properties.ReadOnly     = false;
                break;

            case "view":
                this.newChooseAccountingCategoryId.ShowButton     = false;
                this.newChooseAccountingCategoryId.ButtonReadOnly = true;
                this.textEditSubjectId.Properties.ReadOnly        = true;
                this.textEditSubjectName.Properties.ReadOnly      = true;
                this.textEditCommonSummary.Properties.ReadOnly    = true;
                this.spinEditTheBalance.Properties.ReadOnly       = true;
                this.radioGroupTheLending.Properties.ReadOnly     = true;
                break;

            default:
                break;
            }
            base.Refresh();
        }
예제 #16
0
 public decimal GET_ZFLZ_Yue(Model.AtAccountSubject subject, DateTime startdate)
 {
     return(accessor.GET_ZFLZ_Yue(subject, startdate));
 }
예제 #17
0
 public Model.AtAccountSubject GetPrev(Model.AtAccountSubject e)
 {
     return(accessor.GetPrev(e));
 }
예제 #18
0
 public bool HasRowsAfter(Model.AtAccountSubject e)
 {
     return(accessor.HasRowsAfter(e));
 }
예제 #19
0
 public Model.AtAccountSubject GetPrev(Model.AtAccountSubject e)
 {
     return(sqlmapper.QueryForObject <Model.AtAccountSubject>("AtAccountSubject.get_prev", e));
 }
예제 #20
0
 public bool HasRowsAfter(Model.AtAccountSubject e)
 {
     return(sqlmapper.QueryForObject <bool>("AtAccountSubject.has_rows_after", e));
 }
예제 #21
0
 public bool HasRowsBefore(Model.AtAccountSubject e)
 {
     return(sqlmapper.QueryForObject <bool>("AtAccountSubject.has_rows_before", e));
 }
예제 #22
0
 public void Update(Model.AtAccountSubject e)
 {
     this.Update <Model.AtAccountSubject>(e);
 }
예제 #23
0
 public void Insert(Model.AtAccountSubject e)
 {
     this.Insert <Model.AtAccountSubject>(e);
 }
예제 #24
0
 protected override void AddNew()
 {
     this.AtAccountSubject    = new Model.AtAccountSubject();
     this.AtAccountSubject.Id = this.AtAccountSubjectManager.GetId();
 }
예제 #25
0
 public void Update(Model.AtAccountSubject atAccountSubject)
 {
     Validate(atAccountSubject);
     atAccountSubject.UpdateTime = DateTime.Now;
     accessor.Update(atAccountSubject);
 }
예제 #26
0
 public Model.AtAccountSubject GetNext(Model.AtAccountSubject e)
 {
     return(sqlmapper.QueryForObject <Model.AtAccountSubject>("AtAccountSubject.get_next", e));
 }
예제 #27
0
 public Model.AtAccountSubject GetNext(Model.AtAccountSubject e)
 {
     return(accessor.GetNext(e));
 }