Ejemplo n.º 1
0
        private static StockImage PopulateFromDBDetailsObject(StockImageDetails obj)
        {
            StockImage objNew = new StockImage();

            objNew.StockImageId              = obj.StockImageId;
            objNew.StockNo                   = obj.StockNo;
            objNew.Caption                   = obj.Caption;
            objNew.ThumbnailImage            = obj.ThumbnailImage;
            objNew.ThumbnailImageContentType = obj.ThumbnailImageContentType;
            objNew.MediumImage               = obj.MediumImage;
            objNew.MediumImageContentType    = obj.MediumImageContentType;
            objNew.FullsizeImage             = obj.FullsizeImage;
            objNew.FullsizeImageContentType  = obj.FullsizeImageContentType;
            objNew.UpdatedBy                 = obj.UpdatedBy;
            objNew.DLUP = obj.DLUP;
            return(objNew);
        }
Ejemplo n.º 2
0
        // [001] code start
        /// <summary>
        /// Get Stock Image
        /// Calls [usp_selectAll_Image_for_QuoteToClient]
        /// </summary>
        public override List <StockImageDetails> GetImageListForReq(System.Int32?sourcingResultNo, System.String fileType)
        {
            SqlConnection cn  = null;
            SqlCommand    cmd = null;

            try
            {
                cn                 = new SqlConnection(this.ConnectionString);
                cmd                = new SqlCommand("usp_selectAll_Image_for_QuoteToClient", cn);
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandTimeout = 30;
                cmd.Parameters.Add("@SourcingResultNo", SqlDbType.Int).Value = sourcingResultNo;
                cn.Open();
                DbDataReader             reader = ExecuteReader(cmd);
                List <StockImageDetails> lstPDF = new List <StockImageDetails>();
                while (reader.Read())
                {
                    StockImageDetails obj = new StockImageDetails();
                    obj.StockImageId       = GetReaderValue_Int32(reader, "SourcingImageId", 0);
                    obj.ImageDocumentRefNo = GetReaderValue_Int32(reader, "SourcingResultNo", 0);
                    obj.Caption            = GetReaderValue_String(reader, "Caption", "");
                    obj.ImageName          = GetReaderValue_String(reader, "ImageName", "");
                    obj.UpdatedBy          = GetReaderValue_NullableInt32(reader, "UpdatedBy", null);
                    obj.DLUP          = GetReaderValue_NullableDateTime(reader, "DLUP", null);
                    obj.UpdatedByName = GetReaderValue_String(reader, "ImageName", "");
                    lstPDF.Add(obj);
                    obj = null;
                }
                return(lstPDF);
            }
            catch (SqlException sqlex)
            {
                //LogException(sqlex);
                throw new Exception("Failed to get Image list", sqlex);
            }
            finally
            {
                cmd.Dispose();
                cn.Close();
                cn.Dispose();
            }
        }
Ejemplo n.º 3
0
        //[001] code start
        /// <summary>
        /// GetListForStock
        /// Calls [usp_selectAll_StockImage_for_Stock]
        /// </summary>
        public override List <StockImageDetails> GetListForStockSAN(System.Int32?stockId)
        {
            SqlConnection cn  = null;
            SqlCommand    cmd = null;

            try
            {
                cn                 = new SqlConnection(Globals.Settings.StockImages.ConnectionString);
                cmd                = new SqlCommand("usp_selectAll_StockImage_for_Stock", cn);
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandTimeout = 30;
                cmd.Parameters.Add("@StockId", SqlDbType.Int).Value = stockId;
                cn.Open();
                DbDataReader             reader = ExecuteReader(cmd);
                List <StockImageDetails> lst    = new List <StockImageDetails>();
                while (reader.Read())
                {
                    StockImageDetails obj = new StockImageDetails();
                    obj.StockImageId = GetReaderValue_Int32(reader, "StockImageId", 0);
                    obj.StockNo      = GetReaderValue_Int32(reader, "StockNo", 0);
                    obj.Caption      = GetReaderValue_String(reader, "Caption", "");
                    obj.ImageName    = GetReaderValue_String(reader, "ImageName", "");
                    obj.UpdatedBy    = GetReaderValue_NullableInt32(reader, "UpdatedBy", null);
                    obj.DLUP         = GetReaderValue_NullableDateTime(reader, "DLUP", null);
                    lst.Add(obj);
                    obj = null;
                }
                return(lst);
            }
            catch (SqlException sqlex)
            {
                //LogException(sqlex);
                throw new Exception("Failed to get StockImages", sqlex);
            }
            finally
            {
                cmd.Dispose();
                cn.Close();
                cn.Dispose();
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Get
        /// Calls [usp_select_StockImage]
        /// </summary>
        public override StockImageDetails Get(System.Int32?stockImageId)
        {
            SqlConnection cn  = null;
            SqlCommand    cmd = null;

            try {
                cn                 = new SqlConnection(this.ConnectionString);
                cmd                = new SqlCommand("usp_select_StockImage", cn);
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandTimeout = 30;
                cmd.Parameters.Add("@StockImageId", SqlDbType.Int).Value = stockImageId;
                cn.Open();
                DbDataReader reader = ExecuteReader(cmd, CommandBehavior.SingleRow);
                if (reader.Read())
                {
                    //return GetStockImageFromReader(reader);
                    StockImageDetails obj = new StockImageDetails();
                    obj.StockImageId = GetReaderValue_Int32(reader, "StockImageId", 0);
                    obj.StockNo      = GetReaderValue_Int32(reader, "StockNo", 0);
                    obj.Caption      = GetReaderValue_String(reader, "Caption", "");
                    obj.UpdatedBy    = GetReaderValue_NullableInt32(reader, "UpdatedBy", null);
                    obj.DLUP         = GetReaderValue_NullableDateTime(reader, "DLUP", null);
                    return(obj);
                }
                else
                {
                    return(null);
                }
            } catch (SqlException sqlex) {
                //LogException(sqlex);
                throw new Exception("Failed to get StockImage", sqlex);
            } finally {
                cmd.Dispose();
                cn.Close();
                cn.Dispose();
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// GetThumbnailImage
        /// Calls [usp_select_StockImage_ThumbnailImage]
        /// </summary>
        public override StockImageDetails GetThumbnailImage(System.Int32?stockImageId)
        {
            SqlConnection cn  = null;
            SqlCommand    cmd = null;

            try {
                cn                 = new SqlConnection(Globals.Settings.StockImages.MediaConnectionString);
                cmd                = new SqlCommand("usp_select_StockImage_ThumbnailImage", cn);
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandTimeout = 30;
                cmd.Parameters.Add("@StockImageId", SqlDbType.Int).Value = stockImageId;
                cn.Open();
                DbDataReader reader = ExecuteReader(cmd, CommandBehavior.SingleRow);
                if (reader.Read())
                {
                    //return GetStockImageFromReader(reader);
                    StockImageDetails obj = new StockImageDetails();
                    obj.StockImageId              = GetReaderValue_Int32(reader, "StockImageId", 0);
                    obj.StockNo                   = GetReaderValue_Int32(reader, "StockNo", 0);
                    obj.ThumbnailImage            = GetReaderValue_ByteArray(reader, "ThumbnailImage", null);
                    obj.ThumbnailImageContentType = GetReaderValue_String(reader, "ThumbnailImageContentType", "");
                    return(obj);
                }
                else
                {
                    return(null);
                }
            } catch (SqlException sqlex) {
                //LogException(sqlex);
                throw new Exception("Failed to get StockImage", sqlex);
            } finally {
                cmd.Dispose();
                cn.Close();
                cn.Dispose();
            }
        }