Esempio n. 1
0
        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));
        }
Esempio n. 2
0
        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();
        }
Esempio n. 3
0
        protected void imgDelete_Click(object sender, System.Web.UI.ImageClickEventArgs 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 Attachment
            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));

                pnlAttachFile.Visible  = true;
                pnlDisplayFile.Visible = false;
            }
        }