Example #1
0
        public FBEntity ReSubmitT_FB_COMPANYBUDGETAPPLYMASTER(T_FB_COMPANYBUDGETAPPLYMASTER entity)
        {
            FBEntity fbEntity = GetFBEntityByEntityKey(entity.EntityKey);

            fbEntity.FBEntityState = FBEntityState.ReSubmit;

            var master  = fbEntity.Entity as T_FB_COMPANYBUDGETAPPLYMASTER;
            var details = fbEntity.GetRelationFBEntities(typeof(T_FB_COMPANYBUDGETAPPLYDETAIL).Name);

            T_FB_COMPANYBUDGETAPPLYMASTER resultEntity = master.CopyEntity();

            resultEntity.COMPANYBUDGETAPPLYMASTERID   = Guid.NewGuid().ToString();
            resultEntity.COMPANYBUDGETAPPLYMASTERCODE = "自动生成";
            resultEntity.CHECKSTATES = (int)CheckStates.UnSubmit;
            resultEntity.ISVALID     = "0"; // 未汇总
            resultEntity.T_FB_COMPANYBUDGETSUMDETAIL = null;

            var result        = resultEntity.ToFBEntity();
            var resultDetails = result.GetRelationFBEntities(typeof(T_FB_COMPANYBUDGETAPPLYDETAIL).Name);

            var tempDetails = details.ToEntityList <T_FB_COMPANYBUDGETAPPLYDETAIL>();

            foreach (var item in tempDetails)
            {
                T_FB_COMPANYBUDGETAPPLYDETAIL detail = item.CopyEntity();
                detail.COMPANYBUDGETAPPLYDETAILID    = Guid.NewGuid().ToString();
                detail.T_FB_COMPANYBUDGETAPPLYMASTER = resultEntity;
                FBEntity detailFBEntity = detail.ToFBEntity();
                detailFBEntity.FBEntityState = FBEntityState.Added;
                resultDetails.Add(detailFBEntity);
            }

            result.FBEntityState = FBEntityState.ReSubmit;
            return(result);
        }
Example #2
0
        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);
        }
Example #3
0
        public FBEntity ReSubmitT_FB_COMPANYBUDGETAPPLYMASTER(T_FB_COMPANYBUDGETAPPLYMASTER entity)
        {

            FBEntity fbEntity = GetFBEntityByEntityKey(entity.EntityKey);
            fbEntity.FBEntityState = FBEntityState.ReSubmit;

            var master = fbEntity.Entity as T_FB_COMPANYBUDGETAPPLYMASTER;
            var details = fbEntity.GetRelationFBEntities(typeof(T_FB_COMPANYBUDGETAPPLYDETAIL).Name);

            T_FB_COMPANYBUDGETAPPLYMASTER resultEntity = master.CopyEntity();
            resultEntity.COMPANYBUDGETAPPLYMASTERID = Guid.NewGuid().ToString();
            resultEntity.COMPANYBUDGETAPPLYMASTERCODE = "自动生成";
            resultEntity.CHECKSTATES = (int)CheckStates.UnSubmit;
            resultEntity.ISVALID = "0"; // 未汇总
            resultEntity.T_FB_COMPANYBUDGETSUMDETAIL = null;

            var result = resultEntity.ToFBEntity();
            var resultDetails = result.GetRelationFBEntities(typeof(T_FB_COMPANYBUDGETAPPLYDETAIL).Name);

            var tempDetails = details.ToEntityList<T_FB_COMPANYBUDGETAPPLYDETAIL>();
            foreach (var item in tempDetails)
            {
                T_FB_COMPANYBUDGETAPPLYDETAIL detail = item.CopyEntity();
                detail.COMPANYBUDGETAPPLYDETAILID = Guid.NewGuid().ToString();
                detail.T_FB_COMPANYBUDGETAPPLYMASTER = resultEntity;
                FBEntity detailFBEntity = detail.ToFBEntity();
                detailFBEntity.FBEntityState = FBEntityState.Added;
                resultDetails.Add(detailFBEntity);
            }

            result.FBEntityState = FBEntityState.ReSubmit;
            return result;

        }
