コード例 #1
0
ファイル: EditForm.cs プロジェクト: daobataotie/EDNew
 public EditForm(Model.AtSummon atSummon, string action)
     : this()
 {
     this.atSummon         = atSummon;
     this.atSummon.Details = this.atSummonDetailManager.Select(atSummon);
     this.action           = action;
 }
コード例 #2
0
        public void Update(Model.AtSummon atSummon)
        {
            Validate(atSummon);
            try
            {
                BL.V.BeginTransaction();
                if (atSummon != null)
                {
                    _atSummonDetailManager.DeleteByHeadId(atSummon.SummonId);
                    foreach (Model.AtSummonDetail d in atSummon.Details)
                    {
                        if (d.Lending == null || d.SubjectId == null)
                        {
                            throw new global::Helper.MessageValueException("請輸入傳票詳細資料!!");
                        }
                        d.SummonId   = atSummon.SummonId;
                        d.UpdateTime = DateTime.Now;
                        _atSummonDetailManager.Insert(d);
                    }

                    atSummon.UpdateTime = DateTime.Now;
                    accessor.Update(atSummon);
                }
                BL.V.CommitTransaction();
            }
            catch
            {
                BL.V.RollbackTransaction();
                throw;
            }
        }
コード例 #3
0
ファイル: EditForm.cs プロジェクト: daobataotie/EDERP
 protected override void MoveLast()
 {
     //if (AtSummon == null)
     {
         this.atSummon = this.atSummonManager.Get(this.atSummonManager.GetLast() == null ? "" : this.atSummonManager.GetLast().SummonId);
     }
 }
コード例 #4
0
        public void Delete(Model.AtSummon atSummon)
        {
            try
            {
                BL.V.BeginTransaction();

                _atSummonDetailManager.DeleteByHeadId(atSummon.SummonId);

                this.Delete(atSummon.SummonId);

                //2020年9月9日23:52:04:删除不扣减编号,在新增的时候自动补足删除编号
                //string invoiceKind = this.GetInvoiceKind().ToLower();
                //string sequencekey_y = string.Format("{0}-y-{1}", invoiceKind, atSummon.SummonDate.Value.Year);
                //string sequencekey_m = string.Format("{0}-m-{1}-{2}", invoiceKind, atSummon.SummonDate.Value.Year, atSummon.SummonDate.Value.Month);
                //string sequencekey_d = string.Format("{0}-d-{1}", invoiceKind, atSummon.SummonDate.Value.ToString("yyyy-MM-dd"));
                //string sequencekey = string.Format(invoiceKind);

                //SequenceManager.Decrement(sequencekey_y);
                //SequenceManager.Decrement(sequencekey_m);
                //SequenceManager.Decrement(sequencekey_d);
                //SequenceManager.Decrement(sequencekey);

                BL.V.CommitTransaction();
            }
            catch
            {
                BL.V.RollbackTransaction();
                throw;
            }
        }
コード例 #5
0
ファイル: AtSummonAccessor.cs プロジェクト: daobataotie/EDERP
        public bool ExistsExcept(Model.AtSummon e)
        {
            Hashtable paras = new Hashtable();

            paras.Add("newId", e.Id);
            paras.Add("oldId", Get(e.SummonId) == null?null:Get(e.SummonId).Id);
            return(sqlmapper.QueryForObject <bool>("AtSummon.existsexcept", paras));
        }
コード例 #6
0
 public void DeleteAtSummon(Model.ProduceOtherInDepot produceOtherInDepot)
 {
     Model.AtSummon atSummon = atSummonManager.GetByProduceOtherInDepotId(produceOtherInDepot.ProduceOtherInDepotId);
     if (atSummon != null)
     {
         atSummonManager.Delete(atSummon);
     }
 }
コード例 #7
0
ファイル: InvoiceXSManager.cs プロジェクト: daobataotie/EDERP
 public void DeleteAtSummon(Model.InvoiceXS invoice)
 {
     Model.AtSummon atSummon = atSummonManager.GetByInvoiceXSId(invoice.InvoiceId);
     if (atSummon != null)
     {
         atSummonManager.Delete(atSummon);
     }
 }
