Ejemplo n.º 1
0
    public int Delete(string Id)
    {
        int id        = Convert.ToInt32(Id);
        int rowAffect = new BrandBL().Delete(id);

        return(rowAffect);
    }
Ejemplo n.º 2
0
    public List <BrandOL> GetAllBrands()
    {
        List <BrandOL> objbrand = new List <BrandOL>();

        objbrand = new BrandBL().GetAllBrands();
        return(objbrand);
    }
Ejemplo n.º 3
0
        public JsonResultEntity Create([FromBody] BrandEntity brandEntity)
        {
            BrandBL          brandBL  = new BrandBL();
            JsonResultEntity response = new JsonResultEntity();

            try
            {
                var result = brandBL.Create(brandEntity);

                if (result.HasWarning())
                {
                    response.Message = String.Join(",", result.Warning);
                    return(response);
                }

                response.Success = true;
                response.Data    = result.Value;
            }
            catch (Exception ex)
            {
                response.Message = ex.Message;
                LoggerHelper.Error(ex);
            }

            return(response);
        }
Ejemplo n.º 4
0
    public BrandOL GetById(string id)
    {
        int     Id       = Convert.ToInt32(id);
        BrandOL objbrand = new BrandOL();

        objbrand = new BrandBL().GetById(Id);
        HttpContext.Current.Session["Image"] = objbrand.Image;
        return(objbrand);
    }
Ejemplo n.º 5
0
        private void loadBrands()
        {
            List <Brand> brands = new BrandBL().GetBrands(Page.Request.QueryString["category"]);

            chkAttributes.DataSource     = brands;
            chkAttributes.DataTextField  = "name";
            chkAttributes.DataValueField = "brandID";
            chkAttributes.DataBind();
        }
Ejemplo n.º 6
0
        private void loadBrands()
        {
            BrandBL brandBL = new BrandBL();

            cmbBrand.DataSource     = brandBL.GetBrands(false);
            cmbBrand.DataTextField  = "name";
            cmbBrand.DataValueField = "brandID";
            cmbBrand.DataBind();
        }
Ejemplo n.º 7
0
    public int Edit(string Name, string Id, string Image)
    {
        int id = Convert.ToInt32(Id);

        if (Image == "" || Image == null)
        {
            Image = HttpContext.Current.Session["Image"].ToString();
        }
        int rowAffect = new BrandBL().Edit(id, Name, Image);

        return(id);
    }
Ejemplo n.º 8
0
        private void loadIntoForm()
        {
            CategoryBL categoryBL = new CategoryBL();

            //cmbCategory.DataSource = categoryBL.GetCategories();
            cmbCategory.DataSource     = categoryBL.GetNestedCategoriesDataTable(true, true);
            cmbCategory.DataTextField  = "name";
            cmbCategory.DataValueField = "categoryID";
            cmbCategory.DataBind();

            SupplierBL supplierBL = new SupplierBL();

            cmbSupplier.DataSource     = supplierBL.GetSuppliers(true);
            cmbSupplier.DataTextField  = "name";
            cmbSupplier.DataValueField = "supplierID";
            cmbSupplier.DataBind();


            cmbApproved.Items.Add("Sve");
            cmbApproved.Items.Add("Odobrene");
            cmbApproved.Items.Add("Neodobrene");


            cmbActive.Items.Add("Sve");
            cmbActive.Items.Add("Aktivne");
            cmbActive.Items.Add("Neaktivne");

            cmbPageSize.Items.Add("10");
            cmbPageSize.Items.Add("20");
            cmbPageSize.Items.Add("50");
            cmbPageSize.Items.Add("100");
            cmbPageSize.Items.Add("Sve");

            BrandBL brandBL = new BrandBL();

            cmbBrand.DataSource     = brandBL.GetBrands(true);
            cmbBrand.DataTextField  = "name";
            cmbBrand.DataValueField = "brandID";
            cmbBrand.DataBind();

            cmbPromotions.DataSource     = new PromotionBL().GetPromotions(true, null, null);
            cmbPromotions.DataTextField  = "name";
            cmbPromotions.DataValueField = "promotionID";
            cmbPromotions.DataBind();

            cmbPromotion.DataSource     = new PromotionBL().GetPromotions(true, null, null);
            cmbPromotion.DataTextField  = "name";
            cmbPromotion.DataValueField = "promotionID";
            cmbPromotion.DataBind();
        }
