Esempio n. 1
0
        public EmployeerData GetCreateInfo()
        {
            string OwnerCompanyID      = Convert.ToString(this.GetObjValue(EntityFieldName.CreateCompanyID));
            string OwnerDepartmentID   = Convert.ToString(this.GetObjValue(EntityFieldName.CreateDepartmentID));
            string OwnerPostID         = Convert.ToString(this.GetObjValue(EntityFieldName.CreatePostID));
            string OwnerID             = Convert.ToString(this.GetObjValue(EntityFieldName.CreateUserID));
            string OnwerName           = Convert.ToString(this.GetObjValue("Entity.CREATEUSERNAME"));
            string OwnerPostName       = Convert.ToString(this.GetObjValue("Entity.CREATEPOSTNAME"));
            string ownerDepartmentName = Convert.ToString(this.GetObjValue("Entity.CREATEDEPARTMENTNAME"));
            string OwnerCompanyName    = Convert.ToString(this.GetObjValue("Entity.CREATECOMPANYNAME"));

            EmployeerData result = new EmployeerData
            {
                Value   = OwnerID,
                Text    = OnwerName,
                Company = new CompanyData {
                    Value = OwnerCompanyID, Text = OwnerCompanyName
                },
                Department = new DepartmentData {
                    Value = OwnerDepartmentID, Text = ownerDepartmentName
                },
                Post = new PostData {
                    Value = OwnerPostID, Text = OwnerPostName
                }
            };

            result.Department.Company = result.Company;
            result.Post.Department    = result.Department;
            result.Post.Company       = result.Company;
            return(result);
        }
Esempio n. 2
0
        public EmployeerData GetOwnerInfo()
        {
            string OwnerCompanyID      = Convert.ToString(this.GetObjValue(EntityFieldName.OwnerCompanyID));
            string OwnerDepartmentID   = Convert.ToString(this.GetObjValue(EntityFieldName.OwnerDepartmentID));
            string OwnerPostID         = Convert.ToString(this.GetObjValue(EntityFieldName.OwnerPostID));
            string OwnerID             = Convert.ToString(this.GetObjValue(EntityFieldName.OwnerID));
            string OnwerName           = Convert.ToString(this.GetObjValue(EntityFieldName.OwnerName));
            string OwnerPostName       = Convert.ToString(this.GetObjValue(EntityFieldName.OwnerPostName));
            string ownerDepartmentName = Convert.ToString(this.GetObjValue(EntityFieldName.OwnerDepartmentName));
            string OwnerCompanyName    = Convert.ToString(this.GetObjValue(EntityFieldName.OwnerCompanyName));

            EmployeerData result = new EmployeerData
            {
                Value   = OwnerID,
                Text    = OnwerName,
                Company = new CompanyData {
                    Value = OwnerCompanyID, Text = OwnerCompanyName
                },
                Department = new DepartmentData {
                    Value = OwnerDepartmentID, Text = ownerDepartmentName
                },
                Post = new PostData {
                    Value = OwnerPostID, Text = OwnerPostName
                }
            };

            result.Department.Company = result.Company;
            result.Post.Department    = result.Department;
            result.Post.Company       = result.Company;
            return(result);
        }
Esempio n. 3
0
        public static void InitDataCore()
        {
            if (SMT.SAAS.Main.CurrentContext.Common.CurrentConfig == null)
            {
                throw new Exception("没有登录信息");
            }
            CompanyList = new List <VirtualCompany>();

            //InitHR(); --2011年6月21日注释,原因是:新平台组织架构缓存是按需加载,因此不能直接使用了
            InitHR();  // 新的加载2013.12.24

            FBEntityService service = new FBEntityService();

            service.QueryFBEntitiesCompleted += new EventHandler <QueryFBEntitiesCompletedEventArgs>(service_QueryFBEntitiesCompleted);

            var fbVersion = "";

            service.QueryFBEntities(new QueryExpression()
            {
                QueryType = "InitDataCore", PropertyName = "FBVerson", PropertyValue = fbVersion
            });

            SuperUser                  = new EmployeerData();
            SuperUser.Company          = new CompanyData();
            SuperUser.Department       = new DepartmentData();
            SuperUser.Post             = new PostData();
            SuperUser.Company.Value    = "001";
            SuperUser.Company.Text     = "001";
            SuperUser.Department.Value = "001";
            SuperUser.Department.Text  = "001";
            SuperUser.Post.Value       = "001";
            SuperUser.Post.Text        = "001";
            SuperUser.Value            = "001";
            SuperUser.Text             = "001";
        }
