/// <summary> /// 根据主键获取数据 /// </summary> /// <returns>返回Json串</returns> public string GetQtBaseProjectInfo() { long id = Convert.ToInt64(System.Web.HttpContext.Current.Request.Params["id"]); //主表主键 string tabtype = System.Web.HttpContext.Current.Request.Params["tabtype"]; //Tab类型 var findedresult = QtBaseProjectService.Find(id); return(DataConverterHelper.ResponseResultToJson(findedresult)); }
/// <summary> /// 保存数据 /// </summary> /// <returns>返回Json串</returns> public string SaveTaskreference() { long PhId = Convert.ToInt64(System.Web.HttpContext.Current.Request.Params["PhId"]); string FYear = System.Web.HttpContext.Current.Request.Params["FYear"]; SavedResult <Int64> savedresult = new SavedResult <Int64>(); try { QtBaseProjectModel qtBaseProjectModel = QtBaseProjectService.Find(PhId).Data; //进度控制判断 var processStatus = BudgetProcessCtrlService.FindBudgetProcessCtrl(qtBaseProjectModel.FDwdm, qtBaseProjectModel.FFillDept, FYear); if (processStatus == "1") { qtBaseProjectModel.FType = "c"; } else if (processStatus == "3") { qtBaseProjectModel.FType = "z"; } else { savedresult.Status = ResponseStatus.Error; savedresult.Msg = "当前填报部门不能指派任务!"; return(DataConverterHelper.SerializeObject(savedresult)); } //重复的子科目项目判断 var dicWhere = new Dictionary <string, object>(); new CreateCriteria(dicWhere). Add(ORMRestrictions <string> .Eq("FKmdm", qtBaseProjectModel.FKmdm)). Add(ORMRestrictions <string> .Eq("FDwdm", qtBaseProjectModel.FDwdm)). Add(ORMRestrictions <string> .Eq("FProjName", qtBaseProjectModel.FProjName)). Add(ORMRestrictions <string> .Eq("FYear", FYear)); if (QtBaseProjectService.Find(dicWhere).Data.Count > 0) { savedresult.Status = ResponseStatus.Error; savedresult.Msg = "相同科目下不允许重复的子科目项目名称存在!"; return(DataConverterHelper.SerializeObject(savedresult)); } qtBaseProjectModel.PhId = 0; qtBaseProjectModel.FYear = FYear; qtBaseProjectModel.FProjCode = QtBaseProjectService.CreateOrGetMaxProjCode(FYear); qtBaseProjectModel.PersistentState = PersistentState.Added; savedresult = QtBaseProjectService.Save <Int64>(qtBaseProjectModel, ""); /* * //subjectMstModel.FYear = DateTime.Today.Year.ToString();//年度改为前台传 * subjectMstModel.FProjCode = qtBaseProjectModel.FProjCode; * subjectMstModel.FBudgetDept = "浙江省总工会"; * subjectMstModel.FDateofDeclaration = DateTime.Today; * subjectMstModel.FDeclarer = base.UserID.ToString(); * subjectMstModel.FApproveStatus = "1"; * subjectMstModel.FCarryOver = 1; * subjectMstModel.PersistentState = PersistentState.Added; * //savedresult = SubjectMstService.Save<Int64>(subjectMstModel); * * * savedresult = QtBaseProjectService.Save2(qtBaseProjectModel, subjectMstModel);*/ } catch (Exception ex) { savedresult.Status = ResponseStatus.Error; savedresult.Msg = ex.Message.ToString(); } return(DataConverterHelper.SerializeObject(savedresult)); }