Esempio n. 1
0
        public override void Delete(object obj)
        {
            ProductInfoDTO pDto     = (ProductInfoDTO)obj;
            SqlConnection  objmycon = new SqlConnection(ConfigurationManager.ConnectionStrings["DPOSConnectionString"].ToString());
            SqlCommand     objcmd   = new SqlCommand();

            objcmd.CommandText = "Delete From ProductInfo WHERE P_PK=@P_PK";
            objcmd.Parameters.Add(new SqlParameter("@P_PK", SqlDbType.UniqueIdentifier, 16));
            objcmd.Parameters["@P_PK"].Value = (Guid)pDto.PrimaryKey;
            objcmd.Connection = objmycon;

            try
            {
                objmycon.Open();
                objcmd.ExecuteNonQuery();
            }
            catch (Exception Exp)
            {
                throw Exp;
            }
            finally
            {
                objmycon.Close();
            }
        }
Esempio n. 2
0
    /// <summary>
    /// DDLPopulate method set primary key in domain class use for dropdown list Product Category .
    /// </summary>
    /// <returns></returns>
    private ProductInfoDTO DDLPopulate()
    {
        try
        {
            ProductInfoDTO ddlDTO = new ProductInfoDTO();

            if (this.hfPrimaryKey.Value.ToString() != "")
            {
                ddlDTO.PrimaryKey = (Guid)TypeDescriptor.GetConverter(ddlDTO.PrimaryKey).ConvertFromString(this.hfPrimaryKey.Value);
            }
            if (this.ddlProductCategory.SelectedValue != "")
            {
                ddlDTO.PC_PrimaryKey = (Guid)TypeDescriptor.GetConverter(ddlDTO.PC_PrimaryKey).ConvertFromString(this.ddlProductCategory.SelectedValue);
            }
            else
            {
                return(null);
            }
            return(ddlDTO);
        }
        catch (Exception Exp)
        {
            throw Exp;
        }
    }
        public async Task EditProduct(ProductInfoDTO productDto)
        {
            var product = await _productRepository.GetById(productDto.Id);

            product.ProductName             = productDto.ProductName;
            product.Description             = productDto.Description;
            product.Price                   = productDto.Price;
            product.VideoLink               = productDto.VideoLink;
            product.ProductType             = productDto.ProductType;
            product.ProductArticle          = productDto.ProductArticle;
            product.TransformationMechanism = productDto.TransformationMechanism;

            await _productRepository.Update(product);

            if (productDto.MainImage != null)
            {
                await SaveMainImage(productDto.MainImage, product);
            }
            else if (product.MainImage == null)
            {
                product.MainImage = "/images/noimage.png";
                await _productRepository.Update(product);
            }

            if (productDto.AdditionalImages != null)
            {
                await SaveAddtImages(productDto.AdditionalImages, product);
            }
        }
Esempio n. 4
0
        private string Get_NewProductInfoCode(ProductInfoDTO dto)
        {
            string pcCode  = null;  //2
            string pscCode = null;  //3
            string pbCode  = null;  //4

            // generate Product Code combination of Year+Month+Day+Hour+Minute+Second

            pscCode = Convert.ToString(DateTime.Today.Day.ToString("00") + 1);
            pbCode  = Convert.ToString(DateTime.Today.Year);

            string        pCode    = null; //13
            int           pCodeNo  = 0;
            SqlConnection objMyCon = new SqlConnection(ConfigurationManager.ConnectionStrings["DPOSConnectionString"].ToString());
            SqlCommand    objCmd   = new SqlCommand();

            objCmd.CommandText = "SELECT PC_Code FROM ProductCategoryInfo WHERE (PC_PK = @PC_PK)";
            objCmd.Parameters.Add(new SqlParameter("@PC_PK", SqlDbType.UniqueIdentifier, 16));
            objCmd.Parameters["@PC_PK"].Value = (Guid)dto.PC_PrimaryKey;
            objMyCon.Open();
            objCmd.Connection = objMyCon;
            pcCode            = (string)objCmd.ExecuteScalar();
            objMyCon.Close();

            //objCmd.CommandText = "SELECT PSC_Code FROM ProductSubCategoryInfo WHERE (PSC_PK = @PSC_PK)";
            //objCmd.Parameters.Add(new SqlParameter("@PSC_PK", SqlDbType.UniqueIdentifier, 16));
            //objCmd.Parameters["@PSC_PK"].Value = (Guid)dto.PSC_PrimaryKey;
            //objMyCon.Open();
            //objCmd.Connection = objMyCon;
            //pscCode = (string)objCmd.ExecuteScalar();
            //objMyCon.Close();

            //objCmd.CommandText = "SELECT PB_Code FROM ProductBrandInfo WHERE (PB_PK = @PB_PK)";
            //objCmd.Parameters.Add(new SqlParameter("@PB_PK", SqlDbType.UniqueIdentifier, 16));
            //objCmd.Parameters["@PB_PK"].Value = (Guid)dto.PB_PrimaryKey;
            //objMyCon.Open();
            //objCmd.Connection = objMyCon;
            //pbCode = (string)objCmd.ExecuteScalar();
            //objMyCon.Close();

            objCmd.CommandText = "SELECT ISNULL(MAX(CAST(RIGHT(P_Code, 4) AS int)), 0) + 1 FROM ProductInfo " +
                                 "WHERE (SUBSTRING(P_Code, 1, 2) = @pcCode) " +
                                 "AND (SUBSTRING(P_Code, 3, 3) = @pscCode) " +
                                 "AND (SUBSTRING(P_Code, 6, 4) = @pbCode)";
            objCmd.Parameters.Add(new SqlParameter("@pcCode", SqlDbType.VarChar, 2));
            objCmd.Parameters["@pcCode"].Value = (string)pcCode;
            objCmd.Parameters.Add(new SqlParameter("@pscCode", SqlDbType.VarChar, 3));
            objCmd.Parameters["@pscCode"].Value = (string)pscCode;
            objCmd.Parameters.Add(new SqlParameter("@pbCode", SqlDbType.VarChar, 4));
            objCmd.Parameters["@pbCode"].Value = (string)pbCode;
            objMyCon.Open();
            objCmd.Connection = objMyCon;
            pCodeNo           = (int)objCmd.ExecuteScalar();
            objMyCon.Close();
            pCode = pcCode + pscCode + pbCode + pCodeNo.ToString("0000");

            return(pCode);
        }
