private string GetNodePath(int intCategoryID) { string strNodePath = intCategoryID.ToString(); ServiceDeskDALDataContext objServiceDeskDALDataContext = new ServiceDeskDALDataContext(); var result = (from ITILServiceDesk_Categories in objServiceDeskDALDataContext.ITILServiceDesk_Categories where ITILServiceDesk_Categories.CategoryID == intCategoryID select ITILServiceDesk_Categories).FirstOrDefault(); // Only build a node path if the current level is not the root if (result.Level > 1) { int intCurrentCategoryID = result.CategoryID; for (int i = 1; i < result.Level; i++) { var CurrentCategory = (from ITILServiceDesk_Categories in objServiceDeskDALDataContext.ITILServiceDesk_Categories where ITILServiceDesk_Categories.CategoryID == intCurrentCategoryID select ITILServiceDesk_Categories).FirstOrDefault(); strNodePath = CurrentCategory.ParentCategoryID.ToString() + @"/" + strNodePath; var ParentCategory = (from ITILServiceDesk_Categories in objServiceDeskDALDataContext.ITILServiceDesk_Categories where ITILServiceDesk_Categories.CategoryID == CurrentCategory.ParentCategoryID select ITILServiceDesk_Categories).FirstOrDefault(); intCurrentCategoryID = ParentCategory.CategoryID; } } return(strNodePath); }
protected void btnInsertRole_Click(object sender, EventArgs e) { ServiceDeskDALDataContext objServiceDeskDALDataContext = new ServiceDeskDALDataContext(); // See if Role already exists ITILServiceDesk_Role colITILServiceDesk_Roles = (from ITILServiceDesk_Roles in objServiceDeskDALDataContext.ITILServiceDesk_Roles where ITILServiceDesk_Roles.PortalID == PortalId where ITILServiceDesk_Roles.RoleID == Convert.ToInt32(ddlRole.SelectedValue) select ITILServiceDesk_Roles).FirstOrDefault(); if (colITILServiceDesk_Roles != null) { RoleController objRoleController = new RoleController(); lblRoleError.Text = String.Format(Localization.GetString("RoleAlreadyAdded.Text", LocalResourceFile), objRoleController.GetRole(Convert.ToInt32(ddlRole.SelectedValue), PortalId).RoleName); } else { ITILServiceDesk_Role objITILServiceDesk_Role = new ITILServiceDesk_Role(); objITILServiceDesk_Role.PortalID = PortalId; objITILServiceDesk_Role.RoleID = Convert.ToInt32(ddlRole.SelectedValue); objServiceDeskDALDataContext.ITILServiceDesk_Roles.InsertOnSubmit(objITILServiceDesk_Role); objServiceDeskDALDataContext.SubmitChanges(); lvRoles.DataBind(); } }
private void UploadFileCommentEdit(int intDetailID) { ServiceDeskDALDataContext objServiceDeskDALDataContext = new ServiceDeskDALDataContext(); string strUploadefFilesPath = (from ITILServiceDesk_Settings in objServiceDeskDALDataContext.ITILServiceDesk_Settings where ITILServiceDesk_Settings.PortalID == PortalId where ITILServiceDesk_Settings.SettingName == "UploadefFilesPath" select ITILServiceDesk_Settings).FirstOrDefault().SettingValue; EnsureDirectory(new System.IO.DirectoryInfo(strUploadefFilesPath)); string strfilename = Convert.ToString(intDetailID) + "_" + GetRandomPassword() + Path.GetExtension(fuAttachment.FileName).ToLower(); strUploadefFilesPath = strUploadefFilesPath + @"\" + strfilename; fuAttachment.SaveAs(strUploadefFilesPath); ITILServiceDesk_Attachment objITILServiceDesk_Attachment = new ITILServiceDesk_Attachment(); objITILServiceDesk_Attachment.DetailID = intDetailID; objITILServiceDesk_Attachment.FileName = strfilename; objITILServiceDesk_Attachment.OriginalFileName = fuAttachment.FileName; objITILServiceDesk_Attachment.AttachmentPath = strUploadefFilesPath; objITILServiceDesk_Attachment.UserID = UserId; objServiceDeskDALDataContext.ITILServiceDesk_Attachments.InsertOnSubmit(objITILServiceDesk_Attachment); objServiceDeskDALDataContext.SubmitChanges(); // Insert Log Log.InsertLog(TaskID, UserId, String.Format("{0} uploaded file '{1}'.", GetUserName(), fuAttachment.FileName)); }
private void NotifyGroupAssignTicket(string TaskID) { // ITIL Customization - email notifies the Admins of a new ticket and also includes the ticket details ServiceDeskDALDataContext objServiceDeskDALDataContext = new ServiceDeskDALDataContext(); ITILServiceDesk_Task objITILServiceDesk_Tasks = (from ITILServiceDesk_Tasks in objServiceDeskDALDataContext.ITILServiceDesk_Tasks where ITILServiceDesk_Tasks.TaskID == Convert.ToInt32(TaskID) select ITILServiceDesk_Tasks).FirstOrDefault(); string strDomainServerUrl = DotNetNuke.Common.Globals.AddHTTP(Request.Url.Host); // ITIL Customization - get DomainServerUrl for use in Utility.FixURLLink string strPasswordLinkUrl = Utility.FixURLLink(DotNetNuke.Common.Globals.NavigateURL(PortalSettings.ActiveTab.TabID, "EditTask", "mid=" + ModuleId.ToString(), String.Format(@"&TaskID={0}&TP={1}", TaskID, objITILServiceDesk_Tasks.TicketPassword)), strDomainServerUrl); RoleController objRoleController = new RoleController(); //string strAssignedRole = String.Format("{0}", objRoleController.GetRoleById(Convert.ToInt32(ddlAssigned.SelectedValue), PortalId).RoleName); string strAssignedRole = ddlAssigned.SelectedItem.Text; string strLinkUrl = Utility.FixURLLink(DotNetNuke.Common.Globals.NavigateURL(PortalSettings.ActiveTab.TabID, "EditTask", "mid=" + ModuleId.ToString(), String.Format(@"&TaskID={0}", TaskID)), PortalSettings.PortalAlias.HTTPAlias); string strSubject = String.Format(Localization.GetString("HelpDeskTicketAtHasBeenAssigned.Text", LocalResourceFile), TaskID, strAssignedRole); string strBody = Localization.GetString("HTMLTicketEmailAssignee.Text", LocalResourceFile); strBody = Utility.ReplaceTicketToken(strBody, strPasswordLinkUrl, objITILServiceDesk_Tasks); strBody = strBody + Environment.NewLine; strBody = strBody + String.Format(Localization.GetString("YouMaySeeStatusHere.Text", LocalResourceFile), strLinkUrl); // Get all users in the AssignedRole Role // ArrayList colAssignedRoleUsers = objRoleController.GetUsersByRoleName(PortalId, strAssignedRole); IList <UserInfo> colAssignedRoleUsers = RoleController.Instance.GetUsersByRole(PortalId, strAssignedRole); foreach (UserInfo objUserInfo in colAssignedRoleUsers) { DotNetNuke.Services.Mail.Mail.SendMail(PortalSettings.Email, objUserInfo.Email, "", strSubject, strBody, "", "HTML", "", "", "", ""); } Log.InsertLog(Convert.ToInt32(TaskID), UserId, String.Format(Localization.GetString("AssignedTicketTo.Text", LocalResourceFile), UserInfo.DisplayName, strAssignedRole)); }
// Emails //ITIL Customization - send email requester when ticket is resolved #region NotifyRequesterTicketResolved private void NotifyRequesterTicketResolved(string TaskID) { ServiceDeskDALDataContext objServiceDeskDALDataContext = new ServiceDeskDALDataContext(); ITILServiceDesk_Task objITILServiceDesk_Tasks = (from ITILServiceDesk_Tasks in objServiceDeskDALDataContext.ITILServiceDesk_Tasks where ITILServiceDesk_Tasks.TaskID == Convert.ToInt32(TaskID) select ITILServiceDesk_Tasks).FirstOrDefault(); string strDomainServerUrl = DotNetNuke.Common.Globals.AddHTTP(Request.Url.Host); // ITIL Customization - get DomainServerUrl for use in Utility.FixURLLink string strPasswordLinkUrl = Utility.FixURLLink(DotNetNuke.Common.Globals.NavigateURL(PortalSettings.ActiveTab.TabID, "EditTask", "mid=" + ModuleId.ToString(), String.Format(@"&TaskID={0}&TP={1}", TaskID, objITILServiceDesk_Tasks.TicketPassword)), strDomainServerUrl); string strSubject = String.Format(Localization.GetString("TicketIsResolved.Text", LocalResourceFile), TaskID); string strEmail = objITILServiceDesk_Tasks.RequesterEmail; // If userId is not -1 then get the Email if (objITILServiceDesk_Tasks.RequesterUserID > -1) { strEmail = UserController.GetUserById(PortalId, objITILServiceDesk_Tasks.RequesterUserID).Email; } string strBody = Localization.GetString("HTMLTicketEmailRequester.Text", LocalResourceFile); strBody = Utility.ReplaceTicketToken(strBody, strPasswordLinkUrl, objITILServiceDesk_Tasks); DotNetNuke.Services.Mail.Mail.SendMail(PortalSettings.Email, strEmail, "", strSubject, strBody, "", "HTML", "", "", "", ""); }
private void SaveTags(int intTaskID) { ServiceDeskDALDataContext objServiceDeskDALDataContext = new ServiceDeskDALDataContext(); var ExistingTaskCategories = from ITILServiceDesk_TaskCategories in objServiceDeskDALDataContext.ITILServiceDesk_TaskCategories where ITILServiceDesk_TaskCategories.TaskID == intTaskID select ITILServiceDesk_TaskCategories; // Delete all existing TaskCategories if (ExistingTaskCategories != null) { objServiceDeskDALDataContext.ITILServiceDesk_TaskCategories.DeleteAllOnSubmit(ExistingTaskCategories); objServiceDeskDALDataContext.SubmitChanges(); } // Add TaskCategories TreeView objTreeView = (TreeView)TagsTreeExistingTasks.FindControl("tvCategories"); if (objTreeView.CheckedNodes.Count > 0) { // Iterate through the CheckedNodes collection foreach (TreeNode node in objTreeView.CheckedNodes) { ITILServiceDesk_TaskCategory objITILServiceDesk_TaskCategory = new ITILServiceDesk_TaskCategory(); objITILServiceDesk_TaskCategory.TaskID = intTaskID; objITILServiceDesk_TaskCategory.CategoryID = Convert.ToInt32(node.Value); objServiceDeskDALDataContext.ITILServiceDesk_TaskCategories.InsertOnSubmit(objITILServiceDesk_TaskCategory); objServiceDeskDALDataContext.SubmitChanges(); } } }
private void UpdateLevelOfChildren(ITILServiceDesk_Category result) { int?intStartingLevel = result.Level; if (colProcessedCategoryIDs == null) { colProcessedCategoryIDs = new List <int>(); } ServiceDeskDALDataContext objServiceDeskDALDataContext = new ServiceDeskDALDataContext(); // Get the children of the current item // This method may be called from the top level or recuresively by one of the child items var CategoryChildren = from ITILServiceDesk_Categories in objServiceDeskDALDataContext.ITILServiceDesk_Categories where ITILServiceDesk_Categories.ParentCategoryID == result.CategoryID where !colProcessedCategoryIDs.Contains(result.CategoryID) select ITILServiceDesk_Categories; // Loop thru each item foreach (var objCategory in CategoryChildren) { colProcessedCategoryIDs.Add(objCategory.CategoryID); objCategory.Level = ((intStartingLevel) ?? 0) + 1; objServiceDeskDALDataContext.SubmitChanges(); //Recursively call the UpdateLevelOfChildren method adding all children UpdateLevelOfChildren(objCategory); } }
private string GetParentCategoryID(string strParentCategoryID) { // This is to ensure that the ParentCategoryID does exist and has not been deleted since the last time the form was loaded int ParentCategoryID = 0; if (strParentCategoryID != "0") { ParentCategoryID = Convert.ToInt32(strParentCategoryID); } ServiceDeskDALDataContext objServiceDeskDALDataContext = new ServiceDeskDALDataContext(); var result = (from ITILServiceDesk_Categories in objServiceDeskDALDataContext.ITILServiceDesk_Categories where ITILServiceDesk_Categories.CategoryID == ParentCategoryID select ITILServiceDesk_Categories).FirstOrDefault(); string strResultParentCategoryID = "0"; if (result != null) { strResultParentCategoryID = result.CategoryID.ToString(); } return(strResultParentCategoryID); }
// Tags #region DisplayCategoryTree private void DisplayCategoryTree() { bool boolUserAssignedToTask = false; ServiceDeskDALDataContext objServiceDeskDALDataContext = new ServiceDeskDALDataContext(); ITILServiceDesk_Task objITILServiceDesk_Tasks = (from ITILServiceDesk_Tasks in objServiceDeskDALDataContext.ITILServiceDesk_Tasks where ITILServiceDesk_Tasks.TaskID == Convert.ToInt32(Request.QueryString["TaskID"]) select ITILServiceDesk_Tasks).FirstOrDefault(); //Is user in the Assigned Role? RoleController objRoleController = new RoleController(); RoleInfo objRoleInfo = objRoleController.GetRole(objITILServiceDesk_Tasks.AssignedRoleID, PortalId); if (objRoleInfo != null) { if (UserInfo.IsInRole(objRoleInfo.RoleName)) { boolUserAssignedToTask = true; } } if (boolUserAssignedToTask || UserInfo.IsInRole(GetAdminRole()) || UserInfo.IsInRole(PortalSettings.AdministratorRoleName) || UserInfo.IsSuperUser) { // Show all Tags TagsTreeExistingTasks.Visible = true; TagsTreeExistingTasks.TagID = Convert.ToInt32(Request.QueryString["TaskID"]); TagsTreeExistingTasks.DisplayType = Utility.DisplayTypeAdministrator; TagsTreeExistingTasks.Expand = false; } else { // Show only Visible Tags TagsTreeExistingTasks.Visible = true; TagsTreeExistingTasks.TagID = Convert.ToInt32(Request.QueryString["TaskID"]); TagsTreeExistingTasks.DisplayType = Utility.DisplayTypeRequestor; TagsTreeExistingTasks.Expand = false; } // Select Existing values if (objITILServiceDesk_Tasks.ITILServiceDesk_TaskCategories.Select(x => x.CategoryID).ToArray <int>().Count() > 0) { int[] ArrStrCategories = objITILServiceDesk_Tasks.ITILServiceDesk_TaskCategories.Select(x => x.CategoryID).ToArray <int>(); int?[] ArrIntCatagories = Array.ConvertAll <int, int?>(ArrStrCategories, new Converter <int, int?>(ConvertToNullableInt)); TagsTreeExistingTasks.SelectedCategories = ArrIntCatagories; } // Set visibility of Tags bool RequestorCatagories = (TagsTreeExistingTasks.DisplayType == Utility.DisplayTypeAdministrator) ? false : true; int CountOfCatagories = (from ServiceDeskCategories in CategoriesTable.GetCategoriesTable(PortalId, RequestorCatagories) where ServiceDeskCategories.PortalID == PortalId where ServiceDeskCategories.Level == 1 select ServiceDeskCategories).Count(); imgTags.Visible = (CountOfCatagories > 0); lbltxtTags.Visible = (CountOfCatagories > 0); }
protected void LDSLogs_Selecting(object sender, LinqDataSourceSelectEventArgs e) { ServiceDeskDALDataContext objServiceDeskDALDataContext = new ServiceDeskDALDataContext(); var result = from ITILServiceDesk_Logs in objServiceDeskDALDataContext.ITILServiceDesk_Logs where ITILServiceDesk_Logs.TaskID == TaskID select ITILServiceDesk_Logs; e.Result = result; }
private static IQueryable <ITILServiceDesk_Category> GetEntireTable(int PortalID) { ServiceDeskDALDataContext CategoryAdminDALDataContext = new ServiceDeskDALDataContext(); IQueryable <ITILServiceDesk_Category> EntireTable = (from ServiceDeskCategories in CategoryAdminDALDataContext.ITILServiceDesk_Categories where ServiceDeskCategories.PortalID == PortalID select ServiceDeskCategories).ToList().AsQueryable(); return(EntireTable); }
private int?GetLevelOfParent(int?ParentCategoryID) { ServiceDeskDALDataContext objServiceDeskDALDataContext = new ServiceDeskDALDataContext(); var result = (from ITILServiceDesk_Categories in objServiceDeskDALDataContext.ITILServiceDesk_Categories where ITILServiceDesk_Categories.CategoryID == ParentCategoryID select ITILServiceDesk_Categories).FirstOrDefault(); return((result == null) ? 0 : result.Level); }
protected void LDSComments_Selecting(object sender, LinqDataSourceSelectEventArgs e) { ServiceDeskDALDataContext objServiceDeskDALDataContext = new ServiceDeskDALDataContext(); var result = from ITILServiceDesk_TaskDetails in objServiceDeskDALDataContext.ITILServiceDesk_TaskDetails where ITILServiceDesk_TaskDetails.TaskID == TaskID where (ITILServiceDesk_TaskDetails.DetailType == "Work") select ITILServiceDesk_TaskDetails; e.Result = result; }
protected void btnUpdate_Click(object sender, EventArgs e) { ServiceDeskDALDataContext objServiceDeskDALDataContext = new ServiceDeskDALDataContext(); if (btnUpdate.CommandName == "Update") { var result = (from ITILServiceDesk_Categories in objServiceDeskDALDataContext.ITILServiceDesk_Categories where ITILServiceDesk_Categories.CategoryID == Convert.ToInt32(txtCategoryID.Text) select ITILServiceDesk_Categories).FirstOrDefault(); result.CategoryName = txtCategory.Text.Trim(); result.ParentCategoryID = (GetParentCategoryID(ddlParentCategory.SelectedValue) == "0") ? (int?)null : Convert.ToInt32(ddlParentCategory.SelectedValue); txtParentCategoryID.Text = (ddlParentCategory.SelectedValue == "0") ? "" : ddlParentCategory.SelectedValue; result.Level = (ddlParentCategory.SelectedValue == "0") ? 1 : GetLevelOfParent(Convert.ToInt32(ddlParentCategory.SelectedValue)) + 1; result.RequestorVisible = chkRequesterVisible.Checked; result.Selectable = chkSelectable.Checked; objServiceDeskDALDataContext.SubmitChanges(); // Update levels off all the Children colProcessedCategoryIDs = new List <int>(); UpdateLevelOfChildren(result); } else { // This is a Save for a new Node ITILServiceDesk_Category objITILServiceDesk_Category = new ITILServiceDesk_Category(); objITILServiceDesk_Category.PortalID = PortalId; objITILServiceDesk_Category.CategoryName = txtCategory.Text.Trim(); objITILServiceDesk_Category.ParentCategoryID = (GetParentCategoryID(ddlParentCategory.SelectedValue) == "0") ? (int?)null : Convert.ToInt32(ddlParentCategory.SelectedValue); objITILServiceDesk_Category.Level = (ddlParentCategory.SelectedValue == "0") ? 1 : GetLevelOfParent(Convert.ToInt32(ddlParentCategory.SelectedValue)) + 1; objITILServiceDesk_Category.RequestorVisible = chkRequesterVisible.Checked; objITILServiceDesk_Category.Selectable = chkSelectable.Checked; objServiceDeskDALDataContext.ITILServiceDesk_Categories.InsertOnSubmit(objITILServiceDesk_Category); objServiceDeskDALDataContext.SubmitChanges(); // Set the Hidden CategoryID txtParentCategoryID.Text = (objITILServiceDesk_Category.ParentCategoryID == null) ? "" : ddlParentCategory.SelectedValue; txtCategoryID.Text = objITILServiceDesk_Category.CategoryID.ToString(); ResetForm(); } RefreshCache(); DisplayCatagories(); // Set the Parent drop-down if (txtParentCategoryID.Text != "") { ddlParentCategory.SelectedValue = txtParentCategoryID.Text; } }
private void DisplayComment() { ServiceDeskDALDataContext objServiceDeskDALDataContext = new ServiceDeskDALDataContext(); var objITILServiceDesk_TaskDetail = (from ITILServiceDesk_TaskDetails in objServiceDeskDALDataContext.ITILServiceDesk_TaskDetails where ITILServiceDesk_TaskDetails.DetailID == Convert.ToInt32(lblDetailID.Text) select ITILServiceDesk_TaskDetails).FirstOrDefault(); if (objITILServiceDesk_TaskDetail != null) { txtDescription.Text = objITILServiceDesk_TaskDetail.Description; lblDisplayUser.Text = GetUserName(objITILServiceDesk_TaskDetail.UserID); lblInsertDate.Text = String.Format("{0} {1}", objITILServiceDesk_TaskDetail.InsertDate.ToLongDateString(), objITILServiceDesk_TaskDetail.InsertDate.ToLongTimeString()); chkCommentVisibleEdit.Checked = (objITILServiceDesk_TaskDetail.DetailType == "Comment") ? false : true; if (!ViewOnly) { lnkUpdateRequestor.Visible = (objITILServiceDesk_TaskDetail.DetailType == "Comment") ? false : true; } // Only set the Display of the Email to Requestor link if it is already showing if (lnkUpdateRequestor.Visible) { // Only Display Email to Requestor link if chkCommentVisibleEdit is checked lnkUpdateRequestor.Visible = chkCommentVisibleEdit.Checked; } if (objITILServiceDesk_TaskDetail.ITILServiceDesk_Attachments.Count > 0) { // There is a atachment pnlAttachFile.Visible = false; pnlDisplayFile.Visible = true; lnkFileAttachment.Text = objITILServiceDesk_TaskDetail.ITILServiceDesk_Attachments.FirstOrDefault().OriginalFileName; lnkFileAttachment.CommandArgument = objITILServiceDesk_TaskDetail.ITILServiceDesk_Attachments.FirstOrDefault().AttachmentID.ToString(); } else { // Only do this if not in View Only Mode if (!ViewOnly) { // There is not a file attached pnlAttachFile.Visible = true; pnlDisplayFile.Visible = false; } else { pnlDisplayFile.Visible = false; } } } }
public static void InsertLog(int TaskID, int UserID, string LogDescription) { ServiceDeskDALDataContext objServiceDeskDALDataContext = new ServiceDeskDALDataContext(); ITILServiceDesk_Log objITILServiceDesk_Log = new ITILServiceDesk_Log(); objITILServiceDesk_Log.DateCreated = DateTime.Now; objITILServiceDesk_Log.LogDescription = LogDescription.Substring(0, LogDescription.Length > 499 ? 499 : LogDescription.Length - 1); // Strings.Left(LogDescription, 499); objITILServiceDesk_Log.TaskID = TaskID; objITILServiceDesk_Log.UserID = UserID; objServiceDeskDALDataContext.ITILServiceDesk_Logs.InsertOnSubmit(objITILServiceDesk_Log); objServiceDeskDALDataContext.SubmitChanges(); }
private void UpdateComment() { try { // Try to Make Start and Stop Time DateTime StartTime = Convert.ToDateTime(String.Format("{0} {1}", txtStartDayEdit.Text, txtStartTimeEdit.Text)); DateTime StopTime = Convert.ToDateTime(String.Format("{0} {1}", txtStopDayEdit.Text, txtStopTimeEdit.Text)); } catch { lblErrorEditComment.Text = Localization.GetString("MustProvideValidStarAndStopTimes.Text", LocalResourceFile); return; } if (txtDescription.Text.Trim().Length > 0) { ServiceDeskDALDataContext objServiceDeskDALDataContext = new ServiceDeskDALDataContext(); string strComment = txtDescription.Text.Trim(); // Save Task Details var objITILServiceDesk_TaskDetail = (from ITILServiceDesk_TaskDetails in objServiceDeskDALDataContext.ITILServiceDesk_TaskDetails where ITILServiceDesk_TaskDetails.DetailID == Convert.ToInt32(lblDetailID.Text) select ITILServiceDesk_TaskDetails).FirstOrDefault(); if (objITILServiceDesk_TaskDetail != null) { objITILServiceDesk_TaskDetail.TaskID = TaskID; objITILServiceDesk_TaskDetail.Description = txtDescription.Text.Trim(); objITILServiceDesk_TaskDetail.UserID = UserId; objITILServiceDesk_TaskDetail.DetailType = "Work"; objITILServiceDesk_TaskDetail.StartTime = Convert.ToDateTime(String.Format("{0} {1}", txtStartDayEdit.Text, txtStartTimeEdit.Text)); objITILServiceDesk_TaskDetail.StopTime = Convert.ToDateTime(String.Format("{0} {1}", txtStopDayEdit.Text, txtStopTimeEdit.Text)); objServiceDeskDALDataContext.SubmitChanges(); txtDescription.Text = ""; // Insert Log Log.InsertLog(TaskID, UserId, String.Format("{0} updated Work comment.", GetUserName())); SetView("Default"); gvComments.DataBind(); } } else { lblErrorEditComment.Text = Localization.GetString("MustProvideADescription.Text", LocalResourceFile); } }
protected void btnUpdateAdminRole_Click(object sender, EventArgs e) { ServiceDeskDALDataContext objServiceDeskDALDataContext = new ServiceDeskDALDataContext(); ITILServiceDesk_Setting objITILServiceDesk_Setting = (from ITILServiceDesk_Settings in objServiceDeskDALDataContext.ITILServiceDesk_Settings where ITILServiceDesk_Settings.PortalID == PortalId where ITILServiceDesk_Settings.SettingName == "AdminRole" select ITILServiceDesk_Settings).FirstOrDefault(); objITILServiceDesk_Setting.SettingValue = ddlAdminRole.SelectedValue; objServiceDeskDALDataContext.SubmitChanges(); lblAdminRole.Text = Localization.GetString("Updated.Text", LocalResourceFile); }
private int GetAssignedRole() { int intRole = -1; ServiceDeskDALDataContext objServiceDeskDALDataContext = new ServiceDeskDALDataContext(); var result = from ITILServiceDesk_TaskDetails in objServiceDeskDALDataContext.ITILServiceDesk_Tasks where ITILServiceDesk_TaskDetails.TaskID == Convert.ToInt32(Request.QueryString["TaskID"]) select ITILServiceDesk_TaskDetails; if (result != null) { intRole = result.FirstOrDefault().AssignedRoleID; } return(intRole); }
private string GetDescriptionOfTicket() { string strDescription = ""; int intTaskId = Convert.ToInt32(Request.QueryString["TaskID"]); ServiceDeskDALDataContext objServiceDeskDALDataContext = new ServiceDeskDALDataContext(); var result = (from ITILServiceDesk_TaskDetails in objServiceDeskDALDataContext.ITILServiceDesk_Tasks where ITILServiceDesk_TaskDetails.TaskID == Convert.ToInt32(Request.QueryString["TaskID"]) select ITILServiceDesk_TaskDetails).FirstOrDefault(); if (result != null) { strDescription = result.Description; } return(strDescription); }
protected void lnkDelete_Click(object sender, EventArgs e) { ServiceDeskDALDataContext objServiceDeskDALDataContext = new ServiceDeskDALDataContext(); var objITILServiceDesk_TaskDetail = (from ITILServiceDesk_TaskDetails in objServiceDeskDALDataContext.ITILServiceDesk_TaskDetails where ITILServiceDesk_TaskDetails.DetailID == Convert.ToInt32(lblDetailID.Text) select ITILServiceDesk_TaskDetails).FirstOrDefault(); // Delete any Attachments if (objITILServiceDesk_TaskDetail.ITILServiceDesk_Attachments.Count > 0) { ITILServiceDesk_Attachment objITILServiceDesk_Attachment = objITILServiceDesk_TaskDetail.ITILServiceDesk_Attachments.FirstOrDefault(); string strOriginalFileName = objITILServiceDesk_Attachment.OriginalFileName; string strFile = objITILServiceDesk_Attachment.AttachmentPath; try { // Delete file if (strFile != "") { File.Delete(strFile); } } catch (Exception exc) { Exceptions.ProcessModuleLoadException(this, exc); } objServiceDeskDALDataContext.ITILServiceDesk_Attachments.DeleteOnSubmit(objITILServiceDesk_Attachment); objServiceDeskDALDataContext.SubmitChanges(); // Insert Log Log.InsertLog(TaskID, UserId, String.Format("{0} deleted file '{1}'.", GetUserName(), strOriginalFileName)); } // Delete the Record objServiceDeskDALDataContext.ITILServiceDesk_TaskDetails.DeleteOnSubmit(objITILServiceDesk_TaskDetail); objServiceDeskDALDataContext.SubmitChanges(); // Insert Log Log.InsertLog(TaskID, UserId, String.Format("{0} deleted comment: {1}", GetUserName(), txtDescription.Text)); SetView("Default"); gvComments.DataBind(); }
private void InsertComment() { if (txtComment.Text.Trim().Length > 0) { try { // Try to Make Start and Stop Time DateTime StartTime = Convert.ToDateTime(String.Format("{0} {1}", txtStartDay.Text, txtStartTime.Text)); DateTime StopTime = Convert.ToDateTime(String.Format("{0} {1}", txtStopDay.Text, txtStopTime.Text)); } catch { lblError.Text = Localization.GetString("MustProvideValidStarAndStopTimes.Text", LocalResourceFile); return; } ServiceDeskDALDataContext objServiceDeskDALDataContext = new ServiceDeskDALDataContext(); string strComment = txtComment.Text.Trim(); // Save Task Details ITILServiceDesk_TaskDetail objITILServiceDesk_TaskDetail = new ITILServiceDesk_TaskDetail(); objITILServiceDesk_TaskDetail.TaskID = TaskID; objITILServiceDesk_TaskDetail.Description = txtComment.Text.Trim(); objITILServiceDesk_TaskDetail.InsertDate = DateTime.Now; objITILServiceDesk_TaskDetail.UserID = UserId; objITILServiceDesk_TaskDetail.DetailType = "Work"; objITILServiceDesk_TaskDetail.StartTime = Convert.ToDateTime(String.Format("{0} {1}", txtStartDay.Text, txtStartTime.Text)); objITILServiceDesk_TaskDetail.StopTime = Convert.ToDateTime(String.Format("{0} {1}", txtStopDay.Text, txtStopTime.Text)); objServiceDeskDALDataContext.ITILServiceDesk_TaskDetails.InsertOnSubmit(objITILServiceDesk_TaskDetail); objServiceDeskDALDataContext.SubmitChanges(); txtComment.Text = ""; // Insert Log Log.InsertLog(TaskID, UserId, String.Format("{0} inserted Work comment.", GetUserName())); gvComments.DataBind(); } else { lblError.Text = Localization.GetString("MustProvideADescription.Text", LocalResourceFile); } }
protected void LDSComments_Selecting(object sender, LinqDataSourceSelectEventArgs e) { ServiceDeskDALDataContext objServiceDeskDALDataContext = new ServiceDeskDALDataContext(); var result = from ITILServiceDesk_TaskDetails in objServiceDeskDALDataContext.ITILServiceDesk_TaskDetails where ITILServiceDesk_TaskDetails.TaskID == TaskID where (ITILServiceDesk_TaskDetails.DetailType == "Comment" || ITILServiceDesk_TaskDetails.DetailType == "Comment-Visible") select ITILServiceDesk_TaskDetails; // If View only mode if (ViewOnly) { result = from TaskDetails in result where TaskDetails.DetailType == "Comment-Visible" select TaskDetails; } e.Result = result; }
protected void lnkDelete_Click(object sender, EventArgs e) { ServiceDeskDALDataContext objServiceDeskDALDataContext = new ServiceDeskDALDataContext(); var objITILServiceDesk_TaskDetail = (from ITILServiceDesk_TaskDetails in objServiceDeskDALDataContext.ITILServiceDesk_TaskDetails where ITILServiceDesk_TaskDetails.DetailID == Convert.ToInt32(lblDetailID.Text) select ITILServiceDesk_TaskDetails).FirstOrDefault(); // Delete the Record objServiceDeskDALDataContext.ITILServiceDesk_TaskDetails.DeleteOnSubmit(objITILServiceDesk_TaskDetail); objServiceDeskDALDataContext.SubmitChanges(); // Insert Log Log.InsertLog(TaskID, UserId, String.Format("{0} deleted Work comment: {1}", GetUserName(), txtDescription.Text)); SetView("Default"); gvComments.DataBind(); }
private string GetAdminRole() { ServiceDeskDALDataContext objServiceDeskDALDataContext = new ServiceDeskDALDataContext(); List <ITILServiceDesk_Setting> colITILServiceDesk_Setting = (from ITILServiceDesk_Settings in objServiceDeskDALDataContext.ITILServiceDesk_Settings where ITILServiceDesk_Settings.PortalID == PortalId select ITILServiceDesk_Settings).ToList(); ITILServiceDesk_Setting objITILServiceDesk_Setting = colITILServiceDesk_Setting.Where(x => x.SettingName == "AdminRole").FirstOrDefault(); string strAdminRoleID = "Administrators"; if (objITILServiceDesk_Setting != null) { strAdminRoleID = objITILServiceDesk_Setting.SettingValue; } return(strAdminRoleID); }
private void DisplayComment() { ServiceDeskDALDataContext objServiceDeskDALDataContext = new ServiceDeskDALDataContext(); var objITILServiceDesk_TaskDetail = (from ITILServiceDesk_TaskDetails in objServiceDeskDALDataContext.ITILServiceDesk_TaskDetails where ITILServiceDesk_TaskDetails.DetailID == Convert.ToInt32(lblDetailID.Text) select ITILServiceDesk_TaskDetails).FirstOrDefault(); if (objITILServiceDesk_TaskDetail != null) { txtDescription.Text = objITILServiceDesk_TaskDetail.Description; lblDisplayUser.Text = GetUserName(objITILServiceDesk_TaskDetail.UserID); txtStartDayEdit.Text = objITILServiceDesk_TaskDetail.StartTime.Value.ToShortDateString(); txtStopDayEdit.Text = objITILServiceDesk_TaskDetail.StopTime.Value.ToShortDateString(); txtStartTimeEdit.Text = objITILServiceDesk_TaskDetail.StartTime.Value.ToShortTimeString(); txtStopTimeEdit.Text = objITILServiceDesk_TaskDetail.StopTime.Value.ToShortTimeString(); lblInsertDate.Text = String.Format("{0} {1}", objITILServiceDesk_TaskDetail.InsertDate.ToLongDateString(), objITILServiceDesk_TaskDetail.InsertDate.ToLongTimeString()); } }
private bool UserIsRequestor() { bool isRequestor = false; ServiceDeskDALDataContext objServiceDeskDALDataContext = new ServiceDeskDALDataContext(); var result = from ITILServiceDesk_TaskDetails in objServiceDeskDALDataContext.ITILServiceDesk_Tasks where ITILServiceDesk_TaskDetails.TaskID == Convert.ToInt32(Request.QueryString["TaskID"]) select ITILServiceDesk_TaskDetails; if (result != null) { if (UserId == result.FirstOrDefault().RequesterUserID) { isRequestor = true; } } return(isRequestor); }
static string GetCommentsOfTicket(int TaskId) { string strComments = ""; ServiceDeskDALDataContext objServiceDeskDALDataContext = new ServiceDeskDALDataContext(); ITILServiceDesk_TaskDetail objITILServiceDesk_TaskDetail = (from ITILServiceDesk_TaskDetails in objServiceDeskDALDataContext.ITILServiceDesk_TaskDetails where ITILServiceDesk_TaskDetails.TaskID == TaskId where (ITILServiceDesk_TaskDetails.DetailType == "Comment" || ITILServiceDesk_TaskDetails.DetailType == "Comment-Visible") orderby ITILServiceDesk_TaskDetails.DetailID descending select ITILServiceDesk_TaskDetails).FirstOrDefault(); if (objITILServiceDesk_TaskDetail != null) { strComments = objITILServiceDesk_TaskDetail.Description; } return(strComments); }
private void DisplayUploadedFilesPath() { ServiceDeskDALDataContext objServiceDeskDALDataContext = new ServiceDeskDALDataContext(); // Uploaded Files Path ITILServiceDesk_Setting objITILServiceDesk_Setting = (from ITILServiceDesk_Settings in objServiceDeskDALDataContext.ITILServiceDesk_Settings where ITILServiceDesk_Settings.PortalID == PortalId where ITILServiceDesk_Settings.SettingName == "UploadefFilesPath" select ITILServiceDesk_Settings).FirstOrDefault(); txtUploadedFilesPath.Text = objITILServiceDesk_Setting.SettingValue; // Upload Permissions ITILServiceDesk_Setting UploadPermissionITILServiceDesk_Setting = (from ITILServiceDesk_Settings in objServiceDeskDALDataContext.ITILServiceDesk_Settings where ITILServiceDesk_Settings.PortalID == PortalId where ITILServiceDesk_Settings.SettingName == "UploadPermission" select ITILServiceDesk_Settings).FirstOrDefault(); ddlUploadPermission.SelectedValue = UploadPermissionITILServiceDesk_Setting.SettingValue; }
private void NotifyRequestorOfComment(string strComment) { string strEmail = GetEmailOfRequestor(); if (strEmail != "") { ServiceDeskDALDataContext objServiceDeskDALDataContext = new ServiceDeskDALDataContext(); var result = (from ITILServiceDesk_TaskDetails in objServiceDeskDALDataContext.ITILServiceDesk_Tasks where ITILServiceDesk_TaskDetails.TaskID == Convert.ToInt32(Request.QueryString["TaskID"]) select ITILServiceDesk_TaskDetails).FirstOrDefault(); if (result != null) { string strLinkUrl = ""; if (result.RequesterUserID > -1) { // This is a registred User / Provide link to ticket strLinkUrl = Utility.FixURLLink(DotNetNuke.Common.Globals.NavigateURL(PortalSettings.ActiveTab.TabID, "EditTask", "mid=" + ModuleID.ToString(), String.Format(@"&TaskID={0}", TaskID)), PortalSettings.PortalAlias.HTTPAlias); } else { // This is NOT a registred User / Provide link to ticket with a password strLinkUrl = Utility.FixURLLink(DotNetNuke.Common.Globals.NavigateURL(PortalSettings.ActiveTab.TabID, "EditTask", "mid=" + ModuleID.ToString(), String.Format(@"&TaskID={0}&TP={1}", TaskID, result.TicketPassword)), PortalSettings.PortalAlias.HTTPAlias); } string strDescription = result.Description; string strSubject = String.Format(Localization.GetString("HelpDeskTicketAtHasBeenupdated.Text", LocalResourceFile), Request.QueryString["TaskID"], PortalSettings.PortalAlias.HTTPAlias); string strBody = String.Format(Localization.GetString("HelpDeskTicketHasBeenupdated.Text", LocalResourceFile), Request.QueryString["TaskID"], strDescription); strBody = strBody + Environment.NewLine + Environment.NewLine; strBody = strBody + Localization.GetString("Comments.Text", LocalResourceFile) + Environment.NewLine; strBody = strBody + strComment; strBody = strBody + Environment.NewLine + Environment.NewLine; strBody = strBody + String.Format(Localization.GetString("YouMaySeeFullStatusHere.Text", LocalResourceFile), strLinkUrl); DotNetNuke.Services.Mail.Mail.SendMail(PortalSettings.Email, strEmail, "", strSubject, strBody, "", "HTML", "", "", "", ""); Log.InsertLog(Convert.ToInt32(Request.QueryString["TaskID"]), UserId, String.Format(Localization.GetString("RequestorWasEmailed.Text", LocalResourceFile), strEmail, strComment)); } } }