public FBEntity ReSubmitT_FB_DEPTBUDGETAPPLYMASTER(T_FB_DEPTBUDGETAPPLYMASTER entity) { FBEntity fbEntity = GetFBEntityByEntityKey(entity.EntityKey); fbEntity.FBEntityState = FBEntityState.ReSubmit; var master = fbEntity.Entity as T_FB_DEPTBUDGETAPPLYMASTER; var details = fbEntity.GetRelationFBEntities(typeof(T_FB_DEPTBUDGETAPPLYDETAIL).Name); var resultEntity = master.CopyEntity(); resultEntity.DEPTBUDGETAPPLYMASTERID = Guid.NewGuid().ToString(); resultEntity.DEPTBUDGETAPPLYMASTERCODE = "自动生成"; resultEntity.CHECKSTATES = (int)CheckStates.UnSubmit; resultEntity.ISVALID = "0"; // 未汇总 resultEntity.T_FB_DEPTBUDGETAPPLYDETAIL = null; var result = resultEntity.ToFBEntity(); var resultDetails = result.GetRelationFBEntities(typeof(T_FB_DEPTBUDGETAPPLYDETAIL).Name); var tempDetails = details.ToEntityList<T_FB_DEPTBUDGETAPPLYDETAIL>(); foreach (var item in tempDetails) { T_FB_DEPTBUDGETAPPLYDETAIL detail = item.CopyEntity(); detail.DEPTBUDGETAPPLYDETAILID = Guid.NewGuid().ToString(); detail.T_FB_DEPTBUDGETAPPLYMASTER = resultEntity; FBEntity detailFBEntity = detail.ToFBEntity(); detailFBEntity.FBEntityState = FBEntityState.Added; resultDetails.Add(detailFBEntity); } result.FBEntityState = FBEntityState.ReSubmit; return result; }
public FBEntity ReSubmitT_FB_DEPTBUDGETAPPLYMASTER(T_FB_DEPTBUDGETAPPLYMASTER entity) { FBEntity fbEntity = GetFBEntityByEntityKey(entity.EntityKey); fbEntity.FBEntityState = FBEntityState.ReSubmit; var master = fbEntity.Entity as T_FB_DEPTBUDGETAPPLYMASTER; var details = fbEntity.GetRelationFBEntities(typeof(T_FB_DEPTBUDGETAPPLYDETAIL).Name); var resultEntity = master.CopyEntity(); resultEntity.DEPTBUDGETAPPLYMASTERID = Guid.NewGuid().ToString(); resultEntity.DEPTBUDGETAPPLYMASTERCODE = "自动生成"; resultEntity.CHECKSTATES = (int)CheckStates.UnSubmit; resultEntity.ISVALID = "0"; // 未汇总 resultEntity.T_FB_DEPTBUDGETAPPLYDETAIL = null; var result = resultEntity.ToFBEntity(); var resultDetails = result.GetRelationFBEntities(typeof(T_FB_DEPTBUDGETAPPLYDETAIL).Name); var tempDetails = details.ToEntityList <T_FB_DEPTBUDGETAPPLYDETAIL>(); foreach (var item in tempDetails) { T_FB_DEPTBUDGETAPPLYDETAIL detail = item.CopyEntity(); detail.DEPTBUDGETAPPLYDETAILID = Guid.NewGuid().ToString(); detail.T_FB_DEPTBUDGETAPPLYMASTER = resultEntity; FBEntity detailFBEntity = detail.ToFBEntity(); detailFBEntity.FBEntityState = FBEntityState.Added; resultDetails.Add(detailFBEntity); } result.FBEntityState = FBEntityState.ReSubmit; return(result); }
public void AddToT_FB_DEPTBUDGETAPPLYMASTER(T_FB_DEPTBUDGETAPPLYMASTER t_FB_DEPTBUDGETAPPLYMASTER) { base.AddObject("T_FB_DEPTBUDGETAPPLYMASTER", t_FB_DEPTBUDGETAPPLYMASTER); }
public static T_FB_DEPTBUDGETAPPLYMASTER CreateT_FB_DEPTBUDGETAPPLYMASTER(string dEPTBUDGETAPPLYMASTERID, global::System.DateTime bUDGETARYMONTH, 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_DEPTBUDGETAPPLYMASTER t_FB_DEPTBUDGETAPPLYMASTER = new T_FB_DEPTBUDGETAPPLYMASTER(); t_FB_DEPTBUDGETAPPLYMASTER.DEPTBUDGETAPPLYMASTERID = dEPTBUDGETAPPLYMASTERID; t_FB_DEPTBUDGETAPPLYMASTER.BUDGETARYMONTH = bUDGETARYMONTH; t_FB_DEPTBUDGETAPPLYMASTER.EDITSTATES = eDITSTATES; t_FB_DEPTBUDGETAPPLYMASTER.CHECKSTATES = cHECKSTATES; t_FB_DEPTBUDGETAPPLYMASTER.OWNERID = oWNERID; t_FB_DEPTBUDGETAPPLYMASTER.OWNERPOSTID = oWNERPOSTID; t_FB_DEPTBUDGETAPPLYMASTER.OWNERDEPARTMENTID = oWNERDEPARTMENTID; t_FB_DEPTBUDGETAPPLYMASTER.OWNERCOMPANYID = oWNERCOMPANYID; t_FB_DEPTBUDGETAPPLYMASTER.CREATEUSERID = cREATEUSERID; t_FB_DEPTBUDGETAPPLYMASTER.CREATEDATE = cREATEDATE; t_FB_DEPTBUDGETAPPLYMASTER.CREATECOMPANYID = cREATECOMPANYID; t_FB_DEPTBUDGETAPPLYMASTER.CREATEDEPARTMENTID = cREATEDEPARTMENTID; t_FB_DEPTBUDGETAPPLYMASTER.CREATEPOSTID = cREATEPOSTID; t_FB_DEPTBUDGETAPPLYMASTER.UPDATEUSERID = uPDATEUSERID; t_FB_DEPTBUDGETAPPLYMASTER.UPDATEDATE = uPDATEDATE; return t_FB_DEPTBUDGETAPPLYMASTER; }
private bool UpdateOldDetail(T_FB_DEPTBUDGETAPPLYMASTER master) { var details = this.GetTable<T_FB_DEPTBUDGETSUMDETAIL>(); (details as ObjectQuery<T_FB_DEPTBUDGETSUMDETAIL>).MergeOption = MergeOption.NoTracking; var find = details.Where(item => item.T_FB_DEPTBUDGETAPPLYMASTER.DEPTBUDGETAPPLYMASTERID == master.DEPTBUDGETAPPLYMASTERID && item.CHECKSTATES == 4).FirstOrDefault(); if (find != null) { find.CHECKSTATES = null; this.Update(find); return true; } return false; }
public FBEntity GetDeptBudgetSum(T_FB_DEPTBUDGETAPPLYMASTER entity) { FBEntity result = null; DateTime budgetMonth = entity.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, entity.OWNERCOMPANYID); qe.RelatedExpression = qeStates; qeStates.RelatedExpression = qeCompany; 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 = 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; }
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); }