Esempio n. 5
0
        public async Task RemoveAsync(ProductInfoDTO obj, CancellationToken token = default(CancellationToken))
        {
            Product old = await(serviceProvider.GetService <IProductRepository>()
                                .LoadWith(p => p.Image)
                                .FindByIDAsync(obj.ID));
            await serviceProvider.GetService <IProductRepository>().RemoveAsync(Mapper.Map <Product>(obj), token);

            await imageManager.RemoveAsync(old.Image);
        }
Esempio n. 6
0
 public ProductInfo(ProductInfoDTO dto)
     : this(dto.IsAutoTraded,
            dto.IsInHostedStatistics,
            dto.IsInLiveCenterSoccer,
            dto.IsInLiveScore,
            dto.ProductInfoLinks?.Select(s => new ProductInfoLink(s.Reference, s.Name)),
            dto.StreamingChannels?.Select(s => new StreamingChannel(s.Id, s.Name)))
 {
 }
Esempio n. 7
0
        public ProductInfoDTO FindByPK(Guid pk)
        {
            ProductInfoDTO pInfoDTO  = new ProductInfoDTO();
            string         sqlSelect = "SELECT     ProductInfo.P_PK, ProductInfo.P_Code, ProductInfo.PC_PK, ProductInfo.PSC_PK, ProductInfo.PB_PK, ProductInfo.P_Name, ProductInfo.P_Style, " +
                                       "ProductInfo.P_SalesPrice, ProductInfo.P_CostPrice, ProductInfo.P_Tax, ProductInfo.P_VAT, ProductInfo.P_Discount, ProductInfo.P_MinLevel, " +
                                       "ProductInfo.P_MaxLevel, ProductInfo.P_ReorderLevel, ProductInfo.P_Status, ProductInfo.P_SalesPricedate, ProductInfo.P_CostPricedate, " +
                                       "ProductInfo.P_Warranty, ProductInfo.P_WarrantyMonth, ProductInfo.PU_PK, ProductInfo.EntryBy, ProductInfo.EntryDate, " +
                                       "ProductCategoryInfo.PC_Description " +
                                       "FROM  ProductInfo INNER JOIN " +
                                       "ProductCategoryInfo ON ProductInfo.PC_PK = ProductCategoryInfo.PC_PK " +
                                       "WHERE P_PK=@P_PK ";
            //string sqlSelect = "SELECT ProductInfo.P_PK, ProductInfo.P_Code, ProductInfo.PC_PK, ProductInfo.PSC_PK, ProductInfo.PB_PK, ProductInfo.P_Name, ProductInfo.P_Style, " +
            //          "ProductInfo.P_SalesPrice, ProductInfo.P_CostPrice, ProductInfo.P_Tax, ProductInfo.P_VAT, ProductInfo.P_Discount, ProductInfo.P_MinLevel, " +
            //          "ProductInfo.P_MaxLevel, ProductInfo.P_ReorderLevel, ProductInfo.P_status, ProductInfo.P_SalesPricedate, ProductInfo.P_CostPricedate, " +
            //          "ProductInfo.P_Warranty, ProductInfo.P_WarrantyMonth, ProductInfo.PU_PK, ProductInfo.EntryBy, ProductInfo.EntryDate, " +
            //          "ProductCategoryInfo.PC_Description, ProductSubCategoryInfo.PSC_Description, ProductBrandInfo.PB_Name, ProductUnitInfo.PU_Name " +
            //            "FROM ProductInfo INNER JOIN " +
            //          "ProductCategoryInfo ON ProductInfo.PC_PK = ProductCategoryInfo.PC_PK INNER JOIN " +
            //          "ProductBrandInfo ON ProductInfo.PB_PK = ProductBrandInfo.PB_PK INNER JOIN " +
            //          "ProductUnitInfo ON ProductInfo.PU_PK = ProductUnitInfo.PU_PK INNER JOIN " +
            //          "ProductSubCategoryInfo ON ProductInfo.PSC_PK = ProductSubCategoryInfo.PSC_PK " +
            //            "WHERE P_PK=@P_PK";
            SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["DPOSConnectionString"].ToString());
            SqlCommand    objCmd  = sqlConn.CreateCommand();

            try
            {
                objCmd.CommandText = sqlSelect;
                objCmd.Connection  = sqlConn;
                objCmd.Parameters.Add("@P_PK", SqlDbType.UniqueIdentifier, 16);
                objCmd.Parameters["@P_PK"].Value = pk;
                sqlConn.Open();
                SqlDataReader thisReader = objCmd.ExecuteReader();

                while (thisReader.Read())
                {
                    pInfoDTO = Populate(thisReader);
                }

                thisReader.Close();
                thisReader.Dispose();
            }
            catch (Exception Exp)
            {
                throw Exp;
            }

            finally
            {
                objCmd.Dispose();
                objCmd.Cancel();
                sqlConn.Dispose();
                sqlConn.Close();
            }
            return(pInfoDTO);
        }
Esempio n. 8
0
        public void ProductInfoTest()
        {
            var productInfoType = new productInfo
            {
                is_auto_traded           = true,
                is_in_hosted_statistics  = true,
                is_in_live_center_soccer = true,
                is_in_live_score         = true,
                links = new[]
                {
                    new productInfoLink {
                        name = "info link 1", @ref = "ref 1"
                    },
                    new productInfoLink {
                        name = "info link 2", @ref = "ref 2"
                    },
                    new productInfoLink {
                        name = "info link 3", @ref = "ref 3"
                    }
                },
                streaming = new[]
                {
                    new streamingChannel {
                        id = 1, name = "streaming channel 1"
                    },
                    new streamingChannel {
                        id = 2, name = "streaming channel 2"
                    },
                    new streamingChannel {
                        id = 3, name = "streaming channel 3"
                    },
                    new streamingChannel {
                        id = 4, name = "streaming channel 4"
                    }
                }
            };
            var productInfoDTO = new ProductInfoDTO(productInfoType);
            var productInfo    = new ProductInfo(productInfoDTO.IsAutoTraded,
                                                 productInfoDTO.IsInHostedStatistics,
                                                 productInfoDTO.IsInLiveCenterSoccer,
                                                 productInfoDTO.IsInLiveScore,
                                                 productInfoDTO.ProductInfoLinks?.Select(s => new ProductInfoLink(s.Reference, s.Name)),
                                                 productInfoDTO.StreamingChannels?.Select(s => new StreamingChannel(s.Id, s.Name)));

            Assert.IsNotNull(productInfo);
            Assert.AreEqual(productInfoType.is_auto_traded, productInfo.IsAutoTraded);
            Assert.AreEqual(productInfoType.is_in_hosted_statistics, productInfo.IsInHostedStatistics);
            Assert.AreEqual(productInfoType.is_in_live_center_soccer, productInfo.IsInLiveCenterSoccer);
            Assert.AreEqual(productInfoType.is_in_live_score, productInfo.IsInLiveScore);
            Assert.AreEqual(productInfoType.links.Length, productInfo.Links.Count());
            Assert.AreEqual(productInfoType.streaming.Length, productInfo.Channels.Count());
            Assert.AreNotEqual(productInfo.Links.ToList()[0].Name, productInfo.Links.ToList()[2].Name);
            Assert.AreNotEqual(productInfo.Channels.ToList()[0].Name, productInfo.Channels.ToList()[2].Name);
        }
