コード例 #1
0
        public void InitOrgObjectData()
        {
            string perm   = "3";
            string entity = ReferencedDataInfo.OrderInfo.Type;

            if (OperationType == OperationTypes.Edit)
            {
                perm = ((int)Permissions.Edit).ToString();
            }
            else if (OperationType == OperationTypes.Add)
            {
                perm = ((int)Permissions.Add).ToString();
            }
            else
            {
                perm = ((int)Permissions.Browse).ToString();
            }

            string userID = DataCore.CurrentUser.Value.ToString();
            //             BF06E969-1B2C-4a89-B0AE-A91CA1244053
            OrganizationLookup ogzLookup = new OrganizationLookup(userID, perm, entity);

            ogzLookup.SelectedObjType = OrgTreeItemTypes.Company;

            FrameworkElement plRoot = CommonFunction.ParentLayoutRoot;

            ogzLookup.SelectedClick += (o, e) =>
            {
                if (ogzLookup.SelectedObj.Count > 0)
                {
                    ITextValueItem item = null;

                    var sItem = ogzLookup.SelectedObj[0];

                    //下拨公司只能是公司,其他机构类型都不可以
                    if (sItem.ObjectType == OrgTreeItemTypes.Company)
                    {
                        string         id    = sItem.ObjectID;
                        ITextValueItem cdata = DataCore.FindReferencedData <CompanyData>(id);
                        item = cdata;
                    }

                    #region 废弃代码
                    //if (sItem.ObjectType == OrgTreeItemTypes.Personnel)
                    //{
                    //    EmployeerData eData = new EmployeerData();
                    //    eData.Value = sItem.ObjectID;
                    //    eData.Text = sItem.ObjectName;
                    //    ExtOrgObj post = sItem.ParentObject as ExtOrgObj;
                    //    ExtOrgObj dept = post.ParentObject as ExtOrgObj;

                    //    // ExtOrgObj com = dept.ParentObject as ExtOrgObj;
                    //    ITextValueItem pdata = DataCore.FindReferencedData<PostData>(post.ObjectID);
                    //    ITextValueItem ddata = DataCore.FindReferencedData<DepartmentData>(dept.ObjectID);
                    //    ITextValueItem cdata = (ddata as DepartmentData).Company;

                    //    eData.Company = cdata as CompanyData;
                    //    eData.Department = ddata as DepartmentData;
                    //    eData.Post = pdata as PostData;
                    //    item = eData;
                    //}
                    //else if (sItem.ObjectType == OrgTreeItemTypes.Department)
                    //{
                    //    string id = sItem.ObjectID;
                    //    item = DataCore.FindReferencedData<DepartmentData>(id);
                    //}
                    #endregion 废弃代码


                    MyOrgObjectData sValue = null;
                    if (item != null)
                    {
                        sValue = new MyOrgObjectData {
                            OrgObject = item as OrgObjectData
                        };
                    }
                    this.SelectItem = sValue;
                }
            };
            ogzLookup.Show <string>(DialogMode.ApplicationModal, plRoot, "", (result) => { });
        }
