Exemple #1
0
 /// <summary>
 /// Gets the attachment detail.
 /// </summary>
 /// <param name="AttachmentId">The attachment identifier.</param>
 /// <returns></returns>
 public AttachmentDetailModel GetAttachmentDetail(int AttachmentId)
 {
     try
     {
         var fileDetails = m_AttachmentRepository.Query <Files>().Where(a => a.AttachmentId == AttachmentId).ToList();
         var attachment  = m_AttachmentRepository.GetAll().Where(a => a.AttachmentId == AttachmentId).FirstOrDefault();
         var result      = new AttachmentDetailModel()
         {
             AttachmentID   = attachment.AttachmentId,
             AttachmentName = attachment.Name,
             AttachmentSize = attachment.TotalSize,
             FileDetails    = fileDetails
         };
         return(result);
     }
     catch (Exception ex)
     {
         var message = string.Format("{0} {1} {2}", ex.InnerException == null ? ex.Message : ex.InnerException.Message, Environment.NewLine, ex.StackTrace);
         throw new Exception(message);
     }
 }
Exemple #2
0
        /// <summary>
        /// Dashboards the file status.
        /// </summary>
        /// <param name="attachmentId">The attachment identifier.</param>
        /// <param name="Email">The email.</param>
        /// <returns></returns>
        public AttachmentDetailModel DashboardFileStatus(int attachmentId, string Email)
        {
            using (SqlConnection con = new SqlConnection(ConnectionString))
            {
                SqlCommand            cmd         = new SqlCommand("DASHBOARD.PROC_FILE_DETAILS", con);
                AttachmentDetailModel FileDetails = new AttachmentDetailModel();
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@ATTACHMENTID", attachmentId);
                con.Open();
                SqlDataReader rdr = cmd.ExecuteReader();
                while (rdr.Read())
                {
                    FileDetails.DownloadURL    = (string.IsNullOrEmpty(rdr["DOWNLOADURL"].ToString()) ? null : rdr["DOWNLOADURL"].ToString());
                    FileDetails.Name           = string.IsNullOrEmpty(rdr["NAME"].ToString()) ? null : rdr["NAME"].ToString();
                    FileDetails.Status         = string.IsNullOrEmpty(rdr["STATUS"].ToString()) ? 0 : Convert.ToInt32(rdr["STATUS"].ToString());
                    FileDetails.AttachmentSize = string.IsNullOrEmpty(rdr["TOTALSIZE"].ToString()) ? 0 : Convert.ToDecimal(rdr["TOTALSIZE"].ToString());
                    FileDetails.CreatedOn      = Convert.ToDateTime(rdr["CREATIONDATE"].ToString());
                    FileDetails.PurgedOn       = string.IsNullOrEmpty(rdr["PURGEDON"].ToString()) ? (DateTime?)null : Convert.ToDateTime(rdr["PURGEDON"].ToString());
                    FileDetails.TotalDownload  = string.IsNullOrEmpty(rdr["TOTALDOWNLOAD"].ToString()) ? 0 : Convert.ToInt32(rdr["TOTALDOWNLOAD"].ToString());

                    FileDetails.ExpiredOn     = string.IsNullOrEmpty(rdr["EXPIRYDATE"].ToString()) ? (DateTime?)null : Convert.ToDateTime(rdr["EXPIRYDATE"].ToString());
                    FileDetails.DownloadLimit = string.IsNullOrEmpty(rdr["DOWNLOADSLIMIT"].ToString()) ? 0 : Convert.ToInt32(rdr["DOWNLOADSLIMIT"].ToString());
                    FileDetails.DeleteAfter   = string.IsNullOrEmpty(rdr["DELETEAFTER"].ToString()) ? (DateTime?)null : Convert.ToDateTime(rdr["DELETEAFTER"].ToString());

                    FileDetails.WhenDownload = string.IsNullOrEmpty(rdr["WHENDOWNLOAD"].ToString()) ? false : Convert.ToBoolean(rdr["WHENDOWNLOAD"].ToString());
                    FileDetails.WhenExpired  = string.IsNullOrEmpty(rdr["WHENEXPIRED"].ToString()) ? false : Convert.ToBoolean(rdr["WHENEXPIRED"].ToString());
                    FileDetails.ByEmail      = string.IsNullOrEmpty(rdr["BYEMAIL"].ToString()) ? false : Convert.ToBoolean(rdr["BYEMAIL"].ToString());
                    FileDetails.ByText       = string.IsNullOrEmpty(rdr["BYTEXT"].ToString()) ? false : Convert.ToBoolean(rdr["BYTEXT"].ToString());

                    FileDetails.AccessPassword      = string.IsNullOrEmpty(rdr["ACCESSPASSWORD"].ToString()) ? null : (rdr["ACCESSPASSWORD"].ToString());
                    FileDetails.AccessEmail         = string.IsNullOrEmpty(rdr["ACCESSEMAIL"].ToString()) ? null : (rdr["ACCESSEMAIL"].ToString());
                    FileDetails.AccessName          = string.IsNullOrEmpty(rdr["ACCESSNAME"].ToString()) ? null : (rdr["ACCESSNAME"].ToString());
                    FileDetails.AccessCompany       = string.IsNullOrEmpty(rdr["ACCESSCOMPANY"].ToString()) ? null : (rdr["ACCESSCOMPANY"].ToString());
                    FileDetails.AccessContectNumber = string.IsNullOrEmpty(rdr["ACCESSCONTACTNUMBER"].ToString()) ? null : (rdr["ACCESSCONTACTNUMBER"].ToString());
                    FileDetails.AccessPayment       = string.IsNullOrEmpty(rdr["ACCESSPAYMENT"].ToString()) ? 0 : (Convert.ToDecimal(rdr["ACCESSPAYMENT"].ToString()));
                }
                con.Close();
                return(FileDetails);
            }
        }