public override int?Save(string action) { var data = new TaskDataModel(); data.TaskId = TaskId; data.TaskTypeId = TaskTypeId; data.Name = Name; data.Description = Description; data.SortOrder = SortOrder; if (action == "Insert") { var dtTask = TaskDataManager.DoesExist(data, SessionVariables.RequestProfile); if (dtTask.Rows.Count == 0) { TaskDataManager.Create(data, SessionVariables.RequestProfile); } else { throw new Exception("Record with given ID already exists."); } } else { TaskDataManager.Update(data, SessionVariables.RequestProfile); } // not correct ... when doing insert, we didn't get/change the value of TaskID ? return(TaskId); }
public virtual ActionResult TaskDetail(TaskDataModel model) { var validatorsResponse = _k2DataService.GetValidators(model.Code, model.TaskFolio); var commentsResponse = _k2DataService.GetComments(model.WorkflowInstanceId); var additionalValidatorsResponse = _catalogService.GetMasterDataListByTypeCode(typeCodes: _k2DataService.AdditionalValidatorsRolesDataType); var modelTaskView = new MissionsK2TaskViewModel { UserComments = commentsResponse.IsValid ? commentsResponse.Comments : null, Instructions = Localization.GetText("Pending key multilanguage"), TaskDataModel = model, UserName = IDBContext.Current.UserName, Validators = validatorsResponse.IsValid ? validatorsResponse.Validators : null, UserRoleMissions = validatorsResponse.IsValid ? validatorsResponse.Validators.Where(v => v.Order > model.TaskTypeId).Select(v => v.Role).FirstOrDefault() : null }; ViewBag.AdditionalValidators = additionalValidatorsResponse.IsValid ? additionalValidatorsResponse.MasterDataCollection : new List <MasterDataViewModel>(); ViewBag.UserRole = validatorsResponse.IsValid ? validatorsResponse.Validators.Where(v => v.Order > model.TaskTypeId).Select(v => v.Role).FirstOrDefault() : null; ViewBag.UserName = IDBContext.Current.UserName; ViewBag.SerializedViewModel = PageSerializationHelper.SerializeObject(modelTaskView); return(View(modelTaskView)); }
private void PopulateDropDownList() { //parent var TaskTypeEntry = TaskTimeTracker.Components.BusinessLayer.Task.TaskTypeDataManager.GetList(SessionVariables.RequestProfile); drpTaskType.DataSource = TaskTypeEntry.DefaultView; drpTaskType.DataTextField = "Name"; drpTaskType.DataValueField = "TaskTypeId"; drpTaskType.DataBind(); TaskDataModel data = new TaskDataModel(); data.TaskTypeId = Convert.ToInt32(drpTaskType.SelectedItem.Value); var TaskEntry = TaskTimeTracker.Components.BusinessLayer.Task.TaskDataManager.Search(data, SessionVariables.RequestProfile); drpTask.DataSource = TaskEntry.DefaultView; drpTask.DataTextField = "Name"; drpTask.DataValueField = "TaskId"; drpTask.DataBind(); if (drpTask.Items.Count == 0) { drpTask.Items.Add(new ListItem("None", "-1")); } //Source List var PersonEntry = Framework.Components.ApplicationUser.ApplicationUserDataManager.GetList(SessionVariables.RequestProfile); lstSourcePerson.DataSource = PersonEntry.DefaultView; lstSourcePerson.DataTextField = "FirstName"; lstSourcePerson.DataValueField = "ApplicationUserId"; lstSourcePerson.DataBind(); PopulateTargetPerson(); CleanUpPerson(); drpPerson.DataSource = PersonEntry.DefaultView; drpPerson.DataTextField = "FirstName"; drpPerson.DataValueField = "ApplicationUserId"; drpPerson.DataBind(); TaskEntry = TaskTimeTracker.Components.BusinessLayer.Task.TaskDataManager.GetList(SessionVariables.RequestProfile); lstSourceTask.DataSource = TaskEntry.DefaultView; lstSourceTask.DataTextField = "Name"; lstSourceTask.DataValueField = "TaskId"; lstSourceTask.DataBind(); var TaskStatusType = TaskTimeTracker.Components.BusinessLayer.Task.TaskStatusTypeDataManager.GetList(SessionVariables.RequestProfile); drpTaskStatusType.DataSource = TaskStatusType.DefaultView; drpTaskStatusType.DataTextField = "Name"; drpTaskStatusType.DataValueField = "TaskStatusTypeId"; drpTaskStatusType.DataBind(); PopulateTargetTask(); CleanUpTask(); }
public static List <TaskDataModel> GetEntityDetails(TaskDataModel dataQuery, RequestProfile requestProfile, int returnAuditInfo = BaseDataManager.ReturnAuditInfoOnDetails) { const string sql = @"dbo.TaskSearch "; var parameters = new { AuditId = requestProfile.AuditId , ApplicationId = requestProfile.ApplicationId , ReturnAuditInfo = returnAuditInfo , TaskId = dataQuery.TaskId , TaskTypeId = dataQuery.TaskTypeId , Name = dataQuery.Name , Description = dataQuery.Description }; List <TaskDataModel> result; using (var dataAccess = new DataAccessBase(DataStoreKey)) { result = dataAccess.Connection.Query <TaskDataModel>(sql, parameters, commandType: CommandType.StoredProcedure).ToList(); } return(result); }
//public static List<TaskDataModel> GetEntityDetails(TaskDataModel data, int auditId) //{ // var sql = "EXEC dbo.TaskSearch " + // " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, auditId) + // ", " + ToSQLParameter(BaseDataModel.BaseDataColumns.ApplicationId, ApplicationId) + // ", " + ToSQLParameter(data, StandardDataModel.StandardDataColumns.Name) + // ", " + ToSQLParameter(data, TaskDataModel.DataColumns.TaskId) + // ", " + ToSQLParameter(data, TaskDataModel.DataColumns.TaskTypeId) + // ", " + ToSQLParameter(data, StandardDataModel.StandardDataColumns.Description); // var result = new List<TaskDataModel>(); // using (var reader = new DBDataReader("Get Details", sql, DataStoreKey)) // { // var dbReader = reader.DBReader; // while (dbReader.Read()) // { // var dataItem = new TaskDataModel(); // dataItem.TaskId = (int)dbReader[TaskDataModel.DataColumns.TaskId]; // dataItem.TaskTypeId = (int)dbReader[TaskDataModel.DataColumns.TaskTypeId]; // dataItem.TaskType = (string)dbReader[TaskDataModel.DataColumns.TaskType]; // SetStandardInfo(dataItem, dbReader); // SetBaseInfo(dataItem, dbReader); // result.Add(dataItem); // } // } // return result; //} #endregion GetDetails #region CreateOrUpdate private static string CreateOrUpdate(TaskDataModel data, RequestProfile requestProfile, string action) { var traceId = TraceDataManager.GetNextTraceId(requestProfile); var sql = "EXEC "; switch (action) { case "Create": sql += "dbo.TaskInsert " + "\r\n" + " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) + ", " + ToSQLParameter(BaseDataModel.BaseDataColumns.TraceId, traceId) + ", " + ToSQLParameter(BaseDataModel.BaseDataColumns.ApplicationId, requestProfile.ApplicationId); break; case "Update": sql += "dbo.TaskUpdate " + "\r\n" + " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) + ", " + ToSQLParameter(BaseDataModel.BaseDataColumns.TraceId, traceId); break; default: break; } sql = sql + ", " + ToSQLParameter(data, TaskDataModel.DataColumns.TaskId) + ", " + ToSQLParameter(data, TaskDataModel.DataColumns.TaskTypeId) + ", " + ToSQLParameter(data, StandardDataModel.StandardDataColumns.Name) + ", " + ToSQLParameter(data, StandardDataModel.StandardDataColumns.Description) + ", " + ToSQLParameter(data, StandardDataModel.StandardDataColumns.SortOrder); return(sql); }
public virtual ActionResult VERTask(string operationNumber, TaskDataModel model) { var commentRequest = new CommentsTaskRequest { TaskId = model.TaskId }; var commentsResponse = _verTaskService.GetComments(commentRequest); var instructionRequest = new InstructionTaskRequest { TaskId = model.TaskId }; var instructionResponse = _verTaskService.GetInstruction(instructionRequest); var verTaskViewModel = new TaskViewModel { UserComments = commentsResponse.IsValid ? commentsResponse.Comments : null, Instructions = instructionResponse.IsValid ? instructionResponse.Instruction : null, TaskDataModel = model, UserName = IDBContext.Current.UserName }; ViewBag.SerializedViewModel = PageSerializationHelper.SerializeObject(verTaskViewModel); return(View(verTaskViewModel)); }
public static List <TaskDataModel> GetByActivity(int id) { List <TaskDataModel> tasks = new List <TaskDataModel>(); MySqlConnection connection = new MySqlConnection(ConfigurationManager.AppSettings[BusinessUtilies.Const.Database.AppSetting]); MySqlDataAdapter adapter = new MySqlDataAdapter("Core_GetTasksByActivity", connection); MySqlParameter paramID = new MySqlParameter("pID", id); paramID.Direction = ParameterDirection.Input; adapter.SelectCommand.Parameters.Add(paramID); adapter.SelectCommand.CommandType = CommandType.StoredProcedure; DataTable results = new DataTable(); adapter.Fill(results); foreach (DataRow item in results.Rows) { TaskDataModel task = new TaskDataModel(); if (item["ID"].GetType() != typeof(DBNull)) { task.ID = Convert.ToInt32(item["ID"]); } if (item["Name"].GetType() != typeof(DBNull)) { task.Name = Convert.ToString(item["Name"]); } if (item["CreatedBy"].GetType() != typeof(DBNull)) { task.CreatedBy = Convert.ToInt32(item["CreatedBy"]); } if (item["DateCreated"].GetType() != typeof(DBNull)) { task.DateCreated = Convert.ToDateTime(item["DateCreated"]); } if (item["AssignedTo"].GetType() != typeof(DBNull)) { task.AssignedTo = Convert.ToInt32(item["AssignedTo"]); } if (item["Template"].GetType() != typeof(DBNull)) { task.Template = Convert.ToString(item["Template"]); } if (item["ActivityID"].GetType() != typeof(DBNull)) { task.ActivityID = Convert.ToInt32(item["ActivityID"]); } if (item["Comments"].GetType() != typeof(DBNull)) { task.Comments = Convert.ToString(item["Comments"]); } tasks.Add(task); } return(tasks); }
protected override void Clear() { base.Clear(); var data = new TaskDataModel(); SetData(data); }
public static int Create(TaskDataModel data, RequestProfile requestProfile) { var sql = CreateOrUpdate(data, requestProfile, "Create"); var taskId = DBDML.RunScalarSQL("Task.Insert", sql, DataStoreKey); return(Convert.ToInt32(taskId)); }
public static DataTable GetDetails(TaskDataModel data, RequestProfile requestProfile) { var list = GetEntityDetails(data, requestProfile); var table = list.ToDataTable(); return(table); }
protected override void Update(Dictionary <string, string> values) { var data = new TaskDataModel(); PropertyMapper.CopyProperties(data, values); TaskDataManager.Update(data, SessionVariables.RequestProfile); base.Update(values); }
protected override DataTable GetEntityData(int?entityKey) { var taskdata = new TaskDataModel(); taskdata.TaskId = entityKey; var results = TaskDataManager.Search(taskdata, SessionVariables.RequestProfile); return(results); }
private DataTable GetData() { // TODO: on all export pages var data = new TaskDataModel(); var dt = TaskDataManager.Search(data, SessionVariables.RequestProfile); return(dt); }
public static DataSet DeleteChildren(TaskDataModel data, RequestProfile requestProfile) { var sql = "EXEC dbo.TaskChildrenDelete " + " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) + ", " + ToSQLParameter(data, TaskDataModel.DataColumns.TaskId); var oDT = new DBDataSet("Task.DeleteChildren", sql, DataStoreKey); return(oDT.DBDataset); }
public static DataTable DoesExist(TaskDataModel data, RequestProfile requestProfile) { var sql = "EXEC dbo.TaskSearch " + " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) + ", " + ToSQLParameter(BaseDataModel.BaseDataColumns.ApplicationId, requestProfile.ApplicationId) + ", " + ToSQLParameter(data, TaskDataModel.DataColumns.TaskId) + ", " + ToSQLParameter(data, StandardDataModel.StandardDataColumns.Name); var oDT = new DBDataTable("Task.DoesExist", sql, DataStoreKey); return(oDT.DBTable); }
private void SaveTaskXApplicationUser(int taskId, List <int> ApplicationUserIds) { var data = new TaskDataModel(); data.TaskId = taskId; var taskdata = TaskDataManager.Search(data, SessionVariables.RequestProfile); var row = taskdata.Rows[0]; var taskStatusTypeId = Convert.ToString(row[TaskXApplicationUserDataModel.DataColumns.TaskStatusTypeId]); TaskXApplicationUserDataManager.DeleteByTask(taskId, SessionVariables.RequestProfile); TaskXApplicationUserDataManager.CreateByTask(taskId, ApplicationUserIds.ToArray(), SessionVariables.RequestProfile); }
protected override void Clear() { base.Clear(); var data = new TaskDataModel(); TaskId = data.TaskId; TaskId = data.TaskTypeId; Description = data.Description; Name = data.Name; SortOrder = data.SortOrder; }
public static List <TaskDataModel> GetAll() { List <TaskDataModel> tasks = new List <TaskDataModel>(); MySqlConnection connection = new MySqlConnection(ConfigurationManager.AppSettings[BusinessUtilies.Const.Database.AppSetting]); MySqlDataAdapter adapter = new MySqlDataAdapter("Core_GetTasks", connection); DataTable results = new DataTable(); adapter.Fill(results); foreach (DataRow item in results.Rows) { TaskDataModel task = new TaskDataModel(); if (item["ID"].GetType() != typeof(DBNull)) { task.ID = Convert.ToInt32(item["ID"]); } if (item["Name"].GetType() != typeof(DBNull)) { task.Name = Convert.ToString(item["Name"]); } if (item["CreatedBy"].GetType() != typeof(DBNull)) { task.CreatedBy = Convert.ToInt32(item["CreatedBy"]); } if (item["DateCreated"].GetType() != typeof(DBNull)) { task.DateCreated = Convert.ToDateTime(item["DateCreated"]); } if (item["AssignedTo"].GetType() != typeof(DBNull)) { task.AssignedTo = Convert.ToInt32(item["AssignedTo"]); } if (item["Template"].GetType() != typeof(DBNull)) { task.Template = Convert.ToString(item["Template"]); } if (item["ActivityID"].GetType() != typeof(DBNull)) { task.ActivityID = Convert.ToInt32(item["ActivityID"]); } if (item["Comments"].GetType() != typeof(DBNull)) { task.Comments = Convert.ToString(item["Comments"]); } tasks.Add(task); } return(tasks); }
private void UpdateData(ArrayList values) { var data = new TaskDataModel(); data.TaskId = int.Parse(values[0].ToString()); data.TaskTypeId = int.Parse(values[1].ToString()); data.Name = values[2].ToString(); data.Description = values[3].ToString(); data.SortOrder = int.Parse(values[4].ToString()); TaskDataManager.Update(data, SessionVariables.RequestProfile); ReBindEditableGrid(); }
public ActionResult Create(TaskDataModel task) { TaskBO.GetInstance().Create(task); if (Session["ParentID"] != null) { return(RedirectToAction("Index", new { id = Convert.ToInt32(Session["ParentID"]) })); } else { return(RedirectToAction("Index")); } }
public virtual void Create(TaskDataModel task) { if (task.fileTemplate != null) { string filePath = FileManager.SaveFile(task.fileTemplate); if (!String.IsNullOrEmpty(filePath)) { task.Template = filePath; } ; } TaskDAL.Create(task); }
public static void Delete(TaskDataModel dataQuery, RequestProfile requestProfile) { const string sql = @"dbo.TaskDelete "; var parameters = new { AuditId = requestProfile.AuditId , TaskId = dataQuery.TaskId }; using (var dataAccess = new DataAccessBase(DataStoreKey)) { dataAccess.Connection.Execute(sql, parameters, commandType: CommandType.StoredProcedure); } }
public static DataTable Search(TaskDataModel data, RequestProfile requestProfile) { // formulate SQL var sql = "EXEC dbo.TaskSearch " + " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) + ", " + ToSQLParameter(BaseDataModel.BaseDataColumns.ApplicationId, requestProfile.ApplicationId) + ", " + ToSQLParameter(data, StandardDataModel.StandardDataColumns.Name) + ", " + ToSQLParameter(data, StandardDataModel.StandardDataColumns.Description) + ", " + ToSQLParameter(data, TaskDataModel.DataColumns.TaskId) + ", " + ToSQLParameter(data, TaskDataModel.DataColumns.TaskTypeId); var oDT = new DBDataTable("Task.GetList", sql, DataStoreKey); return(oDT.DBTable); }
public static bool IsDeletable(TaskDataModel data, RequestProfile requestProfile) { var isDeletable = true; var ds = GetChildren(data, requestProfile); if (ds != null && ds.Tables.Count > 0) { if (ds.Tables.Cast <DataTable>().Any(dt => dt.Rows.Count > 0)) { isDeletable = false; } } return(isDeletable); }
public override void Create(TaskDataModel task) { if (!SecurityManager.SesionStarted()) { throw new Exception("Session not started"); } task.CreatedBy = SecurityManager.GetLoggedUser().ID; task.DateCreated = DateTime.Now; if (HttpContext.Current.Session["ParentID"] != null) { task.ActivityID = Convert.ToInt32(HttpContext.Current.Session["ParentID"]); } base.Create(task); }
public static string ToSQLParameter(TaskDataModel data, string dataColumnName) { var returnValue = "NULL"; switch (dataColumnName) { case TaskDataModel.DataColumns.TaskId: if (data.TaskId != null) { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NUMBER, TaskDataModel.DataColumns.TaskId, data.TaskId); } else { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, TaskDataModel.DataColumns.TaskId); } break; case TaskDataModel.DataColumns.TaskTypeId: if (data.TaskTypeId != null) { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NUMBER, TaskDataModel.DataColumns.TaskTypeId, data.TaskTypeId); } else { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, TaskDataModel.DataColumns.TaskTypeId); } break; case TaskDataModel.DataColumns.TaskType: if (data.TaskType != null) { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NUMBER, TaskDataModel.DataColumns.TaskType, data.TaskType); } else { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, TaskDataModel.DataColumns.TaskType); } break; default: returnValue = StandardDataManager.ToSQLParameter(data, dataColumnName); break; } return(returnValue); }
public static void Create(TaskDataModel task) { MySqlConnection connection = new MySqlConnection(ConfigurationManager.AppSettings[BusinessUtilies.Const.Database.AppSetting]); MySqlDataAdapter adapter = new MySqlDataAdapter("Core_CreateTask", connection); adapter.SelectCommand.CommandType = CommandType.StoredProcedure; MySqlParameter paramID = new MySqlParameter("pID", task.ID); paramID.Direction = ParameterDirection.Input; adapter.SelectCommand.Parameters.Add(paramID); MySqlParameter paramName = new MySqlParameter("pName", task.Name); paramName.Direction = ParameterDirection.Input; adapter.SelectCommand.Parameters.Add(paramName); MySqlParameter paramCreatedBy = new MySqlParameter("pCreatedBy", task.CreatedBy); paramCreatedBy.Direction = ParameterDirection.Input; adapter.SelectCommand.Parameters.Add(paramCreatedBy); MySqlParameter paramDateCreated = new MySqlParameter("pDateCreated", task.DateCreated); paramDateCreated.Direction = ParameterDirection.Input; adapter.SelectCommand.Parameters.Add(paramDateCreated); MySqlParameter paramAssignedTo = new MySqlParameter("pAssignedTo", task.AssignedTo); paramAssignedTo.Direction = ParameterDirection.Input; adapter.SelectCommand.Parameters.Add(paramAssignedTo); MySqlParameter paramTemplate = new MySqlParameter("pTemplate", task.Template); paramTemplate.Direction = ParameterDirection.Input; adapter.SelectCommand.Parameters.Add(paramTemplate); MySqlParameter paramActivityID = new MySqlParameter("pActivityID", task.ActivityID); paramActivityID.Direction = ParameterDirection.Input; adapter.SelectCommand.Parameters.Add(paramActivityID); MySqlParameter paramComments = new MySqlParameter("pComments", task.Comments); paramComments.Direction = ParameterDirection.Input; adapter.SelectCommand.Parameters.Add(paramComments); DataTable results = new DataTable(); adapter.Fill(results); }
public virtual ActionResult LCTask(string operationNumber, TaskDataModel model) { var database = new OptimaContainer(); var splittedFolio = model.TaskFolio.Split('-'); var taskId = splittedFolio[splittedFolio.Length - 1]; var taskName = _lcTaskService.GetTaskName(taskId).Name; var TaskViewModel = new TasksViewModel { TaskName = taskName, Instructions = LifeCycleGlobalValues.INSTRUCTIONS_LC, TaskDataModel = model, UserName = IDBContext.Current.UserName }; ViewBag.SerializedViewModel = IDB.Presentation.MVC4.Helpers.PageSerializationHelper.SerializeObject(TaskViewModel); return(View(TaskViewModel)); }
protected void btnDelete_Click(object sender, EventArgs e) { try { string[] deleteIndexList = DeleteIds.Split(','); foreach (string index in deleteIndexList) { var data = new TaskDataModel(); data.TaskId = int.Parse(index); TaskDataManager.Delete(data, SessionVariables.RequestProfile); DeleteAndRedirect(); } } catch (Exception ex) { Response.Write(ex.Message); } }
public virtual ActionResult TaskDetailWorkflow(string operationNumber, TaskDataModel model) { Logger.GetLogger().WriteDebug( "WorkflowK2Controller", "Method: TaskDetailWorkflow - Parameters( operationNumber: " + operationNumber + ")"); object serialNro; object isFinalReport; if (model.Parameters != null) { model.Parameters.TryGetValue(K2TCMHelpers.SerialNro, out serialNro); model.Parameters.TryGetValue(K2TCMHelpers.isFinalReport, out isFinalReport); } else { serialNro = "0"; isFinalReport = false; } var commentsResponse = _commentsTaskService.GetComments(model.EntityId); var modelTaskView = new WorkflowViewModels { UserComments = commentsResponse.IsValid ? commentsResponse.Comments : null, CountComments = commentsResponse.Comments.Count > 0 ? commentsResponse.Comments.Count : 0, Instructions = Convert.ToBoolean(isFinalReport) ? Localization.GetText("TCM.TR.TaskAndRequestFoundCoordinator.ContentInstructions") + "<br>" + Localization.GetText("TCM.TR.TaskAndRequestFoundCoordinator.ContentInstructions.IsFinalReport") : Localization.GetText("TCM.TR.TaskAndRequestFoundCoordinator.ContentInstructions"), TaskDataModel = model, UserName = IDBContext.Current.UserName, ResultMatrixId = model.EntityId, SerialNro = Convert.ToString(serialNro), IsFinalReport = Convert.ToBoolean(isFinalReport) }; ViewBag.SerializedViewModel = PageSerializationHelper.SerializeObject(modelTaskView); Logger.GetLogger().WriteDebug("WorkflowK2Controller", "Method: TaskDetailWorkflow - Final"); return(View(modelTaskView)); }