예제 #1
0
파일: SaveEntityBLL.cs 프로젝트: JuRogn/OA
        public FBEntity ReSubmit(FBEntity fbEntity)
        {
            EntityObject entity = fbEntity.Entity;

            string returnType = fbEntity.Entity.GetType().Name;
            Type type = this.GetType();
            MethodInfo method = type.GetMethod("ReSubmit" + returnType);
            if (method != null)
            {
                try
                {
                    object result = method.Invoke(this, new object[] { entity });
                    return result as FBEntity;
                }
                catch (Exception ex)
                {

                    throw ex.InnerException;
                }
            }
            else
            {
                return null; // SaveDefault(fbEntity);
            }
        }
예제 #2
0
파일: FBEntityBLL.cs 프로젝트: JuRogn/OA
        public FBEntity FBEntityBLLGetFBEntity(QueryExpression queryExpression)
        {
            FBEntity entity = new FBEntity();

            List<EntityObject> list = BaseGetEntities(queryExpression);
            EntityObject eo = list.FirstOrDefault();

            if (eo == null)
            {
                return null;
            }
            entity.Entity = eo;

            GetFBEntityFull(entity);
            return entity;

        }
예제 #3
0
파일: FBEntityBLL.cs 프로젝트: JuRogn/OA
        public FBEntity GetFBEntityFull(FBEntity entity)
        {
            EntityObject eo = entity.Entity;
            var rs = (eo as IEntityWithRelationships).RelationshipManager.GetAllRelatedEnds();

            // Add Relation
            foreach (IRelatedEnd re in rs)
            {
                if (re.GetType().BaseType != typeof(EntityReference))
                {
                    AttachRelationManyEntity(entity, re);
                }
                else
                {
                    AttachRelationOneEntity(entity, re);
                }
            }

            // Child Entity, add Relation
            foreach (RelationManyEntity rEntity in entity.CollectionEntity)
            {
                rEntity.FBEntities.ForEach(subEntity =>
                {
                    var rsSub = (subEntity.Entity as IEntityWithRelationships).RelationshipManager.GetAllRelatedEnds();
                    foreach (IRelatedEnd re in rsSub)
                    {
                        if (re.GetType().BaseType == typeof(EntityReference))
                        {
                            AttachRelationOneEntity(subEntity, re);
                        }
                        else
                        {
                            #region beyond
                            AttachRelationManyEntity(subEntity, re);
                            #endregion
                        }
                    }
                });
            }
            return entity;
        }
예제 #4
0
파일: BudgetSumBLL.cs 프로젝트: JuRogn/OA
        public void CreateCompanyBudgetSumDetail(T_FB_COMPANYBUDGETAPPLYMASTER entity)
        {
            if (UpdateOldDetail(entity))
            {
                return;
            }
            T_FB_COMPANYBUDGETSUMDETAIL detail = new T_FB_COMPANYBUDGETSUMDETAIL();

            detail.COMPANYBUDGETSUMDETAILID = Guid.NewGuid().ToString();
            detail.CREATEUSERID = SYSTEM_USER_ID;
            detail.CREATEDATE = System.DateTime.Now;
            detail.UPDATEUSERID = SYSTEM_USER_ID;
            detail.UPDATEDATE = System.DateTime.Now;
            detail.T_FB_COMPANYBUDGETAPPLYMASTER = entity;
            FBEntity fbDetail = detail.ToFBEntity();
            fbDetail.FBEntityState = FBEntityState.Added;

            FBEntity fbSumMaster = new FBEntity();
            fbSumMaster = GetCompanyBudgetSum(entity);           
            detail.T_FB_COMPANYBUDGETSUMMASTER = fbSumMaster.Entity as T_FB_COMPANYBUDGETSUMMASTER;
            fbSumMaster.AddFBEntities<T_FB_COMPANYBUDGETSUMDETAIL>(new List<FBEntity> { fbDetail });
            this.InnerSave(fbSumMaster);
        }
