/// <summary> /// 受理操作 /// </summary> /// <param name="model"></param> /// <param name="errorMsg"></param> /// <returns></returns> public bool Audit(t_D_UserTableTen model, out string errorMsg) { using (var db = dbFactory.Open()) { using (var dbTrans = db.OpenTransaction()) { try { errorMsg = string.Empty; db.Insert(model, true); db.UpdateOnly(new t_D_UserTableOne { @static = 2 }, p => p.@static, p => p.id == model.pid); dbTrans.Commit(); return(true); } catch (Exception ex) { dbTrans.Rollback(); errorMsg = ex.Message; return(false); } } } }
public ActionResult Distribute(DistributeExpertViewModels model) { ControllerResult result = ControllerResult.SuccResult; try { var zjsp1 = string.Empty; var zjsp2 = string.Empty; var experts = model.DistributedExpert.Split(','); if (experts.Count() == 1) { zjsp1 = experts[0]; } else if (experts.Count() == 2) { zjsp1 = experts[0]; zjsp2 = experts[1]; } var ude = new t_D_UserTableTen() { id = model.Id, pid = model.PID, zjsp1 = zjsp1, zjsp2 = zjsp2, @static = 2 }; string errorMsg = string.Empty; if (!checkQualifyService.SaveDistributeExpert(ude, out errorMsg)) { result = ControllerResult.FailResult; result.ErroMsg = errorMsg; } else { LogUserAction("对检测机构资质Id:{0} 分配专家:[{1}]".Fmt(model.Id, model.DistributedExpert)); } } catch (Exception ex) { result = ControllerResult.FailResult; result.ErroMsg = ex.Message; } return(Content(result.ToJson())); }
public ActionResult NoApproval(CBRUnitApprovalSaveModel model) { ControllerResult result = ControllerResult.SuccResult; try { var utt = new t_D_UserTableTen() { id = model.id, ThreeYJ = model.ThreeYJ, ThreeFZr = model.ThreeFZr, ThreeZZZSBH = model.ThreeZZZSBH, ThreeTime = DateTime.Now, ThreeYXQBegin = model.ThreeYXQBegin, ThreeYXQEnd = model.ThreeYXQEnd, pid = model.pid, cbr = repUser.GetById(GetCurrentUserId()).UserDisplayName, outstaticinfo = model.outstaticinfo, @static = 5 //审核不通过 }; string errorMsg = string.Empty; if (!checkQualifyService.SaveCBRUnitApproval(utt, out errorMsg)) { result = ControllerResult.FailResult; result.ErroMsg = errorMsg; } else { LogUserAction("对检测机构资质Id:{0} 审批完成".Fmt(model.pid)); } } catch (Exception ex) { result = ControllerResult.FailResult; result.ErroMsg = ex.Message; } return(Content(result.ToJson())); }
/// <summary> /// 承办人审批 /// </summary> /// <param name="saveModel"></param> /// <param name="errorMsg"></param> /// <returns></returns> public bool SaveCBRUnitApproval(t_D_UserTableTen saveModel, out string errorMsg) { using (var db = dbFactory.Open()) { using (var dbTrans = db.OpenTransaction()) { try { errorMsg = string.Empty; if (db.Select <t_D_UserTableTen>(r => r.id == saveModel.id).Count > 0) { db.UpdateOnly(saveModel, r => new { r.ThreeYJ, r.ThreeFZr, r.ThreeZZZSBH, r.ThreeTime, r.ThreeYXQBegin, r.ThreeYXQEnd, r.cbr, r.@static, r.outstaticinfo }, r => r.id == saveModel.id); } else { db.Insert <t_D_UserTableTen>(saveModel); } db.UpdateOnly(new t_D_UserTableOne { @static = saveModel.@static }, p => p.@static, p => p.id == saveModel.pid); //更新t_bp_custom表相关数据 证书、资质、有效期 同步到主表 var tbTwo = db.Select <t_D_UserTableTwo>(r => r.pid == saveModel.pid).FirstOrDefault(); if (tbTwo != null) { db.UpdateOnly(new t_bp_custom { BUSINESSNUM = tbTwo.businessnum, businessnumPath = tbTwo.businessnumpath, BUSINESSNUMUNIT = tbTwo.businessnumunit, ECONOMICNATURE = tbTwo.economicnature, MEASNUM = tbTwo.measnum, MEASNUMPATH = tbTwo.measnumpath, MEASUNIT = tbTwo.measunit, zzlbmc = tbTwo.sqjcyw, detectappldate = saveModel.ThreeYXQBegin, measnumEndDate = saveModel.ThreeYXQEnd }, r => new { r.BUSINESSNUM, r.businessnumPath, r.BUSINESSNUMUNIT, r.ECONOMICNATURE, r.MEASNUM, r.MEASNUMPATH, r.MEASUNIT, r.zzlbmc, r.detectappldate, r.measnumEndDate }, r => r.ID == tbTwo.unitcode); } dbTrans.Commit(); return(true); } catch (Exception ex) { dbTrans.Rollback(); errorMsg = ex.Message + ex.StackTrace; return(false); } } } }
/// <summary> /// 分配专家 /// </summary> /// <param name="model"></param> /// <param name="errorMsg"></param> /// <returns></returns> public bool SaveDistributeExpert(t_D_UserTableTen model, out string errorMsg) { using (var db = dbFactory.Open()) { using (var dbTrans = db.OpenTransaction()) { try { errorMsg = string.Empty; int needUnitBuildingQualify = 0; //是否需要填写 建设工程质量检测资质机构审核表 int needSpecialQualify = 0; //是否需要填写 专项检测备案审核表 var tbTwo = repTwo.GetByCondition(r => r.pid == model.pid).FirstOrDefault(); if (tbTwo != null) { if (tbTwo.sqjcyw.IndexOf("地基基础工程检测") >= 0 || tbTwo.sqjcyw.IndexOf("主体结构工程现场检测") >= 0 || tbTwo.sqjcyw.IndexOf("建筑幕墙工程检测") >= 0 || tbTwo.sqjcyw.IndexOf("钢结构工程检测") >= 0 || tbTwo.sqjcyw.IndexOf("见证取样检测") >= 0) { needUnitBuildingQualify = 1; } if (tbTwo.sqjcyw.IndexOf("室内环境质量检测") >= 0 || tbTwo.sqjcyw.IndexOf("建筑附属设备安装工程检测") >= 0) { needSpecialQualify = 1; } } //先删除之前分配的专家 repExp.DeleteByCondition(r => r.pid == model.pid); if (!string.IsNullOrEmpty(model.zjsp1)) { var ueu = new t_D_UserExpertUnit(); ueu.userid = Convert.ToInt32(model.zjsp1); ueu.pid = Convert.ToInt32(model.pid); ueu.addtime = DateTime.Now; ueu.status = 0; ueu.needUnitBuildingQualify = needUnitBuildingQualify; ueu.needSpecialQualify = needSpecialQualify; db.Insert(ueu, true); } if (!string.IsNullOrEmpty(model.zjsp2)) { var ueu = new t_D_UserExpertUnit(); ueu.userid = Convert.ToInt32(model.zjsp2); ueu.pid = Convert.ToInt32(model.pid); ueu.addtime = DateTime.Now; ueu.status = 0; ueu.needUnitBuildingQualify = needUnitBuildingQualify; ueu.needSpecialQualify = needSpecialQualify; db.Insert(ueu, true); } //更新 db.UpdateOnly(new t_D_UserTableOne { @static = 3 }, p => p.@static, p => p.id == model.pid); db.UpdateOnly(model, r => new { r.zjsp1, r.zjsp2, r.@static }, r => r.id == model.id); dbTrans.Commit(); return(true); } catch (Exception ex) { dbTrans.Rollback(); errorMsg = ex.Message; return(false); } } } }