Example #4
0
        public FBEntity GetCompanyBudgetSum(T_FB_COMPANYBUDGETAPPLYMASTER entity)
        {
            FBEntity        result     = null;
            decimal?        budgetYear = entity.BUDGETYEAR;
            QueryExpression qe         = QueryExpression.Equal(FieldName_BudgetYear, budgetYear.Value.ToString());
            QueryExpression qeStates   = QueryExpression.Equal(FieldName.CheckStates, ((int)CheckStates.UnSubmit).ToString());
            QueryExpression qeCompany  = QueryExpression.Equal(FieldName.OwnerCompanyID, entity.OWNERCOMPANYID);

            qe.RelatedExpression       = qeStates;
            qeStates.RelatedExpression = qeCompany;

            T_FB_COMPANYBUDGETSUMMASTER sumMaster = this.InnerGetEntities <T_FB_COMPANYBUDGETSUMMASTER>(qe).FirstOrDefault();

            if (sumMaster == null)
            {
                sumMaster = new T_FB_COMPANYBUDGETSUMMASTER();
                sumMaster.COMPANYBUDGETSUMMASTERID   = Guid.NewGuid().ToString();
                sumMaster.COMPANYBUDGETSUMMASTERCODE = "自动生成";
                sumMaster.CREATEUSERID   = SYSTEM_USER_ID;
                sumMaster.CREATEUSERNAME = "******";
                sumMaster.CREATEDATE     = System.DateTime.Now;
                sumMaster.UPDATEUSERID   = SYSTEM_USER_ID;
                sumMaster.UPDATEDATE     = System.DateTime.Now;

                sumMaster.CREATECOMPANYID      = SYSTEM_USER_ID;
                sumMaster.CREATECOMPANYNAME    = "系统生成";
                sumMaster.CREATEDEPARTMENTID   = SYSTEM_USER_ID;
                sumMaster.CREATEDEPARTMENTNAME = "系统生成";
                sumMaster.CREATEPOSTID         = SYSTEM_USER_ID;
                sumMaster.CREATEPOSTNAME       = "系统生成";

                sumMaster.BUDGETYEAR       = budgetYear;
                sumMaster.OWNERCOMPANYID   = entity.OWNERCOMPANYID;
                sumMaster.OWNERCOMPANYNAME = entity.OWNERCOMPANYNAME;

                sumMaster.OWNERDEPARTMENTID   = SYSTEM_USER_ID;
                sumMaster.OWNERDEPARTMENTNAME = "系统生成";

                sumMaster.OWNERPOSTID   = SYSTEM_USER_ID;
                sumMaster.OWNERPOSTNAME = "系统生成";

                sumMaster.OWNERID   = SYSTEM_USER_ID;
                sumMaster.OWNERNAME = "系统生成";

                sumMaster.SUMLEVEL = 0; //0:代表当前汇总单不走自定义汇总流程;1:代表当前汇总单走自定义汇总流程

                sumMaster.CHECKSTATES = (int)CheckStates.UnSubmit;
                sumMaster.EDITSTATES  = (int)EditStates.Actived;
                result = sumMaster.ToFBEntity();
                result.FBEntityState = FBEntityState.Added;
            }
            else
            {
                result = sumMaster.ToFBEntity();
                result.FBEntityState = FBEntityState.Modified;
            }
            return(result);
        }