예제 #5
0
파일: BudgetSumBLL.cs 프로젝트: JuRogn/OA
        //自定义汇总
        public bool CreateCompanyBudgetSumSetMaster(FBEntity fbMaster)
        {
            bool bRes = false;
            T_FB_COMPANYBUDGETSUMMASTER Master = fbMaster.Entity as T_FB_COMPANYBUDGETSUMMASTER;
            foreach (var entity in Master.T_FB_COMPANYBUDGETSUMDETAIL)
            {
                T_FB_COMPANYBUDGETSUMDETAIL detail = new T_FB_COMPANYBUDGETSUMDETAIL();

                detail.COMPANYBUDGETSUMDETAILID = Guid.NewGuid().ToString();
                detail.CREATEUSERID = SYSTEM_USER_ID;
                detail.CREATEDATE = System.DateTime.Now;
                detail.UPDATEUSERID = SYSTEM_USER_ID;
                detail.UPDATEDATE = System.DateTime.Now;
                detail.T_FB_COMPANYBUDGETAPPLYMASTER = entity.T_FB_COMPANYBUDGETAPPLYMASTER;
                FBEntity fbDetail = detail.ToFBEntity();
                fbDetail.FBEntityState = FBEntityState.Added;

                List<FBEntity> fbSumMasterlist = new List<FBEntity>();

                //查找汇总节点设置 有则新增汇总记录
                FBEntity fbSumMaster = new FBEntity();
                QueryExpression qeDetail = QueryExpression.Equal(FieldName.OwnerCompanyID, entity.T_FB_COMPANYBUDGETAPPLYMASTER.OWNERCOMPANYID).And(FieldName.EditStates, "1");
                qeDetail.QueryType = "T_FB_SUMSETTINGSDETAIL";
                T_FB_SUMSETTINGSDETAIL detailset = GetEntities<T_FB_SUMSETTINGSDETAIL>(qeDetail).FirstOrDefault();
                T_FB_SUMSETTINGSMASTER masterset = null;
                if (detailset != null)
                {
                    QueryExpression qeMaster = QueryExpression.Equal("SUMSETTINGSMASTERID", detailset.T_FB_SUMSETTINGSMASTERReference.EntityKey.EntityKeyValues[0].Value.ToString()).And(FieldName.EditStates, "1");
                    qeMaster.QueryType = "T_FB_SUMSETTINGSMASTER";
                    masterset = GetEntities<T_FB_SUMSETTINGSMASTER>(qeMaster).FirstOrDefault();
                    if (masterset != null)
                    {
                        fbSumMaster = GetCompanyBudgetSumSet(entity, masterset);
                        detail.T_FB_COMPANYBUDGETSUMMASTER = fbSumMaster.Entity as T_FB_COMPANYBUDGETSUMMASTER;
                        fbSumMaster.AddFBEntities<T_FB_COMPANYBUDGETSUMDETAIL>(new List<FBEntity> { fbDetail });
                        fbSumMasterlist.Add(fbSumMaster);
                        Master.PARENTID = detail.T_FB_COMPANYBUDGETSUMMASTER.COMPANYBUDGETSUMMASTERID;
                        Master.SUMSETTINGSMASTERID = masterset.SUMSETTINGSMASTERID;
                        Master.SUMLEVEL = 1; //0:代表当前汇总单不走自定义汇总流程;1:代表当前汇总单走自定义汇总流程
                        fbMaster.Entity = Master;
                        fbMaster.FBEntityState = FBEntityState.Modified;
                        fbSumMasterlist.Add(fbMaster);
                        this.FBEntityBLLSaveListNoTrans(fbSumMasterlist);
                       // this.InnerSave(fbSumMaster);
                    }
                }
            }

            bRes = true;
            return bRes;
          
        }
예제 #6
0
파일: FBService.svc.cs 프로젝트: JuRogn/OA
 public SaveResult Save(FBEntity fbEntity)
 {
     SaveResult result = new SaveResult();
     try
     {
         using (FBCommonBLL fbCommonBLL = new FBCommonBLL())
         {
             result = fbCommonBLL.FBCommSaveEntity(fbEntity);
         }
     }
     catch (Exception ex)
     {
         result.Successful = false;
         result.Exception = ex.Message;
     }
     return result;
 }
