Exemple #1
0
        protected override void OnLoadControlComplete()
        {
            DetailGrid grid = this.EditForm.FindControl("OrderGrid") as DetailGrid;

            if (grid != null)
            {
                grid.CheckSame = CheckSameSubject;
            }

            this.OrderEntity.ReferencedData["Entity.REPAYTYPE"] = DataCore.FindRefData("BorrowTypeData", 1);
        }
Exemple #2
0
        private void InitData(Order order)
        {
            if (this.orderEntity.OrderStatus == EntityAdapter.EditStatus.New)
            {
                string typeName = orderEntity.OrderTypeName;
                this.orderEntity = new OrderEntity(orderEntity.OrderType);
                this.orderEntity.OrderTypeName = typeName;


                EmplyeerData itemOwner = DataCore.CurrentUser.CurrentPostInfo.Copy();
                this.orderEntity.ReferencedData.Dictionary                  = order.ReferenceDataInfoList.Dictionary;
                this.orderEntity.ReferencedData["Entity.OWNERID"]           = itemOwner;
                this.orderEntity.ReferencedData["Entity.OWNERDEPARTMENTID"] = itemOwner.DepartMent;
                this.orderEntity.ReferencedData["Entity.OWNERCOMPANYID"]    = itemOwner.Company;


                this.orderEntity.SetValue("Entity.CREATEUSERID", DataCore.CurrentUser.UserID);
                this.orderEntity.SetValue("Entity.UPDATEUSERID", DataCore.CurrentUser.UserID);
                this.orderEntity.SetValue("Entity.CREATEDATE", DateTime.Now);
                this.orderEntity.SetValue("Entity.CREATEDEPARTMENTID", DataCore.CurrentUser.CurrentPostInfo.DepartMent.Value);
                this.orderEntity.SetValue("Entity.CREATECOMPANYID", DataCore.CurrentUser.CurrentPostInfo.Company.Value);

                this.orderEntity.SetValue("Entity.CREATEDEPARTMENTNAME", DataCore.CurrentUser.CurrentPostInfo.DepartMent.Text);
                this.orderEntity.SetValue("Entity.CREATECOMPANYNAME", DataCore.CurrentUser.CurrentPostInfo.Company.Text);

                //暂时
                this.orderEntity.SetValue("Entity.OWNERPOSTID", DataCore.CurrentUser.CurrentPostInfo.Post.Value);
                this.orderEntity.SetValue("Entity.CREATEPOSTID", DataCore.CurrentUser.CurrentPostInfo.Post.Value);

                this.orderEntity.SetValue("Entity.CREATEPOSTNAME", DataCore.CurrentUser.CurrentPostInfo.Post.Text);
                this.orderEntity.SetValue("Entity.OWNERPOSTNAME", DataCore.CurrentUser.CurrentPostInfo.Post.Text);
            }
            else if (this.orderEntity.OrderStatus == EntityAdapter.EditStatus.Edit)
            {
                QueryExpression q = new QueryExpression();
                q.PropertyName  = orderEntity.Entity.EntityKey.EntityContainerName;
                q.PropertyValue = orderEntity.OrderID;
                q.Operation     = QueryExpression.Operations.Equal;
                //orderEntity.Entity.EntityKey.EntityContainerName
                this.orderEntity = OrderSource.GetOrder(q)[0];

                ObjectList <ReferencedDataInfo> list = order.ReferenceDataInfoList;
                for (int i = 0; i < order.ReferenceDataInfoList.Count; i++)
                {
                    object         key  = this.orderEntity.GetValue(list[i].PropertyName);
                    ITextValueItem item = null;
                    if (key != null)
                    {
                        item = DataCore.FindRefData(list[i].ReferencedType, key.ToString());
                    }
                    orderEntity.ReferencedData.Add(list[i].PropertyName, item);
                }
            }
        }
Exemple #3
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) => { });
        }