Esempio n. 4
0
        public EmployeerData Copy()
        {
            EmployeerData newItem = new EmployeerData();

            base.CopyData(newItem);
            newItem.Department = this.Department;
            newItem.Post       = this.Post;
            newItem.Company    = this.Company;
            return(newItem);
        }
Esempio n. 5
0
        private List <string> OnOwnerPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            List <string> propertyNameList = new List <string>();

            entityHelper.EntityCharged -= new EventHandler <EntityChangedArgs>(entityHelper_EntityCharged);
            try
            {
                switch (e.PropertyName)
                {
                case "OWNERID":

                    EmployeerData emplyeerData = this.ReferencedData["Entity.OWNERID"] as EmployeerData;
                    if (emplyeerData != null)
                    {
                        this.SetObjValue(EntityFieldName.OwnerName, emplyeerData.Text);

                        this.SetObjValue(EntityFieldName.OwnerPostID, emplyeerData.Post.Value);
                        this.SetObjValue(EntityFieldName.OwnerPostName, emplyeerData.Post.Text);

                        this.SetObjValue(EntityFieldName.OwnerDepartmentID, emplyeerData.Department.Value);
                        this.SetObjValue(EntityFieldName.OwnerDepartmentName, emplyeerData.Department.Text);

                        this.SetObjValue(EntityFieldName.OwnerCompanyID, emplyeerData.Company.Value);
                        this.SetObjValue(EntityFieldName.OwnerCompanyName, emplyeerData.Company.Text);
                        propertyNameList.Add(EntityFieldName.OwnerID);
                        propertyNameList.Add(EntityFieldName.OwnerName);

                        propertyNameList.Add(EntityFieldName.OwnerPostID);
                        propertyNameList.Add(EntityFieldName.OwnerPostName);

                        propertyNameList.Add(EntityFieldName.OwnerDepartmentID);
                        propertyNameList.Add(EntityFieldName.OwnerDepartmentName);

                        propertyNameList.Add(EntityFieldName.OwnerCompanyID);
                        propertyNameList.Add(EntityFieldName.OwnerCompanyName);
                    }


                    break;

                case "OWNERCOMPANYID":
                    SetTextFromValue <CompanyData>("Entity.OWNERCOMPANYID", "Entity.OWNERCOMPANYNAME");

                    propertyNameList.Add(EntityFieldName.OwnerCompanyID);
                    propertyNameList.Add(EntityFieldName.OwnerCompanyName);

                    break;

                case "OWNERDEPARTMENTID":
                    DepartmentData dData = SetTextFromValue <DepartmentData>("Entity.OWNERDEPARTMENTID", "Entity.OWNERDEPARTMENTNAME");
                    propertyNameList.Add(EntityFieldName.OwnerDepartmentID);
                    propertyNameList.Add(EntityFieldName.OwnerDepartmentName);
                    try
                    {
                        if (dData != null)
                        {
                            this.SetObjValue(EntityFieldName.OwnerCompanyID, dData.Company.Value);
                            this.SetObjValue(EntityFieldName.OwnerCompanyName, dData.Company.Text);

                            propertyNameList.Add(EntityFieldName.OwnerCompanyID);
                            propertyNameList.Add(EntityFieldName.OwnerCompanyName);
                        }
                    }
                    catch (Exception ex)
                    {
                    }
                    break;

                case "OWNERPOSTID":
                    PostData pData = SetTextFromValue <PostData>(EntityFieldName.OwnerPostID, "Entity.OWNERPOSTNAME");
                    //this.SetObjValue(EntityFieldName.OwnerCompanyID, pData.Company.Value);
                    //this.SetObjValue(EntityFieldName.OwnerCompanyName, pData.Company.Text);

                    //this.SetObjValue(EntityFieldName.OwnerDepartmentID, pData.Department.Value);
                    //this.SetObjValue(EntityFieldName.OwnerDepartmentName, pData.Department.Text);

                    //propertyNameList.Add(EntityFieldName.OwnerPostID);
                    //propertyNameList.Add(EntityFieldName.OwnerPostName);

                    //propertyNameList.Add(EntityFieldName.OwnerDepartmentID);
                    //propertyNameList.Add(EntityFieldName.OwnerDepartmentName);

                    //propertyNameList.Add(EntityFieldName.OwnerCompanyID);
                    //propertyNameList.Add(EntityFieldName.OwnerCompanyName);

                    break;

                default:
                    propertyNameList.Add(e.PropertyName.ToEntityString());
                    break;
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.ToString());
            }
            entityHelper.EntityCharged += new EventHandler <EntityChangedArgs>(entityHelper_EntityCharged);
            return(propertyNameList);
        }