예제 #7
0
파일: Test2.aspx.cs 프로젝트: JuRogn/OA
        protected void btnGenXml_Click(object sender, EventArgs e)
        {
         
            string typeName = "";
            string keyName = "";
            var orderID = this.orderIDForXmlQuery.Text.Split(':')[0];
            var entityInfo = EntityInfoList.First(item => item.Type == this.ddlOrderType.SelectedValue);
            typeName = entityInfo.Type;
            keyName = entityInfo.KeyName;
            var codeName = entityInfo.CodeName;
            string qName = codeName;
            Guid tempGuidID = Guid.Empty;
            
            if (Guid.TryParse(orderID, out tempGuidID))
            {
                qName = keyName;
            }

            QueryExpression qe = QueryExpression.Equal(qName, orderID);
            qe.QueryType = typeName;
            SubjectBLL sbll = new SubjectBLL();
            var data = qe.Query(sbll);
            var order = data.FirstOrDefault();
            if (order != null)
            {
                this.orderIDForXmlQuery.Text += ":" + order.GetValue(keyName);
                FBEntity dataFBEntity = sbll.GetFBEntityByEntityKey(order.EntityKey);
                FBEntity fbEntity = new FBEntity();
                VirtualAudit auditEntity = new VirtualAudit{ModelCode = typeName};
                fbEntity.Entity = auditEntity;
                fbEntity.ReferencedEntity.Add(new RelationOneEntity(){FBEntity = dataFBEntity});
                AuditBLL bll = new AuditBLL();
                xmlConent.Value = bll.GetAuditXmlForMobile(auditEntity.ModelCode, dataFBEntity);
            }
            else
            {
                Response.Write("没有可操作的数据");
            }
        }
예제 #8
0
파일: FBEntityBLL.cs 프로젝트: JuRogn/OA
        private void AttachRelationManyEntity(FBEntity entity, IRelatedEnd re)
        {
            Type t = re.GetType();
            Type eType = t.GetGenericArguments()[0];
            if (!re.IsLoaded) re.Load();             

            RelationManyEntity rManyE = new RelationManyEntity();
            rManyE.EntityType = eType.Name;
            rManyE.RelationshipName = re.RelationshipName;
            rManyE.PropertyName = re.TargetRoleName;
            entity.CollectionEntity.Add(rManyE);

            foreach (var item in re)
            {

                FBEntity tempEntity = new FBEntity();

                tempEntity.Entity = item as EntityObject;
                rManyE.FBEntities.Add(tempEntity);
            }
            //rManyE.FBEntities.ForEach(item =>
            //    {
            //        try
            //        {
            //            IEntityWithRelationships ie = item.Entity as IEntityWithRelationships;
            //            re.Remove(ie);
            //        }
            //        catch (Exception ex)
            //        {
            //        }
            //    });


        }
