public string PostUnChecked([FromBody] GHSubjectRequestModel param) { if (param.PhId == 0) { return(DCHelper.ErrorMessage("主键不能为空!")); } try { long id = param.PhId; //主表主键 var Findresult = GHSubjectService.Find <System.Int64>(id); Common.Model.Results.SavedResult <Int64> savedresult = new Common.Model.Results.SavedResult <Int64>(); Findresult.Data.FApproveStatus = "1"; Findresult.Data.FApprover = 0; Findresult.Data.FApproveDate = new Nullable <DateTime>(); Findresult.Data.PersistentState = PersistentState.Modified; savedresult = GHSubjectService.Save <Int64>(Findresult.Data, ""); return(DataConverterHelper.SerializeObject(savedresult)); } catch (Exception ex) { return(DCHelper.ErrorMessage(ex.Message)); } }
public string PostDeleteGHSubject([FromBody] GHSubjectRequestModel param) { if (param.PhId == 0) { return(DCHelper.ErrorMessage("主键不能为空!")); } try { long id = param.PhId; //主表主键 var data = GHSubjectService.Find(id).Data; if (data.FType == "tz" && data.FApproveStatus != "5") //删除年中调整 未作废单据 恢复上一个年中调整单据 { Dictionary <string, object> dicWhere = new Dictionary <string, object>(); new CreateCriteria(dicWhere).Add(ORMRestrictions <string> .Eq("FDeclarationDept", data.FDeclarationDept)) .Add(ORMRestrictions <string> .Eq("FYear", data.FYear)) .Add(ORMRestrictions <string> .Eq("FProjAttr", data.FProjAttr)) .Add(ORMRestrictions <string> .Eq("FApproveStatus", "5")) .Add(ORMRestrictions <string> .Eq("FType", data.FType)); IList <GHSubjectModel> gHSubjects = GHSubjectService.Find(dicWhere, new string[] { "NgUpdateDt Desc" }).Data; if (gHSubjects.Count > 0) { gHSubjects[0].FApproveStatus = "3"; gHSubjects[0].PersistentState = PersistentState.Modified; GHSubjectService.Save <long>(gHSubjects[0], ""); } else { //没有年中调整单据时将年初新增状态为调整中的变成已审批 Dictionary <string, object> dicWhere2 = new Dictionary <string, object>(); new CreateCriteria(dicWhere2).Add(ORMRestrictions <string> .Eq("FDeclarationDept", data.FDeclarationDept)) .Add(ORMRestrictions <string> .Eq("FYear", data.FYear)) .Add(ORMRestrictions <string> .Eq("FProjAttr", data.FProjAttr)) .Add(ORMRestrictions <string> .Eq("FApproveStatus", "6")) .Add(ORMRestrictions <string> .Eq("FType", "c")); IList <GHSubjectModel> gHSubjects2 = GHSubjectService.Find(dicWhere).Data; if (gHSubjects2.Count > 0) { foreach (var a in gHSubjects2) { a.FApproveStatus = "3"; a.PersistentState = PersistentState.Modified; } GHSubjectService.Save <long>(gHSubjects2, ""); } } } else { } var deletedresult = GHSubjectService.Delete <System.Int64>(id); return(DataConverterHelper.SerializeObject(deletedresult)); } catch (Exception ex) { return(DCHelper.ErrorMessage(ex.Message)); } }