Esempio n. 6
0
        protected virtual void OnLoadDataCompleted()
        {
            ObjectList <ReferencedDataInfo>    listRef    = this.OrderInfo.OrderEntity.ReferenceDatas;
            ObjectList <OrderDetailEntityInfo> listDetail = this.OrderInfo.OrderEntity.OrderDetailEntities;

            this.OrderEntity.OrderDetailData.Dictionary = listDetail.Dictionary;

            CheckOrderAction();
            if (this.OrderEntity.FBEntityState == FBEntityState.Added)
            {
                this.OrderEntity.ReferencedData.Dictionary = listRef.Dictionary;
                this.OrderEntity.SetObjValue(EntityFieldName.CreateDate, DateTime.Now);
                this.OrderEntity.SetObjValue(EntityFieldName.EditStates, decimal.Parse(((int)(EditStates.Actived)).ToString()));
                this.OrderEntity.SetObjValue(EntityFieldName.CheckStates, decimal.Parse(((int)(SMT.FB.UI.FBCommonWS.CheckStates.UnSubmit)).ToString()));


                EmployeerData CreateUser = this.OrderEntity.LoginUser;
                this.OrderEntity.SetObjValue(EntityFieldName.CreateUserID, CreateUser.Value);
                this.OrderEntity.SetObjValue("Entity.CREATEUSERNAME", CreateUser.Text);
                this.OrderEntity.SetObjValue("Entity.CREATECOMPANYID", CreateUser.Company.Value);
                this.OrderEntity.SetObjValue("Entity.CREATECOMPANYNAME", CreateUser.Company.Text);

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

                this.OrderEntity.SetObjValue("Entity.CREATEPOSTID", CreateUser.Post.Value);
                this.OrderEntity.SetObjValue("Entity.CREATEPOSTNAME", CreateUser.Post.Text);
            }

            // 初始化 ReferenceData
            for (int i = 0; i < listRef.Count; i++)
            {
                object value = listRef[i].DefaultValue;
                if (this.OrderEntity.FBEntityState != FBEntityState.Added)
                {
                    value = this.OrderEntity.GetObjValue(listRef[i].ReferencedName);
                }
                ITextValueItem item = GetReference(listRef[i].Type, value);
                this.OrderEntity.ReferencedData.Add(listRef[i].ReferencedName, item);
            }

            // 初始化 OrderDetail
            for (int i = 0; i < listDetail.Count; i++)
            {
                RelationManyEntity relationManyEntity = this.OrderEntity.CollectionEntity.FirstOrDefault(item =>
                {
                    return(item.EntityType == listDetail[i].Entity.Type);
                });

                ObservableCollection <FBEntity> listOfEntity = null;
                if (relationManyEntity == null)
                {
                    listOfEntity                  = new ObservableCollection <FBEntity>();
                    relationManyEntity            = new RelationManyEntity();
                    relationManyEntity.EntityType = listDetail[i].Entity.Type;
                    relationManyEntity.FBEntities = listOfEntity;
                    this.OrderEntity.CollectionEntity.Add(relationManyEntity);
                }
                else
                {
                    listOfEntity = relationManyEntity.FBEntities;
                }
                this.OrderEntity.OrderDetailData[listDetail[i].Name] = listOfEntity;
            }

            if (LoadDataComplete != null)
            {
                LoadDataComplete(this, null);
            }
        }