예제 #9
0
파일: FBEntityBLL.cs 프로젝트: JuRogn/OA
        /// <summary>        
        ///   保存科目设置流水
        /// </summary>
        /// <param name="fbEntityList"></param>
        /// <returns></returns>
        public bool SaveListT_FB_WFSUBJECTSETTING(List<FBEntity> fbEntityList, string strfig)
        {
            List<FBEntity> inActivedlist = fbEntityList.CreateList(item =>
            {
                T_FB_WFSUBJECTSETTING fbEntity = new T_FB_WFSUBJECTSETTING();

                if (strfig == "1")
                {
                    T_FB_SUBJECTCOMPANY SubjectEntity = item.Entity as T_FB_SUBJECTCOMPANY;

                    fbEntity.WFSUBJECTSETTINGID = Guid.NewGuid().ToString();
                    fbEntity.SUBJECTID = SubjectEntity.T_FB_SUBJECTReference.EntityKey.EntityKeyValues[0].Value.ToString();
                    fbEntity.ACTIVED = SubjectEntity.ACTIVED;
                    fbEntity.ISMONTHADJUST = SubjectEntity.ISMONTHADJUST;
                    fbEntity.ISMONTHLIMIT = SubjectEntity.ISMONTHLIMIT;
                    fbEntity.ISPERSON = SubjectEntity.ISPERSON;
                    fbEntity.ISYEARBUDGET = SubjectEntity.ISYEARBUDGET;
                    fbEntity.CONTROLTYPE = SubjectEntity.CONTROLTYPE;
                    fbEntity.OWNERCOMPANYID = SubjectEntity.OWNERCOMPANYID;
                    fbEntity.OWNERCOMPANYNAME = SubjectEntity.OWNERCOMPANYNAME;
                    fbEntity.OWNERDEPARTMENTID = SubjectEntity.OWNERDEPARTMENTID;
                    fbEntity.OWNERDEPARTMENTNAME = SubjectEntity.OWNERDEPARTMENTNAME;
                    fbEntity.OWNERPOSTID = SubjectEntity.OWNERPOSTID;
                    fbEntity.OWNERPOSTNAME = SubjectEntity.OWNERPOSTNAME;
                    fbEntity.CREATEUSERID = SubjectEntity.CREATEUSERID;
                    fbEntity.UPDATEUSERID = SubjectEntity.UPDATEUSERID;
                    fbEntity.UPDATEDATE = DateTime.Now;
                    fbEntity.CREATEDATE = DateTime.Now;
                    fbEntity.ORDERTYPE = strfig;//1 公司 2部门 3岗位
                }
                else if (strfig == "2")
                {
                    T_FB_SUBJECTDEPTMENT SubjectEntity = item.Entity as T_FB_SUBJECTDEPTMENT;
                    if (SubjectEntity == null)
                    {
                        T_FB_SUBJECTPOST SubjectEntity1 = item.Entity as T_FB_SUBJECTPOST;

                        fbEntity.WFSUBJECTSETTINGID = Guid.NewGuid().ToString();
                        fbEntity.SUBJECTID = SubjectEntity1.T_FB_SUBJECTReference.EntityKey.EntityKeyValues[0].Value.ToString();
                        fbEntity.ACTIVED = SubjectEntity1.ACTIVED;
                        fbEntity.LIMITBUDGEMONEY = SubjectEntity1.LIMITBUDGEMONEY;
                        fbEntity.OWNERCOMPANYID = SubjectEntity1.OWNERCOMPANYID;
                        fbEntity.OWNERCOMPANYNAME = SubjectEntity1.OWNERCOMPANYNAME;
                        fbEntity.OWNERDEPARTMENTID = SubjectEntity1.OWNERDEPARTMENTID;
                        fbEntity.OWNERDEPARTMENTNAME = SubjectEntity1.OWNERDEPARTMENTNAME;
                        fbEntity.OWNERPOSTID = SubjectEntity1.OWNERPOSTID;
                        fbEntity.OWNERPOSTNAME = SubjectEntity1.OWNERPOSTNAME;
                        fbEntity.CREATEUSERID = SubjectEntity1.CREATEUSERID;
                        fbEntity.UPDATEUSERID = SubjectEntity1.UPDATEUSERID;
                        fbEntity.UPDATEDATE = DateTime.Now;
                        fbEntity.CREATEDATE = DateTime.Now;
                        fbEntity.ORDERTYPE = "3";//1 公司 2部门 3岗位
                    }
                    else
                    {
                        fbEntity.WFSUBJECTSETTINGID = Guid.NewGuid().ToString();
                        fbEntity.SUBJECTID = SubjectEntity.T_FB_SUBJECTReference.EntityKey.EntityKeyValues[0].Value.ToString();
                        fbEntity.ACTIVED = SubjectEntity.ACTIVED;
                        fbEntity.LIMITBUDGEMONEY = SubjectEntity.LIMITBUDGEMONEY;
                        fbEntity.OWNERCOMPANYID = SubjectEntity.OWNERCOMPANYID;
                        fbEntity.OWNERCOMPANYNAME = SubjectEntity.OWNERCOMPANYNAME;
                        fbEntity.OWNERDEPARTMENTID = SubjectEntity.OWNERDEPARTMENTID;
                        fbEntity.OWNERDEPARTMENTNAME = SubjectEntity.OWNERDEPARTMENTNAME;
                        fbEntity.OWNERPOSTID = SubjectEntity.OWNERPOSTID;
                        fbEntity.OWNERPOSTNAME = SubjectEntity.OWNERPOSTNAME;
                        fbEntity.CREATEUSERID = SubjectEntity.CREATEUSERID;
                        fbEntity.UPDATEUSERID = SubjectEntity.UPDATEUSERID;
                        fbEntity.UPDATEDATE = DateTime.Now;
                        fbEntity.CREATEDATE = DateTime.Now;
                        fbEntity.ORDERTYPE = strfig;//1 公司 2部门 3岗位
                    }
                }
                else if (strfig == "3")
                {
                    T_FB_SUBJECTPOST SubjectEntity = item.Entity as T_FB_SUBJECTPOST;

                    fbEntity.WFSUBJECTSETTINGID = Guid.NewGuid().ToString();
                    fbEntity.SUBJECTID = SubjectEntity.T_FB_SUBJECTReference.EntityKey.EntityKeyValues[0].Value.ToString();
                    fbEntity.ACTIVED = SubjectEntity.ACTIVED;
                    fbEntity.LIMITBUDGEMONEY = SubjectEntity.LIMITBUDGEMONEY;
                    fbEntity.OWNERCOMPANYID = SubjectEntity.OWNERCOMPANYID;
                    fbEntity.OWNERCOMPANYNAME = SubjectEntity.OWNERCOMPANYNAME;
                    fbEntity.OWNERDEPARTMENTID = SubjectEntity.OWNERDEPARTMENTID;
                    fbEntity.OWNERDEPARTMENTNAME = SubjectEntity.OWNERDEPARTMENTNAME;
                    fbEntity.OWNERPOSTID = SubjectEntity.OWNERPOSTID;
                    fbEntity.OWNERPOSTNAME = SubjectEntity.OWNERPOSTNAME;
                    fbEntity.CREATEUSERID = SubjectEntity.CREATEUSERID;
                    fbEntity.UPDATEUSERID = SubjectEntity.UPDATEUSERID;
                    fbEntity.UPDATEDATE = DateTime.Now;
                    fbEntity.CREATEDATE = DateTime.Now;
                    fbEntity.ORDERTYPE = strfig;//1 公司 2部门 3岗位
                }
                FBEntity a = new FBEntity();
                a.Entity = fbEntity;
                a.FBEntityState = FBEntityState.Added;
                a.EntityKey = null;
                return a;
            });
            return FBEntityBLLSaveList(inActivedlist);
        }