Esempio n. 9
0
        public IActionResult Create([FromBody] ProductInfoDTO productinfoDTO)
        {
            ProductInfo productinfo = new ProductInfo();

            productinfo.ProductName = productinfoDTO.ProductName;
            //productType.CreatedBy = User.Identity.Name;
            var productinfoEntity = _productinfoService.Create(productinfo);
            var productinfos      = _mapper.Map <ProductInfoDTO>(productinfoEntity);


            return(Ok(productinfo));
        }
Esempio n. 10
0
        public void ProductInfoTest()
        {
            var productInfoType = new productInfo
            {
                is_auto_traded           = new productInfoItem(),
                is_in_hosted_statistics  = new productInfoItem(),
                is_in_live_center_soccer = new productInfoItem(),
                is_in_live_match_tracker = new productInfoItem(),
                is_in_live_score         = new productInfoItem(),
                links = new[]
                {
                    new productInfoLink {
                        name = "info link 1", @ref = "ref 1"
                    },
                    new productInfoLink {
                        name = "info link 2", @ref = "ref 2"
                    },
                    new productInfoLink {
                        name = "info link 3", @ref = "ref 3"
                    }
                },
                streaming = new[]
                {
                    new streamingChannel {
                        id = 1, name = "streaming channel 1"
                    },
                    new streamingChannel {
                        id = 2, name = "streaming channel 2"
                    },
                    new streamingChannel {
                        id = 3, name = "streaming channel 3"
                    },
                    new streamingChannel {
                        id = 4, name = "streaming channel 4"
                    }
                }
            };
            var productInfoDTO = new ProductInfoDTO(productInfoType);
            var productInfo    = new ProductInfo(productInfoDTO);

            Assert.IsNotNull(productInfo);
            Assert.AreEqual(productInfoType.is_auto_traded != null, productInfo.IsAutoTraded);
            Assert.AreEqual(productInfoType.is_in_hosted_statistics != null, productInfo.IsInHostedStatistics);
            Assert.AreEqual(productInfoType.is_in_live_center_soccer != null, productInfo.IsInLiveCenterSoccer);
            Assert.AreEqual(productInfoType.is_in_live_match_tracker != null, productInfo.IsInLiveMatchTracker);
            Assert.AreEqual(productInfoType.is_in_live_score != null, productInfo.IsInLiveScore);
            Assert.AreEqual(productInfoType.links.Length, productInfo.Links.Count());
            Assert.AreEqual(productInfoType.streaming.Length, productInfo.Channels.Count());
            Assert.AreNotEqual(productInfo.Links.ToList()[0].Name, productInfo.Links.ToList()[2].Name);
            Assert.AreNotEqual(productInfo.Channels.ToList()[0].Name, productInfo.Channels.ToList()[2].Name);
        }
Esempio n. 11
0
 public ProductInfoDTO CreateProduct(Product productToAdd, int colorId, int categoryId, int sizeId, int genderId)
 {
     var color = this.colorsRepo.GetById(colorId);
     var category = this.categoriesRepo.GetById(categoryId);
     var size = this.sizesRepo.GetById(sizeId);
     var gender = this.gendersRepo.GetById(genderId);
     productToAdd.Category = category;
     productToAdd.Colors.Add(color);
     productToAdd.Gender = gender;
     productToAdd.Sizes.Add(size);
     this.productsRepo.Add(productToAdd);
     this.productsRepo.SaveChanges();
     var result = this.GetByName(productToAdd.Title);
     var dtoModel = new ProductInfoDTO { ProductId = result.Id, Title = result.Title, CategoryName = result.Category.Name };
     return dtoModel;
 }
Esempio n. 12
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            if (this.lblErrorMessage.Text.Length != 0)
            {
                this.lblErrorMessage.Text = "";
            }

            ProductInfoDTO pDTO = Populate();

            IProductInfoBL facade = Facade.GetInstance().GetPBLImp();
            facade.AddProductInfo(pDTO);

            this.lblErrorMessage.Text = "Data Save Successfully.";

            this.hfPrimaryKey.Value  = "";
            this.txtProductCode.Text = "";
            this.ddlProductCategory.SelectedValue    = "";
            this.ddlProductSubCategory.SelectedValue = "";
            this.ddlProductBrand.SelectedValue       = "";
            this.ddlProductUnit.SelectedValue        = "";
            this.txtProductName.Text    = "";
            this.txtStyle.Text          = "";
            this.txtSalesPrice.Text     = "";
            this.txtSalesPriceDate.Text = "";
            this.txtVat.Text            = "";
            this.txtTax.Text            = "";
            this.txtMaxLevel.Text       = "";
            this.txtMinLevel.Text       = "";
            this.txtCostPrice.Text      = "";
            this.txtCostPriceDate.Text  = "";
            this.txtDiscount.Text       = "";
            this.txtReorderLevel.Text   = "";
            this.txtWarrantyMonth.Text  = "";
            this.chkWarranty.Checked    = false;
            this.chkStatus.Checked      = false;
            this.btnSave.Text           = "Save";
            GridView1.DataBind();
        }
        catch (Exception Exp)
        {
            lblErrorMessage.Text = cls.ErrorString(Exp);
        }
    }
Esempio n. 13
0
        public async Task <IActionResult> EditProduct(EditProductViewModel model)
        {
            var productDto = new ProductInfoDTO();

            productDto.Id                      = model.Id;
            productDto.ProductName             = model.ProductName;
            productDto.Description             = model.Description;
            productDto.MainImage               = model.MainImage;
            productDto.AdditionalImages        = model.AdditionalImages;
            productDto.Price                   = model.Price;
            productDto.VideoLink               = model.VideoLink;
            productDto.ProductType             = model.ProductType;
            productDto.ProductArticle          = model.ProductArticle;
            productDto.TransformationMechanism = model.TransformationMechanism;

            await _productService.EditProduct(productDto);

            return(Ok());
        }