コード例 #2
0
        void dGrid_ToolBarItemClick(object sender, ToolBarItemClickEventArgs e)
        {
            if (e.Action != Actions.Add)
            {
                return;
            }
            e.Action = Actions.Cancel;
            string perm   = "3";
            string entity = typeof(T_FB_PERSONMONEYASSIGNMASTER).Name;

            if (this.EditForm.OperationType == OperationTypes.Edit)
            {
                perm = ((int)Permissions.Edit).ToString();
            }
            else if (this.EditForm.OperationType == OperationTypes.Add)
            {
                perm = ((int)Permissions.Add + 1).ToString();
            }
            else
            {
                perm = ((int)Permissions.Browse).ToString();
            }

            string userID = DataCore.CurrentUser.Value.ToString();
            //             BF06E969-1B2C-4a89-B0AE-A91CA1244053
            OrganizationLookup ogzLookup = new OrganizationLookup();

            ogzLookup.SelectedObjType = OrgTreeItemTypes.Personnel;
            ogzLookup.MultiSelected   = true;

            FrameworkElement plRoot = CommonFunction.ParentLayoutRoot;

            try
            {
                ogzLookup.SelectedClick += (o, ea) =>
                {
                    if (ogzLookup.SelectedObj.Count > 0)
                    {
                        //处理岗位及下拨
                        SMT.Saas.Tools.PersonnelWS.PersonnelServiceClient pe = new SMT.Saas.Tools.PersonnelWS.PersonnelServiceClient();
                        ObservableCollection <SMT.Saas.Tools.PersonnelWS.V_EMPLOYEEFUNDS> vlistpostinfo = new ObservableCollection <SMT.Saas.Tools.PersonnelWS.V_EMPLOYEEFUNDS>();

                        var assignDetail = this.OrderEntity.GetRelationFBEntities(typeof(T_FB_PERSONMONEYASSIGNDETAIL).Name);

                        var selectedObjects = ogzLookup.SelectedObj;
                        selectedObjects.ForEach(obj =>
                        {
                            ExtOrgObj post = obj.ParentObject as ExtOrgObj;
                            ExtOrgObj dept = post.ParentObject as ExtOrgObj;

                            // ExtOrgObj com = dept.ParentObject as ExtOrgObj;
                            ITextValueItem pdata = DataCore.FindReferencedData <PostData>(post.ObjectID);
                            ITextValueItem ddata = DataCore.FindReferencedData <DepartmentData>(dept.ObjectID);
                            ITextValueItem cdata = (ddata as DepartmentData).Company;

                            var existDetail = assignDetail.FirstOrDefault(item =>
                            {
                                T_FB_PERSONMONEYASSIGNDETAIL cd = item.Entity as T_FB_PERSONMONEYASSIGNDETAIL;
                                return(cd.OWNERID == obj.ObjectID && cd.OWNERPOSTID == pdata.Value.ToString());
                            });

                            T_FB_PERSONMONEYASSIGNDETAIL detail = new T_FB_PERSONMONEYASSIGNDETAIL();
                            if (existDetail != null)
                            {
                                detail.PERSONBUDGETAPPLYDETAILID    = (existDetail.Entity as T_FB_PERSONMONEYASSIGNDETAIL).PERSONBUDGETAPPLYDETAILID;
                                detail.T_FB_PERSONMONEYASSIGNMASTER = this.OrderEntity.Entity as T_FB_PERSONMONEYASSIGNMASTER;
                            }
                            else
                            {
                                detail.PERSONBUDGETAPPLYDETAILID    = Guid.NewGuid().ToString();
                                detail.T_FB_PERSONMONEYASSIGNMASTER = this.OrderEntity.Entity as T_FB_PERSONMONEYASSIGNMASTER;
                                detail.BUDGETMONEY = 0;
                            }

                            // start 添加岗位级别,用于排序
                            var employee1 = obj.ObjectInstance as SMT.Saas.Tools.PersonnelWS.T_HR_EMPLOYEE;
                            if (employee1 != null)
                            {
                                var ep = employee1.T_HR_EMPLOYEEPOST.FirstOrDefault();
                                if (ep != null)
                                {
                                    detail.POSTLEVEL = ep.POSTLEVEL;
                                }
                            }


                            // end

                            detail.OWNERID             = obj.ObjectID;
                            detail.OWNERNAME           = obj.ObjectName;
                            detail.OWNERPOSTID         = pdata.Value.ToString();
                            detail.OWNERPOSTNAME       = pdata.Text;
                            detail.OWNERDEPARTMENTID   = ddata.Value.ToString();
                            detail.OWNERDEPARTMENTNAME = ddata.Text;
                            detail.OWNERCOMPANYID      = cdata.Value.ToString();
                            detail.OWNERCOMPANYNAME    = cdata.Text;

                            //SMT.Saas.Tools.PersonnelWS.V_EMPLOYEEPOSTFORFB vpostinfo = new SMT.Saas.Tools.PersonnelWS.V_EMPLOYEEPOSTFORFB();
                            //vpostinfo.PERSONBUDGETAPPLYDETAILID = detail.PERSONBUDGETAPPLYDETAILID;
                            //vpostinfo.OWNERID = detail.OWNERID;
                            //vpostinfo.OWNERPOSTID = detail.OWNERPOSTID;
                            //vlistpostinfo.Add(vpostinfo);

                            SMT.Saas.Tools.PersonnelWS.V_EMPLOYEEFUNDS vpostinfo = new SMT.Saas.Tools.PersonnelWS.V_EMPLOYEEFUNDS();

                            vpostinfo.EMPLOYEEID = detail.OWNERID;
                            vpostinfo.POSTID     = detail.OWNERPOSTID;
                            vpostinfo.COMPANYID  = detail.OWNERCOMPANYID;
                            vlistpostinfo.Add(vpostinfo);

                            if (existDetail != null)
                            {
                                return;
                            }
                            else
                            {
                                FBEntity fbEntity      = detail.ToFBEntity();
                                fbEntity.FBEntityState = FBEntityState.Added;
                                assignDetail.Add(fbEntity);
                            }
                        });
                        if (vlistpostinfo != null && vlistpostinfo.Count > 0)
                        {
                            this.ShowProcess();
                            pe.GetEmployeeFundsListCompleted += new EventHandler <Saas.Tools.PersonnelWS.GetEmployeeFundsListCompletedEventArgs>(pe_GetEmployeeFundsListCompleted);
                            pe.GetEmployeeFundsListAsync(vlistpostinfo);
                        }
                    }
                };
                ogzLookup.Show <string>(DialogMode.ApplicationModal, plRoot, "", (result) => { });
            }
            catch (Exception ex)
            {
                CommonFunction.ShowErrorMessage("调用HR服务返回异常信息:" + ex.ToString());
            }
        }