コード例 #8
0
ファイル: AtSummonAccessor.cs プロジェクト: daobataotie/EDERP
        public bool IsExistsIdUpdate(Model.AtSummon model)
        {
            Hashtable ht = new Hashtable();

            ht.Add("Id", model.Id);
            ht.Add("SummonId", model.SummonId);
            return(sqlmapper.QueryForObject <bool>("AtSummon.IsExistsIdUpdate", ht));
        }
コード例 #9
0
 public EditForm(Model.AtSummon atSummon)
     : this()
 {
     this.atSummon         = atSummon;
     this.atSummon.Details = this.atSummonDetailManager.Select(atSummon);
     this.action           = "view";
     flag = 1;
 }
コード例 #10
0
ファイル: EditForm.cs プロジェクト: daobataotie/EDNew
 protected override void MovePrev()
 {
     Model.AtSummon atSummon = this.atSummonManager.GetPrev(this.atSummon);
     if (atSummon == null)
     {
         throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows);
     }
     this.atSummon = this.atSummonManager.Get(atSummon.SummonId);
 }
コード例 #11
0
 public Model.AtSummon GetDetails(string SummonId)
 {
     Model.AtSummon AtSummon = accessor.Get(SummonId);
     if (AtSummon != null)
     {
         AtSummon.Details = _atSummonDetailManager.Select(AtSummon);
     }
     return(AtSummon);
 }
コード例 #12
0
        public void Insert(Model.AtSummon atSummon)
        {
            if (atSummon.SummonId == null)
            {
                atSummon.SummonId = Guid.NewGuid().ToString();
            }
            Validate(atSummon);
            try
            {
                atSummon.InsertTime = DateTime.Now;
                atSummon.UpdateTime = DateTime.Now;
                BL.V.BeginTransaction();
                TiGuiExists(atSummon);
                string invoiceKind   = this.GetInvoiceKind().ToLower();
                string sequencekey_y = string.Format("{0}-y-{1}", invoiceKind, atSummon.SummonDate.Value.Year);
                string sequencekey_m = string.Format("{0}-m-{1}-{2}", invoiceKind, atSummon.SummonDate.Value.Year, atSummon.SummonDate.Value.Month);
                string sequencekey_d = string.Format("{0}-d-{1}", invoiceKind, atSummon.SummonDate.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(atSummon);

                foreach (Model.AtSummonDetail atSummonDetail in atSummon.Details)
                {
                    //if (atSummonDetail.SummonDetailId == null)
                    //    continue;
                    if (atSummonDetail.Lending == null || atSummonDetail.SubjectId == null)
                    {
                        throw new global::Helper.MessageValueException("請輸入傳票詳細資料!!");
                    }
                    if (string.IsNullOrEmpty(atSummonDetail.SummonDetailId))
                    {
                        atSummonDetail.SummonDetailId = Guid.NewGuid().ToString();
                    }

                    atSummonDetail.InsertTime     = DateTime.Now;
                    atSummonDetail.SummonCatetory = atSummon.SummonCategory;
                    atSummonDetail.BillCode       = atSummon.BIllCode;
                    atSummonDetail.SummonId       = atSummon.SummonId;

                    _atSummonDetailManager.Insert(atSummonDetail);
                }

                BL.V.CommitTransaction();
            }
            catch
            {
                BL.V.RollbackTransaction();
                throw;
            }
        }
コード例 #13
0
        /// <summary>
        /// 重写父类方法
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        protected override Book.UI.Settings.BasicData.BaseEditForm GetEditForm(object[] args)
        {
            //Type type = typeof(EditForm);
            //return (EditForm)type.Assembly.CreateInstance(type.FullName, false, System.Reflection.BindingFlags.CreateInstance, null, args, null, null);

            Type type = typeof(EditForm);

            Model.AtSummon model = (this.manager as BL.AtSummonManager).Get((args[0] as Model.AtSummonDetail) == null ? null : (args[0] as Model.AtSummonDetail).SummonId);
            args[0] = model;
            return((EditForm)type.Assembly.CreateInstance(type.FullName, false, System.Reflection.BindingFlags.CreateInstance, null, args, null, null));
        }
コード例 #14
0
 private void Validate(Model.AtSummon atSummon)
 {
     if (string.IsNullOrEmpty(atSummon.Id))
     {
         throw new Helper.RequireValueException(Model.AtSummon.PRO_Id);
     }
     if (string.IsNullOrEmpty(atSummon.SummonCategory))
     {
         throw new Helper.RequireValueException(Model.AtSummon.PRO_SummonCategory);
     }
 }
コード例 #15
0
        protected override void MoveLast()
        {
            if (flag == 1)
            {
                flag = 0;
                return;
            }

            this.atSummon = this.atSummonManager.Get(this.atSummonManager.GetLast() == null ? "" : this.atSummonManager.GetLast().SummonId);
            RefreshSubject();
        }
コード例 #16
0
ファイル: EditForm.cs プロジェクト: daobataotie/EDNew
        private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            List f = new List();

            if (f.ShowDialog(this) == DialogResult.OK)
            {
                Model.AtSummon model = f.SelectItem as Model.AtSummon;
                if (model != null)
                {
                    this.atSummon = model;
                    this.Refresh();
                }
            }
        }
