Esempio n. 1
0
        public FBEntity GetDeptBudgetSumSet(T_FB_DEPTBUDGETSUMDETAIL entity, T_FB_SUMSETTINGSMASTER masterset)
        {
            FBEntity result = null;
            DateTime budgetMonth = entity.T_FB_DEPTBUDGETAPPLYMASTER.BUDGETARYMONTH;
            QueryExpression qe = QueryExpression.Equal(FieldName_BudgetMonth, budgetMonth.ToString("yyyy-MM-dd"));
            QueryExpression qeStates = QueryExpression.Equal(FieldName.CheckStates, ((int)CheckStates.UnSubmit).ToString());
            QueryExpression qeCompany = QueryExpression.Equal(FieldName.OwnerCompanyID, masterset.OWNERCOMPANYID);
           // QueryExpression qeSumsettings = QueryExpression.Equal("SUMSETTINGSMASTERID", masterset.SUMSETTINGSMASTERID).And("PARENTID", entity.T_FB_DEPTBUDGETSUMMASTER.PARENTID);
            qe.RelatedExpression = qeStates;
            qeStates.RelatedExpression = qeCompany;
           // qeCompany.RelatedExpression = qeSumsettings;

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

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

                sumMaster.OWNERCOMPANYID = masterset.OWNERCOMPANYID;
                sumMaster.OWNERCOMPANYNAME = masterset.OWNERCOMPANYNAME;

                sumMaster.OWNERDEPARTMENTID = masterset.OWNERDEPARTMENTID;
                sumMaster.OWNERDEPARTMENTNAME = masterset.OWNERDEPARTMENTNAME;

                sumMaster.OWNERPOSTID = masterset.OWNERPOSTID;
                sumMaster.OWNERPOSTNAME = masterset.OWNERPOSTNAME;

                sumMaster.OWNERID = masterset.OWNERID;
                sumMaster.OWNERNAME = masterset.OWNERNAME;

                sumMaster.SUMSETTINGSMASTERID = masterset.SUMSETTINGSMASTERID;
                sumMaster.SUMLEVEL = 1; //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;
        }
Esempio n. 2
0
        //自定义汇总
        public bool CreateDeptBudgetSumSetMaster(FBEntity fbMaster)
        {
            bool bRes = false;
            T_FB_DEPTBUDGETSUMMASTER Master = fbMaster.Entity as T_FB_DEPTBUDGETSUMMASTER;
            foreach (var entity in Master.T_FB_DEPTBUDGETSUMDETAIL)
            {
                T_FB_DEPTBUDGETSUMDETAIL detail = new T_FB_DEPTBUDGETSUMDETAIL();

                detail.DEPTBUDGETSUMDETAILID = 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_DEPTBUDGETAPPLYMASTER = entity.T_FB_DEPTBUDGETAPPLYMASTER;
                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_DEPTBUDGETAPPLYMASTER.OWNERCOMPANYID);
                qeDetail.QueryType = "T_FB_SUMSETTINGSDETAIL";
                
                QueryExpression qeDetailEdits = QueryExpression.Equal(FieldName.EditStates, "1");
                qeDetail.RelatedExpression = qeDetailEdits;

                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());
                    qeMaster.QueryType = "T_FB_SUMSETTINGSMASTER";

                    QueryExpression qeMasterEdits = QueryExpression.Equal(FieldName.EditStates, "1");
                    qeMaster.RelatedExpression = qeMasterEdits;

                    masterset = GetEntities<T_FB_SUMSETTINGSMASTER>(qeMaster).FirstOrDefault();
                    if (masterset != null)
                    {
                        fbSumMaster = GetDeptBudgetSumSet(entity, masterset);

                        detail.T_FB_DEPTBUDGETSUMMASTER = fbSumMaster.Entity as T_FB_DEPTBUDGETSUMMASTER;
                        fbSumMaster.AddFBEntities<T_FB_DEPTBUDGETSUMDETAIL>(new List<FBEntity> { fbDetail });
                        fbSumMasterlist.Add(fbSumMaster);
                        Master.PARENTID = detail.T_FB_DEPTBUDGETSUMMASTER.DEPTBUDGETSUMMASTERID;
                        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;
        }
Esempio n. 3
0
 /// <summary>
 /// 创建新的 T_FB_DEPTBUDGETSUMDETAIL 对象。
 /// </summary>
 /// <param name="dEPTBUDGETSUMDETAILID">DEPTBUDGETSUMDETAILID 属性的初始值。</param>
 /// <param name="cREATEUSERID">CREATEUSERID 属性的初始值。</param>
 /// <param name="cREATEDATE">CREATEDATE 属性的初始值。</param>
 /// <param name="uPDATEUSERID">UPDATEUSERID 属性的初始值。</param>
 /// <param name="uPDATEDATE">UPDATEDATE 属性的初始值。</param>
 public static T_FB_DEPTBUDGETSUMDETAIL CreateT_FB_DEPTBUDGETSUMDETAIL(global::System.String dEPTBUDGETSUMDETAILID, global::System.String cREATEUSERID, global::System.DateTime cREATEDATE, global::System.String uPDATEUSERID, global::System.DateTime uPDATEDATE)
 {
     T_FB_DEPTBUDGETSUMDETAIL t_FB_DEPTBUDGETSUMDETAIL = new T_FB_DEPTBUDGETSUMDETAIL();
     t_FB_DEPTBUDGETSUMDETAIL.DEPTBUDGETSUMDETAILID = dEPTBUDGETSUMDETAILID;
     t_FB_DEPTBUDGETSUMDETAIL.CREATEUSERID = cREATEUSERID;
     t_FB_DEPTBUDGETSUMDETAIL.CREATEDATE = cREATEDATE;
     t_FB_DEPTBUDGETSUMDETAIL.UPDATEUSERID = uPDATEUSERID;
     t_FB_DEPTBUDGETSUMDETAIL.UPDATEDATE = uPDATEDATE;
     return t_FB_DEPTBUDGETSUMDETAIL;
 }
Esempio n. 4
0
        public void CreateDeptBudgetSumDetail(T_FB_DEPTBUDGETAPPLYMASTER entity)
        {
            if (UpdateOldDetail(entity))
            {
                return;
            }

            T_FB_DEPTBUDGETSUMDETAIL detail = new T_FB_DEPTBUDGETSUMDETAIL();

            detail.DEPTBUDGETSUMDETAILID = 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_DEPTBUDGETAPPLYMASTER = entity;
            FBEntity fbDetail = detail.ToFBEntity();
            fbDetail.FBEntityState = FBEntityState.Added;

            FBEntity fbSumMaster = new FBEntity();
            fbSumMaster = GetDeptBudgetSum(entity);           
            detail.T_FB_DEPTBUDGETSUMMASTER = fbSumMaster.Entity as T_FB_DEPTBUDGETSUMMASTER;
            fbSumMaster.AddFBEntities<T_FB_DEPTBUDGETSUMDETAIL>(new List<FBEntity> { fbDetail });
            this.InnerSave(fbSumMaster);
        }
Esempio n. 5
0
 /// <summary>
 /// 用于向 T_FB_DEPTBUDGETSUMDETAIL EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet&lt;T&gt; 属性的 .Add 方法。
 /// </summary>
 public void AddToT_FB_DEPTBUDGETSUMDETAIL(T_FB_DEPTBUDGETSUMDETAIL t_FB_DEPTBUDGETSUMDETAIL)
 {
     base.AddObject("T_FB_DEPTBUDGETSUMDETAIL", t_FB_DEPTBUDGETSUMDETAIL);
 }