Esempio n. 1
0
        //***********************************************************************************************
        //
        // GET: /Indexers/
        public ActionResult Index()
        {
            FlexigridViewModel flexigrid = new FlexigridViewModel("IndexersList", "IndexersForm", "IndexersPost", "/Indexers/List", "json", "Name", "asc", true, "Indexers Listing", true, pageSize, true, 950, 2000);

            flexigrid.Columns = new List <FlexigridColumn>()
            {
                new FlexigridColumn("Name", "Name", 475, true, "left", false, false),
                new FlexigridColumn("OwnerID", "OwnerID", 475, true, "left", false, false)
            };
            flexigrid.Buttons = new List <FlexigridButton>()
            {
                new FlexigridButton("Add", "fgButton", "Add"),
                new FlexigridButton("Edit", "fgButton", "Edit"),
                new FlexigridButton("Delete", "fgButton", "Delete")
            };
            flexigrid.DialogBoxId     = "IndexersDialog";
            flexigrid.DialogBoxWidth  = 700;
            flexigrid.DialogBoxHeight = 800;
            ViewData["flexigrid"]     = flexigrid;

            ViewData["OwnerID"] = IndexersOwnersFactor.Get().Select(x => new SelectListItem {
                Text = x.Name, Value = x.OwnerID.ToString()
            }).ToList();
            //ViewData["Categories"] = CategoriesFactor.Get().Select(x => new SelectListItem { Text = x.Title, Value = x.CategoryID.ToString() }).ToList();
            return(View(new IndexersModel()));
        }
Esempio n. 2
0
 public ActionResult Create(IndexersOwnersModel IndexersOwnersObj)
 {
     //------------------------------------------
     //Check ModelState
     //------------------------------------------
     if (!ModelState.IsValid)
     {
         return(new HttpStatusCodeResult(HttpStatusCode.InternalServerError, "Invalid data"));
     }
     //------------------------------------------
     try
     {
         bool result = IndexersOwnersFactor.Create(IndexersOwnersObj);
         if (result == true)
         {
             return(List(1, 25, null, null, null, null));
         }
         else
         {
             return(new HttpStatusCodeResult(HttpStatusCode.InternalServerError, "Saving operation faild"));
         }
     }
     catch (Exception ex)
     { return(new HttpStatusCodeResult(HttpStatusCode.InternalServerError, ex.Message)); }
 }
Esempio n. 3
0
 public ActionResult GetObject(int id)
 {
     try
     {
         IndexersOwnersModel IndexersOwnersObj = IndexersOwnersFactor.GetObject(id);
         if (IndexersOwnersObj == null)
         {
             IndexersOwnersObj = new IndexersOwnersModel();
         }
         return(Json(IndexersOwnersObj, JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         return(new HttpStatusCodeResult(HttpStatusCode.InternalServerError, ex.Message));
     }
 }
Esempio n. 4
0
        //***********************************************************************************************
        #endregion

        #region -----------------Delete-----------------
        //***********************************************************************************************
        public ActionResult Delete(int[] ids)
        {
            //------------------------------------------
            //Check ModelState
            //------------------------------------------
            if (!ModelState.IsValid)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.InternalServerError, "Invalid data"));
            }
            //------------------------------------------
            try
            {
                IndexersOwnersFactor.DeleteGroupofObjects(ids);
                return(List(1, 25, null, null, null, null));
            }
            catch (Exception ex)
            { return(new HttpStatusCodeResult(HttpStatusCode.InternalServerError, ex.Message)); }
        }
Esempio n. 5
0
        //***********************************************************************************************
        #endregion

        #region -----------------List-----------------
        //***********************************************************************************************
        public ActionResult List(int page, int rp, string sortname, string sortorder, string qtype, string query)
        {
            try
            {
                int pageSize = rp; int totalRecords = 0;
                List <IndexersOwnersModel> IndexersOwnersList = IndexersOwnersFactor.GetPageByPage(page, pageSize, sortname, sortorder, qtype, query, out totalRecords);
                if (IndexersOwnersList.Count > 0)
                {
                    return(CreateFlexiJson(IndexersOwnersList, page, totalRecords));
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception ex)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.InternalServerError, ex.Message));
            }
        }