// GET: SubCatalogues/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SubCatalogue subCatalogue = db.SubCatalogues.Find(id);

            if (subCatalogue == null)
            {
                return(HttpNotFound());
            }
            return(View(subCatalogue));
        }
        // GET: SubCatalogues/Details/5
        public ActionResult Details(int?id)
        {
            if (string.IsNullOrEmpty(Session["Login"] as string))
            {
                return(RedirectToAction("Index", "Login"));
            }

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SubCatalogue subCatalogue = db.SubCatalogues.Find(id);

            if (subCatalogue == null)
            {
                return(HttpNotFound());
            }
            return(View(subCatalogue));
        }
Exemplo n.º 3
0
    public void BindData_UnSelected()
    {
        int IsFetchCount = ucCustomPagerItem_UnSelected.isCountRecord;

        gvItem_UnSelected.DataSource = BLL_PURC_CTP.Get_Ctp_Items(Catalogue_code, UDFLib.ConvertStringToNull(SubCatalogue), UDFLib.ConvertStringToNull(txtItemSearch.Text), (DataTable)ViewState["vsdtSelected_Items"], (DataTable)ViewState["vsdtSelected_SubCatalogue"], (DataTable)ViewState["vsdtSelected_SubCatalogue_items"], 0,
                                                                  UDFLib.ConvertIntegerToNull(Quotation_ID), ucCustomPagerItem_UnSelected.CurrentPageIndex, ucCustomPagerItem_UnSelected.PageSize, ref IsFetchCount, Contract_ID);
        gvItem_UnSelected.DataBind();

        if (ucCustomPagerItem_UnSelected.isCountRecord == 1)
        {
            ucCustomPagerItem_UnSelected.CountTotalRec = IsFetchCount.ToString();
            ucCustomPagerItem_UnSelected.BuildPager();
        }


        btnSelect_All.Enabled             = (IsFetchCount < 1) ? false : true;
        btnselectAll_SubCatalogue.Enabled = (IsFetchCount < 1 || SubCatalogue.Trim() == "" || SubCatalogue.Trim() == "0") ? false : true;

        Set_SelectedCatalogue();
    }
        public ActionResult DeleteConfirmed(int id)
        {
            SubCatalogue subCatalogue = db.SubCatalogues.Find(id);

            System.Collections.ArrayList removeItems = new System.Collections.ArrayList();

            foreach (Models.CatalogueItem item in subCatalogue.CatalogueItems)
            {
                removeItems.Add(item);
            }

            foreach (Models.CatalogueItem item in removeItems)
            {
                db.CatalogueItems.Remove(item);
            }

            db.SubCatalogues.Remove(subCatalogue);

            db.SaveChanges();
            return(RedirectToAction("Index", "Home"));
        }
        public ActionResult Edit([Bind(Include = "SubCataId,CataID,Title,Priority,Description,DateCreated,DateModified")] SubCatalogue subCatalogue)
        {
            if (string.IsNullOrEmpty(Session["Login"] as string))
            {
                return(RedirectToAction("Index", "Login"));
            }

            if (ModelState.IsValid)
            {
                subCatalogue.CataID       = int.Parse(Session["CataID"].ToString());
                subCatalogue.SubCataId    = int.Parse(Session["SubCataID"].ToString());
                subCatalogue.DateCreated  = DateTime.Parse(Session["DateCreated"].ToString());
                subCatalogue.DateModified = DateTime.Now;

                db.Entry(subCatalogue).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index", "Home"));
            }
            ViewBag.CataID = new SelectList(db.Catalogues, "CataID", "Title", subCatalogue.CataID);
            return(View(subCatalogue));
        }
        public ActionResult Create([Bind(Include = "CataID,Title,Priority,Description")] SubCatalogue subCatalogue)
        {
            if (string.IsNullOrEmpty(Session["Login"] as string))
            {
                return(RedirectToAction("Index", "Login"));
            }

            if (ModelState.IsValid)
            {
                subCatalogue.DateCreated  = DateTime.Now;
                subCatalogue.DateModified = DateTime.Now;
                subCatalogue.CataID       = int.Parse(Session["CataID"].ToString());
                subCatalogue.SubCataId    = db.SubCatalogues.Count <Models.SubCatalogue>() + 1;

                db.SubCatalogues.Add(subCatalogue);
                db.SaveChanges();
                return(RedirectToAction("Index", "Home"));
            }

            ViewBag.CataID = Session["CataID"];
            return(View(subCatalogue));
        }
        // GET: SubCatalogues/Edit/5
        public ActionResult Edit(int?id)
        {
            if (string.IsNullOrEmpty(Session["Login"] as string))
            {
                return(RedirectToAction("Index", "Login"));
            }

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SubCatalogue subCatalogue = db.SubCatalogues.Find(id);

            if (subCatalogue == null)
            {
                return(HttpNotFound());
            }

            Session["CataID"]      = subCatalogue.CataID;
            Session["SubCataID"]   = subCatalogue.SubCataId;
            Session["DateCreated"] = subCatalogue.DateCreated;

            return(View(subCatalogue));
        }