Esempio n. 1
0
        void dGrid_ToolBarItemClick(object sender, ToolBarItemClickEventArgs e)
        {
            if (e.Action != Actions.Add)
            {
                return;
            }
            e.Action = Actions.Cancel;
            FBEntityService service = new FBEntityService();
            QueryExpression qeOwner = this.OrderEntity.GetQueryExpression(FieldName.OwnerID);
            QueryExpression qeDept  = this.OrderEntity.GetQueryExpression(FieldName.OwnerDepartmentID);
            QueryExpression qePost  = this.OrderEntity.GetQueryExpression(FieldName.OwnerPostID);

            qeDept.RelatedExpression          = qeOwner;
            qeOwner.RelatedExpression         = qePost;
            qeDept.QueryType                  = typeof(T_FB_TRAVELEXPAPPLYDETAIL).Name;
            service.QueryFBEntitiesCompleted += (o, ea) =>
            {
                ObservableCollection <FBEntity> listDetail     = this.OrderEntity.GetRelationFBEntities(typeof(T_FB_TRAVELEXPAPPLYDETAIL).Name);
                ObservableCollection <FBEntity> listDetailItem = ea.Result;
                listDetailItem.ToList().ForEach(item =>
                {
                    T_FB_TRAVELEXPAPPLYDETAIL t = item.Entity as T_FB_TRAVELEXPAPPLYDETAIL;
                    t.T_FB_TRAVELEXPAPPLYMASTER = this.OrderEntity.Entity as T_FB_TRAVELEXPAPPLYMASTER;
                    t.SERIALNUMBER = listDetail.Count + 1;

                    ps.ForEach(p => { t.SetObjValue(p, decimal.Parse("0")); });
                    t.TOTALCHARGE = decimal.Parse("0");

                    listDetail.Add(item);
                });
            };


            service.QueryFBEntities(qeDept);
        }
Esempio n. 2
0
        protected virtual void OnToolBarItemClick(Actions action)
        {

            if (ToolBarItemClick != null)
            {
                ToolBarItemClickEventArgs args = new ToolBarItemClickEventArgs(action);
                ToolBarItemClick(this, args);

                if (args.Action == Actions.Cancel)
                {
                    return;
                }
            }

           
            if (action == Actions.Add)
            {
                Add();
            }
            else
            {
                IList list = this.ADGrid.SelectedItems as IList;
                Delete(list);
            }
            
        }
Esempio n. 3
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).ToString();
            }
            else
            {
                perm = ((int)Permissions.Browse).ToString();
            }

            string             userID    = DataCore.CurrentUser.Value.ToString();
            OrganizationLookup ogzLookup = new OrganizationLookup(userID, perm, entity);

            ogzLookup.SelectedObjType = OrgTreeItemTypes.Company;

            FrameworkElement plRoot = CommonFunction.ParentLayoutRoot;

            ogzLookup.SelectedClick += (o, ea) =>
            {
                if (ogzLookup.SelectedObj.Count > 0)
                {
                    var assignDetail    = this.OrderEntity.GetRelationFBEntities(typeof(T_FB_SUMSETTINGSDETAIL).Name);
                    var selectedObjects = ogzLookup.SelectedObj;
                    selectedObjects.ForEach(obj =>
                    {
                        ITextValueItem cdata = DataCore.FindReferencedData <CompanyData>(obj.ObjectID);

                        T_FB_SUMSETTINGSDETAIL detail = new T_FB_SUMSETTINGSDETAIL();
                        detail.SUMSETTINGSDETAILID    = Guid.NewGuid().ToString();
                        detail.T_FB_SUMSETTINGSMASTER = this.OrderEntity.Entity as T_FB_SUMSETTINGSMASTER;
                        detail.EDITSTATES             = 1;
                        detail.OWNERCOMPANYID         = cdata.Value.ToString();
                        detail.OWNERCOMPANYNAME       = cdata.Text;
                        detail.CREATEDATE             = DateTime.Now;
                        detail.CREATEUSERID           = DataCore.CurrentUser.ID.ToString();
                        detail.CREATEUSERNAME         = DataCore.CurrentUser.Text.ToString();

                        FBEntity fbEntity      = detail.ToFBEntity();
                        fbEntity.FBEntityState = FBEntityState.Added;
                        assignDetail.Add(fbEntity);
                    });
                }
            };
            ogzLookup.Show <string>(DialogMode.ApplicationModal, plRoot, "", (result) => { });
        }
Esempio n. 4
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).ToString();
            }
            else
            {
                perm = ((int)Permissions.Browse).ToString();
            }

            string userID = DataCore.CurrentUser.Value.ToString();
            OrganizationLookup ogzLookup = new OrganizationLookup(userID, perm, entity);

            ogzLookup.SelectedObjType = OrgTreeItemTypes.Company;

            FrameworkElement plRoot = CommonFunction.ParentLayoutRoot;

            ogzLookup.SelectedClick += (o, ea) =>
            {
                if (ogzLookup.SelectedObj.Count > 0)
                {
                    var assignDetail = this.OrderEntity.GetRelationFBEntities(typeof(T_FB_SUMSETTINGSDETAIL).Name);
                    var selectedObjects = ogzLookup.SelectedObj;
                    selectedObjects.ForEach(obj =>
                        {
                            ITextValueItem cdata = DataCore.FindReferencedData<CompanyData>(obj.ObjectID);
                                                       
                            T_FB_SUMSETTINGSDETAIL detail = new T_FB_SUMSETTINGSDETAIL();
                            detail.SUMSETTINGSDETAILID = Guid.NewGuid().ToString();
                            detail.T_FB_SUMSETTINGSMASTER = this.OrderEntity.Entity as T_FB_SUMSETTINGSMASTER;
                            detail.EDITSTATES =1;
                            detail.OWNERCOMPANYID = cdata.Value.ToString();
                            detail.OWNERCOMPANYNAME = cdata.Text;
                            detail.CREATEDATE = DateTime.Now;
                            detail.CREATEUSERID = DataCore.CurrentUser.ID.ToString();
                            detail.CREATEUSERNAME = DataCore.CurrentUser.Text.ToString();

                            FBEntity fbEntity = detail.ToFBEntity();
                            fbEntity.FBEntityState = FBEntityState.Added;
                            assignDetail.Add(fbEntity);
                        });

                }
            };
            ogzLookup.Show<string>(DialogMode.ApplicationModal, plRoot, "", (result) => { });
        }
Esempio n. 5
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());
            }
        }
Esempio n. 6
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());
            }
        }