Exemplo n.º 1
0
        protected void LDSLogs_Selecting(object sender, LinqDataSourceSelectEventArgs e)
        {
            HelpDeskDALDataContext objHelpDeskDALDataContext = new HelpDeskDALDataContext();
            var result = from HelpDesk_Logs in objHelpDeskDALDataContext.HelpDesk_Logs
                         where HelpDesk_Logs.TaskID == TaskID
                         select HelpDesk_Logs;

            e.Result = result;
        } 
Exemplo n.º 2
0
        private static IQueryable<HelpDesk_Category> GetEntireRequestorTable(int PortalID)
        {
            HelpDeskDALDataContext CategoryAdminDALDataContext = new HelpDeskDALDataContext();

            IQueryable<HelpDesk_Category> EntireTable = (from WebserverCategories in CategoryAdminDALDataContext.HelpDesk_Categories
                                                            where WebserverCategories.PortalID == PortalID
                                                            where WebserverCategories.RequestorVisible == true
                                                            select WebserverCategories).ToList().AsQueryable();

            return EntireTable;
        }
Exemplo n.º 3
0
        public static void InsertLog(int TaskID, int UserID, string LogDescription)
        {
            HelpDeskDALDataContext objHelpDeskDALDataContext = new HelpDeskDALDataContext();

            HelpDesk_Log objHelpDesk_Log = new HelpDesk_Log();
            objHelpDesk_Log.DateCreated = DateTime.Now;
            objHelpDesk_Log.LogDescription = Utils.StringLeft(LogDescription, 499);
            objHelpDesk_Log.TaskID = TaskID;
            objHelpDesk_Log.UserID = UserID;

            objHelpDeskDALDataContext.HelpDesk_Logs.InsertOnSubmit(objHelpDesk_Log);
            objHelpDeskDALDataContext.SubmitChanges();
        } 
Exemplo n.º 4
0
        private void SaveTags(int intTaskID)
        {
            HelpDeskDALDataContext objHelpDeskDALDataContext = new HelpDeskDALDataContext();

            TreeView objTreeView = (TreeView)TagsTree.FindControl("tvCategories");
            if (objTreeView.CheckedNodes.Count > 0)
            {
                // Iterate through the CheckedNodes collection 
                foreach (TreeNode node in objTreeView.CheckedNodes)
                {
                    HelpDesk_TaskCategory objHelpDesk_TaskCategory = new HelpDesk_TaskCategory();

                    objHelpDesk_TaskCategory.TaskID = intTaskID;
                    objHelpDesk_TaskCategory.CategoryID = Convert.ToInt32(node.Value);

                    objHelpDeskDALDataContext.HelpDesk_TaskCategories.InsertOnSubmit(objHelpDesk_TaskCategory);
                    objHelpDeskDALDataContext.SubmitChanges();
                }
            }
        }
Exemplo n.º 5
0
        private void UploadFileCommentEdit(int intDetailID)
        {
            HelpDeskDALDataContext objHelpDeskDALDataContext = new HelpDeskDALDataContext();

            string strUploFilesPath = (from HelpDesk_Settings in objHelpDeskDALDataContext.HelpDesk_Settings
                                           where HelpDesk_Settings.PortalID == PortalId
                                           where HelpDesk_Settings.SettingName == "UploFilesPath"
                                           select HelpDesk_Settings).FirstOrDefault().SettingValue;

            EnsureDirectory(new System.IO.DirectoryInfo(strUploFilesPath));
            string strfilename = Convert.ToString(intDetailID) + "_" + GetRandomPassword() + Path.GetExtension(fuAttachment.FileName).ToLower();
            strUploFilesPath = strUploFilesPath + @"\" + strfilename;
            fuAttachment.SaveAs(strUploFilesPath);

            HelpDesk_Attachment objHelpDesk_Attachment = new HelpDesk_Attachment();
            objHelpDesk_Attachment.DetailID = intDetailID;
            objHelpDesk_Attachment.FileName = strfilename;
            objHelpDesk_Attachment.OriginalFileName = fuAttachment.FileName;
            objHelpDesk_Attachment.AttachmentPath = strUploFilesPath;
            objHelpDesk_Attachment.UserID = UserId;

            objHelpDeskDALDataContext.HelpDesk_Attachments.InsertOnSubmit(objHelpDesk_Attachment);
            objHelpDeskDALDataContext.SubmitChanges();

            // Insert Log
			Log.InsertLog(TaskID, UserId, String.Format(Localization.GetString ("UploadedFile.Text.", LocalResourceFile), GetUserName(), fuAttachment.FileName));
        }
Exemplo n.º 6
0
        // Display Ticket Data

        #region DisplayTicketData
        private void DisplayTicketData()
        {
            HelpDeskDALDataContext objHelpDeskDALDataContext = new HelpDeskDALDataContext();

            HelpDesk_Task objHelpDesk_Tasks = (from HelpDesk_Tasks in objHelpDeskDALDataContext.HelpDesk_Tasks
                                                       where HelpDesk_Tasks.TaskID == Convert.ToInt32(Request.QueryString["TaskID"])
                                                       select HelpDesk_Tasks).FirstOrDefault();

            // Name is editable only if user is Anonymous
            if (objHelpDesk_Tasks.RequesterUserID == -1)
            {
                txtEmail.Visible = true;
                txtName.Visible = true;
                lblEmail.Visible = false;
                lblName.Visible = false;
                txtEmail.Text = objHelpDesk_Tasks.RequesterEmail;
                txtName.Text = objHelpDesk_Tasks.RequesterName;
            }
            else
            {
                txtEmail.Visible = false;
                txtName.Visible = false;
                lblEmail.Visible = true;
                lblName.Visible = true;


				UserInfo objRequester = //UserController.GetUser(PortalId, objHelpDesk_Tasks.RequesterUserID, false);
					UserController.GetUserById (PortalId, objHelpDesk_Tasks.RequesterUserID);

                if (objRequester != null)
                {
					lblEmail.Text = objRequester.Email; // UserController.GetUser(PortalId, objHelpDesk_Tasks.RequesterUserID, false).Email;
					lblName.Text = objRequester.DisplayName; // UserController.GetUser(PortalId, objHelpDesk_Tasks.RequesterUserID, false).DisplayName;
                }
                else
                {
                    lblName.Text = "[User Deleted]";
                }
            }

            lblTask.Text = objHelpDesk_Tasks.TaskID.ToString();
            lblCreated.Text = String.Format(Localization.GetString("Created.Text", LocalResourceFile), objHelpDesk_Tasks.CreatedDate.ToShortDateString(), objHelpDesk_Tasks.CreatedDate.ToShortTimeString());
            ddlStatus.SelectedValue = objHelpDesk_Tasks.Status;
            ddlPriority.SelectedValue = objHelpDesk_Tasks.Priority;
            txtDescription.Text = objHelpDesk_Tasks.Description;
            txtPhone.Text = objHelpDesk_Tasks.RequesterPhone;
            txtDueDate.Text = (objHelpDesk_Tasks.DueDate.HasValue) ? objHelpDesk_Tasks.DueDate.Value.ToShortDateString() : "";
            txtStart.Text = (objHelpDesk_Tasks.EstimatedStart.HasValue) ? objHelpDesk_Tasks.EstimatedStart.Value.ToShortDateString() : "";
            txtComplete.Text = (objHelpDesk_Tasks.EstimatedCompletion.HasValue) ? objHelpDesk_Tasks.EstimatedCompletion.Value.ToShortDateString() : "";
            txtEstimate.Text = (objHelpDesk_Tasks.EstimatedHours.HasValue) ? objHelpDesk_Tasks.EstimatedHours.Value.ToString() : "";

            ListItem TmpRoleListItem = ddlAssigned.Items.FindByValue(objHelpDesk_Tasks.AssignedRoleID.ToString());
            if (TmpRoleListItem == null)
            {
                // Value was not found so add it
                RoleController objRoleController = new RoleController();
                RoleInfo objRoleInfo = objRoleController.GetRole(objHelpDesk_Tasks.AssignedRoleID, PortalId);

                if (objRoleInfo != null)
                {
                    ListItem RoleListItem = new ListItem();
                    RoleListItem.Text = objRoleInfo.RoleName;
                    RoleListItem.Value = objHelpDesk_Tasks.AssignedRoleID.ToString();
                    ddlAssigned.Items.Add(RoleListItem);

                    ddlAssigned.SelectedValue = objHelpDesk_Tasks.AssignedRoleID.ToString();
                }
                else
                {
                    // Role no longer exists in Portal
                    ddlAssigned.SelectedValue = "-1";
                }
            }
            else
            {
                // The Value already exists so set it
                ddlAssigned.SelectedValue = objHelpDesk_Tasks.AssignedRoleID.ToString();
            }
        }