Esempio n. 14
0
        public async Task AddProduct(ProductInfoDTO productDto)
        {
            var newProduct = _mapper.Map <Product>(productDto);
            await _productRepository.Add(newProduct);

            var lastProduct = await _productRepository.GetLastProduct();

            if (productDto.MainImage != null)
            {
                await SaveMainImage(productDto.MainImage, lastProduct);
            }
            else
            {
                lastProduct.MainImage = "/images/noimage.png";
                await _productRepository.Update(lastProduct);
            }

            if (productDto.AdditionalImages != null)
            {
                await SaveAddtImages(productDto.AdditionalImages, lastProduct);
            }
        }
    protected void btnProduct_Click(object sender, EventArgs e)
    {
        try
        {
            if ((this.lblErrorMessage.Text.Length != 0) || (this.lblSuccessMessage.Text.Length != 0))
            {
                this.lblSuccessMessage.Text = "";
                this.lblErrorMessage.Text   = "";
            }

            if (this.ddlProductName.SelectedValue == "")
            {
                return;
            }

            ProductInfoDTO oProductInfoDTO = new ProductInfoDTO();

            Facade facade = Facade.GetInstance();

            if (this.ddlProductName.SelectedValue != "")
            {
                oProductInfoDTO              = ProductInfoBLImp.LoadProductInfoDTO((Guid)TypeDescriptor.GetConverter(oProductInfoDTO.PrimaryKey).ConvertFromString(this.ddlProductName.SelectedValue));
                this.txtOpeningQty.Text      = "1";
                this.txtOpeningRate.Text     = oProductInfoDTO.P_CostPrice.ToString("####.##");
                this.txtOpeningDiscount.Text = oProductInfoDTO.P_Discount.ToString("####.##");
                this.hfProductCode.Value     = oProductInfoDTO.P_Code;
                this.HiddenField1.Value      = oProductInfoDTO.PrimaryKey.ToString();
            }
        }
        catch (Exception exp)
        {
            lblErrorMessage.Text = cls.ErrorString(exp);
        }
        finally
        {
            ScriptManager1.SetFocus(txtOpeningDate);
        }
    }
Esempio n. 16
0
        public ProductInfoDTO Populate(SqlDataReader reader)
        {
            try
            {
                ProductInfoDTO dto = new ProductInfoDTO();

                dto.PrimaryKey       = (Guid)reader["P_PK"];
                dto.PC_PrimaryKey    = (Guid)reader["PC_PK"];
                dto.PSC_PrimaryKey   = (Guid)reader["PSC_PK"];
                dto.PB_PrimaryKey    = (Guid)reader["PB_PK"];
                dto.P_Code           = (string)reader["P_Code"];
                dto.P_Name           = (string)reader["P_Name"];
                dto.P_Style          = (string)reader["P_Style"];
                dto.P_SalesPrice     = Convert.ToDecimal(reader["P_SalesPrice"]);
                dto.P_CostPrice      = Convert.ToDecimal(reader["P_CostPrice"]);
                dto.P_Tax            = Convert.ToDecimal(reader["P_Tax"]);
                dto.P_VAT            = Convert.ToDecimal(reader["P_VAT"]);
                dto.P_Discount       = Convert.ToDecimal(reader["P_Discount"]);
                dto.P_MinLevel       = Convert.ToDecimal(reader["P_MinLevel"]);
                dto.P_MaxLevel       = Convert.ToDecimal(reader["P_MaxLevel"]);
                dto.P_ReorderLevel   = Convert.ToDecimal(reader["P_ReorderLevel"]);
                dto.P_Status         = (Boolean)reader["P_Status"];
                dto.P_SalesPriceDate = (DateTime)reader["P_SalesPricedate"];
                dto.P_CostPriceDate  = (DateTime)reader["P_CostPricedate"];
                dto.P_Warranty       = (Boolean)reader["P_Warranty"];
                dto.P_WarrantyMonth  = (int)reader["P_WarrantyMonth"];
                dto.PU_PrimaryKey    = (Guid)reader["PU_PK"];
                dto.EntryBy          = (string)reader["EntryBy"];
                dto.EntryDate        = (DateTime)reader["EntryDate"];

                return(dto);
            }
            catch (Exception Exp)
            {
                throw Exp;
            }
        }
Esempio n. 17
0
    protected void btnClickProductCategory_Click(object sender, EventArgs e)
    {
        try
        {
            if (this.ddlProductCategory.SelectedValue == "")
            {
                return;
            }

            ProductInfoDTO pddlDTO = DDLPopulate();

            Facade facade = Facade.GetInstance();

            IProductSubCategoryInfoBL        subCategoryList = facade.createProductSubCategoryBL();
            List <ProductSubCategoryInfoDTO> oArrayList      = subCategoryList.showDataSubCategoryInfoByPC(pddlDTO.PC_PrimaryKey);

            int i = 0;
            ddlProductSubCategory.Items.Clear();
            ddlProductSubCategory.Items.Add("(Select any sub category)");
            this.ddlProductSubCategory.Items[i].Value = "";
            foreach (ProductSubCategoryInfoDTO newDto in oArrayList)
            {
                i++;
                this.ddlProductSubCategory.Items.Add(newDto.PSC_Description);
                this.ddlProductSubCategory.Items[i].Value = newDto.PrimaryKey.ToString();
            }
        }
        catch (Exception exp)
        {
            lblErrorMessage.Text = cls.ErrorString(exp);
        }
        finally
        {
            ScriptManager1.SetFocus(ddlProductSubCategory);
        }
    }