예제 #10
0
파일: FBEntityBLL.cs 프로젝트: JuRogn/OA
        /// <summary>
        ///   部门科目记录修改流水
        /// </summary>
        /// <param name="fbEntityList"></param>
        /// <returns></returns>
        public bool SaveListT_FB_SUBJECTDEPTMENT(List<FBEntity> fbEntityList)
        {
            if (fbEntityList.Count > 0)
            {
                //记录公司部门科目设置修改流水
                SaveListT_FB_WFSUBJECTSETTING(fbEntityList, "2");

                //修改部门启用时,同时更新岗位启用。
                fbEntityList.ForEach(item =>
                {
                    T_FB_SUBJECTDEPTMENT entity = item.Entity as T_FB_SUBJECTDEPTMENT;
                    if (entity != null && entity.ACTIVED == 0)
                    {
                        List<FBEntity> EntityListPost = new List<FBEntity>();
                        QueryExpression qe = QueryExpression.Equal("T_FB_SUBJECTDEPTMENT.SUBJECTDEPTMENTID", entity.SUBJECTDEPTMENTID);

                        List<T_FB_SUBJECTPOST> PostList = GetEntities<T_FB_SUBJECTPOST>(qe);
                        PostList.ForEach(p =>
                        {
                            FBEntity a = new FBEntity();
                            a.FBEntityState = FBEntityState.Modified;

                            p.ACTIVED = 0;//1 : 可用 ; 0 : 不可用

                            a.Entity = p;
                            a.EntityKey = null;
                            EntityListPost.Add(a);
                        });
                        FBEntityBLLSaveList(EntityListPost);
                    }
                });
            }
            return FBEntityBLLSaveList(fbEntityList);
        }