Exemplo n.º 7
0
        private void SaveTags(int intTaskID)
        {
            HelpDeskDALDataContext objHelpDeskDALDataContext = new HelpDeskDALDataContext();

            var ExistingTaskCategories = from HelpDesk_TaskCategories in objHelpDeskDALDataContext.HelpDesk_TaskCategories
                                         where HelpDesk_TaskCategories.TaskID == intTaskID
                                         select HelpDesk_TaskCategories;

            // Delete all existing TaskCategories
            if (ExistingTaskCategories != null)
            {
                objHelpDeskDALDataContext.HelpDesk_TaskCategories.DeleteAllOnSubmit(ExistingTaskCategories);
                objHelpDeskDALDataContext.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)
                {
                    HelpDesk_TaskCategory objHelpDesk_TaskCategory = new HelpDesk_TaskCategory();

                    objHelpDesk_TaskCategory.TaskID = intTaskID;
                    objHelpDesk_TaskCategory.CategoryID = Convert.ToInt32(node.Value);

                    objHelpDeskDALDataContext.HelpDesk_TaskCategories.InsertOnSubmit(objHelpDesk_TaskCategory);
                    objHelpDeskDALDataContext.SubmitChanges();
                }
            }
        }
Exemplo n.º 8
0
        private void LoadRolesDropDown()
        {
            RoleController objRoleController = new RoleController();
            HelpDeskDALDataContext objHelpDeskDALDataContext = new HelpDeskDALDataContext();

            List<HelpDesk_Role> colHelpDesk_Roles = (from HelpDesk_Roles in objHelpDeskDALDataContext.HelpDesk_Roles
                                                             where HelpDesk_Roles.PortalID == PortalId
                                                             select HelpDesk_Roles).ToList();

            // Create a ListItemCollection to hold the Roles 
            ListItemCollection colListItemCollection = new ListItemCollection();

            // Add the Roles to the List
            foreach (HelpDesk_Role objHelpDesk_Role in colHelpDesk_Roles)
            {
                try
                {
                    RoleInfo objRoleInfo = objRoleController.GetRole(Convert.ToInt32(objHelpDesk_Role.RoleID), PortalId);

                    ListItem RoleListItem = new ListItem();
                    RoleListItem.Text = objRoleInfo.RoleName;
                    RoleListItem.Value = objHelpDesk_Role.RoleID.ToString();
                    ddlAssigned.Items.Add(RoleListItem);
                }
                catch
                {
                    // Role no longer exists in Portal
                    ListItem RoleListItem = new ListItem();
                    RoleListItem.Text = Localization.GetString("DeletedRole.Text", LocalResourceFile);
                    RoleListItem.Value = objHelpDesk_Role.RoleID.ToString();
                    ddlAssigned.Items.Add(RoleListItem);
                }
            }

            // Add UnAssigned
            ListItem UnassignedRoleListItem = new ListItem();
            UnassignedRoleListItem.Text = Localization.GetString("Unassigned.Text", LocalResourceFile);
            UnassignedRoleListItem.Value = "-1";
            ddlAssigned.Items.Add(UnassignedRoleListItem);

        }
Exemplo n.º 9
0
        private List<HelpDesk_Setting> GetSettings()
        {
            // Get Settings
            HelpDeskDALDataContext objHelpDeskDALDataContext = new HelpDeskDALDataContext();

            List<HelpDesk_Setting> colHelpDesk_Setting = (from HelpDesk_Settings in objHelpDeskDALDataContext.HelpDesk_Settings
                                                                  where HelpDesk_Settings.PortalID == PortalId
                                                                  select HelpDesk_Settings).ToList();

            if (colHelpDesk_Setting.Count == 0)
            {
                // Create Default vaules
                HelpDesk_Setting objHelpDesk_Setting1 = new HelpDesk_Setting();

                objHelpDesk_Setting1.PortalID = PortalId;
                objHelpDesk_Setting1.SettingName = "AdminRole";
                objHelpDesk_Setting1.SettingValue = "Administrators";

                objHelpDeskDALDataContext.HelpDesk_Settings.InsertOnSubmit(objHelpDesk_Setting1);
                objHelpDeskDALDataContext.SubmitChanges();

                HelpDesk_Setting objHelpDesk_Setting2 = new HelpDesk_Setting();

                objHelpDesk_Setting2.PortalID = PortalId;
                objHelpDesk_Setting2.SettingName = "UploFilesPath";
				objHelpDesk_Setting2.SettingValue = Server.MapPath("~/DesktopModules/R7.HelpDesk/R7.HelpDesk/Upload");

                objHelpDeskDALDataContext.HelpDesk_Settings.InsertOnSubmit(objHelpDesk_Setting2);
                objHelpDeskDALDataContext.SubmitChanges();

                colHelpDesk_Setting = (from HelpDesk_Settings in objHelpDeskDALDataContext.HelpDesk_Settings
                                           where HelpDesk_Settings.PortalID == PortalId
                                           select HelpDesk_Settings).ToList();
            }

            return colHelpDesk_Setting;
        }
Exemplo n.º 10
0
        protected void LDSComments_Selecting(object sender, LinqDataSourceSelectEventArgs e)
        {
            HelpDeskDALDataContext objHelpDeskDALDataContext = new HelpDeskDALDataContext();
            var result = from HelpDesk_TaskDetails in objHelpDeskDALDataContext.HelpDesk_TaskDetails
                         where HelpDesk_TaskDetails.TaskID == TaskID
                         where (HelpDesk_TaskDetails.DetailType == "Comment" || HelpDesk_TaskDetails.DetailType == "Comment-Visible")
                         select HelpDesk_TaskDetails;

            // If View only mode
            if (ViewOnly)
            {
                result = from TaskDetails in result
                         where TaskDetails.DetailType == "Comment-Visible"
                         select TaskDetails;
            }

            e.Result = result;
        }
