public IActionResult Find(string lang_no, string lang_na, string search_type, string submitbutton, string language_state) { if (!LoginUtil.CheckIfLoggedIn(HttpContext)) { return(View(nameof(Index))); } StateOfRequest mState; if (string.IsNullOrEmpty(language_state)) { mState = new StateOfRequest("LangNo"); } else { mState = JsonUtil.GetObjectFromJsonString <StateOfRequest>(language_state); } mState.StartTime = DateTime.Now; string temp_state = JsonUtil.SetJsonStringFromObject(mState); if (string.IsNullOrEmpty(lang_no)) { lang_no = string.Empty; } lang_no = lang_no.Trim(); if (string.IsNullOrEmpty(lang_na)) { lang_na = string.Empty; } lang_na = lang_na.Trim(); string sButton = submitbutton.ToUpper(); if (sButton == "CANCEL") { temp_state = JsonUtil.SetJsonStringFromObject(mState); return(RedirectToAction(nameof(LanguagesList), new { language_state = temp_state })); } if (string.IsNullOrEmpty(search_type)) { // search_type not defined return(View()); } string searchType = search_type.Trim(); mState.OrderBy = searchType; Language language = new Language(); // new object language.LangNo = lang_no; // for order by "LangNo" language.LangNa = lang_na; // for order by "LangNa" List <Language> languagesTemp = _languagesManager.FindOnePageOfLanguagesForOneLanguage(mState, language, -1); temp_state = JsonUtil.SetJsonStringFromObject(mState); ViewBag.LanguageState = temp_state; return(View(nameof(LanguagesList), languagesTemp)); }
#pragma warning disable 1998 public async override global::System.Threading.Tasks.Task ExecuteAsync() { BeginContext(77, 1, true); WriteLiteral("\n"); EndContext(); BeginContext(141, 1, true); WriteLiteral("\n"); EndContext(); #line 7 "C:\VisualStudio\Smile_SoftwareSolution\VodManageSystem\Views\Singareas\SingareasList.cshtml" StateOfRequest singareaState = JsonUtil.GetObjectFromJsonString <StateOfRequest>(ViewBag.SingareaState as string); DateTime endTime = DateTime.Now; double diff = ((TimeSpan)(endTime - singareaState.StartTime)).TotalMilliseconds; ViewData["Title"] = "Singer Areas Management ---- elapsed time = " + diff; #line default #line hidden BeginContext(468, 1, true); WriteLiteral("\n"); EndContext(); DefineSection("Scripts", async() => { BeginContext(487, 2838, true); WriteLiteral(@" <script type=""text/javascript""> // use jQuery function toSubmit(action, sId, sNo) { var form = '#bodyForm'; if ( ($(form).length) && (action !== undefined) ) { // if form with id=""bodyForm"" exist. jQuery the length is greater than 0. if ( (action==='/Singareas/Edit') || (action==='/Singareas/Delete') || (action==='/Singareas/Details') ) { if ((sId !== undefined) && (sId !== 0) ) { var singarea_state = getSingareaStateValue(); singarea_state.OrgId = sId; singarea_state.OrgAreaNo = sNo; $('input[name=""singarea_state""]').val(JSON.stringify(singarea_state)); } else { // Edit, Delete, Details alert(""Please select one singarea!""); return false; // cancel submit } } $(form).attr('ac"); WriteLiteral(@"tion', action); $(form).submit(); return true; } else { return false; // cancel submit } } function orderBySubmit(orderBy) { if (orderBy !== undefined) { var form = '#bodyForm'; $(form).attr('action', '/Singareas/ChangeOrder'); var singarea_state = getSingareaStateValue(); singarea_state.OrderBy = orderBy; $('input[name=""singarea_state""]').val(JSON.stringify(singarea_state)); $(form).submit(); return true; } else { return false; } } // highlight item var selectedItem = ""selectedItem""; var $items = $('tr.row_item').click(function(event) { event.preventDefault(); $items.removeClass(selectedItem); $(this).addClass(selectedItem); // get data of this row. It is an array "); WriteLiteral(@" var trData = $(this).children('td').map(function() { return $(this).text(); }).get(); var singarea_state = getSingareaStateValue(); singarea_state.OrgId = trData[0]; // reset the oringinal id of singarea singarea_state.OrgAreaNo = trData[1]; // reset the original area_no // reset the value of singarea_state $('input[name=""singarea_state""]').val(JSON.stringify(singarea_state)); }) function getSingareaStateValue() { // var singarea_state = $('#bodyForm').find('input[name=""singarea_state""]').val(); var singarea_state = $('input[name=""singarea_state""]').val(); return JSON.parse(singarea_state); } </script> "); EndContext(); } ); BeginContext(3327, 1, true); WriteLiteral("\n"); EndContext(); BeginContext(3328, 80, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("link", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "ac92e0af60c84af59d2d79a8e811ad12", async() => { } ); __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_0); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_1); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_2); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(3408, 33, true); WriteLiteral("\n\n<h3 style=\"text-align:center;\">"); EndContext(); BeginContext(3442, 17, false); #line 88 "C:\VisualStudio\Smile_SoftwareSolution\VodManageSystem\Views\Singareas\SingareasList.cshtml" Write(ViewData["Title"]); #line default #line hidden EndContext(); BeginContext(3459, 7, true); WriteLiteral("</h3>\n\n"); EndContext(); BeginContext(3466, 3344, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("form", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "d60e34dc564346688bcc4610f0c1311b", async() => { BeginContext(3543, 47, true); WriteLiteral("\n <input type=\"hidden\" name=\"singarea_state\""); EndContext(); BeginWriteAttribute("value", " value=\"", 3590, "\"", 3620, 1); #line 91 "C:\VisualStudio\Smile_SoftwareSolution\VodManageSystem\Views\Singareas\SingareasList.cshtml" WriteAttributeValue("", 3598, ViewBag.SingareaState, 3598, 22, false); #line default #line hidden EndWriteAttribute(); BeginContext(3621, 828, true); WriteLiteral(@" /> <p> <button class=""aboveTable"" onclick=""return toSubmit('/Singareas/Find');"">Find</button> <button class=""aboveTable"" onclick=""return toSubmit('/Singareas/Print');"">Print</button> <button class=""aboveTable"" onclick=""return toSubmit('/Singareas/FirstPage');"">First Page</button> <button class=""aboveTable"" onclick=""return toSubmit('/Singareas/LastPage');"">Last Page</button> <button class=""aboveTable"" onclick=""return toSubmit('/Singareas/PreviousPage');"">Previous Page</button> <button class=""aboveTable"" onclick=""return toSubmit('/Singareas/NextPage');"">Next Page</button> </p> <table style=""margin-top:10px;""> <!-- class=""table"" --> <thead> <tr> <th style=""display:none;""> "); EndContext(); BeginContext(4450, 38, false); #line 104 "C:\VisualStudio\Smile_SoftwareSolution\VodManageSystem\Views\Singareas\SingareasList.cshtml" Write(Html.DisplayNameFor(model => model.Id)); #line default #line hidden EndContext(); BeginContext(4488, 459, true); WriteLiteral(@" </th> <th>Singer Area No.</th> <th>Singer Area Name</th> <th>English Name of the Area</th> <th/> <th/> <th style=""text-align:center;""> <button class=""crud"" style=""background-color:orange;"" onclick=""return toSubmit('/Singareas/Add');"">Add</button> </th> </tr> </thead> <tbody> "); EndContext(); #line 117 "C:\VisualStudio\Smile_SoftwareSolution\VodManageSystem\Views\Singareas\SingareasList.cshtml" foreach (var item in Model) { string selectedItem = ""; if (item.Id == singareaState.OrgId) { selectedItem = "selectedItem"; } #line default #line hidden BeginContext(5173, 19, true); WriteLiteral(" <tr"); EndContext(); BeginWriteAttribute("class", " class=\"", 5192, "\"", 5222, 2); WriteAttributeValue("", 5200, "row_item", 5200, 8, true); #line 125 "C:\VisualStudio\Smile_SoftwareSolution\VodManageSystem\Views\Singareas\SingareasList.cshtml" WriteAttributeValue(" ", 5208, selectedItem, 5209, 13, false); #line default #line hidden EndWriteAttribute(); BeginContext(5223, 73, true); WriteLiteral(">\n <td style=\"display:none;\">\n "); EndContext(); BeginContext(5297, 37, false); #line 127 "C:\VisualStudio\Smile_SoftwareSolution\VodManageSystem\Views\Singareas\SingareasList.cshtml" Write(Html.DisplayFor(modelItem => item.Id)); #line default #line hidden EndContext(); BeginContext(5334, 76, true); WriteLiteral("\n </td>\n <td>\n "); EndContext(); BeginContext(5411, 41, false); #line 130 "C:\VisualStudio\Smile_SoftwareSolution\VodManageSystem\Views\Singareas\SingareasList.cshtml" Write(Html.DisplayFor(modelItem => item.AreaNo)); #line default #line hidden EndContext(); BeginContext(5452, 76, true); WriteLiteral("\n </td>\n <td>\n "); EndContext(); BeginContext(5529, 41, false); #line 133 "C:\VisualStudio\Smile_SoftwareSolution\VodManageSystem\Views\Singareas\SingareasList.cshtml" Write(Html.DisplayFor(modelItem => item.AreaNa)); #line default #line hidden EndContext(); BeginContext(5570, 76, true); WriteLiteral("\n </td>\n <td>\n "); EndContext(); BeginContext(5647, 41, false); #line 136 "C:\VisualStudio\Smile_SoftwareSolution\VodManageSystem\Views\Singareas\SingareasList.cshtml" Write(Html.DisplayFor(modelItem => item.AreaEn)); #line default #line hidden EndContext(); BeginContext(5688, 136, true); WriteLiteral("\n </td>\n\n <td style=\"text-align:center;width:100px;\">\n <button class=\"crud\""); EndContext(); BeginWriteAttribute("onclick", " onclick=\"", 5824, "\"", 5895, 6); WriteAttributeValue("", 5834, "return", 5834, 6, true); WriteAttributeValue(" ", 5840, "toSubmit(\'/Singareas/Edit\',\'", 5841, 29, true); #line 140 "C:\VisualStudio\Smile_SoftwareSolution\VodManageSystem\Views\Singareas\SingareasList.cshtml" WriteAttributeValue("", 5869, item.Id, 5869, 8, false); #line default #line hidden WriteAttributeValue("", 5877, "\',\'", 5877, 3, true); #line 140 "C:\VisualStudio\Smile_SoftwareSolution\VodManageSystem\Views\Singareas\SingareasList.cshtml" WriteAttributeValue("", 5880, item.AreaNo, 5880, 12, false); #line default #line hidden WriteAttributeValue("", 5892, "\');", 5892, 3, true); EndWriteAttribute(); BeginContext(5896, 149, true); WriteLiteral(">Edit</button>\n </td>\n\n <td style=\"text-align:center;width:100px\">\n <button class=\"crud\""); EndContext(); BeginWriteAttribute("onclick", " onclick=\"", 6045, "\"", 6111, 5); WriteAttributeValue("", 6055, "toSubmit(\'/Singareas/Details\',\'", 6055, 31, true); #line 144 "C:\VisualStudio\Smile_SoftwareSolution\VodManageSystem\Views\Singareas\SingareasList.cshtml" WriteAttributeValue("", 6086, item.Id, 6086, 8, false); #line default #line hidden WriteAttributeValue("", 6094, "\',\'", 6094, 3, true); #line 144 "C:\VisualStudio\Smile_SoftwareSolution\VodManageSystem\Views\Singareas\SingareasList.cshtml" WriteAttributeValue("", 6097, item.AreaNo, 6097, 12, false); #line default #line hidden WriteAttributeValue("", 6109, "\')", 6109, 2, true); EndWriteAttribute(); BeginContext(6112, 153, true); WriteLiteral(">Details</button>\n </td>\n\n <td style=\"text-align:center;width:100px;\">\n <button class=\"crud\""); EndContext(); BeginWriteAttribute("onclick", " onclick=\"", 6265, "\"", 6338, 6); WriteAttributeValue("", 6275, "return", 6275, 6, true); WriteAttributeValue(" ", 6281, "toSubmit(\'/Singareas/Delete\',\'", 6282, 31, true); #line 148 "C:\VisualStudio\Smile_SoftwareSolution\VodManageSystem\Views\Singareas\SingareasList.cshtml" WriteAttributeValue("", 6312, item.Id, 6312, 8, false); #line default #line hidden WriteAttributeValue("", 6320, "\',\'", 6320, 3, true); #line 148 "C:\VisualStudio\Smile_SoftwareSolution\VodManageSystem\Views\Singareas\SingareasList.cshtml" WriteAttributeValue("", 6323, item.AreaNo, 6323, 12, false); #line default #line hidden WriteAttributeValue("", 6335, "\');", 6335, 3, true); EndWriteAttribute(); BeginContext(6339, 77, true); WriteLiteral(">Delete</button>\n </td>\n \n </tr>\n"); EndContext(); #line 152 "C:\VisualStudio\Smile_SoftwareSolution\VodManageSystem\Views\Singareas\SingareasList.cshtml" } #line default #line hidden BeginContext(6430, 373, true); WriteLiteral(@" </tbody> </table> <p style=""margin-top:10px;""> <label style=""color:brown; font-size:18px;"">Order By:</label> <button class=""underTable"" onclick=""return orderBySubmit('AreaNo');"" >Singer Area No.</button> <button class=""underTable"" onclick=""return orderBySubmit('AreaNa');"" >Singer Area Name</button> </p> "); 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_3); __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.Area = (string)__tagHelperAttribute_4.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_4); __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.Controller = (string)__tagHelperAttribute_5.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_5); __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.Action = (string)__tagHelperAttribute_6.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_6); __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.Method = (string)__tagHelperAttribute_7.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_7); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(6810, 1, true); WriteLiteral("\n"); EndContext(); }
public async Task <IActionResult> Add(string submitbutton, string language_state, [Bind("Id", "LangNo, LangNa,LangEn")] Language language) { if (!LoginUtil.CheckIfLoggedIn(HttpContext)) { return(View(nameof(Index))); } StateOfRequest mState; if (string.IsNullOrEmpty(language_state)) { mState = new StateOfRequest("LangNo"); } else { mState = JsonUtil.GetObjectFromJsonString <StateOfRequest>(language_state); } mState.StartTime = DateTime.Now; string temp_state = JsonUtil.SetJsonStringFromObject(mState); int orgId = mState.OrgId; string sButton = submitbutton.ToUpper(); if (sButton == "CANCEL") { Language newLanguage = new Language(); List <Language> languagesTemp = _languagesManager.FindOnePageOfLanguagesForOneLanguage(mState, newLanguage, orgId); mState.IsFirstAddRecord = true; temp_state = JsonUtil.SetJsonStringFromObject(mState); ViewBag.LanguageState = temp_state; return(View(nameof(LanguagesList), languagesTemp)); } if (ModelState.IsValid) { int result = await _languagesManager.AddOneLanguageToTable(language); if (result == ErrorCodeModel.Succeeded) { // succeeded to add the language mState.OrgId = language.Id; mState.OrgNo = language.LangNo; mState.IsFirstAddRecord = false; temp_state = JsonUtil.SetJsonStringFromObject(mState); return(RedirectToAction(nameof(Add), new { language_state = temp_state })); } else { ViewData["ErrorMessage"] = ErrorCodeModel.GetErrorMessage(result); } } else { // Model.IsValid = false ViewData["ErrorMessage"] = ErrorCodeModel.GetErrorMessage(ErrorCodeModel.ModelBindingFailed); } ViewBag.LanguageState = temp_state; return(View(language)); }