Exemplo n.º 1
0
 public ActionResult Subcategory(SCRel sc, string IUDFlag)
 {
     if (IUDFlag == "N")
     {
         DataTable cat = dal.GetData(" exec YOL.SP_InsSubCategorydmaster " + sc.SCID + ",'" + sc.SubCategory_Name + "','','','" + sc.ImgUrl + "','" + sc.IconUrl + "','" + sc.SubCate_Des + "'");
         if (cat.Rows.Count > 0)
         {
             if (Convert.ToInt32(cat.Rows[0][0]) > 0)
             {
                 DataTable brand = dal.GetData(" exec YOL.SP_InsSubCateRel " + sc.CCID + "," + Convert.ToInt32(cat.Rows[0][0]) + "," + sc.CID + "");
             }
         }
     }
     else if (IUDFlag == "U")
     {
         DataTable cat = dal.GetData(" exec YOL.SP_InsSubCategorydmaster " + sc.SCID + ",'" + sc.SubCategory_Name + "','','','" + sc.ImgUrl + "','" + sc.IconUrl + "','" + sc.SubCate_Des + "'");
         if (cat.Rows.Count > 0)
         {
             if (Convert.ToInt32(cat.Rows[0][0]) > 0)
             {
                 DataTable brand = dal.GetData(" exec YOL.SP_InsSubCateRel " + sc.CCID + "," + Convert.ToInt32(cat.Rows[0][0]) + "," + sc.CID + "");
             }
         }
     }
     else if (IUDFlag == "D")
     {
         int brand = dal.executeQury(" exec YOL.sp_delSubCaterel " + sc.CCID + "," + sc.SCID);
     }
     return(RedirectToAction("SubCategory"));
 }
Exemplo n.º 2
0
        public ActionResult SubCategory()
        {
            List <SubCateRel> c            = new List <SubCateRel>();
            DataTable         categorylist = dal.GetData("exec [YOL].[Sp_selCategory]");

            if (categorylist.Rows.Count > 0)
            {
                for (int i = 0; i < categorylist.Rows.Count; i++)
                {
                    SubCateRel obj = new SubCateRel();
                    obj.CID           = Convert.ToInt32(categorylist.Rows[i]["CID"]);
                    obj.Category_Name = Convert.ToString(categorylist.Rows[i]["Category_Name"]);

                    List <SCRel> bcrel = new List <SCRel>();

                    DataTable dt = GetSubcaterel(obj.CID);

                    if (dt.Rows.Count > 0)
                    {
                        foreach (DataRow dr in dt.Rows)
                        {
                            SCRel br = new SCRel();
                            br.CCID             = Convert.ToInt32(dr["CCID"]);
                            br.SCID             = Convert.ToInt32(dr["SCID"]);
                            br.SubCategory_Name = Convert.ToString(dr["SubCategory_Name"]);
                            br.SubCate_Des      = Convert.ToString(dr["SubCate_Des"]);

                            bcrel.Add(br);
                        }
                    }
                    obj.SCrel = bcrel;


                    c.Add(obj);
                }
            }
            return(View(c));
        }
Exemplo n.º 3
0
        public ActionResult SubCategoryDetail(string IUDFlag, int CCID)
        {
            SCRel sc = new SCRel();

            ViewBag.Flag = IUDFlag;
            List <Category> c    = new List <Category>();
            DataTable       list = dal.GetData("exec YOL.Sp_selCategory");

            if (list.Rows.Count > 0)
            {
                for (int i = 0; i < list.Rows.Count; i++)
                {
                    Category obj = new Category();
                    obj.CID           = Convert.ToInt32(list.Rows[i]["CID"]);
                    obj.Category_Name = Convert.ToString(list.Rows[i]["Category_Name"]);
                    c.Add(obj);
                }
            }
            ViewBag.Category = c;

            if (IUDFlag == "N")
            {
                //v.Vendor_Name= Convert.ToString("Vendor_Name");
                ViewBag.Action = "Save";
            }

            else if (IUDFlag == "U")
            {
                // get data from db depend on VID and assign BID and Brandname to brand obj

                DataTable dt = dal.GetData("exec [YOL].[sp_selSubCaterel] " + CCID);

                if (dt.Rows.Count > 0)
                {
                    sc.SubCategory_Name = Convert.ToString(dt.Rows[0]["SubCategory_Name"]);
                    sc.SCID             = Convert.ToInt32(dt.Rows[0]["SCID"]);
                    sc.CID         = Convert.ToInt32(dt.Rows[0]["CID"]);
                    sc.SubCate_Des = Convert.ToString(dt.Rows[0]["SubCate_Des"]);
                    sc.IconUrl     = Convert.ToString(dt.Rows[0]["Iconurl"]);;
                    sc.ImgUrl      = Convert.ToString(dt.Rows[0]["Imgurl"]);
                }
                ViewBag.Action = "Update";
            }

            else if (IUDFlag == "D")
            {
                // get data from db depend on VID and assign VID and Vendorname to vendor obj
                DataTable dt = dal.GetData("exec [YOL].[sp_selSubCaterel] " + CCID);

                if (dt.Rows.Count > 0)
                {
                    sc.SubCategory_Name = Convert.ToString(dt.Rows[0]["SubCategory_Name"]);
                    sc.SCID             = Convert.ToInt32(dt.Rows[0]["SCID"]);
                    sc.CID         = Convert.ToInt32(dt.Rows[0]["CID"]);
                    sc.SubCate_Des = Convert.ToString(dt.Rows[0]["SubCate_Des"]);
                    sc.IconUrl     = Convert.ToString(dt.Rows[0]["Iconurl"]);;
                    sc.ImgUrl      = Convert.ToString(dt.Rows[0]["Imgurl"]);
                }
                ViewBag.Action = "Delete";
            }

            return(View(sc));
        }