Exemplo n.º 11
0
        private bool UserIsRequestor()
        {
            bool isRequestor = false;

            HelpDeskDALDataContext objHelpDeskDALDataContext = new HelpDeskDALDataContext();
            var result = from HelpDesk_TaskDetails in objHelpDeskDALDataContext.HelpDesk_Tasks
                         where HelpDesk_TaskDetails.TaskID == Convert.ToInt32(Request.QueryString["TaskID"])
                         select HelpDesk_TaskDetails;

            if (result != null)
            {
                if (UserId == result.FirstOrDefault().RequesterUserID)
                {
                    isRequestor = true;
                }
            }

            return isRequestor;
        }
Exemplo n.º 12
0
        private string GetAdminRole()
        {
            HelpDeskDALDataContext objHelpDeskDALDataContext = new HelpDeskDALDataContext();

            List<HelpDesk_Setting> colHelpDesk_Setting = (from HelpDesk_Settings in objHelpDeskDALDataContext.HelpDesk_Settings
                                                                  where HelpDesk_Settings.PortalID == PortalId
                                                                  select HelpDesk_Settings).ToList();

            HelpDesk_Setting objHelpDesk_Setting = colHelpDesk_Setting.Where(x => x.SettingName == "AdminRole").FirstOrDefault();

            string strAdminRoleID = "Administrators";
            if (objHelpDesk_Setting != null)
            {
                strAdminRoleID = objHelpDesk_Setting.SettingValue;
            }

            return strAdminRoleID;
        }
Exemplo n.º 13
0
        private void InsertComment()
        {
            // Validate file upload
            if (TicketFileUpload.HasFile)
            {
               /*if (
                    string.Compare(Path.GetExtension(TicketFileUpload.FileName).ToLower(), ".gif", true) != 0
                    & string.Compare(Path.GetExtension(TicketFileUpload.FileName).ToLower(), ".jpg", true) != 0
                    & string.Compare(Path.GetExtension(TicketFileUpload.FileName).ToLower(), ".jpeg", true) != 0
                    & string.Compare(Path.GetExtension(TicketFileUpload.FileName).ToLower(), ".doc", true) != 0
                    & string.Compare(Path.GetExtension(TicketFileUpload.FileName).ToLower(), ".docx", true) != 0
                    & string.Compare(Path.GetExtension(TicketFileUpload.FileName).ToLower(), ".xls", true) != 0
                    & string.Compare(Path.GetExtension(TicketFileUpload.FileName).ToLower(), ".xlsx", true) != 0
                    & string.Compare(Path.GetExtension(TicketFileUpload.FileName).ToLower(), ".pdf", true) != 0
                    )*/
				if(!Utils.IsFileAllowed(TicketFileUpload.FileName))
                {
					lblError.Text = Localization.GetString ("FileExtensionIsNotAllowed.Text", LocalResourceFile);
                    // lblError.Text = "Only .gif, .jpg, .jpeg, .doc, .docx, .xls, .xlsx, .pdf files may be used.";
                    return;
                }
            }

            if (txtComment.Text.Trim().Length > 0)
            {
                HelpDeskDALDataContext objHelpDeskDALDataContext = new HelpDeskDALDataContext();

                string strComment = txtComment.Text.Trim();

                // Save Task Details
                HelpDesk_TaskDetail objHelpDesk_TaskDetail = new HelpDesk_TaskDetail();

                objHelpDesk_TaskDetail.TaskID = TaskID;
                objHelpDesk_TaskDetail.Description = txtComment.Text.Trim();
                objHelpDesk_TaskDetail.InsertDate = DateTime.Now;
                objHelpDesk_TaskDetail.UserID = UserId;

                if (chkCommentVisible.Checked)
                {
                    objHelpDesk_TaskDetail.DetailType = "Comment-Visible";
                }
                else
                {
                    objHelpDesk_TaskDetail.DetailType = "Comment";
                }

                objHelpDeskDALDataContext.HelpDesk_TaskDetails.InsertOnSubmit(objHelpDesk_TaskDetail);
                objHelpDeskDALDataContext.SubmitChanges();
                txtComment.Text = "";

                // Insert Log
				Log.InsertLog(TaskID, UserId, String.Format(Localization.GetString ("InsertedComment.Text", LocalResourceFile), GetUserName()));

                // Upload the File
                if (TicketFileUpload.HasFile)
                {
                    UploadFile(objHelpDesk_TaskDetail.DetailID);
                    // Insert Log
					Log.InsertLog(TaskID, UserId, String.Format(Localization.GetString ("UploadedFile.Text", LocalResourceFile), GetUserName(), TicketFileUpload.FileName));
                }

                if (UserIsRequestor())
                {
                    NotifyAssignedGroupOfComment(strComment);
                }

                gvComments.DataBind();
            }
        }
Exemplo n.º 14
0
        private List<HelpDesk_Setting> GetSettings()
        {
            // Get Settings
            HelpDeskDALDataContext objHelpDeskDALDataContext = new HelpDeskDALDataContext();

            List<HelpDesk_Setting> colHelpDesk_Setting = (from HelpDesk_Settings in objHelpDeskDALDataContext.HelpDesk_Settings
                                                                  where HelpDesk_Settings.PortalID == PortalId
                                                                  select HelpDesk_Settings).ToList();

            if (colHelpDesk_Setting.Count == 0)
            {
                // Create Default vaules
                HelpDesk_Setting objHelpDesk_Setting1 = new HelpDesk_Setting();

                objHelpDesk_Setting1.PortalID = PortalId;
                objHelpDesk_Setting1.SettingName = "AdminRole";
                objHelpDesk_Setting1.SettingValue = "Administrators";

                objHelpDeskDALDataContext.HelpDesk_Settings.InsertOnSubmit(objHelpDesk_Setting1);
                objHelpDeskDALDataContext.SubmitChanges();

                HelpDesk_Setting objHelpDesk_Setting2 = new HelpDesk_Setting();

                objHelpDesk_Setting2.PortalID = PortalId;
                objHelpDesk_Setting2.SettingName = "UploFilesPath";
				objHelpDesk_Setting2.SettingValue = Server.MapPath("~/DesktopModules/R7.HelpDesk/R7.HelpDesk/Upload");

                objHelpDeskDALDataContext.HelpDesk_Settings.InsertOnSubmit(objHelpDesk_Setting2);
                objHelpDeskDALDataContext.SubmitChanges();

                colHelpDesk_Setting = (from HelpDesk_Settings in objHelpDeskDALDataContext.HelpDesk_Settings
                                           where HelpDesk_Settings.PortalID == PortalId
                                           select HelpDesk_Settings).ToList();
            }

            // Upload Permission
            HelpDesk_Setting UploadPermissionHelpDesk_Setting = (from HelpDesk_Settings in objHelpDeskDALDataContext.HelpDesk_Settings
                                                                         where HelpDesk_Settings.PortalID == PortalId
                                                                         where HelpDesk_Settings.SettingName == "UploadPermission"
                                                                         select HelpDesk_Settings).FirstOrDefault();

            if (UploadPermissionHelpDesk_Setting != null)
            {
                // Add to collection
                colHelpDesk_Setting.Add(UploadPermissionHelpDesk_Setting);
            }
            else
            {
                // Add Default value
                HelpDesk_Setting objHelpDesk_Setting = new HelpDesk_Setting();
                objHelpDesk_Setting.SettingName = "UploadPermission";
                objHelpDesk_Setting.SettingValue = "All";
                objHelpDesk_Setting.PortalID = PortalId;
                objHelpDeskDALDataContext.HelpDesk_Settings.InsertOnSubmit(objHelpDesk_Setting);
                objHelpDeskDALDataContext.SubmitChanges();

                // Add to collection
                colHelpDesk_Setting.Add(objHelpDesk_Setting);
            }

            return colHelpDesk_Setting;
        }
