void Start() { DontDestroyOnLoad(transform.gameObject); eyetrackingEnabled = false; // Eyetracking disabled adapting = true; adaptingSimple = false; if (eyetrackingEnabled) // Eyetracking disabled { eyetracking = GameObject.Find("EyeTracking").GetComponent <EyeTrackingClass>(); } emotiv = GameObject.Find("EEGTracking").GetComponent <EmotivTracking>(); taskManagement = GameObject.Find("Tasks").GetComponent <TaskManagement>(); adaptation = GameObject.Find("Adaptation").GetComponent <AdaptationElements>(); classification = GameObject.Find("DecisionReader").GetComponent <ReadDecision>(); timeHistory.Add(Time.time); currentTimeHistory.Add(System.DateTime.Now.ToString("HH:mm:ss.fff")); emotionalHistory.Add(emotiv.getAffectivData()); if (eyetrackingEnabled) // Eyetracking disabled { gazeHistory.Add(eyetracking.getGazeData()); } progressionHistory.Add(timeHistory.Last()); currentProgress = 0; startWindow = timeHistory.Last(); indexWindow = 0; currentIndex = 0; startWindowAdaptation = timeHistory.Last(); }
public async Task <IActionResult> Edit(int id, [Bind("TaskManagementId,Status,Owner,RelatedTo,RelatedToName,RequestType,Priority,CreateBy,CreatedTime,UpdatedBy,UpdatedTime")] TaskManagement taskManagement) { if (id != taskManagement.TaskManagementId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(taskManagement); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TaskManagementExists(taskManagement.TaskManagementId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["Owner"] = new SelectList(_context.OwnerNames, "Owner", "OwnerName"); ViewData["RequestType"] = new SelectList(_context.RequestTypes, "RequestTypeId", "RequestTypeDescription"); ViewData["Status"] = new SelectList(_context.Statuses, "StatusId", "StatusDescription"); ViewData["Priority"] = new SelectList(_context.Priorities, "PriorityId", "PriorityName"); ViewData["RelatedTo"] = new SelectList(_context.RelatedTos, "RelatedToId", "RelatedToName"); return(View(taskManagement)); }
public static DataSet TaskCRUD(TaskManagement task) { DataSet ds = new DataSet(); MySqlConnection conn = connstring; try { conn.Open(); string stm = "spTM_TaskCRUD"; MySqlCommand cmd = new MySqlCommand(stm, conn); cmd.CommandType = CommandType.StoredProcedure; cmd = mySqlCommandParameters(cmd, task); // setting values to the procedure parameters MySqlDataAdapter da = new MySqlDataAdapter(cmd); da.Fill(ds, "Data"); //return ds; } catch (Exception ex) { Log(ex, System.Reflection.MethodBase.GetCurrentMethod().Name); throw ex; } finally { conn.Close(); } return(ds); }
private void accordionControlElement4_Click(object sender, EventArgs e) { tm = new TaskManagement(); tm.Show(); tm.Dock = DockStyle.Fill; panel1.Controls.Clear(); panel1.Controls.Add(tm); }
public ProjectController() { this.pm = new ProjectManagement(); this.cm = new CompentenceManagement(); this.categoryM = new CategoryManagement(); this.tk = new TaskManagement(); this.am = new AccountManagement(); }
public TaskManagementModel(TaskManagement taskManagement) { Id = taskManagement.ID; AssignedTo = taskManagement.AssignedTo; ItemId = taskManagement.ItemId; TaskOutcome = taskManagement.TaskOutcome; Description = taskManagement.Description; Modified = taskManagement.Modified.ToString(StringConstant.DateFormatddMMyyyyHHmmss); }
void Start() { DontDestroyOnLoad(transform.gameObject); taskManagement = GameObject.Find("Tasks").GetComponent <TaskManagement>(); player = GameObject.Find("Player"); inventory = GameObject.Find("Inventory").GetComponent <Inventory>(); mainCamera = Camera.main; }
public IHttpActionResult TaskCRUD(JObject requestParams) { var data = ""; var identity = MyAuthorizationServerProvider.AuthenticateUser(); if (identity != null) { try { //Deserialize JSON data into calss object TaskManagement task = requestParams.ToObject <TaskManagement>(); task.t_CompID = identity.CompId; task.t_UserId = Convert.ToInt32(identity.UserID); var ds = TaskBL.TaskCRUD(task); data = Utility.ConvertDataSetToJSONString(ds); data = Utility.Successful(data); #region Activity Log if (task.t_Action == 2 || task.t_Action == 3 || task.t_Action == 4) { ActivityLog objlog = ActivityLogBL.ActivityLogMapper(Modules.Task.ToString(), task.t_Action, task.t_CompID, task.t_UserId , UserName, System.Reflection.MethodBase.GetCurrentMethod().Name, task.t_TaskName); var dsActivityLog = ActivityLogBL.LogCRUD(objlog); if (!string.IsNullOrEmpty(task.t_FileName) && task.t_IsFileUploaded) { ActivityLog objlogfie = ActivityLogBL.ActivityLogMapper(Modules.Task.ToString(), (int)TaskAction.FILEADDED, task.t_CompID, task.t_UserId , UserName, System.Reflection.MethodBase.GetCurrentMethod().Name, task.t_TaskName, task.t_FileName); var dsActivityLogfile = ActivityLogBL.LogCRUD(objlogfie); } if (!string.IsNullOrEmpty(task.t_Comments)) { ActivityLog objlogcomments = ActivityLogBL.ActivityLogMapper(Modules.Task.ToString(), (int)TaskAction.COMMENTSADDED, task.t_CompID, task.t_UserId , UserName, System.Reflection.MethodBase.GetCurrentMethod().Name, task.t_TaskName, task.t_Comments); var dsActivityLogfile = ActivityLogBL.LogCRUD(objlogcomments); } } #endregion Activity Log } catch (Exception ex) { data = Utility.Exception(ex); } } else { data = Utility.AuthenticationError(); } return(new APIResult(Request, data)); }
private bool isPlayerNearSign = false; //is player near sign private void Start() { taskManagement = FindObjectOfType <TaskManagement>(); //get taskmanagement announcer = GameObject.FindGameObjectWithTag("HUD_Announcer").GetComponent <Text>(); //get hud announcer if (taskInfo.task != string.Empty && (taskManagement.IsTaskAdded(taskManagement.currentTasks, taskInfo.taskID) >= 0 || taskManagement.IsTaskAdded(taskManagement.completedTasks, taskInfo.taskID) >= 0)) //if task added/completed { image.enabled = false; //hide task image } }
private void GetTasksStatus() { TaskManagement taskMgt = new TaskManagement(); Boolean currentCheck = false; if (this.ShowCurrentTasks.IsChecked == true) { currentCheck = true; } datagridTask.ItemsSource = taskMgt.GetTasksByStatus(lstStatus, currentCheck).GetAllRecords(); datagridTask.Items.Refresh(); }
public TaskManagementModel(TaskManagement taskManagement) { Id = taskManagement.ID; if (taskManagement.AssignedTo != null) { AssignedTo = new UserModel { FirstName = taskManagement.AssignedTo.FirstName, FullName = taskManagement.AssignedTo.FullName, ID = taskManagement.AssignedTo.ID, IsGroup = taskManagement.AssignedTo.IsGroup, LastName = taskManagement.AssignedTo.LastName, UserName = taskManagement.AssignedTo.UserName }; } ItemId = taskManagement.ItemId; TaskOutcome = taskManagement.TaskOutcome; Description = taskManagement.Description; Modified = taskManagement.Modified.ToString(StringConstant.DateFormatddMMyyyyHHmmss); }
public async Task <IActionResult> Create([Bind("TaskManagementId,Status,Owner,RelatedTo,RelatedToName,RequestType,Priority,CreateBy,CreatedTime,UpdatedBy,UpdatedTime")] TaskManagement taskManagement) { if (ModelState.IsValid) { _context.Add(taskManagement); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["Owner"] = new SelectList(_context.OwnerNames, "Owner", "OwnerName"); ViewData["RequestType"] = new SelectList(_context.RequestTypes, "RequestTypeId", "RequestTypeDescription"); ViewData["Status"] = new SelectList(_context.Statuses, "StatusId", "StatusDescription"); ViewData["Priority"] = new SelectList(_context.Priorities, "PriorityId", "PriorityName"); ViewData["RelatedTo"] = new SelectList(_context.RelatedTos, "RelatedToId", "RelatedToName"); return(View(taskManagement)); }
public VehicleManagement RunWorkFlow(VehicleManagement vehicleManagement, TaskManagement taskOfPrevStep) { if (vehicleManagement == null) { return(null); } TaskManagement taskManagement = new TaskManagement(); taskManagement.StartDate = DateTime.Now; taskManagement.DueDate = vehicleManagement.RequestDueDate; taskManagement.PercentComplete = 0; taskManagement.ItemId = vehicleManagement.ID; taskManagement.ItemURL = taskOfPrevStep.ItemURL; taskManagement.ListURL = taskOfPrevStep.ListURL; taskManagement.TaskName = TASK_NAME; taskManagement.TaskStatus = TaskStatusList.InProgress; taskManagement.StepModule = StepModuleList.VehicleManagement.ToString(); taskManagement.Department = vehicleManagement.CommonDepartment.LookupId > 0 ? vehicleManagement.CommonDepartment : null; taskManagement.AssignedTo = taskOfPrevStep.NextAssign; taskManagement.NextAssign = null; StepManagementDAL _stepManagementDAL = new StepManagementDAL(this.SiteUrl); var nextStep = _stepManagementDAL.GetNextStepManagement(taskOfPrevStep.StepStatus, StepModuleList.VehicleManagement, vehicleManagement.CommonDepartment.LookupId); if (nextStep != null) { taskManagement.StepStatus = nextStep.StepStatus; ModuleBuilder moduleBuilder = new ModuleBuilder(this.SiteUrl); // TODO: Get location by vehicleManagement: var locationId = 2; var nextAssign = moduleBuilder.GetNextApproval(vehicleManagement.CommonDepartment.LookupId, locationId, StepModuleList.VehicleManagement, nextStep.StepNumber); if (nextAssign != null) { taskManagement.NextAssign = nextAssign.ADAccount; } } TaskManagementDAL taskManagementDAL = new TaskManagementDAL(this.SiteUrl); int retId = taskManagementDAL.SaveItem(taskManagement); vehicleManagement.ApprovalStatus = taskManagement.StepStatus; this.SaveOrUpdate(vehicleManagement); return(vehicleManagement); }
//delete a task according task id private void deleteTask_Click(object sender, RoutedEventArgs e) { if (MessageBox.Show("Are you sure you want to delete this recode?", "Alert", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { if (checkTaskID()) { String txtTaskID = taskID.Text.Trim(); TaskManagement taskMgt = new TaskManagement(); taskMgt.DeleteTask(Int32.Parse(txtTaskID)); isLoading = true; PopulateTasks(false); isLoading = false; datagridTask.Items.Refresh(); } } }
// get all tasks when form loading private void PopulateTasks(Boolean onlyCurrentTasks) { //load all tasks to the datagrid TaskManagement taskMgt = new TaskManagement(); try { datagridTask.Columns.Clear(); //get all tasks by current date datagridTask.ItemsSource = taskMgt.GetTasks(onlyCurrentTasks).GetAllRecords(); } catch (Exception ex) { MessageBox.Show("Get all tasks errors occured", ex.Message); } }
public static DataSet TaskCRUD(TaskManagement task) { DataSet dsresult = new DataSet(); try { task.t_SubTasks = task.t_SubTasks.TrimEnd('|'); if (!string.IsNullOrEmpty(task.t_FileIds)) { string userProfilePicBase64 = string.Empty; var files = task.t_FileIds.Split(new string[] { "," }, StringSplitOptions.None); if (files.Count() == 1) { userProfilePicBase64 = files[0]; } else { userProfilePicBase64 = files[1]; } byte[] imageBytes = Convert.FromBase64String(userProfilePicBase64); string fileName = task.t_UserId + "_" + Guid.NewGuid() + "." + Utility.GetFileExtension(userProfilePicBase64); string filePath = HttpContext.Current.Server.MapPath("~/Files/Task/" + fileName); File.WriteAllBytes(filePath, imageBytes); DataSet dsFile = UserBL.CreateFile(fileName, HttpContext.Current.Server.MapPath("~/Files/Task/"), false, "Task", task.t_FileName); if (dsFile.Tables.Count > 0 && dsFile.Tables[0].Rows.Count > 0) { task.t_FileIds = dsFile.Tables[0].Rows[0]["UniqueID"].ToString().Trim(); } } dsresult = TaskDAL.TaskCRUD(task); } catch (Exception ex) { Log(ex, System.Reflection.MethodBase.GetCurrentMethod().Name); throw ex; } return(dsresult); }
private static MySqlCommand mySqlCommandParameters(MySqlCommand cmd, TaskManagement task) { cmd.Parameters.AddWithValue("t_Action", task.t_Action); cmd.Parameters.AddWithValue("t_ProjectID", task.t_ProjectID); cmd.Parameters.AddWithValue("t_CompID", task.t_CompID); cmd.Parameters.AddWithValue("t_TaskID", task.t_TaskID); cmd.Parameters.AddWithValue("t_TaskName", task.t_TaskName); cmd.Parameters.AddWithValue("t_TaskSummary", task.t_TaskSummary); cmd.Parameters.AddWithValue("t_DueDate", task.t_DueDate); cmd.Parameters.AddWithValue("t_PrivateNotes", task.t_PrivateNotes); cmd.Parameters.AddWithValue("t_UserId", task.t_UserId); cmd.Parameters.AddWithValue("t_TaskAssignees_UserIds", task.t_TaskAssignees_UserIds); cmd.Parameters.AddWithValue("t_TagIds", task.t_TagIds); cmd.Parameters.AddWithValue("t_FileIds", task.t_FileIds); cmd.Parameters.AddWithValue("t_SubTasks", task.t_SubTasks); cmd.Parameters.AddWithValue("t_StatusID", task.t_StatusID); cmd.Parameters.AddWithValue("t_Comments", task.t_Comments); return(cmd); }
//save a task according add a new one or update the existing one. if task name, description, assign to, status, startdate,duedate ,completedate all same then update it else add a new one private void saveTask_Click(object sender, RoutedEventArgs e) { String strReturn = ""; strReturn = checkIfAddOrUpdate(); if (checkAllTexts()) { TaskManagement taskMgt = new TaskManagement(); String txtName = taskName.Text.Trim(); String txtDesc = taskDescription.Text.Trim(); String txtAssignTo = taskAssignTo.Text.Trim(); String cmbStatus = status.Text; DateTime?dtStartDate = startDate.SelectedDate; DateTime?dtDuedate = dueDate.SelectedDate; DateTime?dtCompleteDate = completeDate.SelectedDate; if (strReturn == "insert") { String txtCreateBy = Environment.UserName; DateTime dtCreateDate = DateTime.Now; taskMgt.AddTask(txtName, txtDesc, dtStartDate, dtDuedate, dtCompleteDate, txtAssignTo, cmbStatus, txtCreateBy, dtCreateDate); } if (strReturn == "update") { String txtTaskID = taskID.Text.Trim(); String txtUpdateBy = Environment.UserName; DateTime dtUpdateDate = DateTime.Now; Boolean updateDone = taskMgt.UpdateTask(Int32.Parse(txtTaskID), txtName, txtDesc, dtStartDate, dtDuedate, dtCompleteDate, txtAssignTo, cmbStatus, txtUpdateBy, dtUpdateDate); if (updateDone) { MessageBox.Show("Update is done!", "Message"); } } isLoading = true; PopulateTasks(false); isLoading = false; datagridTask.Items.Refresh(); } }
private Boolean checkTaskID() { Boolean getID = false; if (taskID.Text == "") { MessageBox.Show("Please choose one task to delete!"); } else { TaskManagement taskMgt = new TaskManagement(); Int32 getResult = taskMgt.GetTasksByTaskID(Int32.Parse(taskID.Text.Trim())).Count(); if (getResult > 0) { getID = true; } } return(getID); }
void Start() { mainCamera = Camera.main; helpSheetOn = false; helpExamplesOn = false; helpSheet = helpSheet2; helpSheetCounter = 0; helpsheets = new Texture2D[] { helpSheet2, helpSheet3, helpSheet4, helpSheet5, helpSheetFull }; Screen.lockCursor = true; GameObject tasks = GameObject.Find("Tasks"); taskManagement = tasks.GetComponent <TaskManagement>(); inventory.Add("I", 1); inventory.Add("II", 1); inventory.Add("H", 10); inventory.Add("C", 10); inventory.Add("O", 10); inventory.Add("N", 10); bonds = new Dictionary <Rect, Texture2D>(); bondsLogic = new Dictionary <string, List <int[]> >(); bondsLogic.Add("I", new List <int[]>()); bondsLogic.Add("II", new List <int[]>()); DontDestroyOnLoad(transform.gameObject); usedCompound = ""; journalShown = false; journalStyle = new GUIStyle(); journalStyle.fontSize = 22; journalStyle.wordWrap = true; journalStyle.normal.textColor = Color.white; }
void Start() { DontDestroyOnLoad(transform.gameObject); taskManagement = GameObject.Find("Tasks").GetComponent<TaskManagement>(); player = GameObject.Find("Player"); inventory = GameObject.Find("Inventory").GetComponent<Inventory>(); mainCamera = Camera.main; }
public JsonStandardResponse GetTeamDetails([FromBody] WebApiOauth2.Models.RequestModels.RequestModelGetTeamDetails requestobj) { JsonStandardResponse result = null; try { #region Validations if (requestobj.TeamID == null || requestobj.TeamID == "") { result = new JsonStandardResponse { status = "error", data = "", message = "TeamID is mandatory for fetching team details!" }; return(result); } else { int temp; if (!int.TryParse(requestobj.TeamID, out temp)) { result = new JsonStandardResponse { status = "error", data = "", message = "invalid data for TeamID should be in number form!" }; return(result); } bool flag = new TaskManagement().checkUserOrTeamByID(requestobj.TeamID, "Team", Constants.GetConnectionString()); if (!flag) { result = new JsonStandardResponse { status = "error", data = "", message = "invalid TeamID doesn't exists!" }; return(result); } } #endregion TeamDetails obj = new TeamManagement().getTeamDetails(requestobj.TeamID, Constants.GetConnectionString()); if (obj == null) { result = new JsonStandardResponse { status = "error", data = "", message = "no team details found!" }; return(result); } result = new JsonStandardResponse { status = "success", data = obj, message = "Request Successful!" }; new BusinessLogic().CreateLog("GetTeamDetails", "GetTeamDetails", "0", "webapi", result.message, ((result.status == "success") ? "1" : "0"), "api/Teams/GetTeamDetails", Request.Headers.Authorization.Parameter, Constants.GetConnectionString()); } catch (Exception ex) { result = new JsonStandardResponse { status = "error", data = "", message = ex.Message }; new BusinessLogic().CreateLog("GetTeamDetails", "GetTeamDetails", "0", "webapi", ex.Message, ex.HResult.ToString(), "api/Teams/GetTeamDetails", Request.Headers.Authorization.Parameter, Constants.GetConnectionString()); } return(result); }
public TaskController() { _taskManagement = new TaskManagement(); }
public BusinessTripManagement RunWorkFlow(BusinessTripManagement businessTripManagement, TaskManagement taskOfPrevStep, EmployeeInfo approver, EmployeeInfo currentStepApprover) { if (businessTripManagement == null) { return(null); } TaskManagement taskManagement = new TaskManagement(); taskManagement.StartDate = DateTime.Now; taskManagement.DueDate = businessTripManagement.RequestDueDate; taskManagement.PercentComplete = 0; taskManagement.ItemId = businessTripManagement.ID; taskManagement.ItemURL = taskOfPrevStep.ItemURL; taskManagement.ListURL = taskOfPrevStep.ListURL; taskManagement.TaskName = TASK_NAME; taskManagement.TaskStatus = TaskStatusList.InProgress; taskManagement.StepModule = StepModuleList.BusinessTripManagement.ToString(); taskManagement.Department = businessTripManagement.CommonDepartment.LookupId > 0 ? businessTripManagement.CommonDepartment : null; StepManagementDAL _stepManagementDAL = new StepManagementDAL(this.SiteUrl); User assignee = null; User nextAssignee = null; string stepStatus = string.Empty; if (businessTripManagement.Domestic == true) //Domestic Business Trip { StepManagement nextStep = null; if (currentStepApprover.EmployeePosition.LookupId == (int)StringConstant.EmployeePosition.DepartmentHead && currentStepApprover.ADAccount.ID == businessTripManagement.DH.ID) { nextStep = _stepManagementDAL.GetNextStepManagement(taskOfPrevStep.StepStatus, StepModuleList.BusinessTripManagement, businessTripManagement.CommonDepartment.LookupId); if (businessTripManagement.TripHighPriority == true) { if (nextStep != null) { stepStatus = nextStep.StepStatus; var approverAtStep = GetApproverAtStep(businessTripManagement.CommonDepartment.LookupId, businessTripManagement.CommonLocation.LookupId, StepModuleList.BusinessTripManagement, nextStep.StepNumber); if (approverAtStep != null) { assignee = approverAtStep.ADAccount; } } } else { if (nextStep != null) { nextStep = _stepManagementDAL.GetNextStepManagement(nextStep.StepStatus, StepModuleList.BusinessTripManagement, businessTripManagement.CommonDepartment.LookupId); if (nextStep != null) { stepStatus = nextStep.StepStatus; var approverAtStep = GetApproverAtStep(businessTripManagement.CommonDepartment.LookupId, businessTripManagement.CommonLocation.LookupId, StepModuleList.BusinessTripManagement, nextStep.StepNumber); if (approverAtStep != null) { assignee = approverAtStep.ADAccount; } } } } } else { nextStep = _stepManagementDAL.GetNextStepManagement(taskOfPrevStep.StepStatus, StepModuleList.BusinessTripManagement, businessTripManagement.CommonDepartment.LookupId); if (nextStep != null) { stepStatus = nextStep.StepStatus; var approverAtStep = GetApproverAtStep(businessTripManagement.CommonDepartment.LookupId, businessTripManagement.CommonLocation.LookupId, StepModuleList.BusinessTripManagement, nextStep.StepNumber); if (approverAtStep != null) { assignee = approverAtStep.ADAccount; } } } // get next approver if (nextStep != null) { nextStep = _stepManagementDAL.GetNextStepManagement(nextStep.StepStatus, StepModuleList.BusinessTripManagement, businessTripManagement.CommonDepartment.LookupId); if (nextStep != null) { var nextApprover = GetApproverAtStep(businessTripManagement.CommonDepartment.LookupId, businessTripManagement.CommonLocation.LookupId, StepModuleList.BusinessTripManagement, nextStep.StepNumber); if (nextApprover != null) { nextAssignee = nextApprover.ADAccount; } } } } else // Overseas Business Trip { StepManagement nextStep = null; if (currentStepApprover.ADAccount.ID == businessTripManagement.DirectBOD.ID) { if (businessTripManagement.DirectBOD.ID != businessTripManagement.BOD.ID) { assignee = businessTripManagement.BOD; stepStatus = StepStatusList.BODApproval; nextStep = new StepManagement() { StepStatus = stepStatus, StepModule = StepModuleList.BusinessTripManagement.ToString() }; } else { nextStep = _stepManagementDAL.GetNextStepManagement(taskOfPrevStep.StepStatus, StepModuleList.BusinessTripManagement, businessTripManagement.CommonDepartment.LookupId); if (nextStep != null) { stepStatus = nextStep.StepStatus; var approverAtStep = GetApproverAtStep(businessTripManagement.CommonDepartment.LookupId, businessTripManagement.CommonLocation.LookupId, StepModuleList.BusinessTripManagement, nextStep.StepNumber); if (approverAtStep != null) { assignee = approverAtStep.ADAccount; } } } } else { nextStep = _stepManagementDAL.GetNextStepManagement(taskOfPrevStep.StepStatus, StepModuleList.BusinessTripManagement, businessTripManagement.CommonDepartment.LookupId); if (nextStep != null) { stepStatus = nextStep.StepStatus; var approverAtStep = GetApproverAtStep(businessTripManagement.CommonDepartment.LookupId, businessTripManagement.CommonLocation.LookupId, StepModuleList.BusinessTripManagement, nextStep.StepNumber); if (approverAtStep != null) { assignee = approverAtStep.ADAccount; } } } // get next approver if (nextStep != null) { nextStep = _stepManagementDAL.GetNextStepManagement(nextStep.StepStatus, StepModuleList.BusinessTripManagement, businessTripManagement.CommonDepartment.LookupId); if (nextStep != null) { var nextApprover = GetApproverAtStep(businessTripManagement.CommonDepartment.LookupId, businessTripManagement.CommonLocation.LookupId, StepModuleList.BusinessTripManagement, nextStep.StepNumber); if (nextApprover != null) { nextAssignee = nextApprover.ADAccount; } } } } taskManagement.AssignedTo = assignee; taskManagement.NextAssign = nextAssignee; taskManagement.StepStatus = stepStatus; EmployeeInfoDAL _employeeInfoDAL = new EmployeeInfoDAL(this.SiteUrl); EmailTemplateDAL _emailTemplateDAL = new EmailTemplateDAL(this.SiteUrl); if (assignee == null) { businessTripManagement.ApprovalStatus = StringConstant.ApprovalStatus.Approved.ToString(); this.SaveOrUpdate(businessTripManagement); EmailTemplate emailTemplateRequester = _emailTemplateDAL.GetByKey("BusinessTripManagement_Approve"); EmployeeInfo toRequester = _employeeInfoDAL.GetByID(businessTripManagement.Requester.LookupId); SendEmail(businessTripManagement, emailTemplateRequester, approver, toRequester, this.SiteUrl, false); if (businessTripManagement.TransportationType == ResourceHelper.GetLocalizedString("BusinessTripManagement_TransportationTypeCompanyTitle", StringConstant.ResourcesFileLists, 1033)) { EmailTemplate emailTemplateDriver = _emailTemplateDAL.GetByKey("BusinessTripManagement_Driver"); EmployeeInfo toDriver = _employeeInfoDAL.GetByID(businessTripManagement.Driver.LookupId); SendEmail(businessTripManagement, emailTemplateDriver, approver, toDriver, this.SiteUrl, false); } if (!string.IsNullOrEmpty(businessTripManagement.CashRequestDetail)) { EmailTemplate emailTemplateAccountant = _emailTemplateDAL.GetByKey("BusinessTripManagement_Accountant"); EmployeeInfo toAccountant = _employeeInfoDAL.GetByID(businessTripManagement.Cashier.LookupId); SendEmail(businessTripManagement, emailTemplateAccountant, approver, toAccountant, this.SiteUrl, false); } } else if (assignee != null) { TaskManagementDAL taskManagementDAL = new TaskManagementDAL(this.SiteUrl); int retId = taskManagementDAL.SaveItem(taskManagement); businessTripManagement.ApprovalStatus = taskManagement.StepStatus; this.SaveOrUpdate(businessTripManagement); EmailTemplate emailTemplate = _emailTemplateDAL.GetByKey("BusinessTripManagement_Request"); EmployeeInfo toUser = _employeeInfoDAL.GetByADAccount(assignee.ID); SendEmail(businessTripManagement, emailTemplate, approver, toUser, this.SiteUrl, true); try { List <EmployeeInfo> toUsers = DelegationPermissionManager.GetListOfDelegatedEmployees(toUser.ID, StringConstant.BusinessTripManagementList.Url, businessTripManagement.ID); SendDelegationEmail(businessTripManagement, emailTemplate, toUsers, this.SiteUrl); } catch { } } return(businessTripManagement); }
public override void ItemAdded(SPItemEventProperties properties) { try { base.ItemAdded(properties); var siteURL = properties.WebUrl; var vehicleManagementDAL = new VehicleManagementDAL(siteURL); var ItemID = properties.ListItemId; var currentItem = vehicleManagementDAL.GetByID(ItemID); taskManagementDAL = new TaskManagementDAL(siteURL); TaskManagement taskManagement = new TaskManagement(); taskManagement.StartDate = DateTime.Now; taskManagement.DueDate = currentItem.RequestDueDate; taskManagement.PercentComplete = 0; taskManagement.ItemId = currentItem.ID; taskManagement.ItemURL = properties.List.DefaultDisplayFormUrl + "?ID=" + properties.ListItemId; taskManagement.ListURL = properties.List.DefaultViewUrl; taskManagement.TaskName = TASK_NAME; taskManagement.TaskStatus = TaskStatusList.InProgress; taskManagement.StepModule = StepModuleList.VehicleManagement.ToString(); taskManagement.Department = currentItem.CommonDepartment; taskManagement.AssignedTo = currentItem.DepartmentHead; employeeInfoDAL = new EmployeeInfoDAL(siteURL); EmployeeInfo requesterInfo = employeeInfoDAL.GetByID(currentItem.Requester.LookupId); if ((int)Convert.ToDouble(requesterInfo.EmployeeLevel.LookupValue, CultureInfo.InvariantCulture.NumberFormat) == (int)StringConstant.EmployeeLevel.DepartmentHead) { taskManagement.StepStatus = StepStatusList.BODApproval; } else { taskManagement.StepStatus = StepStatusList.DHApproval; } DepartmentDAL _departmentDAL = new DepartmentDAL(siteURL); Department departmentHR = _departmentDAL.GetByCode("HR"); if (departmentHR.ID == currentItem.CommonDepartment.LookupId) { taskManagement.NextAssign = null; } else { EmployeeInfo deptHeadOfHR = employeeInfoDAL.GetByPositionDepartment(StringConstant.EmployeePosition.DepartmentHead, requesterInfo.FactoryLocation.LookupId, departmentHR.ID).FirstOrDefault(); if (deptHeadOfHR != null) { taskManagement.NextAssign = deptHeadOfHR.ADAccount; } } taskManagementDAL.SaveItem(taskManagement); var mailDAL = new EmailTemplateDAL(siteURL); var emailTemplate = mailDAL.GetByKey("VehicleManagement_Request"); EmployeeInfo assigneeInfo = employeeInfoDAL.GetByADAccount(taskManagement.AssignedTo.ID); currentItem.ApprovalStatus = taskManagement.StepStatus; vehicleManagementDAL.SaveOrUpdate(currentItem); vehicleManagementDAL.SendEmail(currentItem, emailTemplate, null, assigneeInfo, VehicleTypeOfEmail.Request, siteURL); try { List <EmployeeInfo> toUsers = DelegationPermissionManager.GetListOfDelegatedEmployees(siteURL, assigneeInfo.ID, StringConstant.VehicleManagementList.ListUrl, currentItem.ID); vehicleManagementDAL.SendDelegationEmail(currentItem, emailTemplate, toUsers, siteURL); } catch { } } catch (Exception ex) { ULSLogging.Log(new SPDiagnosticsCategory("STADA - Transportation Event Receiver - ItemAdded fn", TraceSeverity.Unexpected, EventSeverity.Error), TraceSeverity.Unexpected, string.Format(CultureInfo.InvariantCulture, "{0}:{1}", ex.Message, ex.StackTrace)); } }
void Start() { DontDestroyOnLoad(transform.gameObject); eyetrackingEnabled = false; // Eyetracking disabled adapting = true; adaptingSimple = false; if (eyetrackingEnabled) // Eyetracking disabled { eyetracking = GameObject.Find ("EyeTracking").GetComponent<EyeTrackingClass>(); } emotiv = GameObject.Find ("EEGTracking").GetComponent<EmotivTracking>(); taskManagement = GameObject.Find ("Tasks").GetComponent<TaskManagement>(); adaptation = GameObject.Find ("Adaptation").GetComponent<AdaptationElements>(); classification = GameObject.Find ("DecisionReader").GetComponent<ReadDecision>(); timeHistory.Add(Time.time); currentTimeHistory.Add (System.DateTime.Now.ToString ("HH:mm:ss.fff")); emotionalHistory.Add(emotiv.getAffectivData()); if (eyetrackingEnabled) // Eyetracking disabled { gazeHistory.Add(eyetracking.getGazeData()); } progressionHistory.Add (timeHistory.Last()); currentProgress = 0; startWindow = timeHistory.Last (); indexWindow = 0; currentIndex = 0; startWindowAdaptation = timeHistory.Last (); }
void Start() { mainCamera = Camera.main; helpSheetOn = false; helpExamplesOn = false; helpSheet = helpSheet2; helpSheetCounter = 0; helpsheets = new Texture2D[]{helpSheet2,helpSheet3,helpSheet4,helpSheet5,helpSheetFull}; Screen.lockCursor = true; GameObject tasks = GameObject.Find ("Tasks"); taskManagement = tasks.GetComponent<TaskManagement>(); inventory.Add("I",1); inventory.Add("II",1); inventory.Add ("H", 10); inventory.Add ("C", 10); inventory.Add ("O", 10); inventory.Add ("N", 10); bonds = new Dictionary<Rect, Texture2D>(); bondsLogic = new Dictionary<string, List<int[]>>(); bondsLogic.Add ("I",new List<int[]>()); bondsLogic.Add ("II",new List<int[]>()); DontDestroyOnLoad(transform.gameObject); usedCompound = ""; journalShown = false; journalStyle = new GUIStyle (); journalStyle.fontSize = 22; journalStyle.wordWrap = true; journalStyle.normal.textColor = Color.white; }
public MessageResult RejectBusinessTrip(BusinessTripManagementModel businessTripManagementModel) { MessageResult msgResult = new MessageResult(); try { SPWeb spWeb = SPContext.Current.Web; if (businessTripManagementModel.Id > 0) { Biz.Models.BusinessTripManagement businessTripManagement = _businessTripManagementDAL.GetByID(businessTripManagementModel.Id); string currentApprovalStatus = businessTripManagement.ApprovalStatus.ToLower(); if (currentApprovalStatus == ApprovalStatus.Approved.ToLower() || currentApprovalStatus == ApprovalStatus.Cancelled.ToLower() || currentApprovalStatus == ApprovalStatus.Rejected.ToLower()) { return(new MessageResult { Code = (int)BusinessTripErrorCode.CannotReject, Message = MessageResultHelper.GetRequestStatusMessage(currentApprovalStatus), ObjectId = 0 }); } string requestExpiredMsg = MessageResultHelper.GetRequestExpiredMessage(businessTripManagement.RequestDueDate); if (!string.IsNullOrEmpty(requestExpiredMsg)) { return(new MessageResult { Code = (int)BusinessTripErrorCode.CannotReject, Message = requestExpiredMsg, ObjectId = 0 }); } bool hasApprovalPermission = HasApprovalPermission(businessTripManagementModel.Id.ToString()); DelegationModel delegationModel = GetDelegatedTaskInfo(businessTripManagementModel.Id.ToString()); bool isDelegated = (delegationModel != null && delegationModel.Requester.LookupId > 0) ? true : false; if (hasApprovalPermission == false && isDelegated == false) { return(msgResult); } EmployeeInfoDAL _employeeInfoDAL = new EmployeeInfoDAL(spWeb.Url); EmployeeInfo approverInfo = _employeeInfoDAL.GetByADAccount(spWeb.CurrentUser.ID); int assigneeId = hasApprovalPermission == true ? approverInfo.ADAccount.ID : (isDelegated == true ? delegationModel.FromEmployee.ID : 0); TaskManagementDAL _taskManagementDAL = new TaskManagementDAL(spWeb.Url); IList <TaskManagement> taskManagementCollection = _taskManagementDAL.GetRelatedTasks(businessTripManagement.ID, StepModuleList.BusinessTripManagement.ToString()); if (taskManagementCollection != null && taskManagementCollection.Count > 0) { TaskManagement taskOfOriginalAssignee = _taskManagementDAL.GetTaskByAssigneeId(taskManagementCollection, assigneeId); List <TaskManagement> relatedTasks = taskManagementCollection.Where(t => t.ID != taskOfOriginalAssignee.ID).ToList(); if (hasApprovalPermission == true) { taskOfOriginalAssignee.TaskStatus = TaskStatusList.Completed.ToString(); taskOfOriginalAssignee.PercentComplete = 1; taskOfOriginalAssignee.TaskOutcome = TaskOutcome.Rejected.ToString(); taskOfOriginalAssignee.Description = businessTripManagementModel.Comment; _taskManagementDAL.CloseTasks(relatedTasks); _taskManagementDAL.SaveItem(taskOfOriginalAssignee); } else if (isDelegated == true) { TaskManagement clonedTask = _taskManagementDAL.CloneTask(taskOfOriginalAssignee); clonedTask.AssignedTo = approverInfo.ADAccount; clonedTask.TaskStatus = TaskStatusList.Completed.ToString(); clonedTask.PercentComplete = 1; clonedTask.TaskOutcome = TaskOutcome.Rejected.ToString(); clonedTask.Description = businessTripManagementModel.Comment; relatedTasks.Add(taskOfOriginalAssignee); _taskManagementDAL.CloseTasks(relatedTasks); _taskManagementDAL.SaveItem(clonedTask); } } if (!string.IsNullOrEmpty(businessTripManagementModel.Comment)) { businessTripManagement.Comment = businessTripManagement.Comment.BuildComment(string.Format("{0}: {1}", approverInfo.FullName, businessTripManagementModel.Comment)); } businessTripManagement.ApprovalStatus = ApprovalStatus.Rejected.ToString(); _businessTripManagementDAL.SaveOrUpdate(spWeb, businessTripManagement); EmailTemplateDAL _emailTemplateDAL = new EmailTemplateDAL(spWeb.Url); EmailTemplate emailTemplate = _emailTemplateDAL.GetByKey("BusinessTripManagement_Reject"); EmployeeInfo toUser = _employeeInfoDAL.GetByID(businessTripManagement.Requester.LookupId); _businessTripManagementDAL.SendEmail(businessTripManagement, emailTemplate, approverInfo, toUser, spWeb.Url, false); } } catch (Exception ex) { msgResult.Code = (int)BusinessTripErrorCode.Unexpected; msgResult.Message = ex.Message; } return(msgResult); }
public void Start() { taskManagement = GameObject.FindObjectOfType <TaskManagement>(); }
public FreightManagement RunWorkFlow(FreightManagement freightManagement, TaskManagement taskOfPrevStep, EmployeeInfo approver, EmployeeInfo currentStepApprover) { if (freightManagement == null) { return(null); } TaskManagement taskManagement = new TaskManagement(); taskManagement.StartDate = DateTime.Now; taskManagement.DueDate = freightManagement.RequestDueDate; taskManagement.PercentComplete = 0; taskManagement.ItemId = freightManagement.ID; taskManagement.ItemURL = taskOfPrevStep.ItemURL; taskManagement.ListURL = taskOfPrevStep.ListURL; taskManagement.TaskName = TASK_NAME; taskManagement.TaskStatus = TaskStatusList.InProgress; taskManagement.StepModule = StepModuleList.FreightManagement.ToString(); taskManagement.Department = freightManagement.Department.LookupId > 0 ? freightManagement.Department : null; StepManagementDAL _stepManagementDAL = new StepManagementDAL(this.SiteUrl); User assignee = null; User nextAssignee = null; string stepStatus = string.Empty; StepManagement nextStep = null; if (currentStepApprover.EmployeePosition.LookupId == (int)StringConstant.EmployeePosition.DepartmentHead && currentStepApprover.ADAccount.ID == freightManagement.DH.ID) { nextStep = _stepManagementDAL.GetNextStepManagement(taskOfPrevStep.StepStatus, StepModuleList.FreightManagement, freightManagement.Department.LookupId); if (freightManagement.HighPriority == true) { if (nextStep != null) { stepStatus = nextStep.StepStatus; var approverAtStep = GetApproverAtStep(freightManagement.Department.LookupId, freightManagement.Location.LookupId, StepModuleList.FreightManagement, nextStep.StepNumber); if (approverAtStep != null) { assignee = approverAtStep.ADAccount; } } } else { if (nextStep != null) { nextStep = _stepManagementDAL.GetNextStepManagement(nextStep.StepStatus, StepModuleList.FreightManagement, freightManagement.Department.LookupId); if (nextStep != null) { stepStatus = nextStep.StepStatus; var approverAtStep = GetApproverAtStep(freightManagement.Department.LookupId, freightManagement.Location.LookupId, StepModuleList.FreightManagement, nextStep.StepNumber); if (approverAtStep != null) { assignee = approverAtStep.ADAccount; } } } } } else { nextStep = _stepManagementDAL.GetNextStepManagement(taskOfPrevStep.StepStatus, StepModuleList.FreightManagement, freightManagement.Department.LookupId); if (nextStep != null) { stepStatus = nextStep.StepStatus; var approverAtStep = GetApproverAtStep(freightManagement.Department.LookupId, freightManagement.Location.LookupId, StepModuleList.FreightManagement, nextStep.StepNumber); if (approverAtStep != null) { assignee = approverAtStep.ADAccount; } } } // get next approver if (nextStep != null) { nextStep = _stepManagementDAL.GetNextStepManagement(nextStep.StepStatus, StepModuleList.FreightManagement, freightManagement.Department.LookupId); if (nextStep != null) { var nextApprover = GetApproverAtStep(freightManagement.Department.LookupId, freightManagement.Location.LookupId, StepModuleList.FreightManagement, nextStep.StepNumber); if (nextApprover != null) { nextAssignee = nextApprover.ADAccount; } } } taskManagement.AssignedTo = assignee; taskManagement.NextAssign = nextAssignee; taskManagement.StepStatus = stepStatus; EmployeeInfoDAL _employeeInfoDAL = new EmployeeInfoDAL(this.SiteUrl); EmailTemplateDAL _emailTemplateDAL = new EmailTemplateDAL(this.SiteUrl); if (assignee == null) { freightManagement.ApprovalStatus = StringConstant.ApprovalStatus.Approved.ToString(); this.SaveOrUpdate(freightManagement); EmailTemplate emailTemplate = _emailTemplateDAL.GetByKey("FreightManagement_Approve"); EmployeeInfo toUser = _employeeInfoDAL.GetByID(freightManagement.Requester.LookupId); SendEmail(freightManagement, emailTemplate, approver, toUser, this.SiteUrl, false); } else if (assignee != null) { TaskManagementDAL taskManagementDAL = new TaskManagementDAL(this.SiteUrl); int retId = taskManagementDAL.SaveItem(taskManagement); freightManagement.ApprovalStatus = taskManagement.StepStatus; this.SaveOrUpdate(freightManagement); EmailTemplate emailTemplate = _emailTemplateDAL.GetByKey("FreightManagement_Request"); EmployeeInfo toUser = _employeeInfoDAL.GetByADAccount(assignee.ID); SendEmail(freightManagement, emailTemplate, approver, toUser, this.SiteUrl, true); try { List <EmployeeInfo> toUsers = DelegationPermissionManager.GetListOfDelegatedEmployees(toUser.ID, StringConstant.FreightManagementList.ListUrl, freightManagement.ID); SendDelegationEmail(freightManagement, emailTemplate, toUsers, this.SiteUrl); } catch { } } return(freightManagement); }
public TaskController() { this.tk = new TaskManagement(); this.rl = new ReplyManagement(); }
public MessageResult ApproveVehicle(VehicleApprovalModel vehicleApprovalModel) { MessageResult msgResult = new MessageResult(); try { SPWeb spWeb = SPContext.Current.Web; if (vehicleApprovalModel.Id > 0) { Biz.Models.VehicleManagement vehicleManagement = _vehicleManagementDAL.GetByID(vehicleApprovalModel.Id); string currentApprovalStatus = vehicleManagement.ApprovalStatus.ToLower(); if (currentApprovalStatus == ApprovalStatus.Approved.ToLower() || currentApprovalStatus == ApprovalStatus.Cancelled.ToLower() || currentApprovalStatus == ApprovalStatus.Rejected.ToLower()) { return(new MessageResult { Code = (int)VehicleErrorCode.CannotApprove, Message = MessageResultHelper.GetRequestStatusMessage(currentApprovalStatus), ObjectId = 0 }); } string requestExpiredMsg = MessageResultHelper.GetRequestExpiredMessage(vehicleManagement.RequestDueDate); if (!string.IsNullOrEmpty(requestExpiredMsg)) { return(new MessageResult { Code = (int)VehicleErrorCode.CannotApprove, Message = requestExpiredMsg, ObjectId = 0 }); } bool hasApprovalPermission = HasApprovalPermission(vehicleApprovalModel.Id.ToString()); DelegationModel delegationModel = GetDelegatedTaskInfo(vehicleApprovalModel.Id.ToString()); bool isDelegated = (delegationModel != null && delegationModel.Requester.LookupId > 0) ? true : false; if (hasApprovalPermission == false && isDelegated == false) { return(msgResult); } EmployeeInfoDAL _employeeInfoDAL = new EmployeeInfoDAL(spWeb.Url); EmployeeInfo approverInfo = _employeeInfoDAL.GetByADAccount(spWeb.CurrentUser.ID); int assigneeId = hasApprovalPermission == true ? approverInfo.ADAccount.ID : (isDelegated == true ? delegationModel.FromEmployee.ID : 0); TaskManagementDAL _taskManagementDAL = new TaskManagementDAL(spWeb.Url); IList <TaskManagement> taskManagementCollection = _taskManagementDAL.GetRelatedTasks(vehicleManagement.ID, StepModuleList.VehicleManagement.ToString()); if (taskManagementCollection != null && taskManagementCollection.Count > 0) { TaskManagement taskOfOriginalAssignee = _taskManagementDAL.GetTaskByAssigneeId(taskManagementCollection, assigneeId); List <TaskManagement> relatedTasks = taskManagementCollection.Where(t => t.ID != taskOfOriginalAssignee.ID).ToList(); User nextAssignee = taskOfOriginalAssignee.NextAssign; if (hasApprovalPermission == true) { taskOfOriginalAssignee.TaskStatus = TaskStatusList.Completed.ToString(); taskOfOriginalAssignee.PercentComplete = 1; taskOfOriginalAssignee.TaskOutcome = TaskOutcome.Approved.ToString(); taskOfOriginalAssignee.Description = vehicleApprovalModel.Comment; _taskManagementDAL.CloseTasks(relatedTasks); _taskManagementDAL.SaveItem(taskOfOriginalAssignee); } else if (isDelegated == true) { TaskManagement clonedTask = _taskManagementDAL.CloneTask(taskOfOriginalAssignee); clonedTask.AssignedTo = approverInfo.ADAccount; clonedTask.TaskStatus = TaskStatusList.Completed.ToString(); clonedTask.PercentComplete = 1; clonedTask.TaskOutcome = TaskOutcome.Approved.ToString(); clonedTask.Description = vehicleApprovalModel.Comment; relatedTasks.Add(taskOfOriginalAssignee); _taskManagementDAL.CloseTasks(relatedTasks); _taskManagementDAL.SaveItem(clonedTask); } if (!string.IsNullOrEmpty(vehicleApprovalModel.Comment)) { vehicleManagement.CommonComment = vehicleManagement.CommonComment.BuildComment(string.Format("{0}: {1}", approverInfo.FullName, vehicleApprovalModel.Comment)); } if (nextAssignee == null) { vehicleManagement.ApprovalStatus = StringConstant.ApprovalStatus.Approved.ToString(); _vehicleManagementDAL.SaveOrUpdate(spWeb, vehicleManagement); EmailTemplateDAL _emailTemplateDAL = new EmailTemplateDAL(spWeb.Url); EmailTemplate emailTemplate = _emailTemplateDAL.GetByKey("VehicleManagement_Approve"); EmployeeInfo toUser = _employeeInfoDAL.GetByID(vehicleManagement.Requester.LookupId); _vehicleManagementDAL.SendEmail(vehicleManagement, emailTemplate, approverInfo, toUser, VehicleTypeOfEmail.Approve, spWeb.Url); } else if (nextAssignee != null && taskManagementCollection != null && taskManagementCollection.Count > 0) { _vehicleManagementDAL.RunWorkFlow(vehicleManagement, taskOfOriginalAssignee); EmailTemplateDAL _emailTemplateDAL = new EmailTemplateDAL(spWeb.Url); EmailTemplate emailTemplate = _emailTemplateDAL.GetByKey("VehicleManagement_Request"); EmployeeInfo toUser = _employeeInfoDAL.GetByADAccount(nextAssignee.ID); _vehicleManagementDAL.SendEmail(vehicleManagement, emailTemplate, approverInfo, toUser, VehicleTypeOfEmail.Request, spWeb.Url); try { List <EmployeeInfo> toUsers = DelegationPermissionManager.GetListOfDelegatedEmployees(toUser.ID, StringConstant.VehicleManagementList.ListUrl, vehicleManagement.ID); _vehicleManagementDAL.SendDelegationEmail(vehicleManagement, emailTemplate, toUsers, spWeb.Url); } catch { } } } } } catch (Exception ex) { msgResult.Code = (int)VehicleErrorCode.Unexpected; msgResult.Message = ex.Message; } return(msgResult); }
public FreightManagement StartWorkFlow(SPWeb spWeb, FreightManagement freightManagement, int freightId) { if (freightId == 0) { return(null); } SPList freightList = spWeb.TryGetSPList(spWeb.Url + this.ListUrl); TaskManagement taskManagement = new TaskManagement(); taskManagement.StartDate = DateTime.Now; taskManagement.DueDate = freightManagement.RequestDueDate; taskManagement.PercentComplete = 0; taskManagement.ItemId = freightManagement.ID; taskManagement.ItemURL = freightList.DefaultDisplayFormUrl + "?ID=" + freightId; taskManagement.ListURL = freightList.DefaultViewUrl; taskManagement.TaskName = TASK_NAME; taskManagement.TaskStatus = TaskStatusList.InProgress; taskManagement.StepModule = StepModuleList.FreightManagement.ToString(); taskManagement.Department = freightManagement.Department.LookupId > 0 ? freightManagement.Department : null; EmployeeInfoDAL _employeeInfoDAL = new EmployeeInfoDAL(this.SiteUrl); EmployeeInfo departmentHeadInfo = _employeeInfoDAL.GetByADAccount(freightManagement.DH.ID); if (freightManagement.Requester.LookupId == departmentHeadInfo.ID) { taskManagement.StepStatus = StepStatusList.BODApproval; taskManagement.AssignedTo = freightManagement.BOD; } else { taskManagement.StepStatus = StepStatusList.DHApproval; taskManagement.AssignedTo = freightManagement.DH; } taskManagement.NextAssign = null; StepManagementDAL _stepManagementDAL = new StepManagementDAL(this.SiteUrl); var nextStep = _stepManagementDAL.GetNextStepManagement(taskManagement.StepStatus, StepModuleList.FreightManagement, freightManagement.Department.LookupId); if (nextStep != null) { var nextAssign = GetApproverAtStep(freightManagement.Department.LookupId, freightManagement.Location.LookupId, StepModuleList.FreightManagement, nextStep.StepNumber); if (nextAssign != null) { taskManagement.NextAssign = nextAssign.ADAccount; } } TaskManagementDAL taskManagementDAL = new TaskManagementDAL(this.SiteUrl); int retId = taskManagementDAL.SaveItem(taskManagement); freightManagement.ApprovalStatus = taskManagement.StepStatus; freightManagement.Comment = string.Empty; freightManagement.SecurityNotes = string.Empty; freightManagement.IsFinished = false; freightManagement.HighPriority = false; this.SaveOrUpdate(freightManagement); EmailTemplateDAL _emailTemplateDAL = new EmailTemplateDAL(this.SiteUrl); EmailTemplate emailTemplate = _emailTemplateDAL.GetByKey("FreightManagement_Request"); EmployeeInfo toUser = _employeeInfoDAL.GetByADAccount(taskManagement.AssignedTo.ID); SendEmail(freightManagement, emailTemplate, null, toUser, this.SiteUrl, true); try { List <EmployeeInfo> toUsers = DelegationPermissionManager.GetListOfDelegatedEmployees(toUser.ID, StringConstant.FreightManagementList.ListUrl, freightManagement.ID); SendDelegationEmail(freightManagement, emailTemplate, toUsers, this.SiteUrl); } catch { } return(freightManagement); }