예제 #1
0
        public ActionResult _partialEmployerListResult()
        {
            var result = (dynamic)null;

            try
            {
                string spExecute = "sp_EmployerList @PageNumber = 1 ,@filterbyCreatedDateORmodifiedDate = true,";

                DateTime fd = Convert.ToDateTime(BaseUtil.GetCalculatedDateTime(-30));
                spExecute += "@fromDate = '" + fd.Date + "',";

                DateTime fd1 = Convert.ToDateTime(BaseUtil.GetCurrentDateTime());
                spExecute += "@tillDate = '" + fd1.Date + "',";

                spExecute += "@isActive = 1 ";
                result     = db.Database.SqlQuery <sp_EmployerList_Result>(spExecute).ToList();
                //var emp = repo.SQLQuery<sp_EmployerList_Result>("sp_EmployerList @PageNumber, @filterbyCreatedDateORmodifiedDate", new SqlParameter("PageNumber", SqlDbType.Int) { Value = 1},new SqlParameter("filterbyCreatedDateORmodifiedDate", SqlDbType.Bit) { Value = 0}).ToList();
                sp_EmployerList_Result sp = new sp_EmployerList_Result();
                decimal pageCount         = 0;
                if (result.Count > 0)
                {
                    pageCount = (decimal)(result[1].total / 4);
                    int a = (int)(result[1].total % 4);
                    if (a > 0)
                    {
                        pageCount = pageCount + 1;
                    }
                    ViewBag.data = "Yes";
                }
                else
                {
                    ViewBag.data = "Nodata";
                }
                sp.PageCount        = (int)pageCount;
                sp.CurrentPageIndex = 1;
                ViewBag.count       = pageCount;

                ViewBag.currindex = sp.CurrentPageIndex;
            }
            catch (Exception e)
            {
                BaseUtil.CaptureErrorValues(e);
                ViewBag.data = "Nodata";
            }
            return(PartialView(result));
        }
예제 #2
0
        public ActionResult EmployerListResult(int currentPageIndex, FormCollection frm)
        {
            var result = (dynamic)null;

            try {
                string spExecute = "sp_EmployerList @PageNumber ='" + currentPageIndex + "',";

                spExecute += "@filterbyCreatedDateORmodifiedDate ='1', ";


                if (frm["frm[fromdate]"] != "")
                {
                    DateTime fd = Convert.ToDateTime(frm["frm[fromdate]"]);
                    spExecute += "@fromDate = '" + fd.Date + "',";
                }
                else
                {
                    DateTime fd = Convert.ToDateTime(BaseUtil.GetCalculatedDateTime(-30));
                    spExecute += "@fromDate = '" + fd.Date + "',";
                }

                if (frm["frm[todate]"] != "")
                {
                    DateTime td = Convert.ToDateTime(frm["frm[todate]"]);
                    spExecute += "@tillDate = '" + td.Date + "',";
                }
                else
                {
                    DateTime fd = Convert.ToDateTime(BaseUtil.GetCurrentDateTime());
                    spExecute += "@tillDate = '" + fd.Date + "',";
                }
                if (frm["frm[companyname]"] != "")
                {
                    spExecute += "@ComapnyName = '" + frm["frm[companyname]"] + "',";
                }
                else
                {
                    spExecute += "@ComapnyName = null , ";
                }
                if (frm["frm[employername]"] != "")
                {
                    spExecute += "@EmployerName = '" + frm["frm[employername]"] + "',";
                }
                else
                {
                    spExecute += "@EmployerName = null , ";
                }
                if (frm["frm[mobile]"] != "")
                {
                    spExecute += "@mobile = '" + frm["frm[mobile]"] + "',";
                }
                else
                {
                    spExecute += "@mobile = null ,";
                }
                if (frm["frm[email]"] != "")
                {
                    spExecute += "@email = '" + frm["frm[email]"] + "',";
                }
                else
                {
                    spExecute += "@email = null ,";
                }
                if (frm["frm[isActive]"] != null)
                {
                    spExecute += "@isActive = '" + frm["frm[isActive]"] + "'";
                }
                else
                {
                    spExecute += "@isActive = 1 ";
                }

                result = db.Database.SqlQuery <sp_EmployerList_Result>(spExecute).ToList();
                sp_EmployerList_Result sp = new sp_EmployerList_Result();

                decimal pageCount = 0;
                if (result.Count > 0)
                {
                    pageCount = (decimal)(result[1].total / 4);
                    int a = (int)(result[1].total % 4);
                    if (a > 0)
                    {
                        pageCount = pageCount + 1;
                    }
                    ViewBag.data = "Yes";
                }
                else
                {
                    ViewBag.data = "Nodata";
                }
                sp.CurrentPageIndex = currentPageIndex;
                ViewBag.count       = pageCount;

                ViewBag.currindex = currentPageIndex;
            }
            catch (Exception e)
            {
                BaseUtil.CaptureErrorValues(e);
                ViewBag.data = "Nodata";
            }
            return(PartialView("_partialEmployerListResult", result));
        }