Exemplo n.º 15
0
        private string GetDescriptionOfTicket()
        {
            string strDescription = "";
            int intTaskId = Convert.ToInt32(Request.QueryString["TaskID"]);

            HelpDeskDALDataContext objHelpDeskDALDataContext = new HelpDeskDALDataContext();
            var result = (from HelpDesk_TaskDetails in objHelpDeskDALDataContext.HelpDesk_Tasks
                          where HelpDesk_TaskDetails.TaskID == Convert.ToInt32(Request.QueryString["TaskID"])
                          select HelpDesk_TaskDetails).FirstOrDefault();

            if (result != null)
            {
                strDescription = result.Description;
            }

            return strDescription;
        }
Exemplo n.º 16
0
        private void DisplayCategoryTree()
        {
            if (UserInfo.IsInRole(GetAdminRole()) || UserInfo.IsInRole("Administrators") || UserInfo.IsSuperUser)
            {
                TagsTree.Visible = true;
                TagsTree.TagID = -1;
                TagsTree.DisplayType = "Administrator";
                TagsTree.Expand = false;

                TagsTreeExistingTasks.Visible = true;
                TagsTreeExistingTasks.TagID = -1;
                TagsTreeExistingTasks.DisplayType = "Administrator";
                TagsTreeExistingTasks.Expand = false;
            }
            else
            {
                TagsTree.Visible = true;
                TagsTree.TagID = -1;
                TagsTree.DisplayType = "Requestor";
                TagsTree.Expand = false;

                TagsTreeExistingTasks.Visible = true;
                TagsTreeExistingTasks.TagID = -1;
                TagsTreeExistingTasks.DisplayType = "Requestor";
                TagsTreeExistingTasks.Expand = false;
            }

            // Only Logged in users can have saved Categories in the Tag tree
            if ((UserId > -1) && (SearchCriteria.Categories != null))
            {
                if (SearchCriteria.Categories.Trim() != "")
                {
                    char[] delimiterChars = { ',' };
                    string[] ArrStrCategories = SearchCriteria.Categories.Split(delimiterChars);
                    // Convert the Categories selected from the Tags tree to an array of integers
                    int?[] ArrIntHelpDesk = Array.ConvertAll<string, int?>(ArrStrCategories, new Converter<string, int?>(ConvertStringToNullableInt));

                    TagsTreeExistingTasks.SelectedCategories = ArrIntHelpDesk;
                }
            }

            // Set visibility of Tags
            bool RequestorR7_HelpDesk = (TagsTreeExistingTasks.DisplayType == "Administrator") ? false : true;
            HelpDeskDALDataContext objHelpDeskDALDataContext = new HelpDeskDALDataContext();

            int CountOfHelpDesk = (from WebserverCategories in CategoriesTable.GetCategoriesTable(PortalId, RequestorR7_HelpDesk)
                                     where WebserverCategories.PortalID == PortalId
                                     where WebserverCategories.Level == 1
                                     select WebserverCategories).Count();

            imgTags.Visible = (CountOfHelpDesk > 0);
            img2Tags.Visible = (CountOfHelpDesk > 0);
            lblCheckTags.Visible = (CountOfHelpDesk > 0);
            lblSearchTags.Visible = (CountOfHelpDesk > 0);
        }
Exemplo n.º 17
0
        private void NotifyRequestorOfComment(string strComment)
        {
            string strEmail = GetEmailOfRequestor();

            if (strEmail != "")
            {
                HelpDeskDALDataContext objHelpDeskDALDataContext = new HelpDeskDALDataContext();

                var result = (from HelpDesk_TaskDetails in objHelpDeskDALDataContext.HelpDesk_Tasks
                              where HelpDesk_TaskDetails.TaskID == Convert.ToInt32(Request.QueryString["TaskID"])
                              select HelpDesk_TaskDetails).FirstOrDefault();

                if (result != null)
                {
                    string strLinkUrl = "";
                    if (result.RequesterUserID > -1)
                    {
                        // This is a registred User / Provide link to ticket
                        strLinkUrl = Utils.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 = Utils.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));

                }
            }
        }
Exemplo n.º 18
0
        // File upload

        #region UploadFile
        private void UploadFile(int intDetailID)
        {
            HelpDeskDALDataContext objHelpDeskDALDataContext = new HelpDeskDALDataContext();

            string strUploFilesPath = (from HelpDesk_Settings in objHelpDeskDALDataContext.HelpDesk_Settings
                                           where HelpDesk_Settings.PortalID == PortalId
                                           where HelpDesk_Settings.SettingName == "UploFilesPath"
                                           select HelpDesk_Settings).FirstOrDefault().SettingValue;

            EnsureDirectory(new System.IO.DirectoryInfo(strUploFilesPath));
            string strfilename = Convert.ToString(intDetailID) + "_" + GetRandomPassword() + Path.GetExtension(TicketFileUpload.FileName).ToLower();
            strUploFilesPath = strUploFilesPath + @"\" + strfilename;
            TicketFileUpload.SaveAs(strUploFilesPath);

            HelpDesk_Attachment objHelpDesk_Attachment = new HelpDesk_Attachment();
            objHelpDesk_Attachment.DetailID = intDetailID;
            objHelpDesk_Attachment.FileName = strfilename;
            objHelpDesk_Attachment.OriginalFileName = TicketFileUpload.FileName;
            objHelpDesk_Attachment.AttachmentPath = strUploFilesPath;
            objHelpDesk_Attachment.UserID = UserId;

            objHelpDeskDALDataContext.HelpDesk_Attachments.InsertOnSubmit(objHelpDesk_Attachment);
            objHelpDeskDALDataContext.SubmitChanges();
        }
Exemplo n.º 19
0
        private int GetAssignedRole()
        {
            int intRole = -1;

            HelpDeskDALDataContext objHelpDeskDALDataContext = new HelpDeskDALDataContext();
            var result = from HelpDesk_TaskDetails in objHelpDeskDALDataContext.HelpDesk_Tasks
                         where HelpDesk_TaskDetails.TaskID == Convert.ToInt32(Request.QueryString["TaskID"])
                         select HelpDesk_TaskDetails;

            if (result != null)
            {
                intRole = result.FirstOrDefault().AssignedRoleID;
            }

            return intRole;
        }