Esempio n. 18
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ProductInfo"/> class
        /// </summary>
        /// <param name="dto">The <see cref="ProductInfoDTO"/> data</param>
        public ProductInfo(ProductInfoDTO dto)
        {
            if (dto == null)
            {
                return;
            }

            _isAutoTraded         = dto.IsAutoTraded;
            _isInHostedStatistics = dto.IsInHostedStatistics;
            _isInLiveCenterSoccer = dto.IsInLiveCenterSoccer;
            _isInLiveMatchTracker = dto.IsInLiveMatchTracker;
            _isInLiveScore        = dto.IsInLiveScore;

            if (dto.ProductInfoLinks != null)
            {
                var links = dto.ProductInfoLinks.Select(s => (IProductInfoLink) new ProductInfoLink(s.Reference, s.Name)).ToList();
                _links = new ReadOnlyCollection <IProductInfoLink>(links);
            }
            if (dto.StreamingChannels != null)
            {
                var channels = dto.StreamingChannels.Select(s => (IStreamingChannel) new StreamingChannel(s.Id, s.Name)).ToList();
                _channels = new ReadOnlyCollection <IStreamingChannel>(channels);
            }
        }
 public ActionResult AddImages(ProductInfoDTO model)
 {
     return View(model);
 }
Esempio n. 20
0
        public List <ProductInfoDTO> GetProductInfo()
        {
            List <ProductInfoDTO> productInfoList = new List <ProductInfoDTO>();
            SqlDataReader         DR;
            SqlConnection         objMyCon = new SqlConnection(ConfigurationManager.ConnectionStrings["DPOSConnectionString"].ToString());
            SqlCommand            objCmd   = new SqlCommand();

            objCmd.Connection  = objMyCon;
            objCmd.CommandText = "SELECT     ProductInfo.P_PK, ProductInfo.P_Code, ProductInfo.PC_PK, ProductInfo.PSC_PK, ProductInfo.PB_PK, ProductInfo.P_Name, ProductInfo.P_Style, " +
                                 "ProductInfo.P_SalesPrice, ProductInfo.P_CostPrice, ProductInfo.P_Tax, ProductInfo.P_VAT, ProductInfo.P_Discount, ProductInfo.P_MinLevel, " +
                                 "ProductInfo.P_MaxLevel, ProductInfo.P_ReorderLevel, ProductInfo.P_Status, ProductInfo.P_SalesPricedate, ProductInfo.P_CostPricedate, " +
                                 "ProductInfo.P_Warranty, ProductInfo.P_WarrantyMonth, ProductInfo.PU_PK, ProductInfo.EntryBy, ProductInfo.EntryDate, " +
                                 "ProductCategoryInfo.PC_Description " +
                                 "FROM  ProductInfo INNER JOIN " +
                                 "ProductCategoryInfo ON ProductInfo.PC_PK = ProductCategoryInfo.PC_PK " +
                                 "ORDER BY ProductInfo.P_Code DESC ";
            //objCmd.CommandText = "SELECT ProductInfo.P_PK, ProductInfo.P_Code, ProductInfo.PC_PK, ProductInfo.PSC_PK, ProductInfo.PB_PK, ProductInfo.P_Name, ProductInfo.P_Style, " +
            //          "ProductInfo.P_SalesPrice, ProductInfo.P_CostPrice, ProductInfo.P_Tax, ProductInfo.P_VAT, ProductInfo.P_Discount, ProductInfo.P_MinLevel, " +
            //          "ProductInfo.P_MaxLevel, ProductInfo.P_ReorderLevel, ProductInfo.P_status, ProductInfo.P_SalesPricedate, ProductInfo.P_CostPricedate, " +
            //          "ProductInfo.P_Warranty, ProductInfo.P_WarrantyMonth, ProductInfo.PU_PK, ProductInfo.EntryBy, ProductInfo.EntryDate, " +
            //          "ProductCategoryInfo.PC_Description, ProductSubCategoryInfo.PSC_Description, ProductBrandInfo.PB_Name, ProductUnitInfo.PU_Name " +
            //            "FROM ProductInfo INNER JOIN " +
            //          "ProductCategoryInfo ON ProductInfo.PC_PK = ProductCategoryInfo.PC_PK " +
            //          "ProductBrandInfo ON ProductInfo.PB_PK = ProductBrandInfo.PB_PK INNER JOIN " +
            //          "ProductUnitInfo ON ProductInfo.PU_PK = ProductUnitInfo.PU_PK INNER JOIN " +
            //          "ProductSubCategoryInfo ON ProductInfo.PSC_PK = ProductSubCategoryInfo.PSC_PK " +
            //          "ORDER BY ProductInfo.P_Code DESC";

            try
            {
                objMyCon.Open();
                DR = objCmd.ExecuteReader();
                while (DR.Read())
                {
                    ProductInfoDTO pDto = new ProductInfoDTO();

                    pDto.PrimaryKey       = (Guid)DR[0];
                    pDto.P_Code           = (string)DR[1];
                    pDto.PC_PrimaryKey    = (Guid)DR[2];
                    pDto.PSC_PrimaryKey   = (Guid)DR[3];
                    pDto.PB_PrimaryKey    = (Guid)DR[4];
                    pDto.P_Name           = (string)DR[5];
                    pDto.P_Style          = (string)DR[6];
                    pDto.P_SalesPrice     = Convert.ToDecimal(DR[7]);
                    pDto.P_CostPrice      = Convert.ToDecimal(DR[8]);
                    pDto.P_Tax            = Convert.ToDecimal(DR[9]);
                    pDto.P_VAT            = Convert.ToDecimal(DR[10]);
                    pDto.P_Discount       = Convert.ToDecimal(DR[11]);
                    pDto.P_MinLevel       = Convert.ToDecimal(DR[12]);
                    pDto.P_MaxLevel       = Convert.ToDecimal(DR[13]);
                    pDto.P_ReorderLevel   = Convert.ToDecimal(DR[14]);
                    pDto.P_Status         = (Boolean)DR[15];
                    pDto.P_SalesPriceDate = (DateTime)DR[16];
                    pDto.P_CostPriceDate  = (DateTime)DR[17];
                    pDto.P_Warranty       = (Boolean)DR[18];
                    pDto.P_WarrantyMonth  = (int)DR[19];
                    pDto.PU_PrimaryKey    = (Guid)DR[20];
                    pDto.EntryBy          = (string)DR[21];
                    pDto.EntryDate        = (DateTime)DR[22];

                    productInfoList.Add(pDto);
                }

                DR.Close();
                objMyCon.Close();
                return(productInfoList);
            }
            catch (Exception Exp)
            {
                throw Exp;
            }
        }