Example #5
0
        public FBEntity GetCompanyBudgetSum(T_FB_COMPANYBUDGETAPPLYMASTER entity)
        {
            FBEntity result = null;
            decimal? budgetYear = entity.BUDGETYEAR;
            QueryExpression qe = QueryExpression.Equal(FieldName_BudgetYear, budgetYear.Value.ToString());
            QueryExpression qeStates = QueryExpression.Equal(FieldName.CheckStates, ((int)CheckStates.UnSubmit).ToString());
            QueryExpression qeCompany = QueryExpression.Equal(FieldName.OwnerCompanyID, entity.OWNERCOMPANYID);
            qe.RelatedExpression = qeStates;
            qeStates.RelatedExpression = qeCompany;

            T_FB_COMPANYBUDGETSUMMASTER sumMaster = this.InnerGetEntities<T_FB_COMPANYBUDGETSUMMASTER>(qe).FirstOrDefault();
            if (sumMaster == null)
            {
                sumMaster = new T_FB_COMPANYBUDGETSUMMASTER();
                sumMaster.COMPANYBUDGETSUMMASTERID = Guid.NewGuid().ToString();
                sumMaster.COMPANYBUDGETSUMMASTERCODE = "自动生成";
                sumMaster.CREATEUSERID = SYSTEM_USER_ID;
                sumMaster.CREATEUSERNAME = "******";
                sumMaster.CREATEDATE = System.DateTime.Now;
                sumMaster.UPDATEUSERID = SYSTEM_USER_ID;
                sumMaster.UPDATEDATE = System.DateTime.Now;

                sumMaster.CREATECOMPANYID = SYSTEM_USER_ID;
                sumMaster.CREATECOMPANYNAME = "系统生成";
                sumMaster.CREATEDEPARTMENTID = SYSTEM_USER_ID;
                sumMaster.CREATEDEPARTMENTNAME = "系统生成";
                sumMaster.CREATEPOSTID = SYSTEM_USER_ID;
                sumMaster.CREATEPOSTNAME = "系统生成";              

                sumMaster.BUDGETYEAR = budgetYear;
                sumMaster.OWNERCOMPANYID = entity.OWNERCOMPANYID;
                sumMaster.OWNERCOMPANYNAME = entity.OWNERCOMPANYNAME;

                sumMaster.OWNERDEPARTMENTID = SYSTEM_USER_ID;
                sumMaster.OWNERDEPARTMENTNAME = "系统生成";       

                sumMaster.OWNERPOSTID = SYSTEM_USER_ID;
                sumMaster.OWNERPOSTNAME = "系统生成";

                sumMaster.OWNERID = SYSTEM_USER_ID;
                sumMaster.OWNERNAME = "系统生成";

                sumMaster.SUMLEVEL = 0; //0:代表当前汇总单不走自定义汇总流程;1:代表当前汇总单走自定义汇总流程

                sumMaster.CHECKSTATES = (int)CheckStates.UnSubmit;
                sumMaster.EDITSTATES = (int)EditStates.Actived;
                result = sumMaster.ToFBEntity();
                result.FBEntityState = FBEntityState.Added;
            }
            else
            {
                result = sumMaster.ToFBEntity();
                result.FBEntityState = FBEntityState.Modified;
            }
            return result;
        }
Example #6
0
        private bool UpdateOldDetail(T_FB_COMPANYBUDGETAPPLYMASTER master)
        {
            var details = this.GetTable <T_FB_COMPANYBUDGETSUMDETAIL>();

            (details as ObjectQuery <T_FB_COMPANYBUDGETSUMDETAIL>).MergeOption = MergeOption.NoTracking;
            var find = details.Where(item => item.T_FB_COMPANYBUDGETAPPLYMASTER.COMPANYBUDGETAPPLYMASTERID == master.COMPANYBUDGETAPPLYMASTERID &&
                                     item.CHECKSTATES == 4).FirstOrDefault();

            if (find != null)
            {
                find.CHECKSTATES = null;
                this.Update(find);
                return(true);
            }
            return(false);
        }
Example #7
0
        private void GetOrderDetail()
        {
            this.ShowProcess(true);
            T_FB_COMPANYBUDGETAPPLYMASTER master = this.OrderEntity.Entity as T_FB_COMPANYBUDGETAPPLYMASTER;

            QueryExpression qeYear = QueryExpressionHelper.Equal("BUDGETYEAR", master.BUDGETYEAR.Add(-1).ToString());

            qeYear.QueryType = typeof(T_FB_COMPANYBUDGETAPPLYDETAIL).Name;

            // 预算部门
            QueryExpression qeDept = QueryExpressionHelper.Equal("OWNERDEPARTMENTID", this.OrderEntity.GetObjValue("Entity.OWNERDEPARTMENTID").ToString());

            qeDept.QueryType         = typeof(T_FB_COMPANYBUDGETAPPLYDETAIL).Name;
            qeDept.RelatedExpression = qeYear;

            fbService.QueryFBEntities(qeDept);
        }
Example #8
0
        /// <summary>
        /// 获取T_FB_COMPANYBUDGETAPPLYMASTER信息
        /// </summary>
        /// <param name="strCompanyBudgetApplyMasterId">主键索引</param>
        /// <returns></returns>
        public T_FB_COMPANYBUDGETAPPLYMASTER GetCompanyBudgetApplyMasterByID(string strCompanyBudgetApplyMasterId)
        {
            if (string.IsNullOrEmpty(strCompanyBudgetApplyMasterId))
            {
                return(null);
            }

            CompanyBudgetApplyMasterDAL dalCompanyBudgetApplyMaster = new CompanyBudgetApplyMasterDAL();
            StringBuilder strFilter = new StringBuilder();
            List <string> objArgs   = new List <string>();

            if (!string.IsNullOrEmpty(strCompanyBudgetApplyMasterId))
            {
                strFilter.Append(" COMPANYBUDGETAPPLYMASTERID == @0");
                objArgs.Add(strCompanyBudgetApplyMasterId);
            }

            T_FB_COMPANYBUDGETAPPLYMASTER entRd = dalCompanyBudgetApplyMaster.GetCompanyBudgetApplyMasterRdByMultSearch(strFilter.ToString(), objArgs.ToArray());

            return(entRd);
        }
