static void Main(string[] args) { Console.WriteLine("Simple test of constructing the objects..."); DALSettingsSection dss = null; var config = ConfigurationManager.OpenExeConfiguration(null); dss = (DALSettingsSection)config.Sections["dalSettings"]; Console.WriteLine("Looking for templates in this folder: " + dss.BaseTemplateFolder); DALSettings settings = new DALSettings(dss); ProcessDAL pd = new ProcessDAL(settings); if (pd.GenerateAllFiles()) { Console.WriteLine("Files generated successfully."); Console.WriteLine("Please check the " + dss.BaseOutputFolder + " folder for results."); } else { Console.WriteLine("There was some sort of processing error."); Console.WriteLine("Check the log files."); } Console.Write("End of test. Press Enter..."); Console.ReadLine(); }
public static void createProcess(String name, String description, decimal userId) { try { ProcessDAL.insert(name, description, DateTime.Now, userId); } catch (Exception e) { throw e; } }
void worker_DoWork(object sender, DoWorkEventArgs e) { DALSettingsSection sect = e.Argument as DALSettingsSection; DALSettings settings = new DALSettings(sect); ProcessDAL pd = new ProcessDAL(settings); e.Result = pd.GenerateAllFiles(); }
public static List <ListReportProcess> getReportProcess(decimal id) { try { List <ListReportProcess> processList = new List <ListReportProcess>(); var dProcess = ProcessDAL.fetchAllByUnit(id); foreach (process p in dProcess) { ListReportProcess response = new ListReportProcess(); response.processId = int.Parse(p.id + ""); response.processName = p.name; var list = TaskDAL.fetchByProcess(p.id).Select(x => new Task { id = long.Parse(x.id + ""), name = x.name, taskStatusId = x.task_status, }).ToList(); response.taskList = list; int ready = 0; int working = 0; int pending = 0; foreach (Task task in list) { if (task.taskStatusId == "0") { pending++; } else if (task.taskStatusId == "2") { ready++; } else if (task.taskStatusId == "4") { working++; } } response.tasks = list.Count(); response.done = ready; response.working = working; response.pending = pending; processList.Add(response); } return(processList); } catch (Exception e) { throw e; } }
public static List <Alert> getRejectionTasksByCreator(decimal id) { try { List <Alert> list = new List <Alert>(); var dTasks = TaskDAL.getCreationTasksByUser(id).ToList(); foreach (tasks item in dTasks) { var dAlert = AlertDAL.fetchByTaskId(long.Parse(item.id + "")); if (dAlert != null) { Task task = new Task(); task.id = long.Parse(item.id + ""); task.name = item.name; task.description = item.description; task.dateEnd = item.date_end; task.sDateEnd = ((DateTime)item.date_end).ToString("dd/MM/yyyy").Replace("-", "/"); if (item.process_id != null) { var process = ProcessDAL.getById(Decimal.Parse(item.process_id + "")); Process dProcess = new Process(); dProcess.name = process.name; dProcess.description = process.description; dProcess.id = long.Parse(process.id + ""); task.process = dProcess; } var user = UserDAL.fetchAll().Where(x => x.id == item.assing_id).FirstOrDefault(); User mUser = new User(); mUser.id = long.Parse(user.id + ""); mUser.name = user.name; task.creatorUser = mUser; Alert alert = new Alert(); alert.id = dAlert.id; alert.message = dAlert.message; alert.state = int.Parse(dAlert.state + ""); alert.task = task; list.Add(alert); } } return(list); } catch (Exception e) { throw e; } }
public void InitTestObjects() { // Init with all defaults proc = new ProcessDAL(); sbTime.Append(String.Format("This is a string with the time tag {0} in it", ProcessDAL.TIME_TAG)); // create an entity string will all variations of the entity tag // // {{entityNameRP}} (for removing plurals - entities becomes entitie b/c an s follows in the template) // {{entityNameP}} (for plural collection instances) // {{entityName}} sbEntity.Append("This string has " + ProcessDAL.ENTITY_NAME + " in it. "); sbEntity.Append("And also proper list as Get" + ProcessDAL.ENTITY_PLURAL_COLS + " entity plurals. "); sbEntity.Append("And also a list of " + ProcessDAL.ENTITY_REMOVE_PLURALS + "s that should be properly singular and pluralized in the template string."); }
public static List <Task> getTasksByProcessId(decimal id) { try { List <Task> list = new List <Task>(); var dTasks = TaskDAL.getTasksByProcessId(id).ToList(); foreach (tasks item in dTasks) { Task task = new Task(); task.id = long.Parse(item.id + ""); task.name = item.name; task.description = item.description; task.dateEnd = item.date_end; task.sDateEnd = ((DateTime)item.date_end).ToString("dd/MM/yyyy").Replace("-", "/"); if (item.process_id != null) { var process = ProcessDAL.getById(Decimal.Parse(item.process_id + "")); Process dProcess = new Process(); dProcess.name = process.name; dProcess.description = process.description; dProcess.id = long.Parse(process.id + ""); task.process = dProcess; } var listFiles = DocumentDAL.fetchAllByTaskId(long.Parse(item.id + "")).Select(x => new Document() { id = long.Parse(x.id + ""), name = x.name, url = x.url, path = x.path, task_id = x.task_id }).ToList(); task.documents = listFiles; task.alert = 0; list.Add(task); } return(list); } catch (Exception e) { throw e; } }
/** * Método para obtener la lista de datos realizando el mapeo desde la capa de datos */ public static List <Process> fetchAllByUnit(decimal id) { try { List <Process> list = new List <Process>(); var mProcess = ProcessDAL.fetchAllByUnit(id).ToList(); foreach (process proceso in mProcess) { var tasks = TaskDAL.fetchByProcess(proceso.id).Count(); Process model = new Process(); model.id = long.Parse(proceso.id + ""); model.name = proceso.name; model.description = proceso.description; model.n_tasks = tasks; list.Add(model); } return(list); } catch (Exception e) { throw e; } }
public static void start(decimal id, decimal userId) { try { var template = TemplateDAL.fetchAll().Where(x => x.id == id).FirstOrDefault(); var tasks = TemplateTaskDAL.fetchAll().Where(x => x.template_id == template.id).ToList(); decimal processId = ProcessDAL.insert(template.name, template.description, DateTime.Now, userId); foreach (templates_tasks ts in tasks) { tasks model = new tasks(); model.name = ts.name; model.description = ts.description; model.date_end = ts.end_date; model.task_status = ts.task_status_code; model.creator_user_id = decimal.Parse(userId + ""); model.process_id = processId; TaskDAL.createTask(model); } } catch (Exception e) { throw e; } }
public bool InsertMaterialItem(string UserID, DataTable tempTable,double PdpLoid) { bool ret = true; ProcessDAL oDAL = new ProcessDAL(); OracleDBObj objDB = new OracleDBObj(); objDB.CreateConnection(); objDB.CreateTransaction(); try { if (tempTable.Rows.Count > 0) { if (InsertMaterialItemData(UserID, tempTable, objDB, PdpLoid) == true) { objDB.zTrans.Commit(); ret = true; } else { objDB.zTrans.Rollback(); ret = false; } } } catch (Exception ex) { _error = ex.Message; ; objDB.zTrans.Rollback(); ret = false; } objDB.CloseConnection(); return ret; }
public bool UpdatePackageLost(string UserID, string PdpLoid, DataTable tempTable) { bool ret = true; ProcessDAL oDAL = new ProcessDAL(); OracleDBObj objDB = new OracleDBObj(); objDB.CreateConnection(); objDB.CreateTransaction(); try { if (tempTable.Rows.Count > 0) { if (UpdatePackageLost(UserID, tempTable, objDB, Convert.ToDouble(PdpLoid)) == true) { objDB.zTrans.Commit(); ret = true; } else { objDB.zTrans.Rollback(); ret = false; } } } catch (Exception ex) { _error = ex.Message; ; objDB.zTrans.Rollback(); ret = false; } objDB.CloseConnection(); return ret; }
public static List <ListProcessResponse> getBackLogByUnit(decimal id) { try { List <ListProcessResponse> list = new List <ListProcessResponse>(); var mProcess = ProcessDAL.fetchAllByUnit(id).ToList(); foreach (process proceso in mProcess) { var dListTasks = TaskDAL.fetchByProcess(proceso.id); ListProcessResponse model = new ListProcessResponse(); model.id = long.Parse(proceso.id + ""); model.name = proceso.name; model.description = proceso.description; var dTasks = 0; if (dListTasks != null) { model.n_tasks = dListTasks.Count(); dTasks = dListTasks.Count(); } var pendingTask = 0; var readyTask = 0; var workingTask = 0; if (dListTasks != null) { foreach (tasks tarea in dListTasks) { if (tarea.task_status == "2") { readyTask = readyTask + 1; } if (tarea.task_status == "0" || tarea.task_status == "1") { pendingTask = pendingTask + 1; } if (tarea.task_status == "4") { workingTask = workingTask + 1; } } } model.task_working = workingTask; model.task_peding = pendingTask; model.task_ready = readyTask; var lastTask = TaskDAL.fetchByProcess(proceso.id).OrderByDescending(x => x.date_end).FirstOrDefault(); if (lastTask != null) { model.endDate = ((DateTime)lastTask.date_end).ToString("dd/MM/yyyy").Replace("-", "/"); } var progress = 0; if (dTasks > 0) { progress = readyTask * 100 / dTasks; } model.progress = progress; list.Add(model); } return(list); } catch (Exception e) { throw e; } }
public static List <Task> getTasksByUserId(decimal id) { try { List <Task> list = new List <Task>(); var dTasks = TaskDAL.getTasksByUser(id); foreach (tasks item in dTasks) { Task task = new Task(); task.id = long.Parse(item.id + ""); task.name = item.name; task.description = item.description; task.dateEnd = item.date_end; task.sDateEnd = ((DateTime)item.date_end).ToString("dd/MM/yyyy").Replace("-", "/"); if (item.process_id != null) { var process = ProcessDAL.getById(Decimal.Parse(item.process_id + "")); Process dProcess = new Process(); dProcess.name = process.name; dProcess.description = process.description; dProcess.id = long.Parse(process.id + ""); task.process = dProcess; } var listFiles = DocumentDAL.fetchAllByTaskId(long.Parse(item.id + "")).Select(x => new Document() { id = long.Parse(x.id + ""), name = x.name, url = x.url, path = x.path, task_id = x.task_id }).ToList(); task.documents = listFiles; var alert = ConfigTrafficLightDAL.fetch(); var end = (DateTime)item.date_end; var now = DateTime.Now; var date = -(Math.Round((now - end).TotalDays)); if (date <= double.Parse(alert.red + "")) { task.alert = 1; } else if (date <= double.Parse(alert.yellow + "")) { task.alert = 2; } else if (date > double.Parse(alert.green + "")) { task.alert = 3; } list.Add(task); } return(list); } catch (Exception e) { throw e; } }