Esempio n. 21
0
        public List <ProductInOrderDTO> GetProductsInOrderByOrderIdNew(int orderId)
        {
            List <ProductInOrderDTO> productsInOrder = new List <ProductInOrderDTO>();

            string query = "ClientsAgregatorDB.GetProductOrderByOrderId @OrderId";

            List <Product_OrderDTO> product_OrderDTOs;

            using (IDbConnection conn = new SqlConnection(Options.connectionString))
            {
                product_OrderDTOs = conn.Query <Product_OrderDTO>(query, new { orderId }).AsList();
            }

            query = "ClientsAgregatorDB.GetProductsInfoById @Id";

            List <ProductInfoDTO> productInfoDTOs = new List <ProductInfoDTO>();

            foreach (Product_OrderDTO po in product_OrderDTOs)
            {
                using (IDbConnection conn = new SqlConnection(Options.connectionString))
                {
                    int            productId         = po.ProductId;
                    ProductInfoDTO newProductInfoDTO = conn.Query <ProductInfoDTO>(query, new { Id = productId }).FirstOrDefault();
                    productInfoDTOs.Add(newProductInfoDTO);
                }
            }

            foreach (ProductInfoDTO pi in productInfoDTOs)
            {
                productsInOrder.Add(new ProductInOrderDTO()
                {
                    Articul          = pi.Articul,
                    ProductId        = pi.Id,
                    ProductTitle     = pi.Title,
                    Price            = pi.Price,
                    MeasureUnitTitle = pi.MeasureUnit,
                    SubgroupTitle    = pi.Subgroup,
                    GroupTitle       = pi.Group
                });
            }
            foreach (ProductInOrderDTO pio in productsInOrder)
            {
                foreach (Product_OrderDTO po in product_OrderDTOs)
                {
                    if (pio.ProductId == po.ProductId)
                    {
                        pio.Quantity = po.Quantity;
                    }
                }
            }

            List <MeasureUnitDTO> measureUnitDTOs;

            query = "ClientsAgregatorDB.GetMeasureUnit";

            using (IDbConnection conn = new SqlConnection(Options.connectionString))
            {
                measureUnitDTOs = conn.Query <MeasureUnitDTO>(query).AsList();
            }

            foreach (ProductInOrderDTO pio in productsInOrder)
            {
                foreach (MeasureUnitDTO mu in measureUnitDTOs)
                {
                    if (pio.MeasureUnitTitle == mu.Title)
                    {
                        pio.MeasureUnitId = mu.Id;
                    }
                }
            }

            List <FeedbackDTO> feedbackDTOs;

            query = "ClientsAgregatorDB.GetFeedbacksByOrderId @OrderId";

            using (IDbConnection conn = new SqlConnection(Options.connectionString))
            {
                feedbackDTOs = conn.Query <FeedbackDTO>(query, new { orderId }).AsList();
            }

            foreach (ProductInOrderDTO pio in productsInOrder)
            {
                foreach (FeedbackDTO f in feedbackDTOs)
                {
                    if (pio.ProductId == f.ProductId)
                    {
                        pio.Rate        = f.Rate;
                        pio.OrderReview = f.Description;
                    }
                }
            }

            return(productsInOrder);
        }
