public IHttpActionResult List(DisJTParm parm) { try { int resultcount = 0; DistributeService diss = new DistributeService(); var list = diss.GetUnDistributeJT(parm, out resultcount); return(Json(new { code = 1, msg = "ok", list = list, resultcount = resultcount })); } catch (Exception) { throw; } }
public IHttpActionResult DisList(dynamic obj) { try { string jtid = string.Empty; jtid = (obj.jtid ?? "").ToString(); DistributeService diss = new DistributeService(); var list = diss.GetDistributeListById(jtid); return(Json(new { code = 1, msg = "ok", list = list })); } catch (Exception) { throw; } }
public override void Validate(ExtendedDataEntity[] dataEntities, ValidateContext validateContext, Context ctx) { List <string> list = (from entity in dataEntities.ToList <ExtendedDataEntity>() select entity.DataEntity["Id"].ToString()).ToList <string>(); IDictionary <string, bool> dictionary = new DistributeService().CheckIsSchemeDistributed(base.Context, list); foreach (ExtendedDataEntity entity in dataEntities) { string key = entity.DataEntity["Id"].ToString(); string str2 = entity.DataEntity["Number"].ToString(); if (dictionary.ContainsKey(key) && dictionary[key]) { string message = ResManager.LoadKDString("该预算方案已经存在分发,不能反审核!", "0032056000020552", SubSystemType.FIN, new object[0]); string title = ResManager.LoadKDString("反审核:", "0032056000020553", SubSystemType.FIN, new object[0]) + str2; validateContext.AddError(entity, new ValidationErrorInfo("Number", "ID", entity.DataEntityIndex, 0, Convert.ToString(entity["ID"]), message, title, ErrorLevel.Error)); } } }
public override void Validate(ExtendedDataEntity[] dataEntities, ValidateContext validateContext, Context ctx) { if ((dataEntities != null) && (dataEntities.Length > 0)) { List <string> sampleIdList = (from entity in dataEntities.ToList <ExtendedDataEntity>() select entity.DataEntity["Id"].ToString()).ToList <string>(); IDictionary <string, bool> dictionary = new DistributeService().CheckIsSampleDistributed(base.Context, sampleIdList, ""); foreach (ExtendedDataEntity entity in dataEntities) { string key = entity.DataEntity["Id"].ToString(); string str2 = entity.DataEntity["NUMBER"].ToString(); if (dictionary.ContainsKey(key) && dictionary[key]) { validateContext.AddError(entity, new ValidationErrorInfo("Number", "ID", entity.DataEntityIndex, 0, Convert.ToString(entity["ID"]), ResManager.LoadKDString("该模板已经被预算方案引用,不能删除!", "0032056000020512", SubSystemType.FIN, new object[0]), ResManager.LoadKDString("删除:", "0032056000020565", SubSystemType.FIN, new object[0]) + str2, ErrorLevel.Error)); } } } }
public IHttpActionResult Edit(zxjc_t_jstcfp entity) { try { DistributeService diss = new DistributeService(); int ret = diss.Modify(entity); if (ret > 0) { return(Json(new { code = 1, msg = "数据修改成功" })); } else { return(Json(new { code = 0, msg = "数据修改失败" })); } } catch (Exception) { throw; } }
public IHttpActionResult DelDistribute(List <zxjc_t_jstcfp> entitys) { try { DistributeService diss = new DistributeService(); entitys.ForEach(t => t.gcdm = "9100"); int ret = diss.DelDistribute(entitys); if (ret > 0) { return(Json(new { code = 1, msg = "数据删除成功" })); } else { return(Json(new { code = 0, msg = "数据删除失败" })); } } catch (Exception) { throw; } }
public IHttpActionResult Add(List <zxjc_t_jstcfp> entitys) { try { DistributeService diss = new DistributeService(); sys_user user = CacheManager.Instance().Current_User; entitys.ForEach(t => { t.lrr1 = user.name; t.lrsj1 = DateTime.Now; }); var ret = diss.Add(entitys); if (ret > 0) { return(Json(new { code = 1, msg = "数据保存成功" })); } else { return(Json(new { code = 0, msg = "数据保存失败" })); } } catch (Exception) { throw; } }
public override void BeginOperationTransaction(BeginOperationTransactionArgs e) { Action <DynamicObject> action = null; if (base.Context.IsMultiOrg) { if (action == null) { action = delegate(DynamicObject entiry) { Func <SchemeOrgDetail, bool> func = null; string reportId = Convert.ToString(entiry["Id"]); int schemeId = Convert.ToInt32(entiry["SchemeID_Id"]); int deptOrgID = Convert.ToInt32(entiry["DeptOrgID_Id"]); DynamicObjectCollection objects = entiry["BM_Sheet"] as DynamicObjectCollection; if ((objects != null) && (objects.Count > 0)) { DistributeService distributeService = new DistributeService(); List <string> sheetIds = (from dy in objects select dy["Id"].ToString()).ToList <string>(); Dictionary <string, List <int> > cycleSheetDic = distributeService.GetSheetCycles(base.Context, sheetIds, true); Dictionary <string, List <DimensionValue> > dicOrgSheetDimension = new BudgetReportPlateService().GetDimesionValueBySheets(base.Context, schemeId, sheetIds, false); Dictionary <int, DynamicObject> orgIdDic = CommonHelper.EntiryId2BudgetOrgId(base.Context, null, null); SchemeEntityExtend schememEntify = distributeService.GetSchemDetailInfo(base.Context, schemeId, true); if (func == null) { func = org => org.DeptOrgId == deptOrgID; } SchemeOrgDetail detail = schememEntify.schemeDetailList.First <SchemeOrgDetail>(func); string sampleId = new BudgetReportPlateService().GetSampleId(base.Context, reportId); DistributeSample sampleDetail = detail.DistributeSampleList.FirstOrDefault <DistributeSample>(sample => sample.SampleId == sampleId); Dictionary <string, Dictionary <string, List <SchemeMonitorEnify> > > sheetDeleteMonitorDic = new Dictionary <string, Dictionary <string, List <SchemeMonitorEnify> > >(); sheetIds.ForEach(delegate(string sheetId) { Func <int, bool> predicate = null; Func <int, int> selector = null; Func <int, DistributeDetail> func3 = null; List <int> source = (from value in dicOrgSheetDimension[sheetId] where value.IsBudgetOrg select Convert.ToInt32(value.DimValue)).ToList <int>(); if (source.Count > 0) { if (predicate == null) { predicate = id => orgIdDic[id] != null; } if (selector == null) { selector = id => Convert.ToInt32(orgIdDic[id]["orgId"]); } if (func3 == null) { func3 = detail => new DistributeDetail { CompanyId = detail, DeptOrgID = detail, OrgType = "ORG", SampleId = sampleDetail.SampleId, ReportBeginDate = sampleDetail.ReportBeginDate }; } List <DistributeDetail> distrDetailList = source.Where <int>(predicate).Select <int, int>(selector).ToList <int>().Select <int, DistributeDetail>(func3).ToList <DistributeDetail>(); IList <SchemeOrgDetail> schemeDetailList = distributeService.GetSchemeDetailList(this.Context, schememEntify, distrDetailList); Dictionary <string, List <SchemeMonitorEnify> > dictionary = distributeService.GetDeleteSchemeMonitor(this.Context, schememEntify, schemeDetailList, cycleSheetDic[sheetId]); sheetDeleteMonitorDic.Add(sheetId, dictionary); } }); sheetDeleteMonitorDic.ToList <KeyValuePair <string, Dictionary <string, List <SchemeMonitorEnify> > > >().ForEach(kv => distributeService.DeleteSchemeMonitor(this.Context, kv.Value, "0", false)); } }; } e.DataEntitys.ToList <DynamicObject>().ForEach(action); } base.BeginOperationTransaction(e); }