예제 #11
0
파일: FBEntityBLL.cs 프로젝트: JuRogn/OA
        internal void InnerSave(FBEntity fbEntity)
        {
           
            List<FBEntity> listSave = new List<FBEntity>();
            if (fbEntity != null)
            {
                foreach (RelationManyEntity rEntity in fbEntity.CollectionEntity)
                {

                    rEntity.FBEntities.ForEach(subEntity =>
                    {
                        // 没改变的记录不修改
                        if (subEntity.FBEntityState == FBEntityState.Unchanged)
                        {
                            return;
                        }
                        RefreshData(subEntity.Entity);
                        listSave.Add(subEntity);
                    });
                }
                RefreshData(fbEntity.Entity);
                listSave.Add(fbEntity);
            }

            if ((fbEntity.FBEntityState == FBEntityState.Added) && (!typeof(VirtualEntityObject).IsAssignableFrom(fbEntity.GetType()))) // 添加的实体也一同把子实体也添加.
            {
                BassBllSave(fbEntity.Entity, fbEntity.FBEntityState);
            }
            else
            {
                listSave.ForEach(saveEntity =>
                {
                    BassBllSave(saveEntity.Entity, saveEntity.FBEntityState);
                });
            }

        }
예제 #12
0
파일: FBEntityBLL.cs 프로젝트: JuRogn/OA
        public bool FBEntityBllSave(FBEntity fbEntity)
        {
            try
            {
               // BeginTransaction();

                InnerSave(fbEntity);

              //  CommitTransaction();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            if (typeof(VirtualEntityObject).IsAssignableFrom(fbEntity.GetType()))
            {
                return false;
            }
            //EntityObject newEntity = GetEntity(fbEntity.Entity.EntityKey);
            
            //FBEntity newFBEntity = new FBEntity();
            //newFBEntity.Entity = newEntity;
            //GetFBEntityFull(newFBEntity);
            //return newFBEntity;
            return true;
            
        }
예제 #13
0
파일: FBEntityBLL.cs 프로젝트: JuRogn/OA
 private void AttachRelationOneEntity(FBEntity entity, IRelatedEnd re)
 {
     //Type t = re.GetType();
     //Type eType = t.GetGenericArguments()[0];
     if (re.IsLoaded) return;
     re.Load();
     //RelationOneEntity rOneE = new RelationOneEntity();
     //rOneE.EntityType= eType.Name;
     //rOneE.RelationshipName = re.RelationshipName;
     //rOneE.PropertyName = re.TargetRoleName;
     //entity.ReferencedEntity.Add(rOneE);
     //foreach (var item in re)
     //{
     //    FBEntity tempEntity = new FBEntity();
     //    tempEntity.Entity = item as EntityObject;
     //    rOneE.FBEntity = tempEntity;
     //    // re.Remove(item as IEntityWithRelationships);
     //}
 }
예제 #14
0
 public AuditResult AuditFBEntity(FBEntity fbEntity, CheckStates checkStates)
 {
     try
     {
         using (FBCommonBLL fbCommonBLL = new FBCommonBLL())
         {
             return fbCommonBLL.AuditFBEntity(fbEntity, checkStates);
         }
     }
     catch (Exception ex)
     {
         Tracer.Debug(ex.ToString());
         throw ex;
     }
     
 }
예제 #15
0
 public SaveResult Save(FBEntity fbEntity)
 {
     SaveResult result = new SaveResult();
     try
     {
         using (FBCommonBLL fbCommonBLL = new FBCommonBLL())
         {
             fbCommonBLL.BeginTransaction();
             result = fbCommonBLL.FBCommSaveEntity(fbEntity);
             if (result.Successful)
             {
                 fbCommonBLL.CommitTransaction();
             }
         }
     }
     catch (Exception ex)
     {
         result.Successful = false;
         result.Exception = ex.Message;
         Tracer.Debug(ex.ToString());
     }
     return result;
 }