Esempio n. 22
0
        public override void Save(object Obj)
        {
            ProductInfoDTO dto = (ProductInfoDTO)Obj;

            SqlConnection objMyCon = new SqlConnection(ConfigurationManager.ConnectionStrings["DPOSConnectionString"].ToString());
            SqlCommand    objCmd   = new SqlCommand();

            if (dto.PrimaryKey.ToString() == "00000000-0000-0000-0000-000000000000")
            {
                dto.P_Code         = Get_NewProductInfoCode(dto);
                objCmd.CommandText = "Insert Into ProductInfo(PC_PK,PSC_PK,PB_PK,P_Code,P_Name,P_Style,P_SalesPrice,P_CostPrice,P_Tax,P_VAT,P_Discount,P_MinLevel,P_MaxLevel,P_ReorderLevel,P_Status,P_SalesPriceDate,P_CostPriceDate,P_Warranty,P_WarrantyMonth,PU_PK,EntryBy,EntryDate) Values(@PC_PK,@PSC_PK,@PB_PK,@P_Code,@P_Name,@P_Style,@P_SalesPrice,@P_CostPrice,@P_Tax,@P_VAT,@P_Discount,@P_MinLevel,@P_MaxLevel,@P_ReorderLevel,@P_Status,@P_SalesPriceDate,@P_CostPriceDate,@P_Warranty,@P_WarrantyMonth,@PU_PK,@EntryBy,@EntryDate)";
            }
            else
            {
                objCmd.CommandText = "Update ProductInfo Set PC_PK=@PC_PK,PSC_PK=@PSC_PK,PB_PK=@PB_PK,P_Code=@P_Code,P_Name=@P_Name,P_Style=@P_Style,P_SalesPrice=@P_SalesPrice,P_CostPrice=@P_CostPrice,P_Tax=@P_Tax,P_VAT=@P_VAT,P_Discount=@P_Discount,P_MinLevel=@P_MinLevel,P_MaxLevel=@P_MaxLevel,P_ReorderLevel=@P_ReorderLevel,P_Status=@P_Status,P_SalesPriceDate=@P_SalesPriceDate,P_CostPriceDate=@P_CostPriceDate,P_Warranty=@P_Warranty,P_WarrantyMonth=@P_WarrantyMonth,PU_PK=@PU_PK,EntryBy=@EntryBy,EntryDate=@EntryDate Where P_PK=@P_PK";
                objCmd.Parameters.Add(new SqlParameter("@P_PK", SqlDbType.UniqueIdentifier, 16));
                objCmd.Parameters["@P_PK"].Value = (Guid)dto.PrimaryKey;
            }

            objCmd.Parameters.Add(new SqlParameter("@PC_PK", SqlDbType.UniqueIdentifier, 16));
            objCmd.Parameters.Add(new SqlParameter("@PSC_PK", SqlDbType.UniqueIdentifier, 16));
            objCmd.Parameters.Add(new SqlParameter("@PB_PK", SqlDbType.UniqueIdentifier, 16));
            objCmd.Parameters.Add(new SqlParameter("@PU_PK", SqlDbType.UniqueIdentifier, 16));
            objCmd.Parameters.Add(new SqlParameter("@P_Code", SqlDbType.VarChar, 13));
            objCmd.Parameters.Add(new SqlParameter("@P_Name", SqlDbType.VarChar, 50));
            objCmd.Parameters.Add(new SqlParameter("@P_Style", SqlDbType.VarChar, 100));
            objCmd.Parameters.Add(new SqlParameter("@P_SalesPrice", SqlDbType.Decimal, 9));
            objCmd.Parameters.Add(new SqlParameter("@P_CostPrice", SqlDbType.Decimal, 9));
            objCmd.Parameters.Add(new SqlParameter("@P_Tax", SqlDbType.Decimal, 9));
            objCmd.Parameters.Add(new SqlParameter("@P_VAT", SqlDbType.Decimal, 9));
            objCmd.Parameters.Add(new SqlParameter("@P_Discount", SqlDbType.Decimal, 9));
            objCmd.Parameters.Add(new SqlParameter("@P_MinLevel", SqlDbType.Decimal, 9));
            objCmd.Parameters.Add(new SqlParameter("@P_MaxLevel", SqlDbType.Decimal, 9));
            objCmd.Parameters.Add(new SqlParameter("@P_ReorderLevel", SqlDbType.Decimal, 9));
            objCmd.Parameters.Add(new SqlParameter("@P_Status", SqlDbType.Bit, 1));
            objCmd.Parameters.Add(new SqlParameter("@P_SalesPriceDate", SqlDbType.DateTime, 8));
            objCmd.Parameters.Add(new SqlParameter("@P_CostPriceDate", SqlDbType.DateTime, 8));
            objCmd.Parameters.Add(new SqlParameter("@P_Warranty", SqlDbType.Bit, 1));
            objCmd.Parameters.Add(new SqlParameter("@P_WarrantyMonth", SqlDbType.Int, 4));
            objCmd.Parameters.Add(new SqlParameter("@EntryBy", SqlDbType.VarChar, 6));
            objCmd.Parameters.Add(new SqlParameter("@EntryDate", SqlDbType.DateTime, 8));

            objCmd.Parameters["@PC_PK"].Value            = (Guid)dto.PC_PrimaryKey;
            objCmd.Parameters["@PSC_PK"].Value           = (Guid)dto.PSC_PrimaryKey;
            objCmd.Parameters["@PB_PK"].Value            = (Guid)dto.PB_PrimaryKey;
            objCmd.Parameters["@PU_PK"].Value            = (Guid)dto.PU_PrimaryKey;
            objCmd.Parameters["@P_Code"].Value           = (string)dto.P_Code;
            objCmd.Parameters["@P_Name"].Value           = (string)dto.P_Name;
            objCmd.Parameters["@P_Style"].Value          = (string)dto.P_Style;
            objCmd.Parameters["@P_SalesPrice"].Value     = Convert.ToDecimal(dto.P_SalesPrice);
            objCmd.Parameters["@P_CostPrice"].Value      = Convert.ToDecimal(dto.P_CostPrice);
            objCmd.Parameters["@P_Tax"].Value            = Convert.ToDecimal(dto.P_Tax);
            objCmd.Parameters["@P_VAT"].Value            = Convert.ToDecimal(dto.P_VAT);
            objCmd.Parameters["@P_Discount"].Value       = Convert.ToDecimal(dto.P_Discount);
            objCmd.Parameters["@P_MinLevel"].Value       = Convert.ToDecimal(dto.P_MinLevel);
            objCmd.Parameters["@P_MaxLevel"].Value       = Convert.ToDecimal(dto.P_MaxLevel);
            objCmd.Parameters["@P_ReorderLevel"].Value   = Convert.ToDecimal(dto.P_ReorderLevel);
            objCmd.Parameters["@P_Status"].Value         = Convert.ToBoolean(dto.P_Status);
            objCmd.Parameters["@P_SalesPriceDate"].Value = (DateTime)dto.P_SalesPriceDate;
            objCmd.Parameters["@P_CostPriceDate"].Value  = (DateTime)dto.P_CostPriceDate;
            objCmd.Parameters["@P_Warranty"].Value       = Convert.ToBoolean(dto.P_Warranty);
            objCmd.Parameters["@P_WarrantyMonth"].Value  = Convert.ToDecimal(dto.P_WarrantyMonth);
            objCmd.Parameters["@EntryBy"].Value          = (string)dto.EntryBy;
            objCmd.Parameters["@EntryDate"].Value        = (DateTime)dto.EntryDate;

            objCmd.Connection = objMyCon;
            objMyCon.Open();
            objCmd.ExecuteNonQuery();
            objMyCon.Close();
        }
Esempio n. 23
0
    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        try
        {
            if (e.CommandName == "Edit")
            {
                ProductInfoDTO pDto = new ProductInfoDTO();

                int         index = Convert.ToInt32(e.CommandArgument);
                GridViewRow row   = GridView1.Rows[index];

                DataKey dk = GridView1.DataKeys[index];
                this.hfPrimaryKey.Value = dk.Value.ToString();

                Facade facade = Facade.GetInstance();

                DropDownListSubCategory(facade);

                pDto = facade.GetProductInfoDTO((Guid)TypeDescriptor.GetConverter(pDto.PrimaryKey).ConvertFromString(this.hfPrimaryKey.Value));
                this.txtProductCode.Text    = pDto.P_Code;
                this.txtProductName.Text    = pDto.P_Name;
                this.txtStyle.Text          = pDto.P_Style;
                this.txtSalesPrice.Text     = pDto.P_SalesPrice.ToString();
                this.txtCostPrice.Text      = pDto.P_CostPrice.ToString();
                this.txtTax.Text            = pDto.P_Tax.ToString();
                this.txtVat.Text            = pDto.P_VAT.ToString();
                this.txtDiscount.Text       = pDto.P_Discount.ToString();
                this.txtMinLevel.Text       = pDto.P_MinLevel.ToString();
                this.txtMaxLevel.Text       = pDto.P_MaxLevel.ToString();
                this.txtReorderLevel.Text   = pDto.P_ReorderLevel.ToString();
                this.chkStatus.Checked      = pDto.P_Status;
                this.txtSalesPriceDate.Text = pDto.P_SalesPriceDate.ToString("MM/dd/yyyy");
                this.txtCostPriceDate.Text  = pDto.P_CostPriceDate.ToString("MM/dd/yyyy");
                this.chkWarranty.Checked    = pDto.P_Warranty;
                this.txtWarrantyMonth.Text  = pDto.P_WarrantyMonth.ToString();
                this.btnSave.Text           = "Update";

                ProductCategoryInfoDTO pcDto = new ProductCategoryInfoDTO();
                pcDto = facade.GetProductCategoryInfo((Guid)pDto.PC_PrimaryKey);
                this.ddlProductCategory.SelectedValue = pcDto.PrimaryKey.ToString();

                ProductSubCategoryInfoDTO pscDto = new ProductSubCategoryInfoDTO();
                pscDto = facade.GetProductsubCategoryInfo((Guid)pDto.PSC_PrimaryKey);
                if (pscDto.PrimaryKey.ToString() == "00000000-0000-0000-0000-000000000000")
                {
                    this.ddlProductSubCategory.SelectedValue = "";
                }
                else
                {
                    this.ddlProductSubCategory.SelectedValue = pscDto.PrimaryKey.ToString();
                }

                ProductBrandInfoDTO pbDto = new ProductBrandInfoDTO();
                pbDto = facade.GetProductBrandInfo((Guid)pDto.PB_PrimaryKey);
                if (pbDto.PrimaryKey.ToString() == "00000000-0000-0000-0000-000000000000")
                {
                    this.ddlProductBrand.SelectedValue = "";
                }
                else
                {
                    this.ddlProductBrand.SelectedValue = pbDto.PrimaryKey.ToString();
                }

                ProductUnitInfoDTO puDto = new ProductUnitInfoDTO();
                puDto = facade.GetProductUnitInfo((Guid)pDto.PU_PrimaryKey);
                if (puDto.PrimaryKey.ToString() == "00000000-0000-0000-0000-000000000000")
                {
                    this.ddlProductUnit.SelectedValue = "";
                }
                else
                {
                    this.ddlProductUnit.SelectedValue = puDto.PrimaryKey.ToString();
                }
            }
        }
        catch (Exception Exp)
        {
            lblErrorMessage.Text = cls.ErrorString(Exp);
        }
    }