Ejemplo n.º 9
0
 private void loadBrand(int brandID)
 {
     try
     {
         Brand brand = new BrandBL().GetBrand(brandID);
         txtName.Text      = brand.Name;
         lblBrandID.Value  = brand.BrandID.ToString();
         imgImage.ImageUrl = brand.LogoUrl != null && brand.LogoUrl != string.Empty ? "/images/brand/" + brand.LogoUrl : string.Empty;
     }
     catch (BLException ex)
     {
         setStatus(ex.Message, System.Drawing.Color.Red, true, "danger");
     }
 }
Ejemplo n.º 10
0
        private void saveBrand()
        {
            try
            {
                Brand brand = new Brand();
                brand.Name    = txtName.Text;
                brand.BrandID = lblBrandID.Value != string.Empty ? int.Parse(lblBrandID.Value) : -1;
                brand.LogoUrl = (imgImage.ImageUrl != null && imgImage.ImageUrl != string.Empty) ? imgImage.ImageUrl.Substring(imgImage.ImageUrl.LastIndexOf("/") + 1) : string.Empty;

                int brandID = new BrandBL().SaveBrand(brand);
                lblBrandID.Value = brandID.ToString();
            }
            catch (BLException ex)
            {
                setStatus(ex.Message, System.Drawing.Color.Red, true, "danger");
            }
        }
Ejemplo n.º 11
0
        protected void btnAddAttributeValue_Click(object sender, EventArgs e)
        {
            switch (lblType.Value)
            {
            case "attribute":
            {
                AttributeBL attributeBL = new AttributeBL();
                attributeBL.SaveAttributeValue(new AttributeValue(-1, txtAttributeValue.Text, int.Parse(lblAttributeID.Value), 0, string.Empty, 0), false);

                foreach (object control in pnlAttributes.Controls)
                {
                    if (control is customControls.AttributeControl)
                    {
                        if (((customControls.AttributeControl)control).ID == lblAttributeName.Value)
                        {
                            ((customControls.AttributeControl)control).setValues();
                        }
                    }
                }
                break;
            }

            case "supplier":
            {
                SupplierBL supplierBL = new SupplierBL();
                supplierBL.SaveSupplier(new Supplier(-1, txtAttributeValue.Text));
                loadSupplier();
                break;
            }

            case "brand":
            {
                BrandBL brandBL = new BrandBL();
                brandBL.SaveBrand(new Brand(-1, txtAttributeValue.Text));
                loadBrands();
                break;
            }
            }
            txtAttributeValue.Text = string.Empty;
        }
Ejemplo n.º 12
0
        public JsonResultEntity Delete(int id)
        {
            var brandBL = new BrandBL();
            JsonResultEntity response = new JsonResultEntity();

            try
            {
                var result = brandBL.DeleteById(id);
                if (result.HasWarning())
                {
                    response.Message = String.Join(",", result.Warning);
                    return(response);
                }

                response.Success = true;
                response.Data    = result.Value;
            }
            catch (Exception e)
            {
                response.Message = e.Message;
                LoggerHelper.Error(e);
            }
            return(response);
        }
Ejemplo n.º 13
0
        public override JsonResultEntity Get([FromBody] DBParamEntity dbParamEntity)
        {
            BrandBL          brandBL  = new BrandBL();
            JsonResultEntity response = new JsonResultEntity();

            try
            {
                var result = brandBL.GetAll(dbParamEntity);

                if (result.HasWarning())
                {
                    response.Message = String.Join(",", result.Warning);
                    return(response);
                }

                var dataFound  = brandBL.GetTotalRows(dbParamEntity);
                var totalPages = Convert.ToInt32(Math.Ceiling(dataFound.Value / Convert.ToDouble(dbParamEntity.Limit)));

                response.Success  = true;
                response.Data     = result.Value;
                response.MetaInfo = new MetaInfoEntity
                {
                    DataFound   = dataFound.Value,
                    DataPerPage = dbParamEntity.Limit,
                    Page        = dbParamEntity.Page,
                    TotalPages  = totalPages == 0 ? 1 : totalPages
                };
            }
            catch (Exception ex)
            {
                response.Message = ex.Message;
                LoggerHelper.Error(ex);
            }

            return(response);
        }