コード例 #17
0
ファイル: EditForm.cs プロジェクト: daobataotie/EDERP
 protected override void AddNew()
 {
     this.atSummon            = new Model.AtSummon();
     this.atSummon.SummonDate = DateTime.Now;
     this.atSummon.Id         = this.atSummonManager.GetId();
     this.atSummon.Details    = new List <Model.AtSummonDetail>();
     if (this.action == "insert")
     {
         Model.AtSummonDetail detail = new Model.AtSummonDetail();
         detail.Subject = new Book.Model.AtAccountSubject();
         this.atSummon.Details.Add(detail);
         this.bindingSource1.Position = this.bindingSource1.IndexOf(detail);
     }
 }
コード例 #18
0
ファイル: EditForm.cs プロジェクト: daobataotie/EDNew
        private void barBtnSearch_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            ListForm f = new ListForm();

            if (f.ShowDialog(this) == DialogResult.OK)
            {
                Model.AtSummon currentModel = f.SelectItem as Model.AtSummon;
                if (currentModel != null)
                {
                    this.atSummon = currentModel;
                    this.atSummon = this.atSummonManager.GetDetails(this.atSummon.SummonId);
                    this.Refresh();
                }
            }
            f.Dispose();
            GC.Collect();
        }
コード例 #19
0
 public void TiGuiExistsForUpdate(Model.AtSummon model)
 {
     if (IsExistsIdUpdate(model))
     {
         //设置KEY值
         string invoiceKind   = this.GetInvoiceKind().ToLower();
         string sequencekey_y = string.Format("{0}-y-{1}", invoiceKind, model.SummonDate.Value.Year);
         string sequencekey_m = string.Format("{0}-m-{1}-{2}", invoiceKind, model.SummonDate.Value.Year, model.SummonDate.Value.Month);
         string sequencekey_d = string.Format("{0}-d-{1}", invoiceKind, model.SummonDate.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.Id = this.GetConsecutiveId(model.SummonDate.Value);
         TiGuiExistsForUpdate(model);
     }
 }
コード例 #20
0
        public RO(Model.AtSummon atSummon)
            : this()
        {
            this.lblCompanyName.Text = BL.Settings.CompanyChineseName;
            this.lblReportDate.Text += DateTime.Now.ToString("yyyy-MM-dd");
            this.lblDate.Text        = atSummon.SummonDate == null ? "" : atSummon.SummonDate.Value.ToString("yyyy-MM-dd");
            this.lblId.Text          = atSummon.Id;
            this.lblCategory.Text    = atSummon.SummonCategory;
            this.lblJieTotal.Text    = atSummon.TotalDebits == null ? "0" : atSummon.TotalDebits.Value.ToString("F2");
            this.lblDaiTotal.Text    = atSummon.CreditTotal == null ? "0" : atSummon.CreditTotal.Value.ToString("F2");

            this.DataSource = atSummon.Details;
            this.TCJieDai.DataBindings.Add("Text", this.DataSource, Model.AtSummonDetail.PRO_Lending);
            this.TCKemuId.DataBindings.Add("Text", this.DataSource, "Subject." + Model.AtAccountSubject.PRO_Id);
            this.TCKemuName.DataBindings.Add("Text", this.DataSource, "Subject." + Model.AtAccountSubject.PRO_SubjectName);
            this.TCNote.DataBindings.Add("Text", this.DataSource, Model.AtSummonDetail.PRO_Summary);
            this.TCMoney.DataBindings.Add("Text", this.DataSource, Model.AtSummonDetail.PRO_AMoney, "{0:F2}");
        }
コード例 #21
0
        public void Delete(Model.AtSummon atSummon)
        {
            try
            {
                BL.V.BeginTransaction();

                _atSummonDetailManager.DeleteByHeadId(atSummon.SummonId);

                this.Delete(atSummon.SummonId);

                BL.V.CommitTransaction();
            }
            catch
            {
                BL.V.RollbackTransaction();
                throw;
            }
        }
コード例 #22
0
 public void TiGuiExists(Model.AtSummon model)
 {
     if (this.Exists(model.Id))
     {
         //设置KEY值
         string invoiceKind   = this.GetInvoiceKind().ToLower();
         string sequencekey_y = string.Format("{0}-y-{1}", invoiceKind, model.SummonDate.Value.Year);
         string sequencekey_m = string.Format("{0}-m-{1}-{2}", invoiceKind, model.SummonDate.Value.Year, model.SummonDate.Value.Month);
         string sequencekey_d = string.Format("{0}-d-{1}", invoiceKind, model.SummonDate.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.Id = this.GetConsecutiveId(model.SummonDate.Value);
         TiGuiExists(model);
         //throw new Helper.InvalidValueException(Model.Product.PRO_Id);
     }
 }
コード例 #23
0
        protected override void AddNew()
        {
            this.atSummon                = new Model.AtSummon();
            this.atSummon.SummonDate     = DateTime.Now;
            this.atSummon.Id             = this.atSummonManager.GetId();
            this.atSummon.SummonId       = Guid.NewGuid().ToString();
            this.atSummon.Details        = new List <Model.AtSummonDetail>();
            this.atSummon.CreditTotal    = 0;
            this.atSummon.TotalDebits    = 0;
            this.atSummon.SummonCategory = "轉帳傳票";
            this.atSummon.EmployeeDS     = BL.V.ActiveOperator.Employee;
            //if (this.action == "insert")
            //{
            Model.AtSummonDetail detail = new Model.AtSummonDetail();
            detail.SummonDetailId = Guid.NewGuid().ToString();
            detail.AMoney         = 0;
            detail.Subject        = new Book.Model.AtAccountSubject();
            detail.Number         = 1;

            switch (this.comboBoxEditSummonCategory.SelectedIndex)
            {
            case 0:
                detail.Lending = "貸";

                break;

            case 1:
                detail.Lending = "借";
                break;

            case 2:
                detail.Lending = "";
                break;

            default:
                detail.Lending = "";
                break;
            }

            this.atSummon.Details.Add(detail);
        }
コード例 #24
0
        protected override void AddNew()
        {
            //会计传票
            this.atSummon             = new Model.AtSummon();
            this.atSummon.SummonDate  = DateTime.Now;
            this.atSummon.Id          = this.atSummonManager.GetId();
            this.atSummon.SummonId    = Guid.NewGuid().ToString();
            this.atSummon.Details     = new List <Model.AtSummonDetail>();
            this.atSummon.CreditTotal = 0;
            this.atSummon.TotalDebits = 0;

            this.shouldPayAccount = new Book.Model.ShouldPayAccount();
            this.shouldPayAccount.ShouldPayAccountId = Guid.NewGuid().ToString();
            this.shouldPayAccount.AtSummon           = this.atSummon;
            this.shouldPayAccount.AtSummonId         = this.atSummon.SummonId;
            //this.shouldPayAccount.AtBillsIncome = this.AtBillsIncome;
            //this.shouldPayAccount.AtBillsIncomeId = this.AtBillsIncome.BillsId;
            this.shouldPayAccount.Employee = BL.V.ActiveOperator.Employee;
            if (this.shouldPayAccount.Employee != null)
            {
                this.shouldPayAccount.EmployeeId = this.shouldPayAccount.Employee.EmployeeId;
            }

            //应付票据作业
            //this.AtBillsIncome = new Model.AtBillsIncome();
            //this.AtBillsIncome.BillsId = Guid.NewGuid().ToString();
            //this.AtBillsIncome.IncomeCategory = "0";
            //this.AtBillsIncome.BillsOften = "0";
            //this.AtBillsIncome.TheOpenDate = DateTime.Now;
            this.atBillsIncomeList = new List <Model.AtBillsIncome>();
            Model.AtBillsIncome model = new Book.Model.AtBillsIncome();
            model.BillsId            = Guid.NewGuid().ToString();
            model.TheOpenDate        = DateTime.Now;
            model.ShouldPayAccountId = this.shouldPayAccount.ShouldPayAccountId;
            this.atBillsIncomeList.Add(model);


            this.action = "insert";
        }
コード例 #25
0
        public ROTransferAccounts(Model.AtSummon atSummon)
        {
            InitializeComponent();

            this.lbl_CompanyName.Text = BL.Settings.CompanyChineseName;
            this.lbl_Id.Text          = atSummon.Id;
            this.lblDate.Text         = atSummon.SummonDate.HasValue ? atSummon.SummonDate.Value.ToString("yyyy-MM-dd") : "";
            this.tc_Employee.Text     = atSummon.EmployeeDS == null ? "" : atSummon.EmployeeDS.EmployeeName;

            //一页补足12条数据
            //int pageCount = (int)(atSummon.Details.Count / 12);
            //int remainder = atSummon.Details.Count % 12;
            //if (remainder != 0)
            //{
            //    int needCount = (pageCount + 1) * 12 - atSummon.Details.Count;
            //    for (int i = 0; i < needCount; i++)
            //    {
            //        atSummon.Details.Add(new Book.Model.AtSummonDetail());
            //    }
            //}


            //this.DataSource = atSummon.Details;

            //this.TC_Jiedai.DataBindings.Add("Text", this.DataSource, Model.AtSummonDetail.PRO_Lending);
            //this.TCSubId.DataBindings.Add("Text", this.DataSource, "Subject." + Model.AtAccountSubject.PRO_Id);
            //this.TC_SubName.DataBindings.Add("Text", this.DataSource, "Subject." + Model.AtAccountSubject.PRO_SubjectName);
            //this.TC_Note.DataBindings.Add("Text", this.DataSource, Model.AtSummonDetail.PRO_Summary);
            //this.TC_JMoney.DataBindings.Add("Text", this.DataSource, "JMoney", "{0:0.##}");
            //this.TC_DMoney.DataBindings.Add("Text", this.DataSource, "DMoney", "{0:0.##}");

            xrSubreport1.ReportSource = new ROTransferAccounts_Sub(atSummon.Details);

            this.TCJTotal.Text = atSummon.TotalDebits.Value.ToString("N0");
            this.TCDTotal.Text = atSummon.CreditTotal.Value.ToString("N0");
        }
コード例 #26
0
        private void bar_Copy_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (this.action != "view")
            {
                MessageBox.Show("請先保存單據!", "提示", MessageBoxButtons.OK);
                return;
            }

            CopyChooseDateForm f = new CopyChooseDateForm();

            if (f.ShowDialog() == DialogResult.OK)
            {
                Model.AtSummon newAtSummon = new Book.Model.AtSummon();
                newAtSummon.SummonId       = Guid.NewGuid().ToString();
                newAtSummon.SummonDate     = f.InvoiceDate;
                newAtSummon.SummonCategory = atSummon.SummonCategory;
                newAtSummon.TotalDebits    = atSummon.TotalDebits;
                newAtSummon.CreditTotal    = atSummon.CreditTotal;
                newAtSummon.Id             = this.atSummonManager.GetId(f.InvoiceDate);
                newAtSummon.EmployeeDSId   = atSummon.EmployeeDSId;
                newAtSummon.EmployeeDS     = atSummon.EmployeeDS;
                newAtSummon.AtSummonDesc   = atSummon.AtSummonDesc;

                newAtSummon.Details = new List <Model.AtSummonDetail>();
                foreach (var item in atSummon.Details)
                {
                    newAtSummon.Details.Add(item);
                }

                this.atSummon = newAtSummon;

                this.action = "insert";

                Refresh();
            }
        }
コード例 #27
0
 public IList <Model.AtSummonDetail> Select(Model.AtSummon atSummon)
 {
     return(sqlmapper.QueryForList <Model.AtSummonDetail>("AtSummonDetail.getBySummonId", atSummon.SummonId));
 }
コード例 #28
0
ファイル: EditForm.cs プロジェクト: daobataotie/EDNew
 protected override void MoveFirst()
 {
     this.atSummon = this.atSummonManager.Get(this.atSummonManager.GetFirst() == null ? "" : this.atSummonManager.GetFirst().SummonId);
 }
コード例 #29
0
ファイル: InvoiceXSManager.cs プロジェクト: daobataotie/EDERP
        public void UpdateAtSummon(Model.InvoiceXS invoice, Dictionary <string, string> dic)
        {
            Model.AtSummon atSummon = atSummonManager.GetByInvoiceXSId(invoice.InvoiceId);
            if (atSummon != null)
            {
                atSummon.UpdateTime = DateTime.Now;

                atSummon.Details = atSummonDetailManager.Select(atSummon);

                foreach (var item in atSummon.Details)
                {
                    if (dic.Values.Contains(item.SubjectId))
                    {
                        if (item.Lending == "貸")
                        {
                            if (item.Subject.SubjectName == "銷貨收入")
                            {
                                if (item.AMoney != invoice.InvoiceHeji)
                                {
                                    item.AMoney     = invoice.InvoiceHeji;
                                    item.UpdateTime = DateTime.Now;

                                    atSummonDetailManager.Update(item);
                                }
                            }
                            else       //銷項稅額
                            {
                                if (invoice.InvoiceTax > 0)
                                {
                                    if (item.AMoney != invoice.InvoiceTax)
                                    {
                                        item.AMoney     = invoice.InvoiceTax;
                                        item.UpdateTime = DateTime.Now;

                                        atSummonDetailManager.Update(item);
                                    }
                                }
                                else
                                {
                                    atSummonDetailManager.Delete(item.SummonDetailId);
                                }
                            }
                        }
                        else          //應收賬款-客戶
                        {
                            if (item.AMoney != invoice.InvoiceTotal)
                            {
                                item.AMoney     = invoice.InvoiceTotal;
                                item.UpdateTime = DateTime.Now;

                                atSummonDetailManager.Update(item);
                            }
                        }
                    }
                }

                if (invoice.InvoiceTax > 0 && atSummon.Details.Count == 2 && !atSummon.Details.Any(d => d.Subject.SubjectName == "銷項稅額"))
                {
                    Model.AtSummonDetail detail3 = new Model.AtSummonDetail();
                    detail3.SummonId       = atSummon.SummonId;
                    detail3.SummonDetailId = Guid.NewGuid().ToString();
                    detail3.SummonCatetory = atSummon.SummonCategory;
                    detail3.Lending        = "貸";
                    detail3.Id             = "B2";
                    detail3.AMoney         = invoice.InvoiceTax;
                    detail3.SubjectId      = dic["銷項稅額"];
                    detail3.InsertTime     = DateTime.Now;
                    detail3.UpdateTime     = DateTime.Now;
                    atSummon.Details.Add(detail3);

                    atSummonDetailManager.Insert(detail3);
                }

                atSummon.TotalDebits = atSummon.Details.Where(d => d.Lending == "借").Sum(d => d.AMoney);
                atSummon.CreditTotal = atSummon.Details.Where(d => d.Lending == "貸").Sum(d => d.AMoney);

                atSummonAccessor.Update(atSummon);
            }
        }
コード例 #30
0
ファイル: EditForm.cs プロジェクト: daobataotie/EDNew
        public override void Refresh()
        {
            if (this.atSummon == null)
            {
                this.AddNew();
                this.action = "insert";
            }
            else
            {
                if (this.action == "view")
                {
                    this.atSummon = this.atSummonManager.GetDetails(atSummon.SummonId);
                }
            }
            this.textEditSummonId.Text = this.atSummon.Id;

            if (global::Helper.DateTimeParse.DateTimeEquls(this.atSummon.SummonDate, global::Helper.DateTimeParse.NullDate))
            {
                this.dateEditSummonDate.EditValue = null;
            }
            else
            {
                this.dateEditSummonDate.EditValue = this.atSummon.SummonDate;
            }

            this.spinEditCreditTotal.EditValue = this.atSummon.CreditTotal;
            this.spinEditTotalDebits.EditValue = this.atSummon.TotalDebits;

            //详细处理
            this.bindingSource1.DataSource = this.atSummon.Details.Where(d => (!d.Lending.Contains(this.atSummon.Id))).ToList <Model.AtSummonDetail>();

            this.comboBoxEditSummonCategory.EditValue = this.atSummon.SummonCategory;

            switch (this.action)
            {
            case "insert":
                this.textEditSummonId.Properties.ReadOnly           = false;
                this.comboBoxEditSummonCategory.Properties.ReadOnly = false;
                this.dateEditSummonDate.Properties.ReadOnly         = false;
                this.simpleButton1.Enabled = true;
                this.simpleButton2.Enabled = true;
                this.spinEditTotalDebits.Properties.ReadOnly = false;
                this.spinEditCreditTotal.Properties.ReadOnly = false;
                this.gridView1.OptionsBehavior.Editable      = true;
                break;

            case "update":
                this.textEditSummonId.Properties.ReadOnly           = false;
                this.comboBoxEditSummonCategory.Properties.ReadOnly = false;
                this.dateEditSummonDate.Properties.ReadOnly         = false;
                this.simpleButton1.Enabled = true;
                this.simpleButton2.Enabled = true;
                this.gridView1.OptionsBehavior.Editable      = true;
                this.spinEditTotalDebits.Properties.ReadOnly = false;
                this.spinEditCreditTotal.Properties.ReadOnly = false;
                break;

            case "view":
                this.textEditSummonId.Properties.ReadOnly           = true;
                this.comboBoxEditSummonCategory.Properties.ReadOnly = true;
                this.dateEditSummonDate.Properties.ReadOnly         = true;
                this.simpleButton1.Enabled = false;
                this.simpleButton2.Enabled = false;
                this.gridView1.OptionsBehavior.Editable      = false;
                this.spinEditTotalDebits.Properties.ReadOnly = true;
                this.spinEditCreditTotal.Properties.ReadOnly = true;
                break;

            default:
                break;
            }

            base.Refresh();

            this.spinEditCreditTotal.Properties.ReadOnly = true;
            this.spinEditTotalDebits.Properties.ReadOnly = true;

            if (this.action != "view")
            {
                switch (this.comboBoxEditSummonCategory.SelectedIndex)
                {
                case 0:
                    this.colJieorDai.OptionsColumn.AllowEdit = false;
                    foreach (Model.AtSummonDetail d in this.bindingSource1.DataSource as IList <Model.AtSummonDetail> )
                    {
                        d.Lending = "貸";
                    }
                    break;

                case 1:
                    this.colJieorDai.OptionsColumn.AllowEdit = false;
                    foreach (Model.AtSummonDetail d in this.bindingSource1.DataSource as IList <Model.AtSummonDetail> )
                    {
                        d.Lending = "借";
                    }
                    break;

                case 2:
                    this.colJieorDai.OptionsColumn.AllowEdit = true;
                    break;
                }
                this.gridControl1.RefreshDataSource();
            }
        }