Esempio n. 24
0
        public async Task <bool> Delete(ProductInfoDTO obj)
        {
            await ServiceProvider.GetService <IProductManager>().RemoveAsync(obj);

            return(true);
        }
Esempio n. 25
0
    /// <summary>
    /// All information set in domain class and return an object
    /// </summary>
    /// <returns></returns>
    private ProductInfoDTO Populate()
    {
        try
        {
            ProductInfoDTO pDTO = new ProductInfoDTO();

            if (this.hfPrimaryKey.Value.ToString() != "")
            {
                pDTO.PrimaryKey = (Guid)TypeDescriptor.GetConverter(pDTO.PrimaryKey).ConvertFromString(this.hfPrimaryKey.Value);
            }
            if (this.ddlProductCategory.SelectedValue == "")
            {
                throw new Exception("Invalid category.");
            }
            //if (this.ddlProductSubCategory.SelectedValue == "")
            //{
            //    throw new Exception("Invalid sub category.");
            //}
            //if (this.ddlProductBrand.SelectedValue == "")
            //{
            //    throw new Exception("Invalid brand.");
            //}
            //if (this.ddlProductUnit.SelectedValue == "")
            //{
            //    throw new Exception("Invalid unit.");
            //}

            Guid nullGuid = Guid.NewGuid();
            nullGuid = (Guid)TypeDescriptor.GetConverter(nullGuid).ConvertFromString("00000000-0000-0000-0000-000000000000");

            string strPSC_PK = (string)this.ddlProductSubCategory.SelectedValue;
            string strPB_PK  = (string)this.ddlProductBrand.SelectedValue;
            string strPU_PK  = (string)this.ddlProductUnit.SelectedValue;

            pDTO.PC_PrimaryKey  = (Guid)TypeDescriptor.GetConverter(pDTO.PC_PrimaryKey).ConvertFromString(this.ddlProductCategory.SelectedValue);
            pDTO.PSC_PrimaryKey = strPSC_PK == string.Empty ? nullGuid :(Guid)TypeDescriptor.GetConverter(pDTO.PSC_PrimaryKey).ConvertFromString(strPSC_PK);
            pDTO.PB_PrimaryKey  = strPB_PK == string.Empty ? nullGuid :(Guid)TypeDescriptor.GetConverter(pDTO.PB_PrimaryKey).ConvertFromString(strPB_PK);
            pDTO.PU_PrimaryKey  = strPU_PK == string.Empty ? nullGuid : (Guid)TypeDescriptor.GetConverter(pDTO.PU_PrimaryKey).ConvertFromString(strPU_PK);

            pDTO.P_Code         = this.txtProductCode.Text;
            pDTO.P_Name         = this.txtProductName.Text;
            pDTO.P_Style        = this.txtStyle.Text;
            pDTO.P_SalesPrice   = this.txtSalesPrice.Text == string.Empty ? 0 : Convert.ToDecimal(this.txtSalesPrice.Text);
            pDTO.P_CostPrice    = this.txtCostPrice.Text == string.Empty ? 0 : Convert.ToDecimal(this.txtCostPrice.Text);
            pDTO.P_Tax          = this.txtTax.Text == string.Empty ? 0 : Convert.ToDecimal(this.txtTax.Text);
            pDTO.P_VAT          = this.txtVat.Text == string.Empty ? 0 : Convert.ToDecimal(this.txtVat.Text);
            pDTO.P_Discount     = this.txtDiscount.Text == string.Empty ? 0 : Convert.ToDecimal(this.txtDiscount.Text);
            pDTO.P_MinLevel     = this.txtMinLevel.Text == string.Empty ? 0 : Convert.ToDecimal(this.txtMinLevel.Text);
            pDTO.P_MaxLevel     = this.txtMaxLevel.Text == string.Empty ? 0 : Convert.ToDecimal(this.txtMaxLevel.Text);
            pDTO.P_ReorderLevel = this.txtReorderLevel.Text == string.Empty ? 0 : Convert.ToDecimal(this.txtReorderLevel.Text);
            pDTO.P_Status       = this.chkStatus.Checked;

            pDTO.P_SalesPriceDate = this.txtSalesPriceDate.Text == string.Empty ? DateTime.Now.Date : Convert.ToDateTime(this.txtSalesPriceDate.Text);
            pDTO.P_CostPriceDate  = this.txtCostPriceDate.Text == string.Empty ? DateTime.Now.Date : Convert.ToDateTime(this.txtCostPriceDate.Text);
            pDTO.P_Warranty       = this.chkWarranty.Checked;
            pDTO.P_WarrantyMonth  = this.txtWarrantyMonth.Text == string.Empty ? 0 : Convert.ToInt32(this.txtWarrantyMonth.Text);
            pDTO.EntryBy          = Constants.DEFULT_USER;
            pDTO.EntryDate        = DateTime.Today;

            return(pDTO);
        }
        catch (Exception Exp)
        {
            throw Exp;
        }
    }
 public ProductInfoViewModel(ProductInfoDTO info)
 {
     this.productInfo = info;
 }