コード例 #1
0
ファイル: GanController.cs プロジェクト: Pandurangv/ShriVivah
        public ActionResult Search(string prefix)
        {
            var countries = objGan.GetGans().Where(p => p.GanName.ToUpper() == prefix.ToUpper());
            int pageindex = 0;
            var filter    = countries.OrderBy(p => p.GanId).Skip(pageindex * PageSize).Take(PageSize);

            Session["users"]     = countries;
            Session["pageindex"] = 0;
            if (filter.Count() > 0)
            {
                GanDetails obj = new GanDetails()
                {
                    Status  = true,
                    GanList = filter
                };
                return(Json(obj, JsonRequestBehavior.AllowGet));
            }
            else
            {
                GanDetails obj = new GanDetails()
                {
                    Status       = false,
                    ErrorMessage = "No Records to display"
                };
                return(Json(obj, JsonRequestBehavior.AllowGet));
            }
        }
コード例 #2
0
ファイル: GanController.cs プロジェクト: Pandurangv/ShriVivah
        public ActionResult Update(tblGan model)
        {
            var        countries = objGan.GetGans();
            var        test      = countries.Where(p => p.GanName.ToUpper() == model.GanName.ToUpper()).FirstOrDefault();
            GanDetails obj       = new GanDetails();

            if (test != null)
            {
                obj.Status       = false;
                obj.ErrorMessage = SettingsManager.Instance.Branding == "SINDHI" ? Resources.SPMOResources.AlreadyExist : "Record already exist.";
            }
            else
            {
                obj.Status       = true;
                obj.ErrorMessage = SettingsManager.Instance.Branding == "SINDHI" ? Resources.SPMOResources.UpdateSuccess : "Record updated successfully.";
                objGan.Update(model);
            }
            int pageindex = 0;
            var filter    = countries.OrderBy(p => p.GanId).Skip(pageindex * PageSize).Take(PageSize);

            Session["users"]     = countries;
            Session["pageindex"] = 0;
            obj.GanList          = filter;
            return(Json(obj, JsonRequestBehavior.AllowGet));
        }
コード例 #3
0
ファイル: GanController.cs プロジェクト: Pandurangv/ShriVivah
        public ActionResult GanLast()
        {
            var        users     = objGan.GetGans();
            GanDetails obj       = new GanDetails();
            int        pageindex = Convert.ToInt32(Session["pageindex"]);

            pageindex++;
            obj.Status = true;
            if (users != null)
            {
                Session["pageindex"] = pageindex;
                if ((users.Count() % PageSize) == 0)
                {
                    obj.GanList = users.OrderBy(p => p.GanId).Skip(users.Count() - 2).Take(PageSize);
                    return(Json(obj, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    int rem = users.Count() % PageSize;
                    obj.GanList = users.OrderBy(p => p.GanId).Skip(users.Count() - rem).Take(PageSize);
                    return(Json(obj, JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                return(GanFirst());
            }
        }
コード例 #4
0
ファイル: GanController.cs プロジェクト: Pandurangv/ShriVivah
        public ActionResult GanPrev()
        {
            IQueryable <tblGan> users = (IQueryable <tblGan>)Session["users"];

            if (users != null)
            {
                int pageindex = Convert.ToInt32(Session["pageindex"]);
                if (pageindex > 0)
                {
                    pageindex--;
                    var filter = users.OrderBy(p => p.GanId).Skip(pageindex * PageSize).Take(PageSize);
                    Session["pageindex"] = pageindex;
                    GanDetails obj = new GanDetails()
                    {
                        Status       = true,
                        ErrorMessage = "",
                        GanList      = filter,
                    };
                    return(Json(obj, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    GanDetails obj = new GanDetails()
                    {
                        Status       = false,
                        ErrorMessage = SettingsManager.Instance.Branding == "SINDHI" ? Resources.SPMOResources.FirstPage : "You are already on first page",
                    };
                    return(Json(obj, JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                return(GanFirst());
            }
        }
コード例 #5
0
ファイル: GanController.cs プロジェクト: Pandurangv/ShriVivah
        public ActionResult GanFirst()
        {
            IQueryable <tblGan> users = (IQueryable <tblGan>)Session["users"];
            int pageindex             = 0;
            var filter = users.OrderBy(p => p.GanId).Skip(pageindex * PageSize).Take(PageSize);

            Session["users"]     = users;
            Session["pageindex"] = 0;
            GanDetails obj = new GanDetails()
            {
                Status  = true,
                GanList = filter
            };

            return(Json(obj, JsonRequestBehavior.AllowGet));
        }
コード例 #6
0
ファイル: GanController.cs プロジェクト: Pandurangv/ShriVivah
        public ActionResult GanNext()
        {
            IQueryable <tblGan> users = (IQueryable <tblGan>)Session["users"];

            if (users != null)
            {
                int pageindex = Convert.ToInt32(Session["pageindex"]);
                pageindex++;
                var filter = users.OrderBy(p => p.GanId).Skip(pageindex * PageSize).Take(PageSize);
                if (filter.Count() > 0)
                {
                    Session["pageindex"] = pageindex;
                    GanDetails obj = new GanDetails()
                    {
                        Status       = true,
                        ErrorMessage = "",
                        GanList      = filter
                    };
                    return(Json(obj, JsonRequestBehavior.AllowGet));
                    //return Json(filter, JsonRequestBehavior.AllowGet);
                }
                else
                {
                    GanDetails obj = new GanDetails()
                    {
                        Status       = false,
                        ErrorMessage = SettingsManager.Instance.Branding == "SINDHI" ? Resources.SPMOResources.NoMoreInformationAvail : "आणखी माहिती उपलब्ध नाही"
                    };
                    return(Json(obj, JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                return(GanFirst());
            }
        }