Exemplo n.º 1
0
        private void TreeView_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e)
        {
            if (sender != null)
            {
                var treeView = sender as TreeView;
                currTreeItmes = treeView.SelectedItem as TreeViewItem;
            }
            TreeViewItem treeViewItem = e.NewValue as TreeViewItem;

            if (treeViewItem != null)
            {
                QuerySubjectCompanyData(treeViewItem);
                this.currentTreeViewItem = treeViewItem;

                VirtualPost virtualPost = currentTreeViewItem.DataContext as VirtualPost;
                if (virtualPost != null)
                {
                    this.CurrentOrderEntity = CreatePostEntity(virtualPost, treeViewItem, string.Empty);
                }
                else
                {
                    OrderEntity entity = currentTreeViewItem.DataContext as OrderEntity;
                    this.CurrentOrderEntity = entity;
                }
            }
        }
Exemplo n.º 2
0
 //处理默认活动经费岗位的设置
 public void CheckMoneyAssign(ObservableCollection <FBEntity> listSave)
 {
     #region 处理默认活动经费岗位的设置
     listSave.ForEach(p =>
     {
         foreach (TreeViewItem tvi in this.currentTreeViewItem.Items)
         {
             OrderEntity oe = tvi.DataContext as OrderEntity;
             bool tf        = true;
             if (oe != null)
             {
                 VirtualPost virtualPost = oe.Entity as VirtualPost;
                 //活动经费处理初始化
                 if (virtualPost != null && tf)
                 {
                     tf = false;
                     CreatePostEntity(virtualPost, tvi, "MoneyAssign");
                 }
             }
             else
             {
                 VirtualPost virtualPost = tvi.DataContext as VirtualPost;
                 //活动经费处理初始化
                 if (virtualPost != null && tf)
                 {
                     CreatePostEntity(virtualPost, tvi, "MoneyAssign");
                 }
             }
         }
     });
     #endregion
 }
Exemplo n.º 3
0
        //处理默认活动经费岗位的设置
        public void CheckMoneyAssign(ObservableCollection <FBEntity> listSave)
        {
            #region 处理默认活动经费岗位的设置
            listSave.ForEach(p =>
            {
                foreach (TreeViewItem tvi in this.currentTreeViewItem.Items)
                {
                    OrderEntity oe = tvi.DataContext as OrderEntity;
                    if (oe != null)
                    {
                        VirtualPost virtualPost = tvi.DataContext as VirtualPost;
                        //活动经费处理初始化
                        if (virtualPost != null)
                        {
                            //CreatePostEntity(virtualPost, tvi, "MoneyAssign");

                            T_FB_SUBJECTPOST subjectPost = tvi.DataContext as T_FB_SUBJECTPOST;
                            if (subjectPost != null)
                            {
                                if (subjectPost.T_FB_SUBJECT != null && subjectPost.T_FB_SUBJECT.SUBJECTID == DataCore.SystemSetting.MONEYASSIGNSUBJECTID)
                                {
                                    if (subjectPost.ACTIVED != 1 || subjectPost.ISPERSON != 1)
                                    {
                                        ComfirmWindow.ConfirmationBoxs("提示", "活动经费在此只能是启用并勾选分配个人,请确认。", Utility.GetResourceStr("CONFIRM"), MessageIcon.Question);
                                    }
                                    //sender.SetObjValue("ACTIVED", 1);
                                    //sender.SetObjValue("ISPERSON", 1);
                                }
                            }
                        }
                    }
                }
            });
            #endregion
        }
