Exemplo n.º 1
0
        /// <summary>
        /// Save / delete from db and return list of attachments
        /// </summary>
        /// <param name="objDOGEN_Attachments"></param>
        /// <param name="loggedInUserId"></param>
        /// <param name="lstDOGEN_Attachments"></param>
        /// <param name="errorMessage"></param>
        /// <returns></returns>
        private bool ManagePWAttachments(DOGEN_Attachments objDOGEN_Attachments, long loggedInUserId, out List <DOGEN_Attachments> lstDOGEN_Attachments, out string errorMessage)
        {
            long?TimeZone = currentUser.ADM_UserPreference.TimezoneLkup != null ? currentUser.ADM_UserPreference.TimezoneLkup : (long)DefaultTimeZone.CentralStandardTime;

            lstDOGEN_Attachments = new List <DOGEN_Attachments>();
            errorMessage         = string.Empty;
            bool isScucess = false;

            try
            {
                ExceptionTypes result = objBLCommon.ManagePWAttachments(TimeZone, objDOGEN_Attachments, loggedInUserId, out lstDOGEN_Attachments, out errorMessage);
                if (result != (long)ExceptionTypes.Success)
                {
                    BLCommon.LogError(currentUser.ADM_UserMasterId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.OSTProcessWorkflow, (long)ExceptionTypes.Uncategorized, errorMessage, errorMessage);
                }
                else
                {
                    isScucess = true;
                }
            }
            catch (Exception ex)
            {
                BLCommon.LogError(currentUser.ADM_UserMasterId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.Attachments, (long)ExceptionTypes.Uncategorized, string.Empty, ex.ToString());
                throw ex;
            }
            return(isScucess);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Private method to add the attachment to list and update the Attchment
        /// </summary>
        /// <param name="FileName"></param>
        /// <param name="formattedFileName"></param>
        /// <param name="filePath"></param>
        /// <param name="errorMessage"></param>
        /// <returns></returns>
        private bool AddToAttchmentList(string FileName, string formattedFileName, string filePath, long genQueueId, out List <DOGEN_Attachments> lstDOGEN_Attachments, out string errorMessage)
        {
            bool isScucess = false;

            lstDOGEN_Attachments = new List <DOGEN_Attachments>();
            DOGEN_Attachments objDOGEN_Attachments = new DOGEN_Attachments();

            errorMessage = string.Empty;
            try
            {
                objDOGEN_Attachments.GEN_AttachmentsId = 0;
                objDOGEN_Attachments.GEN_QueueRef      = genQueueId;
                objDOGEN_Attachments.FileName          = FileName;
                objDOGEN_Attachments.UploadedFileName  = formattedFileName;
                objDOGEN_Attachments.FilePath          = filePath;
                //Save to data base
                if (ManagePWAttachments(objDOGEN_Attachments, currentUser.ADM_UserMasterId, out lstDOGEN_Attachments, out errorMessage))
                {
                    isScucess = true;
                }
            }
            catch (Exception ex)
            {
                BLCommon.LogError(currentUser.ADM_UserMasterId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.Attachments, (long)ExceptionTypes.Uncategorized, string.Empty, ex.ToString());
                throw ex;
            }
            return(isScucess);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Download Attachments
        /// </summary>
        /// <param name="attachmentId"></param>
        /// <returns></returns>
        public ActionResult DownloadPWAttchments(long attachmentId)
        {
            byte[]            fileBytes            = null;
            string            fileName             = string.Empty;
            ExceptionTypes    result               = new ExceptionTypes();
            DOGEN_Attachments objDOGEN_Attachments = new DOGEN_Attachments();

            try
            {
                result = objBLCommon.DownloadPWAttachments(attachmentId, out objDOGEN_Attachments, out errorMessage);
                if (result != (long)ExceptionTypes.Success)
                {
                    BLCommon.LogError(currentUser.ADM_UserMasterId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.Attachments, (long)ExceptionTypes.Uncategorized, errorMessage, errorMessage);
                    return(null);
                }
                fileBytes = System.IO.File.ReadAllBytes(objDOGEN_Attachments.FilePath);
                fileName  = objDOGEN_Attachments.FileName;
                return(File(fileBytes, System.Net.Mime.MediaTypeNames.Application.Octet, fileName));
            }
            catch (System.IO.FileNotFoundException ex)
            {
                BLCommon.LogError(currentUser.ADM_UserMasterId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.Attachments, (long)ExceptionTypes.Uncategorized, "File Not Found", ex.Message);
                return(Content("File Not Available."));
            }
            catch (Exception ex)
            {
                BLCommon.LogError(currentUser.ADM_UserMasterId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.Attachments, (long)ExceptionTypes.Uncategorized, string.Empty, ex.ToString());
                return(Content("An error occoured."));
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Delete a attachment from the list and Attachment session
        /// when user remove attachment from process work screen
        /// </summary>
        /// <param name="slno"></param>
        /// <returns></returns>
        public ActionResult DeletePWAttchments(long attachmentId, long genRef)
        {
            long?                    TimeZone             = currentUser.ADM_UserPreference.TimezoneLkup != null ? currentUser.ADM_UserPreference.TimezoneLkup : (long)DefaultTimeZone.CentralStandardTime;
            string                   returnMessage        = "Error occoured while deleting.";
            ExceptionTypes           result               = new ExceptionTypes();
            List <DOGEN_Attachments> lstDOGEN_Attachments = new List <DOGEN_Attachments>();
            DOGEN_Attachments        objDOGEN_Attachments = new DOGEN_Attachments();
            long                     loggedInUserId       = 0;

            try
            {
                loggedInUserId = currentUser.ADM_UserMasterId;
                objDOGEN_Attachments.GEN_AttachmentsId = attachmentId;
                objDOGEN_Attachments.GEN_QueueRef      = genRef;
                result = objBLCommon.ManagePWAttachments(TimeZone, objDOGEN_Attachments, loggedInUserId, out lstDOGEN_Attachments, out errorMessage);
                if (result != (long)ExceptionTypes.Success)
                {
                    BLCommon.LogError(currentUser.ADM_UserMasterId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.OSTProcessWorkflow, (long)ExceptionTypes.Uncategorized, errorMessage, errorMessage);
                    return(Json(new { ID = result, Message = returnMessage }));
                }
                returnMessage = "Attachment deleted successfully.";
                return(PartialView("_Attachment", lstDOGEN_Attachments));
            }
            catch (Exception ex)
            {
                BLCommon.LogError(currentUser.ADM_UserMasterId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.Attachments, (long)ExceptionTypes.Uncategorized, string.Empty, ex.ToString());
                return(PartialView(""));
            }
        }
Exemplo n.º 5
0
 public ExceptionTypes ManagePWAttachments(long?TimeZone, DOGEN_Attachments objDOGEN_Attachments, long loggedInUserId, out List <DOGEN_Attachments> lstDOGEN_Attachments, out string errorMessage)
 {
     retValue = new ExceptionTypes();
     return(retValue = _objDALCommon.ManagePWAttachments(TimeZone, objDOGEN_Attachments, loggedInUserId, out lstDOGEN_Attachments, out errorMessage));
 }
Exemplo n.º 6
0
 public ExceptionTypes DownloadPWAttachments(long attachmentId, out DOGEN_Attachments objDOGEN_Attachments, out string errorMessage)
 {
     retValue = new ExceptionTypes();
     return(retValue = _objDALCommon.DownloadPWAttachments(attachmentId, out objDOGEN_Attachments, out errorMessage));
 }