Exemplo n.º 20
0
        private void DisplayComment()
        {
            HelpDeskDALDataContext objHelpDeskDALDataContext = new HelpDeskDALDataContext();

            var objHelpDesk_TaskDetail = (from HelpDesk_TaskDetails in objHelpDeskDALDataContext.HelpDesk_TaskDetails
                                              where HelpDesk_TaskDetails.DetailID == Convert.ToInt32(lblDetailID.Text)
                                              select HelpDesk_TaskDetails).FirstOrDefault();

            if (objHelpDesk_TaskDetail != null)
            {
                txtDescription.Text = objHelpDesk_TaskDetail.Description;
                lblDisplayUser.Text = GetUserName(objHelpDesk_TaskDetail.UserID);
                lblInsertDate.Text = String.Format("{0} {1}", objHelpDesk_TaskDetail.InsertDate.ToLongDateString(), objHelpDesk_TaskDetail.InsertDate.ToLongTimeString());
                chkCommentVisibleEdit.Checked = (objHelpDesk_TaskDetail.DetailType == "Comment") ? false : true;

                if (!ViewOnly)
                {
                    ImgEmailUser.Visible = (objHelpDesk_TaskDetail.DetailType == "Comment") ? false : true;
                    lnkUpdateRequestor.Visible = (objHelpDesk_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;
                    ImgEmailUser.Visible = chkCommentVisibleEdit.Checked;
                }

                if (objHelpDesk_TaskDetail.HelpDesk_Attachments.Count > 0)
                {
                    // There is a atachment
                    pnlAttachFile.Visible = false;
                    pnlDisplayFile.Visible = true;

                    lnkFileAttachment.Text = objHelpDesk_TaskDetail.HelpDesk_Attachments.FirstOrDefault().OriginalFileName;
					lnkFileAttachment.CommandArgument = objHelpDesk_TaskDetail.HelpDesk_Attachments.FirstOrDefault().AttachmentID.ToString();
					/*
					#region Attachment URL 


					var commandArgument  = objHelpDesk_TaskDetail.HelpDesk_Attachments.FirstOrDefault().AttachmentID.ToString();

					var objHelpDesk_Attachment = objHelpDesk_TaskDetail.HelpDesk_Attachments.FirstOrDefault();

					if (objHelpDesk_Attachment != null)
					{
						var strPath = objHelpDesk_Attachment.AttachmentPath;
						var strOriginalFileName = objHelpDesk_Attachment.OriginalFileName;


						lnkFileAttachment.Visible = true;
						lnkFileAttachment.NavigateUrl = "/DesktopModules/R7.HelpDesk/R7.HelpDesk/Upload/" + 
					}
					else
						lnkFileAttachment.Visible = false;
                    
					#endregion */
				}
                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;
                    }
                }
            }
        }
Exemplo n.º 21
0
        // Utility

        #region GetEmailOfRequestor
        private string GetEmailOfRequestor()
        {
            string strEmail = "";
            int intTaskId = Convert.ToInt32(Request.QueryString["TaskID"]);

            HelpDeskDALDataContext objHelpDeskDALDataContext = new HelpDeskDALDataContext();
            var result = (from HelpDesk_TaskDetails in objHelpDeskDALDataContext.HelpDesk_Tasks
                          where HelpDesk_TaskDetails.TaskID == Convert.ToInt32(Request.QueryString["TaskID"])
                          select HelpDesk_TaskDetails).FirstOrDefault();

            if (result != null)
            {
                if (result.RequesterUserID == -1)
                {
                    try
                    {
                        strEmail = result.RequesterEmail;
                    }
                    catch (Exception)
                    {
                        // User no longer exists
                        strEmail = "";
                    }
                }
                else
                {
                    try
                    {
                        strEmail = //UserController.GetUser(PortalId, result.RequesterUserID, false).Email;
							UserController.GetUserById(PortalId, result.RequesterUserID).Email;
                    }
                    catch (Exception)
                    {
                        // User no longer exists
                        strEmail = "";
                    }
                }
            }

            return strEmail;
        }
Exemplo n.º 22
0
        protected void lnkFileAttachment_Click(object sender, EventArgs e)
        {
            HelpDeskDALDataContext objHelpDeskDALDataContext = new HelpDeskDALDataContext();

            var objHelpDesk_Attachment = (from HelpDesk_Attachments in objHelpDeskDALDataContext.HelpDesk_Attachments
                                              where HelpDesk_Attachments.AttachmentID == Convert.ToInt32(lnkFileAttachment.CommandArgument)
                                              select HelpDesk_Attachments).FirstOrDefault();

            if (objHelpDesk_Attachment != null)
            {
                string strPath = objHelpDesk_Attachment.AttachmentPath;
                string strOriginalFileName = objHelpDesk_Attachment.OriginalFileName;

                try
                {
					Response.Clear();
					//Respons.ClearHeaders();
					//Response.HeaderEncoding = System.Text.Encoding.UTF8;

					// Patch info from here:
					// http://gordievskiy.blogspot.ru/2009/12/content-disposition-attachment-filename.html
					var attachmentFilename = strOriginalFileName;

					//attachmentFilename = Request.Browser.Browser;

					if (Request.Browser.Browser.Contains("MSIE") || Request.Browser.Browser.StartsWith("IE"))
					{
						attachmentFilename = Server.UrlEncode(attachmentFilename);
						if (!string.IsNullOrEmpty(attachmentFilename)) 
							attachmentFilename = attachmentFilename.Replace("+", "%20");
					}   
					Response.AddHeader("content-disposition", string.Format("attachment; filename=\"{0}\"", attachmentFilename));

                    //Response.ClearContent();
                    Response.ContentEncoding = System.Text.Encoding.UTF8;
                    Response.ContentType = Utils.GetMimeType(Path.GetExtension(strPath).ToLower());

                    var sourceFile = new FileStream(strPath, FileMode.Open, FileAccess.Read, FileShare.Read);
					var fileSize = (int)sourceFile.Length;
					//var reader = new BinaryReader(sourceFile);
                    
					/*
					// read by 4k blocks
					const int blockSize = 4096;
					var buffer = new byte[blockSize];
					int bytesRead;
					var bytesLeft = (int)sourceFile.Length;

					do
					{
						bytesRead =	sourceFile.Read(buffer, 0, (bytesLeft > blockSize)? blockSize : bytesLeft);
						if (bytesRead > 0)
						{
							bytesLeft -= bytesRead;
							if (bytesRead < blockSize)
								Array.Resize<byte>(ref buffer, bytesRead);
							Response.BinaryWrite(buffer);
						}
					} while (bytesLeft >= 0);
 					sourceFile.Close();
					*/

					var data = new byte[fileSize];
					sourceFile.Read(data, 0, fileSize);
                    sourceFile.Close();

                    Response.BinaryWrite(data);
					Response.Flush();
                    Response.Close();

                }
                catch (Exception ex)
                {
					// lblError.Text = ex.Message + "<br />" + ex.StackTrace; 
					Response.Clear();
					Response.Write (ex.Message + "<br />" + ex.StackTrace);
					Response.Flush();
					Response.Close();
                }
            }
        }