Exemple #4
0
        private void OnBorrowIDChanged <TEntity>() where TEntity : EntityObject
        {
            DetailGrid dgrid = this.EditForm.FindControl("OrderGrid") as DetailGrid;

            if (dgrid != null)
            {
                dgrid.ShowToolBar = false;
            }

            ObservableCollection <FBEntity> details = this.OrderEntity.GetRelationFBEntities(typeof(TEntity).Name);

            details.Clear();

            T_FB_BORROWAPPLYMASTER borrowMaster = this.OrderEntity.GetObjValue(typeof(T_FB_BORROWAPPLYMASTER).Name.ToEntityString()) as T_FB_BORROWAPPLYMASTER;

            if (borrowMaster == null)
            {
                return;
            }

            int iPayType = 0;

            int.TryParse(this.OrderEntity.GetObjValue("Entity.PAYTYPE").ToString(), out iPayType);
            if (iPayType != 2)
            {
                this.OrderEntity.ReferencedData["Entity.PAYTYPE"] = DataCore.FindRefData("PayTypeData", 2);
            }

            T_FB_CHARGEAPPLYMASTER chargeMaster = this.OrderEntity.Entity as T_FB_CHARGEAPPLYMASTER;

            if (chargeMaster.OWNERID == borrowMaster.OWNERID)
            {
                if (chargeMaster.OWNERPOSTID != borrowMaster.OWNERPOSTID)
                {
                    chargeMaster.OWNERPOSTID   = borrowMaster.OWNERPOSTID;
                    chargeMaster.OWNERPOSTNAME = borrowMaster.OWNERPOSTNAME;
                }

                if (chargeMaster.OWNERDEPARTMENTID != borrowMaster.OWNERDEPARTMENTID)
                {
                    chargeMaster.OWNERDEPARTMENTID   = borrowMaster.OWNERDEPARTMENTID;
                    chargeMaster.OWNERDEPARTMENTNAME = borrowMaster.OWNERDEPARTMENTNAME;
                }

                if (chargeMaster.OWNERCOMPANYID != borrowMaster.OWNERCOMPANYID)
                {
                    chargeMaster.OWNERCOMPANYID   = borrowMaster.OWNERCOMPANYID;
                    chargeMaster.OWNERCOMPANYNAME = borrowMaster.OWNERCOMPANYNAME;
                }
            }

            QueryExpression qeBorrow    = QueryExpressionHelper.Equal("T_FB_BORROWAPPLYMASTER.BORROWAPPLYMASTERID", borrowMaster.BORROWAPPLYMASTERID);
            QueryExpression qeOwner     = this.OrderEntity.GetQueryExpression(FieldName.OwnerID);
            QueryExpression qeOwnerPost = this.OrderEntity.GetQueryExpression(FieldName.OwnerPostID);

            qeBorrow.QueryType         = typeof(TEntity).Name;
            qeBorrow.RelatedExpression = qeOwner;
            qeOwner.RelatedExpression  = qeOwnerPost;

            FBEntityService service = new FBEntityService();

            service.QueryFBEntitiesCompleted += (o, ea) =>
            {
                ea.Result.ToList().ForEach(item =>
                {
                    details.Add(item);
                    item.FBEntityState = FBEntityState.Added;
                });
            };
            service.QueryFBEntities(qeBorrow);
        }
Exemple #5
0
        void OrderEntity_OrderPropertyChanged(object sender, OrderPropertyChangedArgs e)
        {
            if (object.Equals(sender, this.OrderEntity.Entity))
            {
                if (e.Result.Contains(typeof(T_FB_BORROWAPPLYMASTER).Name.ToEntityString()))
                {
                    OnBorrowIDChanged <T_FB_CHARGEAPPLYDETAIL>();
                }

                #region 测试
                else if (e.Result.Contains("Entity.REMARK"))
                {
                    string remark = Convert.ToString(this.OrderEntity.GetObjValue("Entity.REMARK"));
                    if (remark == "#Show Version#")
                    {
                        this.OrderEntity.SetObjValue("Entity.REMARK", "2010.12.21.18.00");
                    }
                }
                #endregion

                else if (e.Result.Contains(EntityFieldName.OwnerID))
                {
                    ChangeCreator();
                }
                else if (e.Result.Contains("Entity.PAYTYPE"))
                {
                    int iPayType = 0;
                    int.TryParse(this.OrderEntity.GetObjValue("Entity.PAYTYPE").ToString(), out iPayType);
                    SMT.FB.UI.FBLookUp fblBorrow = this.EditForm.FindControl("BorrowApply") as SMT.FB.UI.FBLookUp;
                    DetailGrid         dgrid     = this.EditForm.FindControl("OrderGrid") as DetailGrid;

                    T_FB_BORROWAPPLYMASTER borrowMaster = this.OrderEntity.GetObjValue(typeof(T_FB_BORROWAPPLYMASTER).Name.ToEntityString()) as T_FB_BORROWAPPLYMASTER;

                    if (iPayType != 2 && borrowMaster != null)
                    {
                        if (dgrid != null)
                        {
                            ObservableCollection <FBEntity> details = this.OrderEntity.GetRelationFBEntities(typeof(T_FB_CHARGEAPPLYDETAIL).Name);
                            details.Clear();
                        }

                        borrowMaster = null;
                        this.OrderEntity.ReferencedData["Entity.T_FB_BORROWAPPLYMASTER"] = DataCore.FindRefData("BorrowOrderData", borrowMaster);
                        dgrid.ShowToolBar = true;
                    }
                }
            }
        }