Exemple #1
0
        public ActionResult Index(DefaultModel model)
        {
            DateTime startDate = model.StartDate > DateTime.MinValue ? new DateTime(model.StartDate.Year, model.StartDate.Month, model.StartDate.Day, 0, 0, 0) : DateTime.MinValue;
            DateTime endDate   = model.EndDate > DateTime.MinValue ? new DateTime(model.EndDate.Year, model.EndDate.Month, model.EndDate.Day, 23, 59, 59) : DateTime.MinValue;

            var data = _service.CreateQuery().FindList(!string.IsNullOrEmpty(model.SearchText), o => o.Name.Contains(model.SearchText) || o.Code.Contains(model.SearchText))
                       .Where(!string.IsNullOrEmpty(model.ID), o => o.ID == model.ID)
                       .OrderByDescending(o => o.ID)
                       .ToList();

            ViewBag.Data      = data.Skip(model.PageSize * model.PageIndex).Take(model.PageSize).ToList();
            model.TotalRecord = data.Count;
            ViewBag.Model     = model;
            return(View());
        }
Exemple #2
0
        private static void GetCurrentResource(this HttpContext context, IConfiguration configuration, ref List <CPResourceEntity> currentResource, ref CPLangEntity currentLang)
        {
            string cookie = context.GetValue(Cookies.DefaultLang, false);

            if (string.IsNullOrEmpty(cookie))
            {
                cookie = "vn"; context.SetCurrentLang("VN");
            }
            var lang = new CPLangService(configuration);

            currentLang = lang.CreateQuery().Find(o => o.IsActive == true && o.Code == cookie)?.SingleOrDefault();
            if (currentLang != null)
            {
                // cache
                var cache = CacheExtends.GetDataFromCache <List <CPResourceEntity> >(cookie + "-" + CacheExtends.DefaultLang);
                //
                if (cache != null)
                {
                    currentResource = cache; return;
                }

                var res = new CPResourceService(configuration);
                currentResource = res.GetByLangID(currentLang.ID);
            }
        }
Exemple #3
0
        private static void GetCurrentResource(this HttpContext context, ref List <CPResourceEntity> currentResource, ref CPLangEntity currentLang)
        {
            string cookie = context.GetValue(Cookies.DefaultLang, false);

            if (string.IsNullOrEmpty(cookie))
            {
                cookie = "vn";
            }
            var lang = new CPLangService();

            currentLang = lang.CreateQuery().SelectFirst(o => o.Activity == true && o.Code == cookie);
            // cache
            var cache = CacheExtends.GetDataFromCache <List <CPResourceEntity> >(cookie + "-" + CacheExtends.DefaultLang);

            //
            if (cache != null)
            {
                currentResource = cache;  return;
            }

            var res = new CPResourceService();

            currentResource = res.GetByLangID(currentLang.ID);
        }
