public IActionResult Main() { ViewData["Title"] = "Главное меню"; var command = new FunctionCommand("table(pkg_cmacros.getSheets)", new Param[] { new Param("accesslevel", User.FindFirst(x => x.Type == ClaimsIdentity.DefaultRoleClaimType).Value) }); var caller = new DbCaller(command); caller.DoWork(); if (((DataTable)caller.GetResult()).Rows.Count == 0) { ViewBag.Message = "Данному пользователю недоступны какие-либо действия!"; return(RedirectToAction("Login", "Home")); } List <string> availableSheetsName = new List <string>(); foreach (DataRow row in ((DataTable)caller.GetResult()).Rows) { availableSheetsName.Add(row[0].ToString()); } List <Sheet> availableSheets = (List <Sheet>)Options.Sheets.Where(sheet => availableSheetsName.Contains(sheet.Name)); return(View("Main", availableSheets)); }
public IActionResult Main() { ViewData["Title"] = "Главное меню"; var command = new FunctionCommand("table(pkg_cmacros.getSheets)", new Param[] { new Param("accesslevel", User.FindFirst(x => x.Type == ClaimsIdentity.DefaultRoleClaimType).Value) }); var caller = new DbCaller(command); caller.DoWork(); if (((DataTable)caller.GetResult()).Rows.Count == 0) { ViewBag.Message = "Данному пользователю недоступны какие-либо действия!"; return(RedirectToAction("Login", "Home")); } return(View("Main", caller.GetResult())); }
public ActionResult FillPartialTable(string sheetName, Param[] parameters) { var command = new FunctionCommand(Options.Sheets[sheetName].Procedure); var caller = new DbCaller(command); caller.DoWork(); return(PartialView("_GetDelayedSO", (DataTable)caller.GetResult())); }
public bool IsRowUpdated() { var command = new TextCommand(string.Format(@" select 1 from orderline where ordernumber = {0} and linenumber= {1} and supplementarytext5 like '%{2}%'", OrderNumber, LineNumber, "LETTER")); var caller = new DbCaller(command); caller.DoWork(); return(!(caller.GetResult() is null)); }
public ActionResult GetLoadPrice(int numberIPO) { var command = new FunctionCommand("table(pkg_cmacros.LoadPriceToIPO)"); var caller = new DbCaller(command); caller.DoWork(); return(PartialView("_LoadPrice", (DataTable)caller.GetResult())); //return Helper.GetXlsxFile("Purchaser", "LoadPrice", new Param("№ ЗП", numberIPO)); }
public async Task <IActionResult> Login(string login, string password) { var command = new ScalarCommand(String.Format("select pkg_cmacros.checkAccess('{0}', '{1}') from dual", login, password)); var caller = new DbCaller(command); caller.DoWork(); if (caller.GetResult().ToString().Length == 6) { await Authenticate(new User(login, caller.GetResult().ToString())); return(RedirectToAction("Main", "Sheets")); } else { ViewBag.Message = caller.GetResult().ToString(); return(View()); } }
public ActionResult UpdateDelayedSO(string orderNumber, int lineNumber, string delayedDays, string supplementaryText5, int post = -1) { if (post != -1) { Random rnd = new Random(); int value = rnd.Next(0, 10); return(Content(value > 5 ? post.ToString() : post.ToString())); } else { return(Content("Ожидание")); } // Обновление данных Param[] parameters = { new Param("fDecision", "Отправить запрос МП"), new Param("fYourRequest", "Не отправлен"), new Param("fDelayNumber", delayedDays), new Param("fDelay", supplementaryText5), new Param("fOrdernumb", orderNumber), new Param("fLinenumb", lineNumber) }; var command = new ProcedureCommand(Options.Sheets["Обновление задерж. ЗК"].Procedure, parameters, Returns.Nothing); var caller = new DbCaller(command); try { caller.DoWork(); } catch { return(Content("Обновить данные не удалось!")); } // Проверка, обновились ли данные. Возвращает простой текст в HTML страничку по итогам проверки var checkCommand = new TextCommand(string.Format("select 1 result from OrderLine where OrderNumber = {0} and LineNumber = {1} SupplementaryText5 like '%LETTER%'", orderNumber, lineNumber)); var checkCaller = new DbCaller(checkCommand); try { checkCaller.DoWork(); return(Content(checkCaller.GetResult().ToString().Equals("1") ? "Успешно" : "Неуспешно")); } catch (Exception e) { return(Content("Проверка неуспешна")); } }
public ActionResult GetDelayedSO() { // Вызов осуществляется не через хелпер, так как функционал не так прост. Нужно передать извлеченную информацию в частичное представление. Сам метод работает в аяксе var command = new FunctionCommand(Options.Sheets["GetDelayedSO"].Procedure); var caller = new DbCaller(command); caller.DoWork(); return(PartialView("_DelayedSO", (DataTable)caller.GetResult())); /* * var command = new TextCommand(@"select 1 ""OrderNumber"", 1 ""LineNumber"", 1 ""DelayedDays"", 1 ""SupplementaryText5"", rf.* from dbo.""RefFoms"" rf", Returns.Table); * var caller = new DbCaller(command, null, "PgSQL2"); * caller.DoWork(); * return PartialView("_DelayedSO", (DataTable)caller.GetResult()); * /* * Sheet currentSheet = Purchaser.GetSheet("Задерживается ЗК"); * var command = new FunctionCommand(currentSheet.Procedure); * var caller = new DbCaller(command); * caller.DoWork(); * return PartialView("_DelayedSO", (DataTable)caller.GetResult()); */ }