protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int taskID = 0; if (Request.QueryString["isedit"] == null & Request.QueryString["TaskID"] == null) { Response.Redirect("~/404.aspx"); } if (!int.TryParse(Request.QueryString["TaskID"].ToString(), out taskID)) { taskID = 0; } Session["taskid"] = taskID; ADefHelpDeskTasks t = new ADefHelpDeskTasks(); if (!t.LoadByPrimaryKey(taskID)) { Response.Redirect("~/404.aspx"); } ADefHelpDeskTaskDetailsQuery tQ = new ADefHelpDeskTaskDetailsQuery("a"); ADefHelpDeskTaskDetailsCollection tC = new ADefHelpDeskTaskDetailsCollection(); tQ.SelectAll().Where(tQ.TaskID == taskID && tQ.DetailType == "Details"); tQ.es.Top = 1; tC.Load(tQ); //Fill the Form txtTitle.Text = t.Description; if (tC.Count > 0) { foreach (ADefHelpDeskTaskDetails aT in tC) { txtDesc.Text = aT.Description; } } } }
public void grdTask_ApproveByPic(string TaskID) { ADefHelpDeskTasks t = new ADefHelpDeskTasks(); int taskID = 0; if (int.TryParse(TaskID, out taskID)) { if (t.LoadByPrimaryKey(taskID)) { Session["TaskID"] = taskID; X.Msg.Show(new MessageBoxConfig { Title = "Confirm?", Message = "You agree to declare that this task has been done completely ?", Buttons = MessageBox.Button.YESNO, MessageBoxButtonsConfig = new MessageBoxButtonsConfig { Yes = new MessageBoxButtonConfig { Text = "Yes", Handler = "App.direct.PicConfirmAsFinished()" }, No = new MessageBoxButtonConfig { Text = "No", Handler = "App.direct.PicCancelConfirmAsFinished()" } }, AnimEl = this.grdTask.ClientID, Icon = MessageBox.Icon.QUESTION }); } } }
public void btnSave_Click() { if (string.IsNullOrEmpty(txtTitle.Text) && string.IsNullOrEmpty(txtDesc.Text) && string.IsNullOrEmpty(cmbServiceUnit.SelectedItem.Value)) { return; } ADefHelpDeskTasks t = new ADefHelpDeskTasks(); ADefHelpDeskTasksQuery tQ = new ADefHelpDeskTasksQuery("a"); ADefHelpDeskTasksCollection tC = new ADefHelpDeskTasksCollection(); ADefHelpDeskTaskDetails tD = new ADefHelpDeskTaskDetails(); t.PortalID = 0; t.Description = txtTitle.Text; t.Status = "New"; t.Priority = "High"; t.CreatedDate = DateTime.Now; t.EstimatedStart = DateTime.Now; t.EstimatedCompletion = DateTime.Now.AddDays(7); t.DueDate = DateTime.Now.AddDays(14); t.AssignedRoleID = 1; //Password Ticket string tikPass = Guid.NewGuid().ToString(); t.TicketPassword = tikPass; t.RequesterEmail = AppSession.ServiceUnit.UserServiceUnitID; //RequesterEmail = the requestor service unit t.RequesterPhone = cmbServiceUnit.SelectedItem.Value; //RequesterPhone = the service unit which take charge of the request //Get username ID ADefHelpDeskUsersQuery uq = new ADefHelpDeskUsersQuery("a"); ADefHelpDeskUsersCollection uc = new ADefHelpDeskUsersCollection(); uq.SelectAll().Where(uq.Username == HttpContext.Current.User.Identity.Name.ToString().Trim()); uq.es.Top = 1; uc.Load(uq); if (uc.Count > 0) { foreach (ADefHelpDeskUsers u in uc) { t.RequesterUserID = u.UserID; t.RequesterName = u.FirstName; } } t.Save(); tQ.SelectAll().Where(tQ.TicketPassword == tikPass); tQ.es.Top = 1; tC.Load(tQ); if (tC.Count > 0) { foreach (ADefHelpDeskTasks tt in tC) { tD.TaskID = tt.TaskID; tD.DetailType = "Details"; tD.InsertDate = tt.CreatedDate; tD.Description = txtDesc.Text; tD.UserID = tt.RequesterUserID; tD.Save(); } } MessageBus.Default.Publish("grdTask_Refresh"); //X.Js.Call("onWinClose"); }
public void PicConfirmAsFinished() { int taskID = (int)Session["TaskID"]; ADefHelpDeskTasks t = new ADefHelpDeskTasks(); if (t.LoadByPrimaryKey(taskID)) { t.ApprovedByRequestorID = AppSession.UserLogin.UserID; t.ApprovedByRequestorDateTime = DateTime.Now; t.Save(); X.Msg.Notify("Success", "PIC successfully confirms the task as finished completely").Show(); //Refresh GridPanel MessageBus.Default.Publish("grdTask_Refresh"); } }
public void ConfirmAsFinished() { int taskID = (int)Session["TaskID"]; ADefHelpDeskTasks t = new ADefHelpDeskTasks(); if (t.LoadByPrimaryKey(taskID)) { t.ConfirmAsFinishDate = DateTime.Now; t.Status = "Resolved"; t.Save(); X.Msg.Notify("Success", "Successfully confirmed as finished").Show(); //Refresh GridPanel MessageBus.Default.Publish("grdTask_Refresh"); } }
public void grdTask_Select() { int taskID = 0; RowSelectionModel rm = this.grdTask.GetSelectionModel() as RowSelectionModel; if (rm.SelectedRows.Count > 0) { if (!int.TryParse(rm.SelectedRow.RecordID, out taskID)) { taskID = 0; } if (taskID <= 0) { return; } Session["TaskID"] = taskID; ADefHelpDeskTasks t = new ADefHelpDeskTasks(); if (t.LoadByPrimaryKey(taskID)) { ADefHelpDeskTaskDetailsQuery tQ = new ADefHelpDeskTaskDetailsQuery("a"); ADefHelpDeskTaskDetailsCollection tC = new ADefHelpDeskTaskDetailsCollection(); tQ.SelectAll().Where(tQ.TaskID == taskID); tC.Load(tQ); if (tC.Count > 0) { string detail = string.Empty; foreach (ADefHelpDeskTaskDetails tD in tC) { ADefHelpDeskUsers u = new ADefHelpDeskUsers(); detail += tD.Description; if (u.LoadByPrimaryKey((int)tD.UserID)) { detail += "<br><br><b>User : </b>" + u.FirstName; //detail += "<b>User : </b>" + u.FirstName + ", <b>Insert Date : </b>" + tD.InsertDate.ToString(); //detail += "<br><br><br>"; } detail += ", <b>Insert Date : </b>" + tD.InsertDate.ToString() + "<br>---------------------------------------------------------<br>"; lblHtml.Html = detail; } } else { lblHtml.Html = string.Empty; } } } }
public void grdTask_Cancel(string TaskID) { ADefHelpDeskTasks t = new ADefHelpDeskTasks(); int taskID = 0; if (int.TryParse(TaskID, out taskID)) { if (t.LoadByPrimaryKey(taskID)) { if (AppSession.ServiceUnit.UserServiceUnitID == "HIT" || AppSession.ServiceUnit.UserServiceUnitID == "IT" || AppSession.ServiceUnit.UserServiceUnitID == t.RequesterPhone) { if (t.Status == "Resolved") { X.Msg.Alert("Error", "This request has been resolved").Show(); return; } if (t.Status == "Cancelled") { X.Msg.Alert("Error", "This request has been cancelled").Show(); return; } t.Status = "Cancelled"; t.Save(); X.Msg.Show(new MessageBoxConfig { Title = "Success", Message = "Request Cancelled", Buttons = MessageBox.Button.OK, Icon = MessageBox.Icon.INFO, AnimEl = this.grdTask.ClientID }); //Refresh GridPanel MessageBus.Default.Publish("grdTask_Refresh"); } else { X.Msg.Notify("Error", "You don not have the privileges to cancell this task").Show(); } } } }
public void btnConfirmAlls_Click() { string messagesuccess = string.Empty; if (AppSession.UserLogin.UserID == 36) { messagesuccess = "Her Majesty Santi Dwiyanti S.Si, Apt, the pride of RSCM Kencana, has successfully confirms all tasks as finished completely "; } else { messagesuccess = "PIC successfully confirms all tasks as finished completely"; } ADefHelpDeskTasksQuery tQ = new ADefHelpDeskTasksQuery("a"); ADefHelpDeskTasksCollection tC = new ADefHelpDeskTasksCollection(); tQ.SelectAll().Where(tQ.ApprovedByRequestorID.IsNull(), tQ.ApprovedByRequestorDateTime.IsNull(), tQ.Status == "Resolved"); if (AppSession.ServiceUnit.UserServiceUnitID != null) { tQ.Where(tQ.RequesterEmail == AppSession.ServiceUnit.UserServiceUnitID); } tC.Load(tQ); if (tC.Count > 0) { foreach (var t in tC) { ADefHelpDeskTasks at = new ADefHelpDeskTasks(); if (at.LoadByPrimaryKey((int)t.TaskID)) { at.ApprovedByRequestorID = AppSession.UserLogin.UserID; at.ApprovedByRequestorDateTime = DateTime.Now; at.Save(); X.Msg.Notify("Success", messagesuccess).Show(); //Refresh GridPanel MessageBus.Default.Publish("grdTask_Refresh"); } } } }
public void grdTask_Confirm(string TaskID) { int taskID = 0; if (!int.TryParse(TaskID, out taskID)) { taskID = 0; } ADefHelpDeskTasks t = new ADefHelpDeskTasks(); if (t.LoadByPrimaryKey(taskID)) { if (t.Status == "Resolved" || t.Status == "Cancelled" || t.Status == "OnHold") { X.Msg.Notify("Info", "Unable to mark as finished, either task already confirmed or cancelled").Show(); return; } if (AppSession.ServiceUnit.UserServiceUnitID == "HIT" || AppSession.ServiceUnit.UserServiceUnitID == "IT" || AppSession.ServiceUnit.UserServiceUnitID == t.RequesterPhone) { Session["TaskID"] = taskID; X.Msg.Show(new MessageBoxConfig { Title = "Confirm?", Message = "Are You sure want to confirm as finished ?", Buttons = MessageBox.Button.YESNO, MessageBoxButtonsConfig = new MessageBoxButtonsConfig { Yes = new MessageBoxButtonConfig { Text = "Yes", Handler = "App.direct.ConfirmAsFinished()" }, No = new MessageBoxButtonConfig { Text = "No", Handler = "App.direct.CancelConfirmAsFinished()" } }, AnimEl = this.grdTask.ClientID, Icon = MessageBox.Icon.QUESTION }); //t.Status = "Resolved"; //t.Save(); //X.Msg.Show(new MessageBoxConfig //{ // Title = "Success", // Message = "Request Confirmed", // Buttons = MessageBox.Button.OK, // Icon = MessageBox.Icon.INFO, // AnimEl = this.grdTask.ClientID //}); ////Refresh GridPanel //MessageBus.Default.Publish("grdTask_Refresh"); } else { X.Msg.Notify("Error", "You don not have the privileges to confirm this task").Show(); } } }
public void btnSave_Click() { int taskID = 0; if (Session["taskid"] != null) { taskID = (int)Session["taskid"]; } else { Response.Redirect("~/404.aspx"); } ADefHelpDeskTasks t = new ADefHelpDeskTasks(); ADefHelpDeskTaskDetails td = new ADefHelpDeskTaskDetails(); ADefHelpDeskTaskDetailsQuery tdQ = new ADefHelpDeskTaskDetailsQuery("a"); ADefHelpDeskTaskDetailsCollection tdC = new ADefHelpDeskTaskDetailsCollection(); if (t.LoadByPrimaryKey(taskID)) { t.Description = txtTitle.Text; tdQ.SelectAll().Where(tdQ.TaskID == taskID, tdQ.DetailType == "Details"); tdQ.es.Top = 1; tdC.Load(tdQ); if (tdC.Count > 0) { foreach (ADefHelpDeskTaskDetails ttt in tdC) { if (td.LoadByPrimaryKey((int)ttt.DetailID)) { td.Description = txtDesc.Text; td.Save(); } } } t.Save(); } //t.PortalID = 0; //t.Description = txtDesc.Text; //t.Status = "New"; //t.Priority = "High"; //t.CreatedDate = DateTime.Now; //t.EstimatedStart = DateTime.Now; //t.EstimatedCompletion = DateTime.Now.AddDays(7); //t.DueDate = DateTime.Now.AddDays(14); //t.AssignedRoleID = 1; //Password Ticket //Guid g = new Guid(); //t.TicketPassword = Guid.NewGuid().ToString(); //Get username ID //ADefHelpDeskUsersQuery uq = new ADefHelpDeskUsersQuery("a"); //ADefHelpDeskUsersCollection uc = new ADefHelpDeskUsersCollection(); //uq.SelectAll().Where(uq.Username == HttpContext.Current.User.Identity.Name.ToString().Trim()); //uq.es.Top = 1; //uc.Load(uq); //if (uc.Count > 0) //{ // foreach (ADefHelpDeskUsers u in uc) // { // t.RequesterUserID = u.UserID; // t.RequesterName = u.FirstName; // } //} //t.Save(); MessageBus.Default.Publish("grdTask_Refresh"); //X.Js.Call("onWinClose"); }