Exemplo n.º 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;

        }
Exemplo n.º 2
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;
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
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;
     
 }
Exemplo n.º 5
0
 /// <summary>
 /// 创建新的 T_FB_COMPANYBUDGETAPPLYMASTER 对象。
 /// </summary>
 /// <param name="cOMPANYBUDGETAPPLYMASTERID">COMPANYBUDGETAPPLYMASTERID 属性的初始值。</param>
 /// <param name="eDITSTATES">EDITSTATES 属性的初始值。</param>
 /// <param name="cHECKSTATES">CHECKSTATES 属性的初始值。</param>
 /// <param name="oWNERID">OWNERID 属性的初始值。</param>
 /// <param name="oWNERPOSTID">OWNERPOSTID 属性的初始值。</param>
 /// <param name="oWNERDEPARTMENTID">OWNERDEPARTMENTID 属性的初始值。</param>
 /// <param name="oWNERCOMPANYID">OWNERCOMPANYID 属性的初始值。</param>
 /// <param name="cREATEUSERID">CREATEUSERID 属性的初始值。</param>
 /// <param name="cREATEDATE">CREATEDATE 属性的初始值。</param>
 /// <param name="cREATECOMPANYID">CREATECOMPANYID 属性的初始值。</param>
 /// <param name="cREATEDEPARTMENTID">CREATEDEPARTMENTID 属性的初始值。</param>
 /// <param name="cREATEPOSTID">CREATEPOSTID 属性的初始值。</param>
 /// <param name="uPDATEUSERID">UPDATEUSERID 属性的初始值。</param>
 /// <param name="uPDATEDATE">UPDATEDATE 属性的初始值。</param>
 public static T_FB_COMPANYBUDGETAPPLYMASTER CreateT_FB_COMPANYBUDGETAPPLYMASTER(global::System.String cOMPANYBUDGETAPPLYMASTERID, global::System.Decimal eDITSTATES, global::System.Decimal cHECKSTATES, global::System.String oWNERID, global::System.String oWNERPOSTID, global::System.String oWNERDEPARTMENTID, global::System.String oWNERCOMPANYID, global::System.String cREATEUSERID, global::System.DateTime cREATEDATE, global::System.String cREATECOMPANYID, global::System.String cREATEDEPARTMENTID, global::System.String cREATEPOSTID, global::System.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;
 }
Exemplo n.º 6
0
 /// <summary>
 /// 用于向 T_FB_COMPANYBUDGETAPPLYMASTER EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet&lt;T&gt; 属性的 .Add 方法。
 /// </summary>
 public void AddToT_FB_COMPANYBUDGETAPPLYMASTER(T_FB_COMPANYBUDGETAPPLYMASTER t_FB_COMPANYBUDGETAPPLYMASTER)
 {
     base.AddObject("T_FB_COMPANYBUDGETAPPLYMASTER", t_FB_COMPANYBUDGETAPPLYMASTER);
 }