Ejemplo n.º 1
0
    public string addCategoryProduct(string parentid, string categoryName, string categoryDescription, string isactive)
    {
        categoryManager objcategory = new categoryManager();
        string          sortor      = Convert.ToString(CommonFunctions.GetLastSortCount("category", "sortorder"));

        if (parentid != "" && categoryName != "")
        {
            objcategory.parentid     = Convert.ToInt32(parentid);
            objcategory.categoryName = categoryName;
            objcategory.catedesc     = categoryDescription;
            objcategory.imagepath    = "";
            objcategory.sortorder    = Convert.ToInt32(sortor);
            objcategory.isactive     = 1;
            //objcategory.InsertItem();
            if (objcategory.TitleExist())
            {
                return("Category name already exists.");
            }
            else
            {
                objcategory.InsertItem();
                return("Category added successfully");
            }
        }
        else
        {
            return("fail");
        }
    }
Ejemplo n.º 2
0
        // GET: category
        public ActionResult ByCategory(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }


            categoryManager cm  = new categoryManager();
            category        cat = cm.getCategoryById(id.Value);

            if (cat == null)
            {
                return(HttpNotFound());
            }
            return(View("Index", cat.Notes.OrderByDescending(x => x.modifiedOn).ToList()));
        }
Ejemplo n.º 3
0
    public static ParentCategory[] BindCategoryProductPage()
    {
        DataTable             dt          = new DataTable();
        categoryManager       objcategory = new categoryManager();
        List <ParentCategory> details     = new List <ParentCategory>();

        dt = objcategory.GetParentCategoryProductPage();

        foreach (DataRow dtrow in dt.Rows)
        {
            ParentCategory country = new ParentCategory();
            country.categoryId   = Convert.ToInt32(dtrow["CountryId"].ToString());
            country.categoryName = dtrow["CountryName"].ToString();
            details.Add(country);
        }

        return(details.ToArray());
    }
Ejemplo n.º 4
0
    public List <categoryManager> BindPopCategory()
    {
        // productManager objProduct = new productManager();
        categoryManager objCategory = new categoryManager();

        List <categoryManager> lmp = new List <categoryManager>();
        DataTable dt = new DataTable();

        //dt = objProduct.SKUBind();
        dt = objCategory.GetAllCategory();
        foreach (DataRow dr in dt.Rows)
        {
            categoryManager CMS = new categoryManager();
            CMS.categoryId   = Convert.ToInt32(dr["categoryId"].ToString());
            CMS.categoryName = dr["categoryName"].ToString();
            lmp.Add(CMS);
        }
        return(lmp);
    }
Ejemplo n.º 5
0
    public static string GetAutoCompleteCategory()
    {
        JavaScriptSerializer jsonscript  = new JavaScriptSerializer();
        categoryManager      objcategory = new categoryManager();

        try
        {
            DataTable dt = new DataTable();
            dt = objcategory.GetParentCategoryProductPage();
            List <string> tags = new List <string>();
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                tags.Add(Convert.ToString(dt.Rows[i]["Name"]));
            }
            return(jsonscript.Serialize(tags));
        }
        catch (Exception ex) { throw ex; }
        finally { objcategory = null; }
    }
Ejemplo n.º 6
0
    public List <string> BindParentMenu()
    {
        categoryManager objcategory = new categoryManager();
        DataTable       dt          = new DataTable();
        DataTable       dtsub       = new DataTable();

        try
        {
            List <string> Category_parent = new List <string>();
            dt = objcategory.GetParentCategory(true);
            if (dt != null && dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    //ListItem li = new ListItem(dt.Rows[i]["categoryName"].ToString(), dt.Rows[i]["categoryId"].ToString());
                    //li.Attributes.Add("style", "color:#a7688a;font-weight:bold;");
                    Category_parent.Add(dt.Rows[i]["categoryName"].ToString());

                    objcategory.parentid = Convert.ToInt32(dt.Rows[i]["categoryId"].ToString());
                    dtsub = objcategory.GetSubCategory();
                    if (dtsub != null && dtsub.Rows.Count > 0)
                    {
                        for (int j = 0; j < dtsub.Rows.Count; j++)
                        {
                            //ListItem lisub = new ListItem("--" + dtsub.Rows[j]["categoryName"].ToString(), dtsub.Rows[j]["categoryId"].ToString());
                            //lisub.Attributes.Add("style", "color:#6dace5");
                            Category_parent.Add("--" + dtsub.Rows[j]["categoryName"].ToString());
                        }
                    }
                }
                return(Category_parent);
            }
            else
            {
                return(Category_parent);
            }
        }
        catch (Exception ex) { throw ex; }
        finally { }
    }