Exemplo n.º 23
0
        private bool CheckSecurity()
        {
            bool boolPassedSecurity = false;
            HelpDeskDALDataContext objHelpDeskDALDataContext = new HelpDeskDALDataContext();

            HelpDesk_Task objHelpDesk_Tasks = (from HelpDesk_Tasks in objHelpDeskDALDataContext.HelpDesk_Tasks
                                                       where HelpDesk_Tasks.TaskID == Convert.ToInt32(Request.QueryString["TaskID"])
                                                       select HelpDesk_Tasks).FirstOrDefault();
            if (objHelpDesk_Tasks == null)
            {
                pnlEditTask.Visible = false;
                Response.Redirect(DotNetNuke.Common.Globals.NavigateURL());
            }

            // User not logged in
            if (UserId == -1)
            {
                // Must have the valid password
                if (Request.QueryString["TP"] != null)
                {
                    // Check the password for this Ticket
                    if (objHelpDesk_Tasks.TicketPassword == Convert.ToString(Request.QueryString["TP"]))
                    {
                        boolPassedSecurity = true;
                    }
                    else
                    {
                        boolPassedSecurity = false;
                    }
                }
            }

            // User is logged in
            if (UserId > -1)
            {
                // Is user an Admin?
                string strAdminRoleID = GetAdminRole();
                if (UserInfo.IsInRole(strAdminRoleID) || UserInfo.IsInRole("Administrators") || UserInfo.IsSuperUser)
                {
                    boolPassedSecurity = true;
                    CommentsControl.ViewOnly = false;
                }

                // Is user the Requestor?
                if (UserId == objHelpDesk_Tasks.RequesterUserID)
                {
                    boolPassedSecurity = true;
                }

                //Is user in the Assigned Role?
                RoleController objRoleController = new RoleController();
                RoleInfo objRoleInfo = objRoleController.GetRole(objHelpDesk_Tasks.AssignedRoleID, PortalId);
                if (objRoleInfo != null)
                {
                    if (UserInfo.IsInRole(objRoleInfo.RoleName))
                    {
                        boolPassedSecurity = true;
                        CommentsControl.ViewOnly = false;
                    }
                }

                // Does user have a valid temporary password?
                if (Request.QueryString["TP"] != null)
                {
                    // Check the password for this Ticket
                    if (objHelpDesk_Tasks.TicketPassword == Convert.ToString(Request.QueryString["TP"]))
                    {
                        boolPassedSecurity = true;
                    }
                    else
                    {
                        boolPassedSecurity = false;
                    }
                }
            }

            return boolPassedSecurity;
        }
Exemplo n.º 24
0
        protected void lnkDelete_Click(object sender, EventArgs e)
        {
            HelpDeskDALDataContext objHelpDeskDALDataContext = new HelpDeskDALDataContext();

            var objHelpDesk_TaskDetail = (from HelpDesk_TaskDetails in objHelpDeskDALDataContext.HelpDesk_TaskDetails
                                              where HelpDesk_TaskDetails.DetailID == Convert.ToInt32(lblDetailID.Text)
                                              select HelpDesk_TaskDetails).FirstOrDefault();

            // Delete any Attachments
            if (objHelpDesk_TaskDetail.HelpDesk_Attachments.Count > 0)
            {
                HelpDesk_Attachment objHelpDesk_Attachment = objHelpDesk_TaskDetail.HelpDesk_Attachments.FirstOrDefault();
                string strOriginalFileName = objHelpDesk_Attachment.OriginalFileName;
                string strFile = objHelpDesk_Attachment.AttachmentPath;

                try
                {
                    // Delete file
                    if (strFile != "")
                    {
                        File.Delete(strFile);
                    }
                }
                catch (Exception exc)
                {
                    Exceptions.ProcessModuleLoadException(this, exc);
                }

                objHelpDeskDALDataContext.HelpDesk_Attachments.DeleteOnSubmit(objHelpDesk_Attachment);
                objHelpDeskDALDataContext.SubmitChanges();

                // Insert Log
				Log.InsertLog(TaskID, UserId, String.Format(Localization.GetString ("DeletedFile.Text", LocalResourceFile), GetUserName(), strOriginalFileName));
            }

            // Delete the Record
            objHelpDeskDALDataContext.HelpDesk_TaskDetails.DeleteOnSubmit(objHelpDesk_TaskDetail);
            objHelpDeskDALDataContext.SubmitChanges();

            // Insert Log
			Log.InsertLog(TaskID, UserId, String.Format(Localization.GetString ("DeletedComment.Text", LocalResourceFile), GetUserName(), txtDescription.Text));

            SetView("Default");
            gvComments.DataBind();
        }
Exemplo n.º 25
0
        // Tags

        #region DisplayCategoryTree
        private void DisplayCategoryTree()
        {
            bool boolUserAssignedToTask = false;
            HelpDeskDALDataContext objHelpDeskDALDataContext = new HelpDeskDALDataContext();

            HelpDesk_Task objHelpDesk_Tasks = (from HelpDesk_Tasks in objHelpDeskDALDataContext.HelpDesk_Tasks
                                                       where HelpDesk_Tasks.TaskID == Convert.ToInt32(Request.QueryString["TaskID"])
                                                       select HelpDesk_Tasks).FirstOrDefault();

            //Is user in the Assigned Role?
            RoleController objRoleController = new RoleController();
            RoleInfo objRoleInfo = objRoleController.GetRole(objHelpDesk_Tasks.AssignedRoleID, PortalId);

            if (objRoleInfo != null)
            {
                if (UserInfo.IsInRole(objRoleInfo.RoleName))
                {
                    boolUserAssignedToTask = true;
                }
            }

            if (boolUserAssignedToTask || UserInfo.IsInRole(GetAdminRole()) || UserInfo.IsInRole("Administrators") || UserInfo.IsSuperUser)
            {
                // Show all Tags
                TagsTreeExistingTasks.Visible = true;
                TagsTreeExistingTasks.TagID = Convert.ToInt32(Request.QueryString["TaskID"]);
                TagsTreeExistingTasks.DisplayType = "Administrator";
                TagsTreeExistingTasks.Expand = false;
            }
            else
            {
                // Show only Visible Tags
                TagsTreeExistingTasks.Visible = true;
                TagsTreeExistingTasks.TagID = Convert.ToInt32(Request.QueryString["TaskID"]);
                TagsTreeExistingTasks.DisplayType = "Requestor";
                TagsTreeExistingTasks.Expand = false;
            }

            // Select Existing values
            if (objHelpDesk_Tasks.HelpDesk_TaskCategories.Select(x => x.CategoryID).ToArray<int>().Count() > 0)
            {
                int[] ArrStrCategories = objHelpDesk_Tasks.HelpDesk_TaskCategories.Select(x => x.CategoryID).ToArray<int>();
                int?[] ArrIntHelpDesk = Array.ConvertAll<int, int?>(ArrStrCategories, new Converter<int, int?>(ConvertToNullableInt));

                TagsTreeExistingTasks.SelectedCategories = ArrIntHelpDesk;
            }

            // Set visibility of Tags
            bool RequestorR7_HelpDesk = (TagsTreeExistingTasks.DisplayType == "Administrator") ? false : true;

            int CountOfHelpDesk = (from WebserverCategories in CategoriesTable.GetCategoriesTable(PortalId, RequestorR7_HelpDesk)
                                     where WebserverCategories.PortalID == PortalId
                                     where WebserverCategories.Level == 1
                                     select WebserverCategories).Count();

            imgTags.Visible = (CountOfHelpDesk > 0);
            lbltxtTags.Visible = (CountOfHelpDesk > 0);
        }
