Example #1
0
        public virtual Product_HistoryDomain CreateProductDomain()
        {
            Product_HistoryEntity entity = new Product_HistoryEntity();
            entity.ProductId = Guid.NewGuid().ToString();

            return new Product_HistoryDomain(entity);
        }
        private Product_HistoryEntity GetEntity()
        {
            Product_HistoryEntity objEntity = null;
            if (!string.IsNullOrEmpty(ProductId))
                objEntity = MainService.Product_HistoryBLLService.GetProductEntityById(ProductId);
            else
            {
                objEntity = new Product_HistoryEntity();
                objEntity.ProductId = Guid.NewGuid().ToString();
            }

            //objEntity.GbuId = this.ddlGBU.SelectedItem.Value;
            objEntity.Gbu = this.ddlGBU.SelectedItem.Text;
            //objEntity.CategoryId = this.ddlCategory.SelectedItem.Value;
            objEntity.Category = this.ddlCategory.SelectedItem.Text;
            //objEntity.BrandId = this.ddlBrand.SelectedItem.Value;
            objEntity.Brand = this.ddlBrand.SelectedItem.Text;
            //objEntity.SubcategoryId = this.ddlSubCategory.SelectedItem.Value;
            objEntity.Subcategory = this.ddlSubCategory.SelectedItem.Text;

            objEntity.ProductType = ddlProductType.SelectedValue.Trim();

            objEntity.DescCn = this.txtDescCN.Text.Trim();
            objEntity.DescEn = this.txtDescEN.Text.Trim();
            objEntity.Specification = this.txtSpec.Text.Trim();

            objEntity.RetailCaseprice = decimal.Parse(this.txtValue.Text.Trim());

            //objEntity.BrandtypeId = this.ddlBrandType.SelectedItem.Value;
            objEntity.Brandtype = this.ddlBrandType.SelectedItem.Text;
            //objEntity.ProductSizeId = this.ddlProductSize.SelectedItem.Value;
            objEntity.ProductSize = this.ddlProductSize.SelectedItem.Text;
            objEntity.Product_SAP_Code = this.txtSAPCode.Text.Trim();
            objEntity.CasePackage = decimal.Parse(this.txtCasePackage.Text.Trim());
            objEntity.Product_StartDate = Convert.ToDateTime(this.txtStartDate.Text.Trim());
            if (!string.IsNullOrEmpty(this.txtEndDate.Text.Trim()))
            {
                objEntity.Product_EndDate = Convert.ToDateTime(this.txtEndDate.Text.Trim());
            }
            return objEntity;
        }
        /// <summary>
        /// Set entity data
        /// </summary>
        private void SetEntity(Product_HistoryEntity objEntity)
        {
            ProductId = objEntity.ProductId;
            string gbuId = objEntity.Gbu;
            string categoryId = objEntity.Category;
            string brandId = objEntity.Brand; ;
            string subCategoryId = objEntity.Subcategory;

            BindGBUList();
            this.ddlGBU.SelectedValue = gbuId;
            BindCategoryList();
            this.ddlCategory.SelectedValue = categoryId;
            BindBrandList();
            this.ddlBrand.SelectedValue = brandId;
            BindSubCategoryList();
            this.ddlSubCategory.SelectedValue = subCategoryId;

            this.ddlBrandType.SelectedValue = objEntity.BrandtypeId;
            this.ddlProductSize.SelectedValue = objEntity.ProductSizeId;

             ddlProductType.SelectedValue= objEntity.ProductType;

            txtDescCN.Text = objEntity.DescCn;
            txtDescEN.Text = objEntity.DescEn;

            txtValue.Text = objEntity.RetailCaseprice.ToString();
            txtSpec.Text = objEntity.Specification;
            txtSAPCode.Text = objEntity.Product_SAP_Code;
            txtCasePackage.Text = objEntity.CasePackage.ToString();
            if (objEntity.Product_StartDate != DateTime.MinValue)
            {
                txtStartDate.Text = objEntity.Product_StartDate.ToShortDateString();
            }
            if (objEntity.Product_EndDate != DateTime.MinValue)
            {
                txtEndDate.Text = objEntity.Product_EndDate.ToShortDateString();
            }
            ddlGBU.Focus();
        }
Example #4
0
 public Product_HistoryDomain(Product_HistoryEntity entity)
     : base(entity)
 {
     masterEntity = entity;
 }
 private Product_HistoryEntity convertToEntity(DataRow row)
 {
     int colIndex = 0;
     string product_ID = row[colIndex++].ToString().Trim().ToLower();
     string gbu = row[colIndex++].ToString().Trim();
     string category = row[colIndex++].ToString().Trim();
     string brand = row[colIndex++].ToString().Trim();
     string brandType = row[colIndex++].ToString().Trim();
     string sub_category = row[colIndex++].ToString().Trim();
     string product_SAP_code = row[colIndex++].ToString().Trim();
     string desc_cn = row[colIndex++].ToString().Trim();
     string produPCS_type = row[colIndex++].ToString().Trim();
     string productSize = row[colIndex++].ToString().Trim();
     string case_package = row[colIndex++].ToString().Trim();
     string retail_unitprice = row[colIndex++].ToString().Trim();
     string desc_en = row[colIndex++].ToString().Trim().ToLower();
     string specification = row[colIndex++].ToString().Trim().ToLower();
     string startdate = row[colIndex++].ToString().Trim().ToLower();
     string enddate = row[colIndex++].ToString().Trim().ToLower();
     Product_HistoryEntity entity = new Product_HistoryEntity();
     entity.ProductId = product_ID;
     entity.Gbu = gbu;
     entity.Category = category;
     entity.Brand = brand;
     entity.Subcategory = sub_category;
     entity.DescCn = desc_cn;
     entity.DescEn = desc_en;
     entity.Brandtype = brandType;
     entity.ProductSize = productSize;
     entity.CasePackage = decimal.Parse(case_package);
     entity.Specification = specification;
     entity.RetailCaseprice = decimal.Parse(retail_unitprice);
     entity.Product_SAP_Code = product_SAP_code;
     entity.ProductType = produPCS_type;
     DateTime _d = DateTime.Now;
     if (DateTime.TryParse(startdate, out _d))
     {
         entity.Product_StartDate = DateTime.Parse(_d.ToShortDateString());
     }
     if (DateTime.TryParse(enddate, out _d))
     {
         entity.Product_EndDate = DateTime.Parse(_d.ToShortDateString());
     }
     entity.ImportTime = DateTime.Now;
     entity.ImportUser = CurrentUser.SecUserEntity.EnglishName;
     return entity;
 }