Ejemplo n.º 14
0
        private void loadIntoForm()
        {
            CategoryBL categoryBL = new CategoryBL();

            //cmbCategory.DataSource = categoryBL.GetCategories();
            cmbCategory.DataSource     = categoryBL.GetNestedCategoriesDataTable(true, true);
            cmbCategory.DataTextField  = "name";
            cmbCategory.DataValueField = "categoryID";
            cmbCategory.DataBind();

            SupplierBL supplierBL = new SupplierBL();

            cmbSupplier.DataSource     = supplierBL.GetSuppliers(true);
            cmbSupplier.DataTextField  = "name";
            cmbSupplier.DataValueField = "supplierID";
            cmbSupplier.DataBind();


            cmbApproved.Items.Add("Sve");
            cmbApproved.Items.Add("Odobrene");
            cmbApproved.Items.Add("Neodobrene");


            cmbActive.Items.Add("Sve");
            cmbActive.Items.Add("Aktivne");
            cmbActive.Items.Add("Neaktivne");

            cmbPageSize.Items.Add("10");
            cmbPageSize.Items.Add("20");
            cmbPageSize.Items.Add("50");
            cmbPageSize.Items.Add("100");
            cmbPageSize.Items.Add("Sve");

            BrandBL brandBL = new BrandBL();

            cmbBrand.DataSource     = brandBL.GetBrands(true);
            cmbBrand.DataTextField  = "name";
            cmbBrand.DataValueField = "brandID";
            cmbBrand.DataBind();

            cmbPromotions.DataSource     = new PromotionBL().GetPromotions(true, null, null);
            cmbPromotions.DataTextField  = "name";
            cmbPromotions.DataValueField = "promotionID";
            cmbPromotions.DataBind();

            cmbPromotion.DataSource     = new PromotionBL().GetPromotions(true, null, null);
            cmbPromotion.DataTextField  = "name";
            cmbPromotion.DataValueField = "promotionID";
            cmbPromotion.DataBind();

            cmbAdditionallyCategory.DataSource     = categoryBL.GetNestedCategoriesDataTable(true, true);
            cmbAdditionallyCategory.DataTextField  = "name";
            cmbAdditionallyCategory.DataValueField = "categoryID";
            cmbAdditionallyCategory.DataBind();

            cmbSort.Items.Add(new ListItem("Nazivu", "brand.name, product.name"));
            cmbSort.Items.Add(new ListItem("Datumu unosa", "product.insertDate"));
            cmbSort.Items.Add(new ListItem("Datumu izmene", "product.updateDate"));
            cmbSort.Items.Add(new ListItem("Datum izmene opadajuće", "product.updateDate DESC"));
            cmbSort.Items.Add(new ListItem("Datum unosa opadajuće", "product.insertDate DESC"));

            cmbNewCategory.DataSource     = new CategoryBL().GetNestedCategoriesDataTable(true, true);
            cmbNewCategory.DataTextField  = "name";
            cmbNewCategory.DataValueField = "categoryID";
            cmbNewCategory.DataBind();

            cmbHasImage.Items.Add(new ListItem("Sve", "null"));
            cmbHasImage.Items.Add(new ListItem("Ima", "true"));
            cmbHasImage.Items.Add(new ListItem("Nema", "false"));

            cmbCustomPage.DataSource     = new CustomPageBL().GetCustomPages();
            cmbCustomPage.DataTextField  = "title";
            cmbCustomPage.DataValueField = "customPageID";
            cmbCustomPage.DataBind();
        }
Ejemplo n.º 15
0
 public MobileController()
 {
     mobileBL = new MobileBL();
     brandBL  = new BrandBL();
 }
Ejemplo n.º 16
0
    public int Add(string Name, string Image)
    {
        int rowAffect = new BrandBL().Add(Name, Image);

        return(rowAffect);
    }
 public BrandController()
 {
     brandBL = new BrandBL();
 }