Esempio n. 1
0
        protected override void OnAuditing(object sender, AuditEventArgs e)
        {
            try
            {
                this.OrderEntity.FBEntity.CollectionEntity.Clear();

                var           posts     = (this.OrderEntity.LoginUser as LoginUserData).PostInfos;
                EmployeerData ownerInfo = this.OrderEntity.GetOwnerInfo();

                var finds = posts.Where(item => item.Company.Value.ToString() == ownerInfo.Company.Value.ToString());
                if (finds.Count() > 0)
                {
                    var          user = finds.FirstOrDefault();
                    AuditControl ac   = sender as AuditControl;
                    ac.AuditEntity.CreateCompanyID    = user.Company.Value.ToString();
                    ac.AuditEntity.CreateDepartmentID = user.Department.Value.ToString();
                    ac.AuditEntity.CreatePostID       = user.Post.Value.ToString();
                }



                base.OnAuditing(sender, e);
            }
            catch (Exception ex)
            {
                e.Result = AuditEventArgs.AuditResult.Cancel;
                CommonFunction.ShowErrorMessage("提交或审核异常, " + ex.ToString());
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 初始化
        /// </summary>
        private void InitData()
        {
            if (this.OrderEntity.FBEntityState == FBEntityState.Added)
            {
                EmployeerData create = this.OrderEntity.GetCreateInfo();

                this.OrderEntity.ReferencedData["Entity.FromObject"] = new MyOrgObjectData {
                    Value = create.Department
                };

                this.OrderEntity.SetObjValue(EntityFieldName.OwnerID, create.Value);
                this.OrderEntity.SetObjValue(EntityFieldName.OwnerName, create.Text);
                this.OrderEntity.SetObjValue(EntityFieldName.OwnerPostID, create.Post.Value);
                this.OrderEntity.SetObjValue(EntityFieldName.OwnerPostName, create.Post.Text);

                OrderEntity.SetObjValue("Entity.BUDGETARYMONTH", new DateTime(DataCore.SystemDateTime.Year, DataCore.SystemDateTime.Month, 1));
                this.OrderEntity.SetObjValue(EntityFieldName.OwnerDepartmentID, this.OrderEntity.GetObjValue(FIELDNAME_TRANSFERFROM.ToEntityString()));
            }
            else if (this.EditForm.OperationType == OperationTypes.Browse)
            {
                SetPropertyChanged();
                return;
            }
            GetOrderDetail();
        }
Esempio n. 3
0
        private void InitData()
        {
            if (this.OrderEntity.FBEntityState == FBEntityState.Added)
            {
                OrderEntity.SetObjValue("Entity.BUDGETARYMONTH", new DateTime(DataCore.SystemDateTime.Year, DataCore.SystemDateTime.Month, 1));

                EmployeerData create = this.OrderEntity.GetCreateInfo();
                this.OrderEntity.ReferencedData["Entity.AssignCompany"] = new MyOrgObjectData {
                    Value = create.Company
                };
                OrderEntity.SetObjValue("Entity.ASSIGNCOMPANYID", create.Company.Value);
                OrderEntity.SetObjValue("Entity.ASSIGNCOMPANYNAME", create.Company.Text);

                // 1. 获取上个月当前操作者审核通过的单据
                GetOrderDetail();
            }
            else
            {
                SetSortDetails();
                //if (isFirst)
                //{
                //    isFirst = false;
                // SortDetails();
                //  }
            }

            this.OrderEntity.OrderPropertyChanged    += new EventHandler <OrderPropertyChangedArgs>(OrderEntity_OrderPropertyChanged);
            this.OrderEntity.CollectionEntityChanged += new EventHandler <EntityChangedArgs>(OrderEntity_CollectionEntityChanged);

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

            details.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(details_CollectionChanged);
        }
Esempio n. 4
0
        protected void ChangeCreator()
        {
            OrderEntity orderEntity = this.OrderEntity;

            if (this.EditForm.OperationType == OperationTypes.Add)
            {
                var curentLoginUser = this.OrderEntity.LoginUser;
                #region 判断是否与创建人一致
                var           posts     = (this.OrderEntity.LoginUser as LoginUserData).PostInfos;
                EmployeerData ownerInfo = orderEntity.GetOwnerInfo();

                var finds = posts.Where(item => item.Company.Value.ToString() == ownerInfo.Company.Value.ToString());
                if (finds.Count() > 0)
                {
                    curentLoginUser = finds.First();
                }

                finds = finds.Where(item => item.Department.Value.ToString() == ownerInfo.Department.Value.ToString());
                if (finds.Count() > 0)
                {
                    curentLoginUser = finds.First();
                }

                finds = finds.Where(item => item.Post.Value.ToString() == ownerInfo.Post.Value.ToString());
                if (finds.Count() > 0)
                {
                    curentLoginUser = finds.First();
                }

                #endregion

                if (curentLoginUser != this.OrderEntity.LoginUser)
                {
                    EmployeerData CreateUser = curentLoginUser;

                    orderEntity.SetObjValue("Entity.CREATECOMPANYID", CreateUser.Company.Value);
                    orderEntity.SetObjValue("Entity.CREATECOMPANYNAME", CreateUser.Company.Text);

                    orderEntity.SetObjValue("Entity.CREATEDEPARTMENTID", CreateUser.Department.Value);
                    orderEntity.SetObjValue("Entity.CREATEDEPARTMENTNAME", CreateUser.Department.Text);

                    orderEntity.SetObjValue("Entity.CREATEPOSTID", CreateUser.Post.Value);
                    orderEntity.SetObjValue("Entity.CREATEPOSTNAME", CreateUser.Post.Text);
                    orderEntity.LoginUser = CreateUser;
                }
            }
        }
Esempio n. 5
0
        private void InitData()
        {
            this.OrderEntity.Entity.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(Entity_PropertyChanged);
            if (this.OrderEntity.FBEntityState == FBEntityState.Added)
            {
                EmployeerData create = this.OrderEntity.GetCreateInfo();
                this.OrderEntity.SetObjValue(EntityFieldName.OwnerID, create.Value);
                this.OrderEntity.SetObjValue(EntityFieldName.OwnerName, create.Text);
                this.OrderEntity.SetObjValue(EntityFieldName.OwnerPostID, create.Post.Value);


                OrderEntity.SetObjValue("Entity.BUDGETYEAR", DataCore.SystemDateTime.Year);
            }
            else if (this.EditForm.OperationType == OperationTypes.Browse)
            {
                SetPropertyChanged();
                return;
            }
            GetOrderDetail();
        }
Esempio n. 6
0
        void OrderEntity_OrderPropertyChanged(object sender, OrderPropertyChangedArgs e)
        {
            T_FB_DEPTTRANSFERMASTER entity = this.OrderEntity.Entity as T_FB_DEPTTRANSFERMASTER;

            if (e.Result.Contains("Entity.TRANSFERFROM"))
            {
                if (entity.TRANSFERFROMTYPE.Equal(3)) // 个人
                {
                    EmployeerData ed = (entity.FromObject as EmployeerData);
                    entity.OWNERID           = ed.Value.ToString();
                    entity.OWNERNAME         = ed.Text;
                    entity.OWNERDEPARTMENTID = ed.Department.Value.ToString();
                    entity.OWNERPOSTID       = ed.Post.Value.ToString();
                    entity.OWNERPOSTNAME     = ed.Post.Text.ToString();
                }
                else if (entity.TRANSFERFROMTYPE.Equal(2)) // 部门 
                {
                    entity.OWNERDEPARTMENTID = entity.TRANSFERFROM;
                    //entity.OWNERDEPARTMENTNAME = dd.Text;
                    //entity.OWNERCOMPANYID = dd.Company.Value.to
                    ChangeOwnerID();
                }
                else
                {
                    // 清除预算明细
                    this.OrderEntity.GetRelationFBEntities(typeof(T_FB_DEPTTRANSFERDETAIL).Name).Clear();

                    CommonFunction.ShowMessage("调出单位必须是个人或部门");
                }

                GetOrderDetail();
                ChangeCreator();
            }
            //else if (e.Result.Contains("Entity.ToObject"))
            //{
            //    if (!entity.TRANSFERTOTYPE.Equal(3) && !entity.TRANSFERTOTYPE.Equal(2)) // 个人
            //    {
            //        CommonFunction.ShowMessage("调入单位必须是个人或部门");
            //    }
            //}
        }
Esempio n. 7
0
        private void InitData()
        {
            //string companyID = Convert.ToString(OrderEntity.GetValue("Entity.OWNERCOMPANYID"));
            //curCompany = DataCore.CompanyList.FirstOrDefault(company => { return company.ID == companyID; });
            if (this.OrderEntity.FBEntityState == FBEntityState.Added)
            {
                EmployeerData create = this.OrderEntity.GetCreateInfo();
                this.OrderEntity.SetObjValue(EntityFieldName.OwnerID, create.Value);
                this.OrderEntity.SetObjValue(EntityFieldName.OwnerName, create.Text);
                this.OrderEntity.SetObjValue(EntityFieldName.OwnerPostID, create.Post.Value);
                this.OrderEntity.SetObjValue(EntityFieldName.OwnerPostName, create.Post.Text);

                OrderEntity.SetObjValue("Entity.BUDGETARYMONTH", new DateTime(DataCore.SystemDateTime.Year, DataCore.SystemDateTime.Month, 1));
            }
            else if (this.EditForm.OperationType == OperationTypes.Browse)
            {
                SetPropertyChanged();
                return;
            }
            GetOrderDetail();
        }
Esempio n. 8
0
        private void InitData()
        {
            //string companyID = Convert.ToString(OrderEntity.GetValue("Entity.OWNERCOMPANYID"));
            //curCompany = DataCore.CompanyList.FirstOrDefault(company => { return company.ID == companyID; });
            if (this.OrderEntity.FBEntityState == FBEntityState.Added)
            {
                EmployeerData create = this.OrderEntity.GetCreateInfo();
                this.OrderEntity.SetObjValue(EntityFieldName.OwnerID, create.Value);
                this.OrderEntity.SetObjValue(EntityFieldName.OwnerName, create.Text);
                this.OrderEntity.SetObjValue(EntityFieldName.OwnerPostID, create.Post.Value);
                this.OrderEntity.SetObjValue(EntityFieldName.OwnerPostName, create.Post.Text);

                OrderEntity.SetObjValue("Entity.BUDGETYEAR", DataCore.SystemDateTime.Year);

                this.OrderEntity.SetObjValue(EntityFieldName.OwnerDepartmentID, this.OrderEntity.GetObjValue(FIELDNAME_TRANSFERFROM.ToEntityString()));
                GetOrderDetail();
            }
            else
            {
            }
        }
Esempio n. 9
0
        protected void ChangeOwnerID()
        {
            EmployeerData create = this.OrderEntity.GetCreateInfo();
            EmployeerData owner  = this.OrderEntity.GetOwnerInfo();

            if (!object.Equals(create.Department.Value, owner.Department.Value) && !string.IsNullOrEmpty(owner.Department.Value.ToString()))
            {
                SMT.Saas.Tools.PersonnelWS.PersonnelServiceClient ps = new Saas.Tools.PersonnelWS.PersonnelServiceClient();
                ps.GetDepartmentLeadersCompleted += (o, e) =>
                {
                    if (e.Result != null && e.Result.Count > 0)
                    {
                        this.OrderEntity.SetObjValue(EntityFieldName.OwnerID, e.Result[0].T_HR_EMPLOYEE.EMPLOYEEID);
                        this.OrderEntity.SetObjValue(EntityFieldName.OwnerName, e.Result[0].T_HR_EMPLOYEE.EMPLOYEECNAME);
                        this.OrderEntity.SetObjValue(EntityFieldName.OwnerPostID, e.Result[0].T_HR_POST.POSTID);
                    }
                    else
                    {
                        CommonFunction.ShowMessage("找不到相应的部门负责人");
                        //this.OrderEntity.SetObjValue(EntityFieldName.OwnerDepartmentID, null);
                        //this.OrderEntity.SetObjValue(EntityFieldName.OwnerDepartmentName, null);
                        this.OrderEntity.ReferencedData[EntityFieldName.OwnerDepartmentID] = null;
                        OnOwnerIsNotReady();
                    }
                    this.CloseProcess();
                };

                ps.GetDepartmentLeadersAsync(owner.Department.Value.ToString());
                this.ShowProcess();
            }
            else
            {
                this.OrderEntity.SetObjValue(EntityFieldName.OwnerID, create.Value);
                this.OrderEntity.SetObjValue(EntityFieldName.OwnerName, create.Text);
                this.OrderEntity.SetObjValue(EntityFieldName.OwnerPostID, create.Post.Value);
                this.OrderEntity.SetObjValue(EntityFieldName.OwnerPostName, create.Post.Text);
            }
        }
Esempio n. 10
0
        public void InitOrganization()
        {
            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);

            if (ReferencedDataInfo.Type == typeof(CompanyData).Name)
            {
                ogzLookup.SelectedObjType = OrgTreeItemTypes.Company;
            }
            else if (ReferencedDataInfo.Type == typeof(EmployeerData).Name)
            {
                ogzLookup.SelectedObjType = OrgTreeItemTypes.Personnel;
            }
            else if (ReferencedDataInfo.Type == typeof(DepartmentData).Name)
            {
                ogzLookup.SelectedObjType = OrgTreeItemTypes.Department;
            }
            else if (ReferencedDataInfo.Type == typeof(OrgObjectData).Name)
            {
                ogzLookup.SelectedObjType = OrgTreeItemTypes.All;
            }

            FrameworkElement plRoot = CommonFunction.ParentLayoutRoot;

            ogzLookup.SelectedClick += (o, e) =>
            {
                if (ogzLookup.SelectedObj.Count > 0)
                {
                    ITextValueItem item = null;
                    string         id   = ogzLookup.SelectedObj[0].ObjectID;
                    if (ReferencedDataInfo.Type == typeof(EmployeerData).Name)
                    {
                        EmployeerData eData = new EmployeerData();
                        eData.Value = ogzLookup.SelectedObj[0].ObjectID;
                        eData.Text  = ogzLookup.SelectedObj[0].ObjectName;
                        ExtOrgObj post = ogzLookup.SelectedObj[0].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
                    {
                        item = DataCore.FindRefData(ReferencedDataInfo.Type, id);
                    }
                    this.SelectItem = item;
                }
            };
            ogzLookup.Show <string>(DialogMode.ApplicationModal, plRoot, "", (result) => { });
        }
Esempio n. 11
0
        private void InitAudit(AuditOperation op)
        {
            EmployeerData auditor = null;

            if (op == AuditOperation.Add)
            {
                auditor = this.OrderEntity.GetOwnerInfo();
                string userID = Convert.ToString(auditor.Value);
                if (string.IsNullOrEmpty(userID) || userID == DataCore.SuperUser.Value.ToString())
                {
                    auditor = this.OrderEntity.LoginUser;
                }
            }
            else
            {
                auditor = this.OrderEntity.LoginUser;
            }

            // 提交前,需要对AuditEntity赋值 ,以下属性必填

            AuditEntity.CreateCompanyID    = auditor.Company.Value.ToString();
            AuditEntity.CreateDepartmentID = auditor.Department.Value.ToString();
            AuditEntity.CreatePostID       = auditor.Post.Value.ToString();
            AuditEntity.CreateUserID       = auditor.Value.ToString();
            AuditEntity.CreateUserName     = auditor.Text;
            AuditEntity.EditUserID         = auditor.Value.ToString();
            AuditEntity.EditUserName       = auditor.Text;

            AuditEntity.ModelCode = this.OrderEntity.OrderInfo.Type;
            AuditEntity.FormID    = this.OrderEntity.OrderID;

            // 如果这个单据是报销单,或借款单,且有外部扩展单据关联。重新赋FormID和ModelCode 和EditUserID= ""

            if (this.OrderEntity.OrderType != typeof(T_FB_CHARGEAPPLYMASTER) &&
                this.OrderEntity.OrderType != typeof(T_FB_BORROWAPPLYMASTER))
            {
                return;
            }

            if (this.OrderEntity.OrderType == typeof(T_FB_CHARGEAPPLYMASTER))
            {
                T_FB_CHARGEAPPLYMASTER entView = orderEntity.Entity as T_FB_CHARGEAPPLYMASTER;
                if (entView.T_FB_EXTENSIONALORDER == null)
                {
                    return;
                }


                if (entView.T_FB_EXTENSIONALORDER.T_FB_EXTENSIONALTYPE != null)
                {
                    AuditEntity.ModelCode = entView.T_FB_EXTENSIONALORDER.T_FB_EXTENSIONALTYPE.MODELCODE;
                    AuditEntity.FormID    = entView.T_FB_EXTENSIONALORDER.ORDERID;
                }
            }
            else if (this.OrderEntity.OrderType == typeof(T_FB_BORROWAPPLYMASTER))
            {
                T_FB_BORROWAPPLYMASTER entView = orderEntity.Entity as T_FB_BORROWAPPLYMASTER;
                if (entView.T_FB_EXTENSIONALORDER == null)
                {
                    return;
                }

                if (entView.T_FB_EXTENSIONALORDER.T_FB_EXTENSIONALTYPE != null)
                {
                    AuditEntity.ModelCode = entView.T_FB_EXTENSIONALORDER.T_FB_EXTENSIONALTYPE.MODELCODE;
                    AuditEntity.FormID    = entView.T_FB_EXTENSIONALORDER.ORDERID;
                }
            }
        }
Esempio n. 12
0
        public void InitOrganization()
        {

            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);

            if (ReferencedDataInfo.Type == typeof(CompanyData).Name)
            {
                ogzLookup.SelectedObjType = OrgTreeItemTypes.Company;
            }
            else if (ReferencedDataInfo.Type == typeof(EmployeerData).Name)
            {
                ogzLookup.SelectedObjType = OrgTreeItemTypes.Personnel;
            }
            else if (ReferencedDataInfo.Type == typeof(DepartmentData).Name)
            {
                ogzLookup.SelectedObjType = OrgTreeItemTypes.Department;
            }
            else if (ReferencedDataInfo.Type == typeof(OrgObjectData).Name)
            {
                ogzLookup.SelectedObjType = OrgTreeItemTypes.All;
            }

            FrameworkElement plRoot = CommonFunction.ParentLayoutRoot;

            ogzLookup.SelectedClick += (o, e) =>
            {
                if (ogzLookup.SelectedObj.Count > 0)
                {
                    ITextValueItem item = null;
                    string id = ogzLookup.SelectedObj[0].ObjectID;
                    if (ReferencedDataInfo.Type == typeof(EmployeerData).Name)
                    {
                        EmployeerData eData = new EmployeerData();
                        eData.Value = ogzLookup.SelectedObj[0].ObjectID;
                        eData.Text = ogzLookup.SelectedObj[0].ObjectName;
                        ExtOrgObj post = ogzLookup.SelectedObj[0].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
                    {
                        item = DataCore.FindRefData(ReferencedDataInfo.Type, id);
                    }
                    this.SelectItem = item;
                }
            };
            ogzLookup.Show<string>(DialogMode.ApplicationModal, plRoot, "", (result) => { });

        }