public InvokeResult NullifySelected(string strIds) { InvokeResult result = new InvokeResult { Success = true }; try { List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>(); string[] arrIds = strIds.Split("|".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); if (arrIds.Length == 0) { result.Success = false; result.ErrorCode = 59996; return(result); } string statementName = new AssessmentResult().GetUpdateMethodName(); foreach (string strId in arrIds) { AssessmentResult assessmentResult = new AssessmentResult { Id = Int32.Parse(strId), Status = 0 }; /***********************begin 自定义代码*******************/ assessmentResult.OperatedBy = NormalSession.UserId.ToGuid(); assessmentResult.OperatedOn = DateTime.Now; assessmentResult.DataSource = GlobalManager.DIKey_00012_ManualEdit; /***********************end 自定义代码*********************/ statements.Add(new IBatisNetBatchStatement { StatementName = statementName, ParameterObject = assessmentResult.ToStringObjectDictionary(false), Type = SqlExecuteType.UPDATE }); } BuilderFactory.DefaultBulder().ExecuteNativeSqlNoneQuery(statements); } catch (Exception ex) { result.Success = false; result.ErrorMessage = ex.Message; } return(result); }
public ModelInvokeResult <AssessmentResultPK> NullifyEx(string strIds, string strOldManId, string strWorkItems) { ModelInvokeResult <AssessmentResultPK> result = new ModelInvokeResult <AssessmentResultPK> { Success = true }; try { string[] arrIds = strIds.Split("|".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); string[] arrWorkItems = strWorkItems.Split("|".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); if (arrIds.Length == 0) { result.Success = false; result.ErrorCode = 59996; return(result); } List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>(); foreach (string strId in arrIds) { AssessmentResult assessmentResult = new AssessmentResult { Id = Int32.Parse(strId), Status = 0 }; /***********************begin 自定义代码*******************/ assessmentResult.OperatedBy = NormalSession.UserId.ToGuid(); assessmentResult.OperatedOn = DateTime.Now; assessmentResult.DataSource = GlobalManager.DIKey_00012_ManualEdit; /***********************end 自定义代码*********************/ statements.Add(new IBatisNetBatchStatement { StatementName = assessmentResult.GetUpdateMethodName(), ParameterObject = assessmentResult.ToStringObjectDictionary(false), Type = SqlExecuteType.UPDATE }); } BuilderFactory.DefaultBulder().ExecuteNativeSqlNoneQuery(statements); /***********************begin 自定义代码*******************/ string sql = "delete from Pam_WorkPlan where OldManId='" + strOldManId + "' and WorkItem in ('" + string.Join("','", arrWorkItems) + "') and PlanDate>GETDATE()"; BuilderFactory.DefaultBulder().ExecuteNativeSqlNoneQuery(sql); /***********************end 自定义代码*********************/ /***********************begin 重新生成工作执行表*********************/ SPParam spParam = new { }.ToSPParam(); spParam["OldManId"] = strOldManId.ToGuid(); spParam["BatchFlag"] = 0; BuilderFactory.DefaultBulder().ExecuteSPNoneQuery("SP_Pam_GenDailyWorkExcute", spParam); /***********************end 重新生成工作执行表*********************/ } catch (Exception ex) { result.Success = false; result.ErrorMessage = ex.Message; } return(result); }
public InvokeResult CreateAssessment(string strOldManId, IList <AssessmentItem> assessmentItems) { InvokeResult result = new InvokeResult { Success = true }; try { List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>(); AssessmentResult assessmentResult = new AssessmentResult(); foreach (AssessmentItem assessmentItem in assessmentItems) { /***********************begin 自定义代码*******************/ assessmentResult.Id = null; assessmentResult.OperatedBy = NormalSession.UserId.ToGuid(); assessmentResult.OperatedOn = DateTime.Now; assessmentResult.DataSource = GlobalManager.DIKey_00012_ManualEdit; assessmentResult.OldManId = strOldManId.ToGuid(); assessmentResult.WorkItem = assessmentItem.WorkItem; assessmentResult.WorkSchedule = assessmentItem.WorkSchedule; assessmentResult.Workload = assessmentItem.Workload; assessmentResult.RemindFlag = assessmentItem.RemindFlag; assessmentResult.RemindRepeats = assessmentItem.RemindRepeats; assessmentResult.PlayRepeats = assessmentItem.PlayRepeats; assessmentResult.CheckDescription = assessmentItem.Remark; /***********************end 自定义代码*********************/ statements.Add(new IBatisNetBatchStatement { StatementName = assessmentResult.GetCreateMethodName(), ParameterObject = assessmentResult.ToStringObjectDictionary(false), Type = SqlExecuteType.INSERT }); /***********************begin 自定义代码*******************/ /***********************此处添加自定义代码*****************/ /***********************end 自定义代码*********************/ } if (statements.Count > 0) { BuilderFactory.DefaultBulder().ExecuteNativeSqlNoneQuery(statements); } } catch (Exception ex) { result.Success = false; result.ErrorMessage = ex.Message; } return(result); }
public ModelInvokeResult <AssessmentResultPK> UpdateWorkSchedule(string strId, AssessmentResult assessmentResult) { ModelInvokeResult <AssessmentResultPK> result = new ModelInvokeResult <AssessmentResultPK> { Success = true }; try { List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>(); if (strId == null || strId == "undefined") { result.Success = false; result.ErrorCode = 59996; return(result); } /***********************begin 自定义代码*******************/ assessmentResult.Id = Int32.Parse(strId); assessmentResult.OperatedBy = NormalSession.UserId.ToGuid(); assessmentResult.OperatedOn = DateTime.Now; assessmentResult.DataSource = GlobalManager.DIKey_00012_ManualEdit; /***********************end 自定义代码*********************/ statements.Add(new IBatisNetBatchStatement { StatementName = assessmentResult.GetUpdateMethodName(), ParameterObject = assessmentResult.ToStringObjectDictionary(false), Type = SqlExecuteType.UPDATE }); /***********************begin 自定义代码*******************/ /***********************此处添加自定义代码*****************/ /***********************begin 修改已经制定的工作计划中的服务时间*********************/ BuilderFactory.DefaultBulder().ExecuteNativeSqlNoneQuery(statements); result.instance = new AssessmentResultPK { Id = Int32.Parse(strId) }; string sql = "update Pam_WorkPlan set PlanDate=SUBSTRING(CONVERT(varchar(100),PlanDate, 21),1,11)+'" + assessmentResult.WorkSchedule + "'" + " ,OperatedBy='" + NormalSession.UserId.ToGuid() + "',OperatedOn='" + DateTime.Now + "'" + " where PlanDate>GETDATE() and WorkItem='" + assessmentResult.WorkItem + "' and OldManId='" + assessmentResult.OldManId + "'"; BuilderFactory.DefaultBulder().ExecuteNativeSqlNoneQuery(sql); /***********************end 修改已经制定的工作计划中的服务时间*********************/ /***********************begin 重新生成工作执行表*********************/ SPParam spParam = new { }.ToSPParam(); spParam["OldManId"] = assessmentResult.OldManId; spParam["BatchFlag"] = 0; BuilderFactory.DefaultBulder().ExecuteSPNoneQuery("SP_Pam_GenDailyWorkExcute", spParam); /***********************end 重新生成工作执行表*********************/ } catch (Exception ex) { result.Success = false; result.ErrorMessage = ex.Message; } return(result); }
public ModelInvokeResult <AssessmentResultPK> Nullify(string strId) { ModelInvokeResult <AssessmentResultPK> result = new ModelInvokeResult <AssessmentResultPK> { Success = true }; try { List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>(); AssessmentResult assessmentResult = new AssessmentResult { Id = Int32.Parse(strId), Status = 0 }; /***********************begin 自定义代码*******************/ assessmentResult.OperatedBy = NormalSession.UserId.ToGuid(); assessmentResult.OperatedOn = DateTime.Now; assessmentResult.DataSource = GlobalManager.DIKey_00012_ManualEdit; /***********************end 自定义代码*********************/ statements.Add(new IBatisNetBatchStatement { StatementName = assessmentResult.GetUpdateMethodName(), ParameterObject = assessmentResult.ToStringObjectDictionary(false), Type = SqlExecuteType.UPDATE }); /***********************begin 自定义代码*******************/ /***********************此处添加自定义代码*****************/ /***********************end 自定义代码*********************/ BuilderFactory.DefaultBulder().ExecuteNativeSqlNoneQuery(statements); result.instance = new AssessmentResultPK { Id = Int32.Parse(strId) }; } catch (Exception ex) { result.Success = false; result.ErrorMessage = ex.Message; } return(result); }