Example #9
0
        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);
        }
Example #10
0
 public void AddToT_FB_COMPANYBUDGETAPPLYMASTER(T_FB_COMPANYBUDGETAPPLYMASTER t_FB_COMPANYBUDGETAPPLYMASTER)
 {
     base.AddObject("T_FB_COMPANYBUDGETAPPLYMASTER", t_FB_COMPANYBUDGETAPPLYMASTER);
 }
Example #11
0
 public static T_FB_COMPANYBUDGETAPPLYMASTER CreateT_FB_COMPANYBUDGETAPPLYMASTER(string cOMPANYBUDGETAPPLYMASTERID, decimal eDITSTATES, decimal cHECKSTATES, string oWNERID, string oWNERPOSTID, string oWNERDEPARTMENTID, string oWNERCOMPANYID, string cREATEUSERID, global::System.DateTime cREATEDATE, string cREATECOMPANYID, string cREATEDEPARTMENTID, string cREATEPOSTID, string uPDATEUSERID, global::System.DateTime uPDATEDATE)
 {
     T_FB_COMPANYBUDGETAPPLYMASTER t_FB_COMPANYBUDGETAPPLYMASTER = new T_FB_COMPANYBUDGETAPPLYMASTER();
     t_FB_COMPANYBUDGETAPPLYMASTER.COMPANYBUDGETAPPLYMASTERID = cOMPANYBUDGETAPPLYMASTERID;
     t_FB_COMPANYBUDGETAPPLYMASTER.EDITSTATES = eDITSTATES;
     t_FB_COMPANYBUDGETAPPLYMASTER.CHECKSTATES = cHECKSTATES;
     t_FB_COMPANYBUDGETAPPLYMASTER.OWNERID = oWNERID;
     t_FB_COMPANYBUDGETAPPLYMASTER.OWNERPOSTID = oWNERPOSTID;
     t_FB_COMPANYBUDGETAPPLYMASTER.OWNERDEPARTMENTID = oWNERDEPARTMENTID;
     t_FB_COMPANYBUDGETAPPLYMASTER.OWNERCOMPANYID = oWNERCOMPANYID;
     t_FB_COMPANYBUDGETAPPLYMASTER.CREATEUSERID = cREATEUSERID;
     t_FB_COMPANYBUDGETAPPLYMASTER.CREATEDATE = cREATEDATE;
     t_FB_COMPANYBUDGETAPPLYMASTER.CREATECOMPANYID = cREATECOMPANYID;
     t_FB_COMPANYBUDGETAPPLYMASTER.CREATEDEPARTMENTID = cREATEDEPARTMENTID;
     t_FB_COMPANYBUDGETAPPLYMASTER.CREATEPOSTID = cREATEPOSTID;
     t_FB_COMPANYBUDGETAPPLYMASTER.UPDATEUSERID = uPDATEUSERID;
     t_FB_COMPANYBUDGETAPPLYMASTER.UPDATEDATE = uPDATEDATE;
     return t_FB_COMPANYBUDGETAPPLYMASTER;
 }
Example #12
0
 private bool UpdateOldDetail(T_FB_COMPANYBUDGETAPPLYMASTER master)
 {
     var details = this.GetTable<T_FB_COMPANYBUDGETSUMDETAIL>();
     (details as ObjectQuery<T_FB_COMPANYBUDGETSUMDETAIL>).MergeOption = MergeOption.NoTracking;
     var find = details.Where(item => item.T_FB_COMPANYBUDGETAPPLYMASTER.COMPANYBUDGETAPPLYMASTERID == master.COMPANYBUDGETAPPLYMASTERID
         && item.CHECKSTATES == 4).FirstOrDefault();
     if (find != null)
     {
         find.CHECKSTATES = null;
         this.Update(find);
         return true;
     }
     return false;
     
 }