Exemplo n.º 4
0
        public List <VirtualCompany> InitData()
        {
            string userID = "";

            List <OrganizationWS.T_HR_COMPANY>    comList  = organizationService.GetCompanyActived(userID).ToList();
            List <OrganizationWS.T_HR_DEPARTMENT> deptList = organizationService.GetDepartmentActived(userID).ToList();
            List <OrganizationWS.T_HR_POST>       postList = organizationService.GetPostActived(userID).ToList();

            List <VirtualCompany> listCompany = new List <VirtualCompany>();

            comList.ForEach(comHR =>
            {
                List <VirtualDepartment> listDepartment = new List <VirtualDepartment>();

                VirtualCompany vc       = new VirtualCompany();
                vc.ID                   = comHR.COMPANYID;
                vc.Name                 = comHR.CNAME;
                vc.DepartmentCollection = listDepartment;
                listCompany.Add(vc);

                List <OrganizationWS.T_HR_DEPARTMENT> deptListPart = deptList.FindAll(item =>
                {
                    return(item.T_HR_COMPANY.COMPANYID == comHR.COMPANYID);
                });

                deptListPart.ForEach(deptHR =>
                {
                    List <VirtualPost> listPost = new List <VirtualPost>();

                    VirtualDepartment vd = new VirtualDepartment();
                    vd.ID             = deptHR.DEPARTMENTID;
                    vd.Name           = deptHR.T_HR_DEPARTMENTDICTIONARY.DEPARTMENTNAME;
                    vd.VirtualCompany = vc;
                    vd.PostCollection = listPost;
                    listDepartment.Add(vd);

                    List <OrganizationWS.T_HR_POST> postListPart = postList.FindAll(item =>
                    {
                        return(item.T_HR_DEPARTMENT.DEPARTMENTID == deptHR.DEPARTMENTID);
                    });
                    postListPart.ForEach(postHR =>
                    {
                        VirtualPost vp       = new VirtualPost();
                        vp.ID                = postHR.POSTID;
                        vp.Name              = postHR.T_HR_POSTDICTIONARY.POSTNAME;
                        vp.VirtualCompany    = vc;
                        vp.VirtualDepartment = vd;
                        listPost.Add(vp);
                    });
                });
            });
            return(listCompany);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 添加不生效岗位
        /// </summary>
        /// <param name="subjectDepartment"></param>
        /// <param name="virtualPost"></param>
        private void CreateNonActionPost(T_FB_SUBJECTDEPTMENT subjectDepartment, VirtualPost virtualPost)
        {
            ObservableCollection <FBEntity> listFBEntities = new ObservableCollection <FBEntity>();
            FBEntity fbEntityPostNew = this.CreateSubjectPost(subjectDepartment, virtualPost, "ACTIVED");

            listFBEntities.Add(fbEntityPostNew);
            FBEntity postFBEntity = virtualPost.ToFBEntity();

            postFBEntity.AddFBEntities <T_FB_SUBJECTPOST>(listFBEntities);
            OrderEntity entityPost = new OrderEntity(postFBEntity);

            EntityList.Add(entityPost);
        }
Exemplo n.º 6
0
        internal List <VirtualPost> GetVirtualPost(QueryExpression qe)
        {
            List <VirtualPost> listPost = new List <VirtualPost>();
            string             action   = ((int)Utility.Permissions.Browse).ToString();
            //if (listPost.Count == 0)
            //{
            List <OrganizationWS.T_HR_POST> postList = organizationService.GetPostByEntityPerm(qe.VisitUserID, action, qe.VisitModuleCode).ToList();

            postList.ForEach(postHR =>
            {
                VirtualPost vp = new VirtualPost();
                vp.ID          = postHR.POSTID;
                vp.Name        = postHR.T_HR_POSTDICTIONARY.POSTNAME;
                listPost.Add(vp);
            });
            //}
            return(listPost);
        }
Exemplo n.º 7
0
        /// <summary>
        /// 新增岗位科目
        /// </summary>
        /// <param name="sd"></param>
        /// <returns></returns>
        private FBEntity CreateSubjectPost(T_FB_SUBJECTDEPTMENT sd, VirtualPost virtualPost, string strFlag)
        {
            T_FB_SUBJECTPOST post = new T_FB_SUBJECTPOST();

            post.T_FB_SUBJECTDEPTMENT = sd;
            post.T_FB_SUBJECT         = sd.T_FB_SUBJECT;
            post.LIMITBUDGEMONEY      = 0;
            post.SUBJECTPOSTID        = Guid.NewGuid().ToString();

            post.OWNERID           = DataCore.SuperUser.Value.ToString();
            post.OWNERPOSTID       = virtualPost.ID;
            post.OWNERDEPARTMENTID = virtualPost.OWNERDEPARTMENTID;
            post.OWNERCOMPANYID    = virtualPost.OWNERCOMPANYID;

            //岗位默认处理
            post = SubjectPostChanged(sd, post, strFlag);

            FBEntity fbEntityPostNew = post.ToFBEntity();

            fbEntityPostNew.FBEntityState = FBEntityState.Added;

            return(fbEntityPostNew);
        }
Exemplo n.º 8
0
        /// <summary>
        /// 创建或获取相应岗位科目
        /// </summary>
        /// <param name="virtualPost"></param>
        /// <returns></returns>
        private OrderEntity CreatePostEntity(VirtualPost virtualPost, TreeViewItem treeViewItem, string strFlag)
        {
            ObservableCollection<FBEntity> listFBEntities = new ObservableCollection<FBEntity>();
            OrderEntity oeDepartment = dictDepartment[virtualPost.VirtualDepartment];

            // 已存在的岗位科目
            ObservableCollection<FBEntity> listOfSubjectDepartmentFB = oeDepartment.GetRelationFBEntities(typeof(T_FB_SUBJECTDEPTMENT).Name);

            // 1. 获取所有已启用的部门科目
            var itemsDepartmentActived = listOfSubjectDepartmentFB.Where(item =>
            {
                return (item.Entity as T_FB_SUBJECTDEPTMENT).ACTIVED == 1;
            });

            // 2. 遍历所有已启用的部门科目, 添加相应的岗位科目,已有科目的,则加上原有的,没有的,则新增

            foreach (FBEntity entityDepartment in itemsDepartmentActived)
            {
                T_FB_SUBJECTDEPTMENT sd = entityDepartment.Entity as T_FB_SUBJECTDEPTMENT;

                // 是否已有岗位科目的记录
                List<FBEntity> listPost = entityDepartment.GetRelationFBEntities(typeof(T_FB_SUBJECTPOST).Name, item =>
                {
                    return (item.Entity as T_FB_SUBJECTPOST).OWNERPOSTID == virtualPost.ID;
                });

                // 已有岗位科目,添加。没有,就新增         
                if (listPost.Count > 0)
                {
                    T_FB_SUBJECTPOST post = listPost[0].Entity as T_FB_SUBJECTPOST;
                    if (post.ACTIVED != sd.ACTIVED)
                    {
                        listPost[0].FBEntityState = FBEntityState.Modified;
                    }
                    //岗位默认处理
                    if (post != null)
                        post = SubjectPostChanged(sd, post, strFlag);
                    listPost[0].Entity = post;
                    listFBEntities.Add(listPost[0]);
                }
                else
                {
                    //临时添加防止重复数据
                    var a = staticobpost.FirstOrDefault(item => (item.Entity as T_FB_SUBJECTPOST).OWNERPOSTID == virtualPost.ID && (item.Entity as T_FB_SUBJECTPOST).T_FB_SUBJECT != null && (item.Entity as T_FB_SUBJECTPOST).T_FB_SUBJECT.SUBJECTID == sd.T_FB_SUBJECT.SUBJECTID);
                    if (a == null && sd.ACTIVED == 1)
                    {
                        FBEntity fbEntityPostNew = this.CreateSubjectPost(sd, virtualPost, strFlag);
                        listFBEntities.Add(fbEntityPostNew);

                        staticobpost.Add(fbEntityPostNew);
                    }
                    else
                    {
                        listFBEntities.Add(a);
                    }
                }
            }

            FBEntity postFBEntity = virtualPost.ToFBEntity();
            postFBEntity.AddFBEntities<T_FB_SUBJECTPOST>(listFBEntities);
            OrderEntity entityPost = new OrderEntity(postFBEntity);

            Binding binding = new Binding();
            binding.Path = new PropertyPath("Entity.Name");
            treeViewItem.SetBinding(TreeViewItem.HeaderProperty, binding);
            treeViewItem.DataContext = entityPost;
            EntityList.Add(entityPost);
            return entityPost;
        }
Exemplo n.º 9
0
        public List <VirtualCompany> InnerGetCompany(QueryExpression qe)
        {
            try
            {
                string action = ((int)Utility.Permissions.Browse).ToString();

                List <OrganizationWS.T_HR_COMPANY> comList   = organizationService.GetCompanyByEntityPerm(qe.VisitUserID, action, qe.VisitModuleCode).ToList();
                List <OrganizationWS.V_DEPARTMENT> deptList  = organizationService.GetDepartmentView(qe.VisitUserID, action, qe.VisitModuleCode).ToList();
                List <OrganizationWS.V_POST>       vpostList = organizationService.GetPostView(qe.VisitUserID, action, qe.VisitModuleCode).ToList();
                //有效的部门和岗位
                deptList  = deptList.Where(s => s.EDITSTATE == "1").ToList();
                vpostList = vpostList.Where(s => s.EDITSTATE == "1").ToList();
                List <OrganizationWS.T_HR_POST> postList = new List <OrganizationWS.T_HR_POST>();
                try
                {
                    foreach (var ent in vpostList)
                    {
                        OrganizationWS.T_HR_POST pt = new OrganizationWS.T_HR_POST();
                        pt.POSTID       = ent.POSTID;
                        pt.FATHERPOSTID = ent.FATHERPOSTID;
                        pt.CHECKSTATE   = ent.CHECKSTATE;
                        pt.EDITSTATE    = ent.EDITSTATE;

                        pt.T_HR_POSTDICTIONARY = new OrganizationWS.T_HR_POSTDICTIONARY();
                        pt.T_HR_POSTDICTIONARY.POSTDICTIONARYID = Guid.NewGuid().ToString();
                        pt.T_HR_POSTDICTIONARY.POSTNAME         = ent.POSTNAME;

                        pt.T_HR_DEPARTMENT = new OrganizationWS.T_HR_DEPARTMENT();
                        try
                        {
                            string strDepartmentid = deptList.Where(s => s.DEPARTMENTID == ent.DEPARTMENTID).FirstOrDefault().DEPARTMENTID;
                            pt.T_HR_DEPARTMENT.DEPARTMENTID = strDepartmentid;
                            postList.Add(pt);
                        }
                        catch (Exception ex)
                        {
                            SystemBLL.Debug("当前员工:" + qe.VisitUserID + "查询岗位所属部门错误,岗位名称 " + ent.POSTNAME + "岗位id" + ent.POSTID + "没找到所属部门,可能是权限不足导致");
                        }
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }


                List <VirtualCompany> listCompany = new List <VirtualCompany>();
                try
                {
                    comList.ForEach(comHR =>
                    {
                        List <VirtualDepartment> listDepartment = new List <VirtualDepartment>();


                        VirtualCompany vc       = new VirtualCompany();
                        vc.ID                   = comHR.COMPANYID;
                        vc.Name                 = comHR.CNAME;
                        vc.DepartmentCollection = listDepartment;
                        listCompany.Add(vc);

                        List <OrganizationWS.V_DEPARTMENT> deptListPart = deptList.FindAll(item =>
                        {
                            if (item.COMPANYID == null)
                            {
                                return(false);
                            }
                            return(item.COMPANYID == comHR.COMPANYID);
                        });
                        deptListPart.ForEach(deptHR =>
                        {
                            try
                            {
                                List <VirtualPost> listPost = new List <VirtualPost>();

                                VirtualDepartment vd = new VirtualDepartment();
                                vd.ID             = deptHR.DEPARTMENTID;
                                vd.Name           = deptHR.DEPARTMENTNAME;
                                vd.VirtualCompany = vc;
                                vd.PostCollection = listPost;
                                listDepartment.Add(vd);

                                List <OrganizationWS.T_HR_POST> postListPart = postList.FindAll(item =>
                                {
                                    if (item.T_HR_DEPARTMENT.DEPARTMENTID == null)
                                    {
                                        return(false);
                                    }
                                    return(item.T_HR_DEPARTMENT.DEPARTMENTID == deptHR.DEPARTMENTID);
                                });
                                postListPart.ForEach(postHR =>
                                {
                                    try
                                    {
                                        VirtualPost vp       = new VirtualPost();
                                        vp.ID                = postHR.POSTID;
                                        vp.Name              = postHR.T_HR_POSTDICTIONARY.POSTNAME;
                                        vp.VirtualCompany    = vc;
                                        vp.VirtualDepartment = vd;
                                        listPost.Add(vp);
                                    }
                                    catch (Exception ex)
                                    {
                                        throw ex;
                                    }
                                });
                            }
                            catch (Exception ex)
                            {
                                throw ex;
                            }
                        });
                    });
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                return(listCompany);
            }
            catch (Exception ex)
            {
                SystemBLL.Debug(ex.ToString());
                throw new Exception("调用HR服务异常", ex);
            }
        }
Exemplo n.º 10
0
 /// <summary>
 /// 添加不生效岗位
 /// </summary>
 /// <param name="subjectDepartment"></param>
 /// <param name="virtualPost"></param>
 private void CreateNonActionPost(T_FB_SUBJECTDEPTMENT subjectDepartment, VirtualPost virtualPost)
 {
     ObservableCollection<FBEntity> listFBEntities = new ObservableCollection<FBEntity>();
     FBEntity fbEntityPostNew = this.CreateSubjectPost(subjectDepartment, virtualPost, "ACTIVED");
     listFBEntities.Add(fbEntityPostNew);
     FBEntity postFBEntity = virtualPost.ToFBEntity();
     postFBEntity.AddFBEntities<T_FB_SUBJECTPOST>(listFBEntities);
     OrderEntity entityPost = new OrderEntity(postFBEntity);
     EntityList.Add(entityPost);
 }
Exemplo n.º 11
0
        private void CreateNonActionSubjectPost(T_FB_SUBJECTDEPTMENT sd, T_FB_SUBJECTPOST post, VirtualPost virtualPost)
        {
            ObservableCollection <FBEntity> listFBEntities = new ObservableCollection <FBEntity>();

            post.ACTIVED    = 0;
            post.UPDATEDATE = DateTime.Now;
            FBEntity fbEntityPostNew = post.ToFBEntity();

            fbEntityPostNew.FBEntityState = FBEntityState.Modified;
            listFBEntities.Add(fbEntityPostNew);
            FBEntity postFBEntity = virtualPost.ToFBEntity();

            postFBEntity.AddFBEntities <T_FB_SUBJECTPOST>(listFBEntities);
            OrderEntity entityPost = new OrderEntity(postFBEntity);

            EntityList.Add(entityPost);
        }
Exemplo n.º 12
0
        /// <summary>
        /// 创建或获取相应岗位科目
        /// </summary>
        /// <param name="virtualPost"></param>
        /// <returns></returns>
        private OrderEntity CreatePostEntity(VirtualPost virtualPost, TreeViewItem treeViewItem, string strFlag)
        {
            ObservableCollection <FBEntity> listFBEntities = new ObservableCollection <FBEntity>();
            OrderEntity oeDepartment = dictDepartment[virtualPost.VirtualDepartment];

            // 已存在的岗位科目
            ObservableCollection <FBEntity> listOfSubjectDepartmentFB = oeDepartment.GetRelationFBEntities(typeof(T_FB_SUBJECTDEPTMENT).Name);

            // 1. 获取所有已启用的部门科目
            var itemsDepartmentActived = listOfSubjectDepartmentFB.Where(item =>
            {
                return((item.Entity as T_FB_SUBJECTDEPTMENT).ACTIVED == 1);
            });

            // 2. 遍历所有已启用的部门科目, 添加相应的岗位科目,已有科目的,则加上原有的,没有的,则新增

            foreach (FBEntity entityDepartment in itemsDepartmentActived)
            {
                T_FB_SUBJECTDEPTMENT sd = entityDepartment.Entity as T_FB_SUBJECTDEPTMENT;

                // 是否已有岗位科目的记录
                List <FBEntity> listPost = entityDepartment.GetRelationFBEntities(typeof(T_FB_SUBJECTPOST).Name, item =>
                {
                    return((item.Entity as T_FB_SUBJECTPOST).OWNERPOSTID == virtualPost.ID);
                });

                // 已有岗位科目,添加。没有,就新增
                if (listPost.Count > 0)
                {
                    T_FB_SUBJECTPOST post = listPost[0].Entity as T_FB_SUBJECTPOST;
                    if (post.ACTIVED != sd.ACTIVED)
                    {
                        listPost[0].FBEntityState = FBEntityState.Modified;
                    }
                    //岗位默认处理
                    if (post != null)
                    {
                        post = SubjectPostChanged(sd, post, strFlag);
                    }
                    listPost[0].Entity = post;
                    listFBEntities.Add(listPost[0]);
                }
                else
                {
                    //临时添加防止重复数据
                    var a = staticobpost.FirstOrDefault(item => (item.Entity as T_FB_SUBJECTPOST).OWNERPOSTID == virtualPost.ID && (item.Entity as T_FB_SUBJECTPOST).T_FB_SUBJECT != null && (item.Entity as T_FB_SUBJECTPOST).T_FB_SUBJECT.SUBJECTID == sd.T_FB_SUBJECT.SUBJECTID);
                    if (a == null && sd.ACTIVED == 1)
                    {
                        FBEntity fbEntityPostNew = this.CreateSubjectPost(sd, virtualPost, strFlag);
                        listFBEntities.Add(fbEntityPostNew);

                        staticobpost.Add(fbEntityPostNew);
                    }
                    else
                    {
                        listFBEntities.Add(a);
                    }
                }
            }

            FBEntity postFBEntity = virtualPost.ToFBEntity();

            postFBEntity.AddFBEntities <T_FB_SUBJECTPOST>(listFBEntities);
            OrderEntity entityPost = new OrderEntity(postFBEntity);

            Binding binding = new Binding();

            binding.Path = new PropertyPath("Entity.Name");
            treeViewItem.SetBinding(TreeViewItem.HeaderProperty, binding);
            treeViewItem.DataContext = entityPost;
            EntityList.Add(entityPost);
            return(entityPost);
        }
Exemplo n.º 13
0
        /// <summary>
        /// 可用额度汇总
        /// </summary>
        /// <param name="qe"></param>
        /// <returns></returns>
        public List <FBEntity> QueryQueryBudgetAccount(QueryExpression qe)
        {
            // qe.VisitModuleCode = typeof(T_FB_BUDGETACCOUNT).Name;
            qe.Include = new string[] { "T_FB_SUBJECT" };

            qe.QueryType = "T_FB_BUDGETACCOUNT";
            if (qe.RightType != "QueryBudgetAccount")
            {
                qe.RightType = "QueryBudgetAccount";
            }

            List <T_FB_BUDGETACCOUNT> listBudgetAccount = GetEntities <T_FB_BUDGETACCOUNT>(qe);

            List <T_FB_BUDGETACCOUNT> listBAPerson = listBudgetAccount.FindAll(item =>
            {
                return(!string.IsNullOrEmpty(item.OWNERID));
            });
            List <string> listUserIDs = listBAPerson.CreateList(item =>
            {
                return(item.OWNERID);
            });
            OrganizationBLL          orgbll         = new OrganizationBLL();
            List <VirtualUser>       listUser       = orgbll.GetVirtualUser(listUserIDs);
            List <VirtualCompany>    listCompany    = orgbll.GetVirtualCompany(qe);
            List <VirtualDepartment> listDepartment = orgbll.GetVirtualDepartment(qe);
            List <VirtualPost>       listPost       = orgbll.GetVirtualPost(qe);


            listBudgetAccount.ForEach(item =>
            {
                VirtualCompany vc = listCompany.FirstOrDefault(item2 =>
                {
                    return(item2.ID == item.OWNERCOMPANYID);
                });
                item.OWNERCOMPANYID = vc == null ? "" : vc.Name;

                VirtualDepartment vd = listDepartment.FirstOrDefault(item2 =>
                {
                    return(item2.ID == item.OWNERDEPARTMENTID);
                });
                item.OWNERDEPARTMENTID = vd == null ? "" : vd.Name;

                VirtualPost vp = listPost.FirstOrDefault(item2 =>
                {
                    return(item2.ID == item.OWNERPOSTID);
                });
                item.OWNERPOSTID = vp == null ? "" : vp.Name;

                VirtualUser vu = listUser.FirstOrDefault(item2 =>
                {
                    return(item2.ID == item.OWNERID);
                });
                item.OWNERID = vu == null ? "" : vu.Name;
            });
            listBudgetAccount = listBudgetAccount.OrderByDescending(item => item.BUDGETYEAR)
                                .ThenByDescending(item => item.BUDGETMONTH)
                                .ThenBy(item => item.ACCOUNTOBJECTTYPE)
                                .ThenBy(item => item.OWNERCOMPANYID)
                                .ThenBy(item => item.OWNERDEPARTMENTID)
                                .ThenBy(item => item.OWNERPOSTID)
                                .ThenBy(item => item.OWNERID).ToList();
            return(listBudgetAccount.ToFBEntityList());
        }
Exemplo n.º 14
0
        /// <summary>
        /// 新增岗位科目
        /// </summary>
        /// <param name="sd"></param>
        /// <returns></returns>
        private FBEntity CreateSubjectPost(T_FB_SUBJECTDEPTMENT sd, VirtualPost virtualPost, string strFlag)
        {
            T_FB_SUBJECTPOST post = new T_FB_SUBJECTPOST();
            post.T_FB_SUBJECTDEPTMENT = sd;
            post.T_FB_SUBJECT = sd.T_FB_SUBJECT;
            post.LIMITBUDGEMONEY = 0;
            post.SUBJECTPOSTID = Guid.NewGuid().ToString();

            post.OWNERID = DataCore.SuperUser.Value.ToString();
            post.OWNERPOSTID = virtualPost.ID;
            post.OWNERDEPARTMENTID = virtualPost.OWNERDEPARTMENTID;
            post.OWNERCOMPANYID = virtualPost.OWNERCOMPANYID;

            //岗位默认处理
            post = SubjectPostChanged(sd, post, strFlag);

            FBEntity fbEntityPostNew = post.ToFBEntity();
            fbEntityPostNew.FBEntityState = FBEntityState.Added;

            return fbEntityPostNew;
        }
Exemplo n.º 15
0
        /// <summary>
        /// 处理 部门项目actived 改变时,相应的增减对应的岗位项目
        ///
        /// </summary>
        /// <remarks>
        ///     1. 去除 SubjectPost的所有关联,如有跟其他实体有关联,再提交服务端时,可能会出错
        ///     2. 从 RelationCollection中去掉 SubjectPost
        ///     3. 根据 SubjectDepartment 是否启用,对SubjectPost进行相应处理
        ///        Y.新增SubjectPost 到集合中
        ///        N.从集合中去除SubjectPost
        /// </remarks>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void SubjectDepartment_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (e.PropertyName == "ACTIVED" || e.PropertyName == "ISPERSON")
            {
                T_FB_SUBJECTDEPTMENT subjectDepartment = sender as T_FB_SUBJECTDEPTMENT;

                VirtualDepartment vd             = this.currentOrderEntity.Entity as VirtualDepartment;
                OrderEntity       curOrderEntity = this.dictDepartment[vd];

                // 3.如果是不启用的部门科目,则从各个岗位项目对象中去除 SubjectPost, 否则,添加相应的subjectPost

                foreach (TreeViewItem item in this.currentTreeViewItem.Items)
                {
                    OrderEntity oe = item.DataContext as OrderEntity;
                    if (oe != null)
                    {
                        VirtualPost virtualPost = oe.Entity as VirtualPost;
                        // 启用科目,添加新subjectpost.
                        if (subjectDepartment.ACTIVED == 1)
                        {
                            if (e.PropertyName == "ACTIVED")//启用科目
                            {
                                //FBEntity fbEntityPostNew = CreateSubjectPost(subjectDepartment, virtualPost, "ACTIVED");
                                //oe.FBEntity.AddFBEntities<T_FB_SUBJECTPOST>(new List<FBEntity> { fbEntityPostNew });

                                CreatePostEntity(virtualPost, item, "ACTIVED");
                            }
                            else if (e.PropertyName == "ISPERSON")//修改科目
                            {
                                oe = IsPersonChanged(oe, subjectDepartment);
                            }
                        }
                        else // 从集合中去除相应的subjectPost
                        {
                            if (subjectDepartment.T_FB_SUBJECTPOST != null)
                            {
                                foreach (var postEnt in subjectDepartment.T_FB_SUBJECTPOST)
                                {
                                    CreateNonActionSubjectPost(subjectDepartment, postEnt, virtualPost);
                                }
                            }
                            ObservableCollection <FBEntity> fbEntities = oe.GetRelationFBEntities(typeof(T_FB_SUBJECTPOST).Name);
                            fbEntities.RemoveAll(entity =>
                            {
                                return((entity.Entity as T_FB_SUBJECTPOST).T_FB_SUBJECTDEPTMENT.SUBJECTDEPTMENTID == subjectDepartment.SUBJECTDEPTMENTID);
                            });
                        }
                    }
                    else //处理修改部门数据后,默认处理岗位数据
                    {
                        VirtualPost virtualPost = item.DataContext as VirtualPost;
                        if (virtualPost == null)
                        {
                            continue;
                        }

                        // 启用科目,添加新subjectpost.
                        if (subjectDepartment.ACTIVED == 1)
                        {
                            if (e.PropertyName == "ACTIVED")//启用科目
                            {
                                //  FBEntity fbEntityPostNew = CreateSubjectPost(subjectDepartment, virtualPost, "ACTIVED");
                                //  curOrderEntity.FBEntity.AddFBEntities<T_FB_SUBJECTPOST>(new List<FBEntity> { fbEntityPostNew });

                                CreatePostEntity(virtualPost, item, "ACTIVED");
                            }
                            else if (e.PropertyName == "ISPERSON")//修改科目
                            {
                                curOrderEntity = IsPersonChanged(curOrderEntity, subjectDepartment);
                            }
                        }
                        else // 从集合中去除相应的subjectPost
                        {
                            if (subjectDepartment.T_FB_SUBJECTPOST != null)
                            {
                                foreach (var postEnt in subjectDepartment.T_FB_SUBJECTPOST)
                                {
                                    CreateNonActionSubjectPost(subjectDepartment, postEnt, virtualPost);
                                }
                            }
                            ObservableCollection <FBEntity> fbEntities = curOrderEntity.GetRelationFBEntities(typeof(T_FB_SUBJECTPOST).Name);
                            fbEntities.RemoveAll(entity =>
                            {
                                return((entity.Entity as T_FB_SUBJECTPOST).T_FB_SUBJECTDEPTMENT.SUBJECTDEPTMENTID == subjectDepartment.SUBJECTDEPTMENTID);
                            });
                        }
                    }
                }
            }
        }
Exemplo n.º 16
0
 private void CreateNonActionSubjectPost(T_FB_SUBJECTDEPTMENT sd, T_FB_SUBJECTPOST post, VirtualPost virtualPost)
 {
     ObservableCollection<FBEntity> listFBEntities = new ObservableCollection<FBEntity>();
     post.ACTIVED = 0;
     post.UPDATEDATE = DateTime.Now;
     FBEntity fbEntityPostNew = post.ToFBEntity();
     fbEntityPostNew.FBEntityState = FBEntityState.Modified;
     listFBEntities.Add(fbEntityPostNew);
     FBEntity postFBEntity = virtualPost.ToFBEntity();
     postFBEntity.AddFBEntities<T_FB_SUBJECTPOST>(listFBEntities);
     OrderEntity entityPost = new OrderEntity(postFBEntity);
     EntityList.Add(entityPost);
 }
Exemplo n.º 17
0
        //public static void InitHR()
        //{
        //    try
        //    {
        //        IList<CompanyData> listCData = new List<CompanyData>();
        //        IList<DepartmentData> ListDData = new List<DepartmentData>();
        //        IList<PostData> ListPData = new List<PostData>();

        //        List<OrganizationWS.T_HR_COMPANY> comList = (List<OrganizationWS.T_HR_COMPANY>)App.Current.Resources["SYS_CompanyInfo"];
        //        List<OrganizationWS.T_HR_DEPARTMENT> deptList = (List<OrganizationWS.T_HR_DEPARTMENT>)App.Current.Resources["SYS_DepartmentInfo"];
        //        List<OrganizationWS.T_HR_POST> postList = (List<OrganizationWS.T_HR_POST>)App.Current.Resources["SYS_PostInfo"];


        //        comList.ForEach(comHR =>
        //        {
        //            ObservableCollection<VirtualDepartment> listDepartment = new ObservableCollection<VirtualDepartment>();

        //            VirtualCompany vc = new VirtualCompany();
        //            vc.ID = comHR.COMPANYID;
        //            vc.Name = comHR.CNAME;
        //            vc.DepartmentCollection = listDepartment;


        //            CompanyData cData = CreateItem<CompanyData>(vc);
        //            List<DepartmentData> listDepartmentData = new List<DepartmentData>();

        //            List<OrganizationWS.T_HR_DEPARTMENT> deptListPart = deptList.FindAll(item =>
        //            {
        //                if (item.T_HR_COMPANY == null)
        //                {
        //                    return false;
        //                }
        //                return item.T_HR_COMPANY.COMPANYID == comHR.COMPANYID;

        //            });

        //            deptListPart.ForEach(deptHR =>
        //            {
        //                ObservableCollection<VirtualPost> listPost = new ObservableCollection<VirtualPost>();

        //                VirtualDepartment vd = new VirtualDepartment();
        //                vd.ID = deptHR.DEPARTMENTID;
        //                vd.Name = deptHR.T_HR_DEPARTMENTDICTIONARY.DEPARTMENTNAME;
        //                vd.VirtualCompany = vc;
        //                vd.PostCollection = listPost;
        //                listDepartment.Add(vd);


        //                DepartmentData dData = CreateItem<DepartmentData>(vd);
        //                List<PostData> listPostData = new List<PostData>();

        //                List<OrganizationWS.T_HR_POST> postListPart = postList.FindAll(item =>
        //                {
        //                    if (item.T_HR_DEPARTMENT == null)
        //                    {
        //                        return false;
        //                    }
        //                    return item.T_HR_DEPARTMENT.DEPARTMENTID == deptHR.DEPARTMENTID;
        //                });

        //                postListPart.ForEach(postHR =>
        //                {
        //                    VirtualPost vp = new VirtualPost();
        //                    vp.ID = postHR.POSTID;
        //                    vp.Name = postHR.T_HR_POSTDICTIONARY.POSTNAME;
        //                    vp.VirtualCompany = vc;
        //                    vp.VirtualDepartment = vd;
        //                    listPost.Add(vp);


        //                    PostData pData = CreateItem<PostData>(vp);
        //                    pData.Company = cData;
        //                    pData.Department = dData;
        //                    listPostData.Add(pData);
        //                    ListPData.Add(pData);

        //                });

        //                dData.Company = cData;
        //                dData.PostCollection = listPostData;
        //                listDepartmentData.Add(dData);
        //                ListDData.Add(dData);
        //            });

        //            cData.DepartmentCollection = listDepartmentData;
        //            listCData.Add(cData);
        //            CompanyList.Add(vc);
        //        });

        //        ReferencedData<CompanyData>.RefData = listCData;
        //        ReferencedData<DepartmentData>.RefData = ListDData;
        //        ReferencedData<PostData>.RefData = ListPData;
        //    }
        //    catch (Exception ex)
        //    {
        //        System.Diagnostics.Debug.WriteLine(ex);
        //        throw new Exception("调用HR服务异常", ex);
        //    }
        //}

        #endregion

        /// <summary>
        /// 新的,从平台组织架构缓存中加载。
        /// </summary>
        public static void InitHR()
        {
            try
            {
                IList <CompanyData>    listCData = new List <CompanyData>();
                IList <DepartmentData> ListDData = new List <DepartmentData>();
                IList <PostData>       ListPData = new List <PostData>();


                List <OrganizationWS.T_HR_COMPANY> comList
                    = App.Current.Resources["SYS_CompanyInfo"] as List <OrganizationWS.T_HR_COMPANY> ?? new List <OrganizationWS.T_HR_COMPANY>();
                List <OrganizationWS.T_HR_DEPARTMENT> deptList
                    = App.Current.Resources["SYS_DepartmentInfo"] as List <OrganizationWS.T_HR_DEPARTMENT> ?? new List <OrganizationWS.T_HR_DEPARTMENT>();
                List <OrganizationWS.T_HR_POST> postList
                    = App.Current.Resources["SYS_PostInfo"] as List <OrganizationWS.T_HR_POST> ?? new List <OrganizationWS.T_HR_POST>();


                comList.ForEach(comHR =>
                {
                    ObservableCollection <VirtualDepartment> listDepartment = new ObservableCollection <VirtualDepartment>();

                    VirtualCompany vc       = new VirtualCompany();
                    vc.ID                   = comHR.COMPANYID;
                    vc.Name                 = comHR.CNAME;
                    vc.DepartmentCollection = listDepartment;


                    CompanyData cData = CreateItem <CompanyData>(vc);
                    List <DepartmentData> listDepartmentData = new List <DepartmentData>();

                    List <OrganizationWS.T_HR_DEPARTMENT> deptListPart = deptList.FindAll(item =>
                    {
                        if (item.T_HR_COMPANY == null)
                        {
                            return(false);
                        }
                        return(item.T_HR_COMPANY.COMPANYID == comHR.COMPANYID);
                    });

                    deptListPart.ForEach(deptHR =>
                    {
                        ObservableCollection <VirtualPost> listPost = new ObservableCollection <VirtualPost>();

                        VirtualDepartment vd = new VirtualDepartment();
                        vd.ID             = deptHR.DEPARTMENTID;
                        vd.Name           = deptHR.T_HR_DEPARTMENTDICTIONARY.DEPARTMENTNAME;
                        vd.VirtualCompany = vc;
                        vd.PostCollection = listPost;
                        listDepartment.Add(vd);


                        DepartmentData dData         = CreateItem <DepartmentData>(vd);
                        List <PostData> listPostData = new List <PostData>();

                        List <OrganizationWS.T_HR_POST> postListPart = postList.FindAll(item =>
                        {
                            if (item.T_HR_DEPARTMENT == null)
                            {
                                return(false);
                            }
                            return(item.T_HR_DEPARTMENT.DEPARTMENTID == deptHR.DEPARTMENTID);
                        });

                        postListPart.ForEach(postHR =>
                        {
                            VirtualPost vp       = new VirtualPost();
                            vp.ID                = postHR.POSTID;
                            vp.Name              = postHR.T_HR_POSTDICTIONARY.POSTNAME;
                            vp.VirtualCompany    = vc;
                            vp.VirtualDepartment = vd;
                            listPost.Add(vp);


                            PostData pData   = CreateItem <PostData>(vp);
                            pData.Company    = cData;
                            pData.Department = dData;
                            listPostData.Add(pData);
                            ListPData.Add(pData);
                        });

                        dData.Company        = cData;
                        dData.PostCollection = listPostData;
                        listDepartmentData.Add(dData);
                        ListDData.Add(dData);
                    });

                    cData.DepartmentCollection = listDepartmentData;
                    listCData.Add(cData);
                    CompanyList.Add(vc);
                });

                ReferencedData <CompanyData> .RefData    = listCData;
                ReferencedData <DepartmentData> .RefData = ListDData;
                ReferencedData <PostData> .RefData       = ListPData;
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex);
                throw new Exception("调用HR服务异常", ex);
            }
        }