private LinkSubStep convertToLinkSubStep(DataRow dr) { LinkSubStep linkSubStep = new LinkSubStep(); linkSubStep.Id = dr.Field <int>("ID"); linkSubStep.PrimaryStepId = dr.Field <int>("PrimaryStepId"); linkSubStep.StepNo = dr.Field <int>("StepNo"); linkSubStep.Title = dr.Field <string>("Title"); linkSubStep.Description = dr.Field <string>("Description"); linkSubStep.Remarks = dr.Field <string>("Remarks"); linkSubStep.DurationInMinutes = dr.Field <int>("DurationInMinutes"); linkSubStep.TimelineInDays = dr.Field <int>("TimelineInDays"); linkSubStep.PrimaryResponsibility = dr.Field <int>("PrimaryResponsibility"); linkSubStep.Owner = dr.Field <int>("Owner"); linkSubStep.Checker = dr.Field <int>("Checker"); return(linkSubStep); }
public LinkSubStep UpdateLinkSubSteps(LinkSubStep linkSubStep) { try { string countResult = DataBase.DBService.ExecuteCommandScalar(string.Format(GET_CLIENT_NAME_QUERY, 0)); if (linkSubStep.Id == 0) { DataBase.DBService.ExecuteCommand(string.Format(INSERT_LINKSUB_STEP_QUERY, linkSubStep.PrimaryStepId, linkSubStep.StepNo, linkSubStep.Title, linkSubStep.Description, linkSubStep.Remarks, linkSubStep.DurationInMinutes, linkSubStep.TimelineInDays, linkSubStep.PrimaryResponsibility, linkSubStep.Owner, linkSubStep.Checker)); } else { DataBase.DBService.ExecuteCommand(string.Format(UPDATE_LINKSUB_STEP_QUERY, linkSubStep.StepNo, linkSubStep.Title, linkSubStep.Description, linkSubStep.Remarks, linkSubStep.DurationInMinutes, linkSubStep.TimelineInDays, linkSubStep.PrimaryResponsibility, linkSubStep.Owner, linkSubStep.Checker, linkSubStep.Id)); } string linkSubStepId = DataBase.DBService.ExecuteCommandScalar(string.Format("SELECT Id FROM LinkSubStep where StepNo = {0} and Title = '{1}' and DurationInMinutes = {2} and TimelineInDays = {3} and PrimaryStepId ={4}", linkSubStep.StepNo, linkSubStep.Title, linkSubStep.DurationInMinutes, linkSubStep.TimelineInDays, linkSubStep.PrimaryStepId)); if (!string.IsNullOrEmpty(linkSubStepId)) { linkSubStep.Id = int.Parse(linkSubStepId); } return(linkSubStep); } catch (Exception ex) { StackTrace st = new StackTrace(); StackFrame sf = st.GetFrame(0); MethodBase currentMethodName = sf.GetMethod(); LogDebug(currentMethodName.Name, ex); throw ex; } }
private DateTime getDueDate(ClientProcess clientProcess) { DateTime dueDate = DateTime.Now.Date; if (!clientProcess.LinkStepId.Equals(0)) { LinkSubStep linkSub = linkSubSteps.First(i => i.Id.Equals(clientProcess.LinkStepId)); if (linkSub != null) { dueDate = dueDate.AddDays(linkSub.TimelineInDays); } else { } } return(dueDate); }
public Result <LinkSubStep> UpdateLinkSubStep(LinkSubStep linkSubStep) { var result = new Result <LinkSubStep>(); try { ProcessService processService = new ProcessService(); result.Value = processService.UpdateLinkSubSteps(linkSubStep); result.IsSuccess = true; } catch (Exception exception) { result.IsSuccess = false; result.ExceptionInfo = exception; } return(result); }
private string getTaskTitleByProcessId(int primaryStepId, int linkStepId) { string title = string.Empty; if (!linkStepId.Equals(0)) { LinkSubStep linkSub = linkSubSteps.First(i => i.PrimaryStepId == primaryStepId && i.Id.Equals(linkStepId)); if (linkSub != null) { title = linkSub.Title; } } else { PrimaryStep primaryStep = primarySteps.First(i => i.Id.Equals(primaryStepId)); if (primaryStep != null) { title = primaryStep.Title; } } return(title); }
public IList <LinkSubStep> GetLinkSubSteps(int primaryStepId) { try { Logger.LogInfo("Get: LinkSubStep process start"); IList <LinkSubStep> processSteps = new List <LinkSubStep>(); DataTable dtAppConfig = DataBase.DBService.ExecuteCommand(string.Format(SELECT_LINKSUBSTEP_QUERY_BY_PRIMARY_STEP, primaryStepId)); foreach (DataRow dr in dtAppConfig.Rows) { LinkSubStep processStep = convertToLinkSubStep(dr); processSteps.Add(processStep); } Logger.LogInfo("Get: LinkSubStep process completed."); return(processSteps); } catch (Exception ex) { StackTrace st = new StackTrace(); StackFrame sf = st.GetFrame(0); MethodBase currentMethodName = sf.GetMethod(); LogDebug(currentMethodName.Name, ex); throw ex; } }