Exemple #4
0
        #pragma warning disable 1998
        public async override global::System.Threading.Tasks.Task ExecuteAsync()
        {
#line 3 "E:\Dashbroad\Project_True\DashBoard_Final\AdminPage\Views\Shared\_NavBar.cshtml"

            var    lang       = new CPLangService();
            var    data       = lang.CreateQuery().Find(o => o.Activity == true).ToList();
            string searchText = ViewBag.Model != null ? ViewBag.Model.SearchText : string.Empty;

#line default
#line hidden
            BeginContext(252, 244, true);
            WriteLiteral("<nav class=\"navbar navbar-expand-lg navbar-transparent navbar-absolute fixed-top \" id=\"navigation-example\">\r\n    <div class=\"container-fluid\">\r\n        <div class=\"navbar-wrapper\">\r\n            <a class=\"navbar-brand\" href=\"javascript:void(0)\">");
            EndContext();
            BeginContext(497, 17, false);
#line 11 "E:\Dashbroad\Project_True\DashBoard_Final\AdminPage\Views\Shared\_NavBar.cshtml"
            Write(ViewData["Title"]);

#line default
#line hidden
            EndContext();
            BeginContext(514, 571, true);
            WriteLiteral(@"</a>
        </div>
        <button class=""navbar-toggler"" type=""button"" data-toggle=""collapse"" aria-controls=""navigation-index"" aria-expanded=""false"" aria-label=""Toggle navigation"" data-target=""#navigation-example"">
            <span class=""sr-only"">Toggle navigation</span>
            <span class=""navbar-toggler-icon icon-bar""></span>
            <span class=""navbar-toggler-icon icon-bar""></span>
            <span class=""navbar-toggler-icon icon-bar""></span>
        </button>
        <div class=""collapse navbar-collapse justify-content-end"">
            ");
            EndContext();
            BeginContext(1085, 495, false);
            __tagHelperExecutionContext = __tagHelperScopeManager.Begin("form", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "068487affba4bcad0c3a3d09a50d5b51ada312ab5540", async() => {
                BeginContext(1111, 111, true);
                WriteLiteral("\r\n                <div class=\"input-group no-border\">\r\n                    <input type=\"text\" name=\"SearchText\"");
                EndContext();
                BeginWriteAttribute("value", " value=\"", 1222, "\"", 1241, 1);
#line 22 "E:\Dashbroad\Project_True\DashBoard_Final\AdminPage\Views\Shared\_NavBar.cshtml"
                WriteAttributeValue("", 1230, searchText, 1230, 11, false);

#line default
#line hidden
                EndWriteAttribute();
                BeginContext(1242, 331, true);
                WriteLiteral(@" class=""form-control"" placeholder=""Search..."">
                    <button type=""submit"" class=""btn btn-default btn-round btn-just-icon"">
                        <i class=""material-icons"">search</i>
                        <div class=""ripple-container""></div>
                    </button>
                </div>
            ");
                EndContext();
            }
                                                                        );
            __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper>();
            __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper);
            __Microsoft_AspNetCore_Mvc_TagHelpers_RenderAtEndOfFormTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.RenderAtEndOfFormTagHelper>();
            __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_RenderAtEndOfFormTagHelper);
            __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_0);
            await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);

            if (!__tagHelperExecutionContext.Output.IsContentModified)
            {
                await __tagHelperExecutionContext.SetOutputContentAsync();
            }
            Write(__tagHelperExecutionContext.Output);
            __tagHelperExecutionContext = __tagHelperScopeManager.End();
            EndContext();
            BeginContext(1580, 117, true);
            WriteLiteral("\r\n            <ul class=\"navbar-nav\">\r\n                <li class=\"nav-item\">\r\n                    <a class=\"nav-link\"");
            EndContext();
            BeginWriteAttribute("href", " href=\"", 1697, "\"", 1724, 1);
#line 31 "E:\Dashbroad\Project_True\DashBoard_Final\AdminPage\Views\Shared\_NavBar.cshtml"
            WriteAttributeValue("", 1704, Url.Action("Index"), 1704, 20, false);

#line default
#line hidden
            EndWriteAttribute();
            BeginContext(1725, 294, true);
            WriteLiteral(@">
                        <i class=""material-icons"">apps</i>
                        <p class=""d-lg-none d-md-block"">
                            Stats
                        </p>
                    </a>
                </li>
                <li class=""nav-item"">
                    ");
            EndContext();
            BeginContext(2020, 39, false);
#line 39 "E:\Dashbroad\Project_True\DashBoard_Final\AdminPage\Views\Shared\_NavBar.cshtml"
            Write(StartUp.CurrentLang.GetSelectMini(data));

#line default
#line hidden
            EndContext();
            BeginContext(2059, 586, true);
            WriteLiteral(@"
                </li>
                <li class=""nav-item dropdown"">
                    <a class=""nav-link"" href=""javascript:void(0)"" id=""userdropdown"" data-toggle=""dropdown"" aria-haspopup=""true"" aria-expanded=""false"">
                        <i class=""material-icons"">person</i>
                        <p class=""d-lg-none d-md-block"">
                            Account
                        </p>
                    </a>
                    <div class=""dropdown-menu dropdown-menu-right"" aria-labelledby=""userdropdown"">
                        <a class=""dropdown-item""");
            EndContext();
            BeginWriteAttribute("href", " href=\"", 2645, "\"", 2685, 1);
#line 49 "E:\Dashbroad\Project_True\DashBoard_Final\AdminPage\Views\Shared\_NavBar.cshtml"
            WriteAttributeValue("", 2652, Url.Action("Index", "CPAccounts"), 2652, 33, false);

#line default
#line hidden
            EndWriteAttribute();
            BeginContext(2686, 62, true);
            WriteLiteral(">Profile</a>\r\n                        <a class=\"dropdown-item\"");
            EndContext();
            BeginWriteAttribute("href", " href=\"", 2748, "\"", 2790, 1);
#line 50 "E:\Dashbroad\Project_True\DashBoard_Final\AdminPage\Views\Shared\_NavBar.cshtml"
            WriteAttributeValue("", 2755, Url.Action("SignOut", "CPAccounts"), 2755, 35, false);

#line default
#line hidden
            EndWriteAttribute();
            BeginContext(2791, 117, true);
            WriteLiteral(">Logout</a>\r\n                    </div>\r\n                </li>\r\n            </ul>\r\n        </div>\r\n    </div>\r\n</nav>");
            EndContext();
        }