Exemplo n.º 26
0
        private void SaveLastSearchCriteria(HelpDesk_LastSearch UpdateHelpDesk_LastSearch)
        {
            HelpDeskDALDataContext objHelpDeskDALDataContext = new HelpDeskDALDataContext();

            HelpDesk_LastSearch objHelpDesk_LastSearch = (from HelpDesk_LastSearches in objHelpDeskDALDataContext.HelpDesk_LastSearches
                                                                  where HelpDesk_LastSearches.PortalID == PortalId
                                                                  where HelpDesk_LastSearches.UserID == UserId
                                                                  select HelpDesk_LastSearches).FirstOrDefault();

            if (objHelpDesk_LastSearch == null)
            {
                objHelpDesk_LastSearch = new HelpDesk_LastSearch();
                objHelpDesk_LastSearch.UserID = UserId;
                objHelpDesk_LastSearch.PortalID = PortalId;
                objHelpDeskDALDataContext.HelpDesk_LastSearches.InsertOnSubmit(objHelpDesk_LastSearch);
                objHelpDeskDALDataContext.SubmitChanges();
            }

            objHelpDesk_LastSearch.AssignedRoleID = UpdateHelpDesk_LastSearch.AssignedRoleID;
            objHelpDesk_LastSearch.Categories = UpdateHelpDesk_LastSearch.Categories;
            objHelpDesk_LastSearch.CreatedDate = UpdateHelpDesk_LastSearch.CreatedDate;
            objHelpDesk_LastSearch.SearchText = UpdateHelpDesk_LastSearch.SearchText;
            objHelpDesk_LastSearch.DueDate = UpdateHelpDesk_LastSearch.DueDate;
            objHelpDesk_LastSearch.Priority = UpdateHelpDesk_LastSearch.Priority;
            objHelpDesk_LastSearch.Status = UpdateHelpDesk_LastSearch.Status;
            objHelpDesk_LastSearch.CurrentPage = UpdateHelpDesk_LastSearch.CurrentPage;
            objHelpDesk_LastSearch.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);

            objHelpDeskDALDataContext.SubmitChanges();
        }
Exemplo n.º 27
0
        private int SaveTicketForm()
        {
            HelpDeskDALDataContext objHelpDeskDALDataContext = new HelpDeskDALDataContext();

            HelpDesk_Task objHelpDesk_Task = (from HelpDesk_Tasks in objHelpDeskDALDataContext.HelpDesk_Tasks
                                                      where HelpDesk_Tasks.TaskID == Convert.ToInt32(Request.QueryString["TaskID"])
                                                      select HelpDesk_Tasks).FirstOrDefault();

            // Save original Assigned Group
            int intOriginalAssignedGroup = objHelpDesk_Task.AssignedRoleID; 

            // Save Task
            objHelpDesk_Task.Status = ddlStatus.SelectedValue;
            objHelpDesk_Task.Description = txtDescription.Text;
            objHelpDesk_Task.PortalID = PortalId;
            objHelpDesk_Task.Priority = ddlPriority.SelectedValue;
            objHelpDesk_Task.RequesterPhone = txtPhone.Text;
            objHelpDesk_Task.AssignedRoleID = Convert.ToInt32(ddlAssigned.SelectedValue);

            // Only validate Name and email if Ticket is not for a DNN user
            // lblName will be hidden if it is not a DNN user
            if (lblName.Visible == false)
            {
                // not a DNN user
                objHelpDesk_Task.RequesterEmail = txtEmail.Text;
                objHelpDesk_Task.RequesterName = txtName.Text;
                objHelpDesk_Task.RequesterUserID = -1;
            }

            // DueDate
            if (txtDueDate.Text.Trim().Length > 1)
            {
                objHelpDesk_Task.DueDate = Convert.ToDateTime(txtDueDate.Text.Trim());
            }
            else
            {
                objHelpDesk_Task.DueDate = null;
            }

            // EstimatedStart
            if (txtStart.Text.Trim().Length > 1)
            {
                objHelpDesk_Task.EstimatedStart = Convert.ToDateTime(txtStart.Text.Trim());
            }
            else
            {
                objHelpDesk_Task.EstimatedStart = null;
            }

            // EstimatedCompletion
            if (txtComplete.Text.Trim().Length > 1)
            {
                objHelpDesk_Task.EstimatedCompletion = Convert.ToDateTime(txtComplete.Text.Trim());
            }
            else
            {
                objHelpDesk_Task.EstimatedCompletion = null;
            }

            // EstimatedHours
            if (txtEstimate.Text.Trim().Length > 0)
            {
                objHelpDesk_Task.EstimatedHours = Convert.ToInt32(txtEstimate.Text.Trim());
            }
            else
            {
                objHelpDesk_Task.EstimatedHours = null;
            }

            objHelpDeskDALDataContext.SubmitChanges();

            // Notify Assigned Group
            if (Convert.ToInt32(ddlAssigned.SelectedValue) > -1)
            {
                // Only notify if Assigned group has changed
                if (intOriginalAssignedGroup != Convert.ToInt32(ddlAssigned.SelectedValue))
                {
                    NotifyAssignedGroupOfAssignment();                    
                }
            }

            // Insert Log
            Log.InsertLog(objHelpDesk_Task.TaskID, UserId, String.Format(Localization.GetString("UpdatedTicket.Text", LocalResourceFile), UserInfo.DisplayName));

            return objHelpDesk_Task.TaskID;
        }
