Ejemplo n.º 1
0
        private void 实时监控结束_Load(object sender, EventArgs e)
        {
            m_cm = AssociateDataControlsInControlManager(new Control[] {
                pnl作业号, pnl车牌号, pnl驾驶员编号, pnl联系电话, pnl备注
            },
                                                         "实时监控_车辆作业_监控结束");
            grid = base.AssociateArchiveGrid(pnl作业流程, "实时监控_车辆作业_监控结束_任务");

            var dm = m_cm.DisplayManager;

            dm.DataControls["备注"].ReadOnly = false;

            using (IRepository rep = ServiceProvider.GetService <IRepositoryFactory>().GenerateRepository <车辆作业>())
            {
                rep.Initialize(m_clzy.车辆, m_clzy);
                rep.Initialize(m_clzy.驾驶员, m_clzy);
                rep.Initialize(m_clzy.专家任务, m_clzy);
                rep.Initialize(m_clzy.专家任务.任务, m_clzy.专家任务);

                dm.DataControls["作业号"].SelectedDataValue   = m_clzy.作业号;
                dm.DataControls["车牌号"].SelectedDataValue   = m_clzy.车辆.车牌号;
                dm.DataControls["驾驶员编号"].SelectedDataValue = m_clzy.驾驶员编号;
                dm.DataControls["联系电话"].SelectedDataValue  = m_clzy.驾驶员.联系方式;
                dm.DataControls["备注"].SelectedDataValue    = m_clzy.备注;

                grid.DisplayManager.SetDataBinding(m_clzy.专家任务.任务, string.Empty);
                for (int i = 0; i < grid.DataRows.Count; ++i)
                {
                    grid.DataRows[i].Cells["序号"].Value = i;
                }
            }
        }
        private void btn退回_Click(object sender, EventArgs e)
        {
            车辆作业 clzy = m_clzy;

            using (IRepository rep = ServiceProvider.GetService <IRepositoryFactory>().GenerateRepository <车辆作业>())
            {
                rep.Initialize(clzy.专家任务, clzy);
                rep.Initialize(clzy.专家任务.任务, clzy.专家任务);

                foreach (var i in clzy.专家任务.任务)
                {
                    if (i.任务号 == clzy.最新作业状态.异常参数)
                    {
                        m_dao2.撤销专家任务(clzy.专家任务, i);
                        break;
                    }
                }
            }

            m_处理 = 1;
            DateTime?通知时间 = System.DateTime.Now;
            string   msg  = "动态任务追加失败";

            if (m_dm.DataControls["理由"].SelectedDataValue != null)
            {
                msg += ":" + m_dm.DataControls["理由"].SelectedDataValue.ToString();
            }
            m_dao.处理作业异常(m_clzy, msg, 通知时间, true);

            this.DialogResult = System.Windows.Forms.DialogResult.OK;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 撤销提交
        /// </summary>
        /// <param name="rep"></param>
        /// <param name="entity"></param>
        public override void Unsubmit(IRepository rep, 坏账 entity)
        {
            rep.Initialize(entity.费用, entity);
            System.Diagnostics.Debug.Assert(entity.费用.Count == 1, "坏账费用有且只有一条!");

            对账单 dzd = entity.费用[0].对账单;

            System.Diagnostics.Debug.Assert(dzd != null, "坏账费用肯定已自动出过对账单!");
            rep.Initialize(dzd, entity.费用[0]);
            rep.Initialize(dzd.费用, dzd);

            rep.Delete(entity.费用[0]);

            rep.Initialize(dzd.应收应付款, dzd);
            //System.Diagnostics.Debug.Assert(dzd.应收应付款.Count == 1, "坏账应收应付款有且只有一条!");
            //rep.Delete(dzd.应收应付款[0]);
            foreach (应收应付款 i in dzd.应收应付款)
            {
                rep.Delete(i);
            }
            dzd.应收应付款.Clear();

            rep.Delete(dzd);

            entity.Submitted = false;
            this.Update(rep, entity);
        }
Ejemplo n.º 4
0
        private static void UngeneratePzYsyf(IRepository rep, 凭证 pz)
        {
            IList <应收应付款> ysyfk = (rep as Feng.NH.INHibernateRepository).List <应收应付款>(NHibernate.Criterion.DetachedCriteria.For <应收应付款>()
                                                                                      .Add(NHibernate.Criterion.Expression.Eq("应收应付源", pz)));

            foreach (应收应付款 i in ysyfk)
            {
                rep.Delete(i);
            }

            rep.Initialize(pz.凭证费用明细, pz);

            foreach (凭证费用明细 pzfymx in pz.凭证费用明细)
            {
                费用项 fyx = EntityBufferCollection.Instance.Get <费用项>(pzfymx.费用项编号);

                rep.Initialize(pzfymx.费用, pzfymx);
                if (pzfymx.费用.Count > 0 &&
                    fyx.应收应付类型 != 应收应付类型.管理费用类型)
                {
                    continue;
                }

                if (fyx.应收应付类型 == 应收应付类型.业务)
                {
                }
                else if (fyx.应收应付类型 == 应收应付类型.借款类型)
                {
                }
                else if (fyx.应收应付类型 == 应收应付类型.管理费用类型)
                {
                    if (string.IsNullOrEmpty(s_非业务默认费用实体))
                    {
                        throw new ArgumentException("必须指定一个非业务默认费用实体!");
                    }

                    IList <费用> fys = new List <费用>();
                    foreach (费用 fy in pzfymx.费用)
                    {
                        if (fy.费用实体.ID == new Guid(s_非业务默认费用实体))
                        {
                            fys.Add(fy);
                        }
                    }

                    foreach (费用 fy in fys)
                    {
                        pzfymx.费用.Remove(fy);
                        rep.Delete(fy);
                    }
                }
                else if (fyx.应收应付类型 == 应收应付类型.其他)
                {
                }
            }
        }
Ejemplo n.º 5
0
        public static void 自动生成全部费用(ArchiveOperationForm masterForm)
        {
            if (!ServiceProvider.GetService <IMessageBox>().ShowYesNo("是否要自动全部生成费用?", "确认"))
            {
                return;
            }
            ProgressForm progressForm = new ProgressForm();

            progressForm.Start(masterForm, "生成");

            Feng.Async.AsyncHelper asyncHelper = new Feng.Async.AsyncHelper(
                new Feng.Async.AsyncHelper.DoWork(delegate()
            {
                费用实体 entity = masterForm.DisplayManager.CurrentItem as 费用实体;
                if (entity == null)
                {
                    throw new ArgumentException("请选择要生成费用的产值!");
                }
                using (IRepository rep = ServiceProvider.GetService <IRepositoryFactory>().GenerateRepository <车辆产值>())
                {
                    车辆产值 piao = rep.Get <车辆产值>(entity.ID);
                    rep.Initialize(piao.任务, piao);
                    process_fy_yw.批量生成费用(rep, piao, piao.任务, null, null);
                }

                return(null);
            }),
                new Feng.Async.AsyncHelper.WorkDone(delegate(object result)
            {
                masterForm.ControlManager.OnCurrentItemChanged();
                progressForm.Stop();
            }));
        }
Ejemplo n.º 6
0
        public static void 提交(ArchiveOperationForm masterForm)
        {
            调节款 tjk = masterForm.ControlManager.DisplayManager.CurrentItem as 调节款;

            if (tjk == null)
            {
                return;
            }

            using (IRepository rep = RepositoryFactory.GenerateRepository <调节款>())
            {
                try
                {
                    rep.BeginTransaction();
                    tjk.Submitted = true;
                    rep.Update(tjk);

                    rep.Initialize(tjk, tjk.调节款明细);
                    foreach (调节款明细 i in tjk.调节款明细)
                    {
                        应收应付款 j = i.Clone() as 应收应付款;
                        j.应收应付源 = tjk;
                        rep.Save(j);
                    }

                    rep.CommitTransaction();
                }
                catch (Exception)
                {
                    rep.RollbackTransaction();
                }
            }
        }
Ejemplo n.º 7
0
        public 受托人合同 Get受托人合同(IRepository rep, int 费用实体类型, string 受托人编号)
        {
            string key = 费用实体类型.ToString() + "," + 受托人编号;

            if (!s_wtrhts.ContainsKey(key))
            {
                IList <受托人合同> list = (rep as Feng.NH.INHibernateRepository).List <受托人合同>(NHibernate.Criterion.DetachedCriteria.For <受托人合同>()
                                                                                         .Add(NHibernate.Criterion.Expression.Eq("业务类型编号", 费用实体类型))
                                                                                         .Add(NHibernate.Criterion.Expression.Eq("受托人编号", 受托人编号))
                                                                                         .Add(NHibernate.Criterion.Expression.Le("有效期始", System.DateTime.Today))
                                                                                         .Add(NHibernate.Criterion.Expression.Ge("有效期止", System.DateTime.Today))
                                                                                         .AddOrder(NHibernate.Criterion.Order.Desc("签约时间"))
                                                                                         .SetMaxResults(1));

                if (list.Count > 0)
                {
                    受托人合同 strht = list[0];
                    rep.Initialize(strht.合同费用项, strht);
                    s_strhts[key] = strht;
                }
                else
                {
                    s_strhts[key] = null;
                }
            }
            return(s_strhts[key]);
        }
Ejemplo n.º 8
0
        public 付款合同 Get付款合同(IRepository rep, int 费用实体类型)
        {
            string key = 费用实体类型.ToString();

            if (!s_fkhts.ContainsKey(key))
            {
                IList <付款合同> list = (rep as Feng.NH.INHibernateRepository).List <付款合同>(NHibernate.Criterion.DetachedCriteria.For <付款合同>()
                                                                                       .Add(NHibernate.Criterion.Expression.Eq("业务类型编号", 费用实体类型))
                                                                                       .Add(NHibernate.Criterion.Expression.Le("生效时间", System.DateTime.Today))
                                                                                       .AddOrder(NHibernate.Criterion.Order.Desc("生效时间"))
                                                                                       .SetMaxResults(1));

                if (list.Count > 0)
                {
                    付款合同 fkht = list[0];
                    rep.Initialize(fkht.合同费用项, fkht);
                    s_fkhts[key] = fkht;
                }
                else
                {
                    s_fkhts[key] = null;
                }
            }
            return(s_fkhts[key]);
        }
 public void Initialize()
 {
     string connection =
         @"Data Source=(localdb)\ProjectsV12;Initial Catalog=SouthendUni.StudentSite.Database;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False";
     _repository = Resolve<IRepository<PermissionLevel,int>>();
     _repository.Initialize(connection);
 }
        private void 实时监控异常处理_Load(object sender, EventArgs e)
        {
            AssociateDataControls(new Control[] {
                pnl作业号, pnl车牌号, pnl任务性质, pnl货物特征, pnl时间要求, pnl起始地途经地终止地,
                pnl备注, pnl理由
            }, m_dm, "实时监控_车辆作业_作业退回申请");

            车辆作业 clzy = m_clzy;

            m_dm.SetDataBinding(new List <车辆作业> {
                m_clzy
            }, string.Empty);
            m_dm.Position = 0;
            m_dm.DisplayCurrent();

            StringBuilder sb = new StringBuilder();

            using (IRepository rep = ServiceProvider.GetService <IRepositoryFactory>().GenerateRepository <专家任务>())
            {
                rep.Initialize(clzy.专家任务.任务, clzy.专家任务);
                foreach (var rw in clzy.专家任务.任务)
                {
                    if (sb.Length > 0)
                    {
                        sb.Append(",");
                    }
                    sb.Append(rw.货物特征);
                }
            }
            m_dm.DataControls["货物特征"].SelectedDataValue = sb.ToString();

            m_dm.DataControls["理由"].ReadOnly = false;
        }
Ejemplo n.º 11
0
        public void UnConfirmSzzt(IRepository rep, 凭证 entity)
        {
            try
            {
                //if (entity.凭证类别 == 凭证类别.收款凭证)
                //{
                //    throw new InvalidUserOperationException("收款凭证不需要撤销收支确认!");
                //}
                if (!entity.收支状态)
                {
                    //throw new InvalidUserOperationException("还未通过收支确认,不需要撤销!");
                    // 当作废时
                    return;
                }

                entity.收支状态 = false;
                rep.Initialize(entity.凭证收支明细, entity);
                foreach (凭证收支明细 i in entity.凭证收支明细)
                {
                    凭证收支明细Dao.取消支付(rep, i);
                }

                this.Update(rep, entity);
            }
            catch (Exception)
            {
                entity.收支状态 = true;
            }
        }
Ejemplo n.º 12
0
        static void Main(string[] args)
        {
            Console.WriteLine("Gnosis Repository Test");

            try
            {
                artistCache = new Cache <Artist>();
                workCache   = new Cache <Work>();
                artistStore = new SQLiteArtistDatabase();
                workStore   = new SQLiteWorkDatabase(artistCache, workCache);
                repository  = new Repository(artistCache, artistStore, workCache, workStore);
                repository.Initialize();

                //cache = new GlobalCache();
                //database = new GlobalDatabase();
                //database.Initialize(cache);

                //repository = new GlobalRepository(cache, database);

                //AddAlbum();
                DisplayInfo();

                Console.WriteLine("Artist Count: {0}", artistCache.Entities.Count());
                Console.WriteLine("Work Count: {0}", workCache.Entities.Count());
            }
            catch (Exception ex)
            {
                Console.WriteLine("ERROR");
                Console.WriteLine(ex.Message);
                Console.WriteLine(ex.StackTrace);
            }

            Console.WriteLine("Press ENTER to close");
            Console.ReadLine();
        }
Ejemplo n.º 13
0
        /// <summary>
        /// 提交
        /// </summary>
        /// <param name="rep"></param>
        /// <param name="entity"></param>
        public override void Submit(IRepository rep, 进口票 entity)
        {
            rep.Initialize(entity.箱, entity);

            if (!entity.箱量.HasValue || entity.箱量.Value != entity.箱.Count)
            {
                throw new InvalidUserOperationException("箱量不付,请重新填写!");
            }
            if (!entity.到港时间.HasValue)
            {
                throw new InvalidUserOperationException("到港时间不能为空!");
            }

            for (int i = 0; i < entity.箱.Count - 1; i++)
            {
                for (int k = i + 1; k < entity.箱.Count; k++)
                {
                    if (entity.箱[i].箱号 == entity.箱[k].箱号 && !string.IsNullOrEmpty(entity.箱[i].箱号))
                    {
                        throw new InvalidUserOperationException("包含了重复箱号,无法提交");
                    }
                }
            }

            entity.Submitted = true;
            this.Update(rep, entity);
        }
Ejemplo n.º 14
0
        public async Task Initialize()
        {
            await _repository.Initialize();

            await AddTransactionsViewModel.Initialize();

            SearchTransactions.Initialize();

            var i = 0;

            while (true)
            {
                var monthBalanceViewModel = new MonthBalanceViewModel(DateTime.Now.PreviousMonth(i), _repository, _windowService);
                await monthBalanceViewModel.Initialize();

                if (monthBalanceViewModel.TotalBalance.Income > 0 || monthBalanceViewModel.TotalBalance.Expense < 0 || i == 0) // always add current month
                {
                    monthBalanceViewModel.DetailTransactionsRequested += async(sender, args) =>
                    {
                        await SearchTransactions.SearchForDatesAndCategory(args.DateFrom, args.DateTo, args.Category);
                    };
                    MonthBalanceViewModels.Add(monthBalanceViewModel);
                    i++;
                }
                else
                {
                    break;
                }
            }

            await CheckGoalsButtons();
        }
Ejemplo n.º 15
0
        private void Awake()
        {
            IUIStack uiStack = gameObject.AddComponent <UIStack>();

            uiStack.SetDependencies(_slider, permanentbottom);
            BasePopup.SetDependencies(uiStack);
            permanentbottom._uiStack = uiStack;

            Application.targetFrameRate = 45;
            EventBus.Instance.register <IRepositoryEvents>(gameObject);
            StorageManager instance = StorageManager.Instance;

            _repo = new Repository();
            BaseModel.SetDependencies(_repo);

            _subjectController.SetDependencies(_repo);
            _subjectController2.SetDependencies(_repo);
            _favView.SetDependencies(_repo);
            _homeView.SetDependencies(_repo);
            _registerView.SetDependencies(_repo);
            _ratingView.SetDependencies(_repo);
            _loginView.SetDependencies(this);
            _settingsView.SetGuiRoot(this);
            UserManager.Instance.SetRepo(_repo);
            _repo.Initialize();
        }
Ejemplo n.º 16
0
        static void Main(string[] args)
        {
            Console.WriteLine("Gnosis Repository Test");

            try
            {
                artistCache = new Cache<Artist>();
                workCache = new Cache<Work>();
                artistStore = new SQLiteArtistDatabase();
                workStore = new SQLiteWorkDatabase(artistCache, workCache);
                repository = new Repository(artistCache, artistStore, workCache, workStore);
                repository.Initialize();

                //cache = new GlobalCache();
                //database = new GlobalDatabase();
                //database.Initialize(cache);

                //repository = new GlobalRepository(cache, database);

                //AddAlbum();
                DisplayInfo();

                Console.WriteLine("Artist Count: {0}", artistCache.Entities.Count());
                Console.WriteLine("Work Count: {0}", workCache.Entities.Count());
            }
            catch (Exception ex)
            {
                Console.WriteLine("ERROR");
                Console.WriteLine(ex.Message);
                Console.WriteLine(ex.StackTrace);
            }

            Console.WriteLine("Press ENTER to close");
            Console.ReadLine();
        }
Ejemplo n.º 17
0
        public void Unaudit(IRepository rep, 凭证 entity)
        {
            try
            {
                //if (entity.凭证类别 == 凭证类别.付款凭证)
                //{
                //    throw new InvalidUserOperationException("付款凭证不需要撤销审核!");
                //}
                if (!entity.审核状态)
                {
                    //throw new InvalidUserOperationException("还未通过审核,不需要撤销!");
                    return;
                }

                rep.Initialize(entity.凭证费用明细, entity);
                entity.审核状态 = false;
                UngeneratePzYsyf(rep, entity);

                this.Update(rep, entity);
            }
            catch (Exception)
            {
                entity.审核状态 = true;
            }
        }
Ejemplo n.º 18
0
        /// <summary>
        /// 撤销提交
        /// </summary>
        /// <param name="rep"></param>
        /// <param name="entity"></param>
        public override void Unsubmit(IRepository rep, 对账单 entity)
        {
            entity.Submitted = false;
            entity.金额        = null;

            this.Update(rep, entity);

            rep.Initialize(entity.费用, entity);
            foreach (费用 i in entity.费用)
            {
                if (i.凭证费用明细 != null)
                {
                    throw new InvalidUserOperationException("费用已经出凭证!");
                }
            }

            switch (entity.对账单类型)
            {
            case (int)财务对账单类型.固定资产折旧:
                UngenerateDzdYsyf(rep, entity);
                break;

            case (int)财务对账单类型.坏账:
                break;

            case (int)财务对账单类型.应收调节款:
                UngenerateDzdYsyf(rep, entity);
                break;

            default:
                throw new NotSupportedException("Not Supported 对账单类型 of " + entity.对账单类型 + "!");
            }
        }
Ejemplo n.º 19
0
        public 车队合同 Get车队合同(IRepository rep)
        {
            string key = "车队合同";

            if (!s_cdhts.ContainsKey(key))
            {
                IList <车队合同> list = (rep as Feng.NH.INHibernateRepository).List <车队合同>(NHibernate.Criterion.DetachedCriteria.For <车队合同>()
                                                                                       .Add(NHibernate.Criterion.Expression.Le("有效期始", System.DateTime.Today))
                                                                                       .Add(NHibernate.Criterion.Expression.Ge("有效期止", System.DateTime.Today))
                                                                                       .AddOrder(NHibernate.Criterion.Order.Desc("签约时间"))
                                                                                       .SetMaxResults(1));

                if (list.Count > 0)
                {
                    车队合同 fkht = list[0];
                    rep.Initialize(fkht.合同费用项, fkht);
                    s_cdhts[key] = fkht;
                }
                else
                {
                    s_cdhts[key] = null;
                }
            }
            return(s_cdhts[key]);
        }
Ejemplo n.º 20
0
        public void Audit(IRepository rep, 凭证 entity)
        {
            try
            {
                //if (entity.凭证类别 == 凭证类别.付款凭证)
                //{
                //    throw new InvalidUserOperationException("付款凭证不需要审核!");
                //}
                if (entity.审核状态)
                {
                    throw new InvalidUserOperationException("已经通过审核!");
                }

                rep.Initialize(entity.凭证费用明细, entity);
                if (entity.凭证费用明细 != null && entity.凭证费用明细.Count > 0)
                {
                    entity.审核状态 = true;
                    GeneratePzYsyf(rep, entity);
                }
                else
                {
                    entity.审核状态 = false;
                }

                this.Update(rep, entity);
            }
            catch (Exception)
            {
                entity.审核状态 = false;
            }
        }
Ejemplo n.º 21
0
        public static void 生成相同费用(ArchiveOperationForm masterForm)
        {
            if (masterForm.MasterGrid.GridControl.SelectedRows.Count == 0)
            {
                ServiceProvider.GetService <IMessageBox>().ShowWarning("请选择费用!");
                return;
            }
            if (!MessageForm.ShowYesNo("是否要生成选中项相同的费用?", "确认"))
            {
                return;
            }

            int cnt = 0;

            using (IRepository rep = ServiceProvider.GetService <IRepositoryFactory>().GenerateRepository <非业务费用>())
            {
                foreach (Xceed.Grid.Row row in masterForm.MasterGrid.GridControl.SelectedRows)
                {
                    Xceed.Grid.DataRow dataRow = row as Xceed.Grid.DataRow;
                    if (dataRow == null)
                    {
                        continue;
                    }

                    非业务费用 entity = dataRow.Tag as 非业务费用;

                    if (entity.非业务费用实体.费用实体类型编号 != 37 /*费用实体类型.其他非业务*/)
                    {
                        continue;
                    }

                    rep.Initialize(entity.费用实体, entity);

                    非业务费用 item = new 非业务费用();
                    item.收付标志   = entity.收付标志;
                    item.费用实体   = entity.费用实体;
                    item.费用项编号  = entity.费用项编号;
                    item.费用类别编号 = entity.费用类别编号;
                    item.金额     = entity.金额;
                    item.相关人编号  = entity.相关人编号;

                    object newEntity = masterForm.ControlManager.AddNew();
                    if (newEntity != null)
                    {
                        masterForm.ControlManager.DisplayManager.Items[masterForm.ControlManager.DisplayManager.Position] = item;
                        masterForm.ControlManager.EndEdit();
                        (masterForm.MasterGrid.CurrentRow as Xceed.Grid.DataRow).Cells["费用项编号"].CellEditorManager = dataRow.Cells["费用项编号"].CellEditorManager;
                        cnt++;
                    }
                    else
                    {
                        masterForm.ControlManager.CancelEdit();
                        break;
                    }
                }
            }

            MessageForm.ShowInfo("已生成" + cnt + "条费用!");
        }
Ejemplo n.º 22
0
        /// <summary>
        /// (带rep的Transaction在外面
        /// </summary>
        /// <param name="rep"></param>
        /// <param name="entity"></param>
        public void ConfirmSzzt(IRepository rep, 凭证 entity)
        {
            try
            {
                //if (entity.凭证类别 == 凭证类别.收款凭证)
                //{
                //    throw new InvalidUserOperationException("收款凭证不需要收支确认!");
                //}
                if (entity.收支状态)
                {
                    throw new InvalidUserOperationException("已经通过收支确认!");
                }

                rep.Initialize(entity.凭证收支明细, entity);
                if (entity.凭证收支明细 != null && entity.凭证收支明细.Count > 0)
                {
                    decimal sum = 0;
                    foreach (凭证收支明细 item in entity.凭证收支明细)
                    {
                        if (item.收付标志 == 收付标志.收)
                        {
                            sum -= item.金额.Value;
                        }
                        else if (item.收付标志 == 收付标志.付)
                        {
                            sum += item.金额.Value;
                        }
                        else
                        {
                            throw new InvalidUserOperationException("未填写有效的收付标志!");
                        }
                    }
                    decimal rsum = entity.凭证类别 == 凭证类别.付款凭证 ? sum : -sum;
                    if (entity.金额.数额 != rsum)
                    {
                        throw new InvalidUserOperationException("凭证收支明细总额和凭证金额不符!");
                    }

                    entity.收支状态 = true;

                    foreach (凭证收支明细 i in entity.凭证收支明细)
                    {
                        凭证收支明细Dao.支付(rep, i);
                    }
                }
                else
                {
                    throw new InvalidUserOperationException("必须填写凭证收支明细!");
                    //entity.收支状态 = false;
                }

                this.Update(rep, entity);
            }
            catch (Exception)
            {
                entity.收支状态 = false;
                throw;
            }
        }
Ejemplo n.º 23
0
        /// <summary>
        /// 撤销提交
        /// </summary>
        /// <param name="rep"></param>
        /// <param name="entity"></param>
        public override void Unsubmit(IRepository rep, 工资单 entity)
        {
            rep.Initialize(entity.费用, entity);
            System.Diagnostics.Debug.Assert(entity.费用.Count == 1, "工资单费用有且只有一条!");

            rep.Delete(entity.费用[0]);
            entity.费用.Clear();
        }
        private async static Task InitializeRepositories(IRepository <Neuron> neuronRepository, IRepository <Terminal> terminalRepository, IRepository <Settings> settingsRepository)
        {
            await neuronRepository.Initialize();

            await terminalRepository.Initialize();

            await settingsRepository.Initialize();
        }
Ejemplo n.º 25
0
        public static void 生成油费对外费用(ArchiveOperationForm masterForm)
        {
            if (MessageForm.ShowYesNo("是否自动生成油费对外费用?", "提示"))
            {
                int count = 0;
                try
                {
                    if (masterForm.DisplayManager.Items != null && masterForm.DisplayManager.Items.Count > 0)
                    {
                        foreach (Xceed.Grid.Row row in masterForm.MasterGrid.GridControl.SelectedRows)
                        {
                            Xceed.Grid.DataRow dataRow = row as Xceed.Grid.DataRow;
                            if (dataRow == null)
                            {
                                continue;
                            }

                            业务费用 fy = dataRow.Tag as 业务费用;

                            // 把 费用归属=驾驶员 费用项=204 的记录 逐条生成  费用归属=对外的
                            // 收付标志 反一下   相关人=null
                            using (IRepository rep = ServiceProvider.GetService <IRepositoryFactory>().GenerateRepository <业务费用>())
                            {
                                rep.Initialize(fy.车辆产值, fy);
                            }

                            if (fy.费用归属 == 费用归属.驾驶员 && fy.费用项编号 == "204")
                            {
                                业务费用 kps = masterForm.ControlManager.AddNew() as 业务费用;

                                kps.费用归属  = 费用归属.对外;
                                kps.收付标志  = fy.收付标志 == 收付标志.收 ? 收付标志.付 : 收付标志.收;
                                kps.数量    = fy.数量;
                                kps.费用项编号 = fy.费用项编号;
                                kps.金额    = fy.金额;
                                kps.费用实体  = fy.费用实体;
                                kps.车辆产值  = fy.车辆产值;
                                kps.车辆编号  = fy.车辆编号;
                                kps.任务    = fy.任务;

                                masterForm.DisplayManager.DisplayCurrent();
                                masterForm.ControlManager.EndEdit(true);
                                count++;
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    throw new InvalidUserOperationException(ex.Message);
                }
                finally
                {
                    MessageForm.ShowInfo("已生成 " + count + " 条对外费用!");
                }
            }
        }
Ejemplo n.º 26
0
        /// <summary>
        /// 作废。
        /// 付款凭证,需收支状态=false,此时反审核。
        /// 收款凭证,需审核状态=false,此时反支付确认
        /// </summary>
        /// <param name="rep"></param>
        /// <param name="entity"></param>
        public void Cancellate(IRepository rep, object entity)
        {
            凭证 pz = entity as 凭证;

            if (pz.凭证类别 == 凭证类别.付款凭证)
            {
                pz.操作人 = "会计";
            }
            else
            {
                pz.操作人 = "出纳";
            }


            try
            {
                if (pz.凭证类别 == 凭证类别.付款凭证)
                {
                    if (pz.收支状态 != false)
                    {
                        throw new InvalidUserOperationException("凭证未撤销收支确认!");
                    }
                    Unaudit(rep, pz);
                }
                else if (pz.凭证类别 == 凭证类别.收款凭证)
                {
                    if (pz.审核状态 != false)
                    {
                        throw new InvalidUserOperationException("凭证未撤销审核!");
                    }
                    UnConfirmSzzt(rep, pz);
                }

                pz.Submitted = false;
                pz.是否作废      = true;

                // 无论收付,都要撤销费用
                foreach (凭证费用明细 pzs1 in pz.凭证费用明细)
                {
                    rep.Initialize(pzs1.费用, pzs1);
                    foreach (费用 fee in pzs1.费用)
                    {
                        fee.凭证费用明细 = null;
                        (new 费用Dao()).Update(rep, fee);
                    }

                    (new HdBaseDao <凭证费用明细>()).Update(rep, pzs1);
                }

                this.Update(rep, pz);
            }
            catch (Exception)
            {
                pz.是否作废 = false;
            }
        }
Ejemplo n.º 27
0
        private async Task EnsureInitialized()
        {
            if (_isInitialized)
            {
                return;
            }

            await _repository.Initialize();

            _isInitialized = true;
        }
Ejemplo n.º 28
0
        /// <summary>
        /// Inicializa los repositorios internos de la clase.
        /// </summary>
        public Sistema(IPersonaRepository repositoryPersona, IRepository <Usuario> repositoryUsuario)
        {
            // Setter!
            _repositoryPersona = repositoryPersona ??
                                 throw new ArgumentNullException("Se requiere el repositorio de personas");
            _repositoryUsuario = repositoryUsuario ??
                                 throw new ArgumentNullException("Se requiere repositorio de usuarios");

            // Inicializacion del repositorio.
            _repositoryPersona.Initialize();
            _repositoryUsuario.Initialize();
        }
Ejemplo n.º 29
0
        public void Load(string extraDataKey)
        {
            _dynamicExpressionQuery = ObjectFactory.GetInstance<IDynamicExpressionQuery>();
            _repository = ObjectFactory.GetNamedInstance<IRepository>("NoFiltersOrInterceptor");

            _securityDataService = ObjectFactory.GetInstance<ISecurityDataService>();

            _repository.Initialize();

            createUser();
            _repository.Commit();
        }
Ejemplo n.º 30
0
        /// <summary>
        /// 提交
        /// </summary>
        /// <param name="rep"></param>
        /// <param name="entity"></param>
        public override void Submit(IRepository rep, 空运票 entity)
        {
            rep.Initialize(entity.箱, entity);

            //if (!entity.箱量.HasValue || entity.箱量.Value != entity.箱.Count)
            //{
            //    throw new InvalidUserOperationException("箱量不付,请重新填写!");
            //}

            entity.Submitted = true;
            this.Update(rep, entity);
        }
Ejemplo n.º 31
0
        internal static void UngenerateDzdYsyf(IRepository rep, 对账单 dzd)
        {
            rep.Initialize(dzd.应收应付款, dzd);

            //IList<应收应付款> ysyfk = rep.Session.CreateCriteria<应收应付款>()
            //    .Add(NHibernate.Criterion.Expression.Eq("应收应付源", dzd))
            //    .List<应收应付款>();
            foreach (应收应付款 i in dzd.应收应付款)
            {
                rep.Delete(i);
            }
            dzd.应收应付款.Clear();
        }
Ejemplo n.º 32
0
        private void Initialize()
        {
            _metaDataStore.Initialize();
            _uaSource.Connect(Settings.UaServerUrl, USER_NAME, PASSWORD);
            _eventHub.Open();

            new Thread(KeepSettingsUpToDate).Start();

            if (Settings.PublishToEventHub)
            {
                new Thread(Publisher).Start();
            }
        }
Ejemplo n.º 33
0
        public static void 自动生成费用(ArchiveOperationForm masterForm)
        {
            Dictionary <string, object> setData = masterForm.Tag as Dictionary <string, object>;
            费用实体 entity;

            using (IRepository rep = ServiceProvider.GetService <IRepositoryFactory>().GenerateRepository <业务费用>())
            {
                rep.BeginTransaction();
                entity = rep.Get <费用实体>(setData["费用实体"]);
                rep.CommitTransaction();
            }

            if (entity.费用实体类型编号 == 11 /*费用实体类型.进口*/)
            {
                using (IRepository rep = ServiceProvider.GetService <IRepositoryFactory>().GenerateRepository <进口票>())
                {
                    进口票 piao = rep.Get <进口票>(setData["费用实体"]);
                    rep.Initialize(piao.箱, piao);
                    process_fy_yw.批量生成费用(rep, entity.费用实体类型编号, piao, piao.箱, (string)setData["费用项"], !setData.ContainsKey("收付标志") ? null : (收付标志?)setData["收付标志"]);
                }
            }
            else if (entity.费用实体类型编号 == 15 /*费用实体类型.内贸出港*/)
            {
                using (IRepository rep = ServiceProvider.GetService <IRepositoryFactory>().GenerateRepository <内贸出港票>())
                {
                    内贸出港票 piao = rep.Get <内贸出港票>(setData["费用实体"]);
                    rep.Initialize(piao.箱, piao);
                    process_fy_yw.批量生成费用(rep, entity.费用实体类型编号, piao, piao.箱, (string)setData["费用项"], !setData.ContainsKey("收付标志") ? null : (收付标志?)setData["收付标志"]);
                }
            }
            else if (entity.费用实体类型编号 == 45 /*费用实体类型.进口其他业务*/)
            {
                using (IRepository rep = ServiceProvider.GetService <IRepositoryFactory>().GenerateRepository <进口其他业务票>())
                {
                    进口其他业务票 piao = rep.Get <进口其他业务票>(setData["费用实体"]);
                    rep.Initialize(piao.箱, piao);
                    process_fy_yw.批量生成费用(rep, entity.费用实体类型编号, piao, piao.箱, (string)setData["费用项"], !setData.ContainsKey("收付标志") ? null : (收付标志?)setData["收付标志"]);
                }
            }
            else if (entity.费用实体类型编号 == 13 /*费用实体类型.出口*/)
            {
                using (IRepository rep = ServiceProvider.GetService <IRepositoryFactory>().GenerateRepository <出口票>())
                {
                    出口票 piao = rep.Get <出口票>(setData["费用实体"]);
                    rep.Initialize(piao.箱, piao);
                    process_fy_yw.批量生成费用(rep, entity.费用实体类型编号, piao, piao.箱, (string)setData["费用项"], !setData.ContainsKey("收付标志") ? null : (收付标志?)setData["收付标志"]);
                }
            }

            (masterForm.MasterGrid as IBoundGrid).ReloadData();
        }
Ejemplo n.º 34
0
        public static int 批量生成费用(IRepository rep, 车辆产值 票, IEnumerable 箱, string 费用项编号, 收付标志? 收付标志)
        {
            int cnt = 0;

            // 需按照委托人合同和付款合同生成相应费用和费用理论值
            // 如果总体来生成,则按照:
            // 如果费用已经打了完全标志,则不生成。如果相应理论值已经生成过,也不生成。
            // 如果单个费用项来生成,则不管理论值是否已经生成过
            // Todo: 理论值可能显示生成票的,后来信息完全了再生成箱的,此时要删除票的
            //using (IRepository rep = ServiceProvider.GetService<IRepositoryFactory>().GenerateRepository(票.GetType()))
            {
                try
                {
                    rep.BeginTransaction();

                    IList<业务费用理论值> llzs = (rep as Feng.NH.INHibernateRepository).List<业务费用理论值>(NHibernate.Criterion.DetachedCriteria.For<业务费用理论值>()
                                            .Add(NHibernate.Criterion.Expression.Eq("费用实体.ID", 票.ID)));

                    rep.Initialize(票.费用, 票);

                    process_fy_generate.批量生成费用(rep, 票, 箱, 费用项编号, 收付标志, llzs);

                    ////  有几项(发票税,贴息费)要看收款费用
                    // 不行,会多生成
                    //批量生成费用付款(rep, 费用实体类型, 票, 箱, 费用项编号, 收付标志, llzs);

                    rep.CommitTransaction();
                }
                catch (Exception ex)
                {
                    rep.RollbackTransaction();
                    ServiceProvider.GetService<IExceptionProcess>().ProcessWithNotify(ex);
                }
            }
            return cnt;
        }
Ejemplo n.º 35
0
 // 返回MinValue:没符合的条件,不生成理论值,不生成费用(内部外部都不生成)
 // 返回0:符合条件,生成理论值, 但不生成费用(内部外部都不生成)
 // 返回NULL:符合条件,不生成理论值,但生成空费用记录。在不在生成全部的时候生成看配置,生成单费用项的时候生成
 // 返回具体值:生成记录
 // 根据相关人不同得到理论值
 private static decimal? Get理论值金额(IRepository rep, 合同费用项 htfyx, object entity)
 {
     rep.Initialize(htfyx.费用理论值, htfyx);
     foreach (费用理论值信息 i in htfyx.费用理论值)
     {
         string exp;
         if (i.条件.Contains(System.Environment.NewLine))
         {
             exp = s_feeThoeryGenerate2.Replace("%IFEXPRESSION%", i.条件);
         }
         else
         {
             exp = s_feeThoeryGenerate.Replace("%IFEXPRESSION%", i.条件);
         }
         object ret = Script.ExecuteStatement(exp, new Dictionary<string, object> { { "entity", entity } });
         if (ConvertHelper.ToBoolean(ret).Value)
         {
             if (string.IsNullOrEmpty(i.结果))
             {
                 return null;
             }
             else
             {
                 if (i.结果.Contains(System.Environment.NewLine))
                 {
                     exp = s_feeThoeryGenerateResult2.Replace("%IFEXPRESSION%", i.结果);
                 }
                 else
                 {
                     exp = s_feeThoeryGenerateResult.Replace("%IFEXPRESSION%", i.结果);
                 }
                 ret = Script.ExecuteStatement(exp, new Dictionary<string, object> { { "entity", entity }, { "rep", rep } });
                 decimal? d = Feng.Utils.ConvertHelper.ToDecimal(ret);
                 if (d.HasValue)
                     return d.Value;
                 else
                     return null;
             }
         }
     }
     return decimal.MinValue;
 }