Exemplo n.º 28
0
        private void UpdateComment()
        {
            // Validate file upload
            if (fuAttachment.HasFile)
            {
                /*if (
                    string.Compare(Path.GetExtension(fuAttachment.FileName).ToLower(), ".gif", true) != 0
                    & string.Compare(Path.GetExtension(fuAttachment.FileName).ToLower(), ".jpg", true) != 0
                    & string.Compare(Path.GetExtension(fuAttachment.FileName).ToLower(), ".jpeg", true) != 0
                    & string.Compare(Path.GetExtension(fuAttachment.FileName).ToLower(), ".doc", true) != 0
                    & string.Compare(Path.GetExtension(fuAttachment.FileName).ToLower(), ".docx", true) != 0
                    & string.Compare(Path.GetExtension(fuAttachment.FileName).ToLower(), ".xls", true) != 0
                    & string.Compare(Path.GetExtension(fuAttachment.FileName).ToLower(), ".xlsx", true) != 0
                    & string.Compare(Path.GetExtension(fuAttachment.FileName).ToLower(), ".pdf", true) != 0
                    )*/

				if(!Utils.IsFileAllowed(TicketFileUpload.FileName))
				{
					lblError.Text = Localization.GetString ("FileExtensionIsNotAllowed.Text", LocalResourceFile);
					// lblError.Text = "Only .gif, .jpg, .jpeg, .doc, .docx, .xls, .xlsx, .pdf files may be used.";
					return;
				}
            }

			if (!string.IsNullOrWhiteSpace(txtDescription.Text))
		    // if(txtDescription.Text.Trim().Length > 0)
            {
                HelpDeskDALDataContext objHelpDeskDALDataContext = new HelpDeskDALDataContext();

                string strComment = txtDescription.Text.Trim();

                // Save Task Details
                var objHelpDesk_TaskDetail = (from HelpDesk_TaskDetails in objHelpDeskDALDataContext.HelpDesk_TaskDetails
                                                  where HelpDesk_TaskDetails.DetailID == Convert.ToInt32(lblDetailID.Text)
                                                  select HelpDesk_TaskDetails).FirstOrDefault();

                if (objHelpDesk_TaskDetail != null)
                {

                    objHelpDesk_TaskDetail.TaskID = TaskID;
                    objHelpDesk_TaskDetail.Description = txtDescription.Text.Trim();
                    objHelpDesk_TaskDetail.UserID = UserId;

                    if (chkCommentVisibleEdit.Checked)
                    {
                        objHelpDesk_TaskDetail.DetailType = "Comment-Visible";
                    }
                    else
                    {
                        objHelpDesk_TaskDetail.DetailType = "Comment";
                    }

                    objHelpDeskDALDataContext.SubmitChanges();
                    txtDescription.Text = "";

                    // Insert Log
					Log.InsertLog(TaskID, UserId, String.Format(Localization.GetString ("UpdatedComment.Text", LocalResourceFile), GetUserName()));

                    // Upload the File
                    if (fuAttachment.HasFile)
                    {
                        UploadFileCommentEdit(objHelpDesk_TaskDetail.DetailID);
                    }

                    SetView("Default");
                    gvComments.DataBind();
                }
            }
        }
Exemplo n.º 29
0
        protected void imgDelete_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        {
            HelpDeskDALDataContext objHelpDeskDALDataContext = new HelpDeskDALDataContext();

            var objHelpDesk_TaskDetail = (from HelpDesk_TaskDetails in objHelpDeskDALDataContext.HelpDesk_TaskDetails
                                              where HelpDesk_TaskDetails.DetailID == Convert.ToInt32(lblDetailID.Text)
                                              select HelpDesk_TaskDetails).FirstOrDefault();

            // Delete Attachment
            if (objHelpDesk_TaskDetail.HelpDesk_Attachments.Count > 0)
            {
                HelpDesk_Attachment objHelpDesk_Attachment = objHelpDesk_TaskDetail.HelpDesk_Attachments.FirstOrDefault();
                string strOriginalFileName = objHelpDesk_Attachment.OriginalFileName;
                string strFile = objHelpDesk_Attachment.AttachmentPath;

                try
                {
                    // Delete file
                    if (strFile != "")
                    {
                        File.Delete(strFile);
                    }
                }
                catch (Exception exc)
                {
                    Exceptions.ProcessModuleLoadException(this, exc);
                }

                objHelpDeskDALDataContext.HelpDesk_Attachments.DeleteOnSubmit(objHelpDesk_Attachment);
                objHelpDeskDALDataContext.SubmitChanges();

                // Insert Log
				Log.InsertLog(TaskID, UserId, String.Format(Localization.GetString ("DeletedFile.Text", LocalResourceFile), GetUserName(), strOriginalFileName));

                pnlAttachFile.Visible = true;
                pnlDisplayFile.Visible = false;
            }
        }
Exemplo n.º 30
0
        private int SaveNewTicketForm()
        {
            HelpDeskDALDataContext objHelpDeskDALDataContext = new HelpDeskDALDataContext();

            // Save Task
            HelpDesk_Task objHelpDesk_Task = new HelpDesk_Task();

            objHelpDesk_Task.Status = "New";
            objHelpDesk_Task.CreatedDate = DateTime.Now;
            objHelpDesk_Task.Description = txtDescription.Text;
            objHelpDesk_Task.PortalID = PortalId;
            objHelpDesk_Task.Priority = ddlPriority.SelectedValue;
            objHelpDesk_Task.RequesterPhone = txtPhone.Text;
            objHelpDesk_Task.AssignedRoleID = -1;
            objHelpDesk_Task.TicketPassword = GetRandomPassword();

            if (Convert.ToInt32(txtUserID.Text) == -1)
            {
                // User not logged in
                objHelpDesk_Task.RequesterEmail = txtEmail.Text;
                objHelpDesk_Task.RequesterName = txtName.Text;
                objHelpDesk_Task.RequesterUserID = -1;
            }
            else
            {
                // User logged in
                objHelpDesk_Task.RequesterUserID = Convert.ToInt32(txtUserID.Text);
                objHelpDesk_Task.RequesterName = //UserController.GetUser(PortalId, Convert.ToInt32(txtUserID.Text), false).DisplayName;
					UserController.GetUserById(PortalId, Convert.ToInt32(txtUserID.Text)).DisplayName;
            }

            if (txtDueDate.Text.Trim().Length > 1)
            {
                objHelpDesk_Task.DueDate = Convert.ToDateTime(txtDueDate.Text.Trim());
            }

            // If Admin panel is visible this is an admin
            // Save the Status and Assignment
            if (pnlAdminTicketStatus.Visible == true)
            {
                objHelpDesk_Task.AssignedRoleID = Convert.ToInt32(ddlAssignedAdmin.SelectedValue);
                objHelpDesk_Task.Status = ddlStatusAdmin.SelectedValue;
            }

            objHelpDeskDALDataContext.HelpDesk_Tasks.InsertOnSubmit(objHelpDesk_Task);
            objHelpDeskDALDataContext.SubmitChanges();

            // Save Task Details
            HelpDesk_TaskDetail objHelpDesk_TaskDetail = new HelpDesk_TaskDetail();

            if ((txtDetails.Text.Trim().Length > 0) || (TicketFileUpload.HasFile))
            {
                objHelpDesk_TaskDetail.TaskID = objHelpDesk_Task.TaskID;
                objHelpDesk_TaskDetail.Description = txtDetails.Text;
                objHelpDesk_TaskDetail.DetailType = "Comment-Visible";
                objHelpDesk_TaskDetail.InsertDate = DateTime.Now;

                if (Convert.ToInt32(txtUserID.Text) == -1)
                {
                    // User not logged in
                    objHelpDesk_TaskDetail.UserID = -1;
                }
                else
                {
                    // User logged in
                    objHelpDesk_TaskDetail.UserID = Convert.ToInt32(txtUserID.Text);
                }

                objHelpDeskDALDataContext.HelpDesk_TaskDetails.InsertOnSubmit(objHelpDesk_TaskDetail);
                objHelpDeskDALDataContext.SubmitChanges();

                // Upload the File
                if (TicketFileUpload.HasFile)
                {
                    UploadFile(objHelpDesk_TaskDetail.DetailID);
                    // Insert Log
					Log.InsertLog(objHelpDesk_Task.TaskID, UserId, String.Format(Localization.GetString("UploadedFile.Text", LocalResourceFile), GetUserName(), TicketFileUpload.FileName));
                }
            }

            // Insert Log
			Log.InsertLog(objHelpDesk_Task.TaskID, UserId, String.Format(Localization.GetString("CreatedTicket.Text", LocalResourceFile), GetUserName()));

            return objHelpDesk_Task.TaskID;
        }