// GET: UserJob/Index/5 public async Task <IActionResult> Index(int?id) { /*Check Session */ var page = "32"; var typeofuser = ""; var PermisionAction = ""; // CheckSession if (string.IsNullOrEmpty(HttpContext.Session.GetString("Username"))) { Alert("คุณไม่มีสิทธิ์ใช้งานหน้าดังกล่าว", NotificationType.error); return(RedirectToAction("Index", "Home")); } else { typeofuser = HttpContext.Session.GetString("TypeOfUserId"); PermisionAction = HttpContext.Session.GetString("PermisionAction"); if (PermisionHelper.CheckPermision(typeofuser, PermisionAction, page) == false) { Alert("คุณไม่มีสิทธิ์ใช้งานหน้าดังกล่าว", NotificationType.error); return(RedirectToAction("Index", "Home")); } } /*Check Session */ var query = "SELECT dbo." + Environment.GetEnvironmentVariable("Company") + "Job].No_ AS JobNo,dbo." + Environment.GetEnvironmentVariable("Company") + "Job].[Location Code] AS LocationCode FROM dbo." + Environment.GetEnvironmentVariable("Company") + "Job]"; ViewData["JobNo"] = _navcontext.v_Job.FromSqlRaw(query).ToList(); if (id == null) { return(NotFound()); } var users = await _context.Users .Include(p => p.TitleOfUsers) .Include(p => p.StatusUser) .Include(p => p.Branchs) .FirstOrDefaultAsync(m => m.UserId == id); if (users == null) { return(NotFound()); } var userjob = _context.UserJobs .Where(s => s.UserId == id) .ToList(); ViewData["UserJob"] = userjob; return(View(users)); }
public async Task <IActionResult> remove(int id) { /*Check Session */ var page = "259"; var typeofuser = ""; var PermisionAction = ""; // CheckSession if (string.IsNullOrEmpty(HttpContext.Session.GetString("Username"))) { Alert("คุณไม่มีสิทธิ์ใช้งานหน้าดังกล่าว", NotificationType.error); return(RedirectToAction("Index", "Home")); } else { typeofuser = HttpContext.Session.GetString("TypeOfUserId"); PermisionAction = HttpContext.Session.GetString("PermisionAction"); if (PermisionHelper.CheckPermision(typeofuser, PermisionAction, page) == false) { Alert("คุณไม่มีสิทธิ์ใช้งานหน้าดังกล่าว", NotificationType.error); return(RedirectToAction("Index", "Home")); } } /*Check Session */ var bank = await _context.BankRatios.FindAsync(id); _context.BankRatios.RemoveRange(bank); _context.SaveChanges(); return(Ok(bank)); }
// GET: BlogCats public async Task <IActionResult> Index() { /*Check Session */ var page = "7"; var typeofuser = ""; var PermisionAction = ""; // CheckSession if (string.IsNullOrEmpty(HttpContext.Session.GetString("Username"))) { Alert("กรุณา Login เข้าสู่ระบบ", NotificationType.error); return(RedirectToAction("Login", "Accounts")); } else { typeofuser = HttpContext.Session.GetString("TypeOfUserId"); PermisionAction = HttpContext.Session.GetString("PermisionAction"); if (PermisionHelper.CheckPermision(typeofuser, PermisionAction, page) == false) { Alert("คุณไม่มีสิทธิ์ใช้งานหน้าดังกล่าว", NotificationType.error); return(RedirectToAction("Index", "Home")); } } /*Check Session */ return(View(await _context.BlogCats.ToListAsync())); }
public IActionResult remove(int id, string job) { /*Check Session */ var page = "32"; var typeofuser = ""; var PermisionAction = ""; // CheckSession if (string.IsNullOrEmpty(HttpContext.Session.GetString("Username"))) { Alert("คุณไม่มีสิทธิ์ใช้งานหน้าดังกล่าว", NotificationType.error); return(RedirectToAction("Index", "Home")); } else { typeofuser = HttpContext.Session.GetString("TypeOfUserId"); PermisionAction = HttpContext.Session.GetString("PermisionAction"); if (PermisionHelper.CheckPermision(typeofuser, PermisionAction, page) == false) { Alert("คุณไม่มีสิทธิ์ใช้งานหน้าดังกล่าว", NotificationType.error); return(RedirectToAction("Index", "Home")); } } /*Check Session */ List <UserJob> userJobs = _context.UserJobs .Where(s => s.UserId == id && s.UserJobDetail == job) .ToList(); _context.UserJobs.RemoveRange(userJobs); _context.SaveChanges(); return(Ok(userJobs)); }
public async Task <IActionResult> Create([Bind("MapSiteId,SiteName,SiteAddress,Latitude,Longitude")] MapSite mapSite) { /*Check Session */ var page = "227"; var typeofuser = ""; var PermisionAction = ""; // CheckSession if (string.IsNullOrEmpty(HttpContext.Session.GetString("Username"))) { Alert("กรุณา Login เข้าสู่ระบบ", NotificationType.error); return(RedirectToAction("Login", "Accounts")); } else { typeofuser = HttpContext.Session.GetString("TypeOfUserId"); PermisionAction = HttpContext.Session.GetString("PermisionAction"); if (PermisionHelper.CheckPermision(typeofuser, PermisionAction, page) == false) { Alert("คุณไม่มีสิทธิ์ใช้งานหน้าดังกล่าว", NotificationType.error); return(RedirectToAction("Index", "Home")); } } /*Check Session */ if (ModelState.IsValid) { _context.Add(mapSite); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(mapSite)); }
// GET: MapSites/Create public IActionResult Create() { /*Check Session */ var page = "227"; var typeofuser = ""; var PermisionAction = ""; // CheckSession if (string.IsNullOrEmpty(HttpContext.Session.GetString("Username"))) { Alert("กรุณา Login เข้าสู่ระบบ", NotificationType.error); return(RedirectToAction("Login", "Accounts")); } else { typeofuser = HttpContext.Session.GetString("TypeOfUserId"); PermisionAction = HttpContext.Session.GetString("PermisionAction"); if (PermisionHelper.CheckPermision(typeofuser, PermisionAction, page) == false) { Alert("คุณไม่มีสิทธิ์ใช้งานหน้าดังกล่าว", NotificationType.error); return(RedirectToAction("Index", "Home")); } } /*Check Session */ ViewData["SiteName"] = new SelectList(_context.Branchs, "BranchName", "BranchName"); return(View()); }
public async Task <IActionResult> Create([Bind("CaseBPCId,CaseBPCDate,CaseMA,CaseBPCSubject,CaseBPCDetail,caseBPCStatus,caseBPCPLevel,CaseBPCPDateFix,EditBy,openCaseBy")] CaseBPC caseBPC) { /*Check Session */ var page = "190"; var typeofuser = ""; var PermisionAction = ""; // CheckSession if (string.IsNullOrEmpty(HttpContext.Session.GetString("Username"))) { Alert("คุณไม่มีสิทธิ์ใช้งานหน้าดังกล่าว", NotificationType.error); return(RedirectToAction("Index", "Home")); } else { typeofuser = HttpContext.Session.GetString("TypeOfUserId"); PermisionAction = HttpContext.Session.GetString("PermisionAction"); if (PermisionHelper.CheckPermision(typeofuser, PermisionAction, page) == false) { Alert("คุณไม่มีสิทธิ์ใช้งานหน้าดังกล่าว", NotificationType.error); return(RedirectToAction("Index", "Home")); } } /*Check Session */ if (ModelState.IsValid) { _context.Add(caseBPC); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(caseBPC)); }
public IActionResult GenData() { /*Check Session */ var page = "207"; var typeofuser = ""; var PermisionAction = ""; // CheckSession if (string.IsNullOrEmpty(HttpContext.Session.GetString("Username"))) { Alert("กรุณา Login เข้าสู่ระบบ", NotificationType.error); return(RedirectToAction("Login", "Accounts")); } else { typeofuser = HttpContext.Session.GetString("TypeOfUserId"); PermisionAction = HttpContext.Session.GetString("PermisionAction"); if (PermisionHelper.CheckPermision(typeofuser, PermisionAction, page) == false) { Alert("คุณไม่มีสิทธิ์ใช้งานหน้าดังกล่าว", NotificationType.error); return(RedirectToAction("Index", "Home")); } } /*Check Session */ IActionResult response = Unauthorized(); var Monitors = _context.Monitors.ToList(); response = Ok(new { data = Monitors }); return(response); }
public async Task <IActionResult> GenDataAllInLine() { /*Check Session */ var page = "251"; var typeofuser = ""; var PermisionAction = ""; // CheckSession if (string.IsNullOrEmpty(HttpContext.Session.GetString("Username"))) { Alert("คุณไม่มีสิทธิ์ใช้งานหน้าดังกล่าว", NotificationType.error); return(RedirectToAction("Index", "Home")); } else { typeofuser = HttpContext.Session.GetString("TypeOfUserId"); PermisionAction = HttpContext.Session.GetString("PermisionAction"); if (PermisionHelper.CheckPermision(typeofuser, PermisionAction, page) == false) { Alert("คุณไม่มีสิทธิ์ใช้งานหน้าดังกล่าว", NotificationType.error); return(RedirectToAction("Index", "Home")); } } /*Check Session */ IActionResult response = Unauthorized(); var fixAssetStraightAll = await _context.FixAssetStraightAlls.ToListAsync(); response = Ok(new { data = fixAssetStraightAll }); return(response); }
public IActionResult Index() { /*Check Session */ var page = "232"; var typeofuser = ""; var PermisionAction = ""; // CheckSession if (string.IsNullOrEmpty(HttpContext.Session.GetString("Username"))) { Alert("กรุณา Login เข้าสู่ระบบ", NotificationType.error); return(RedirectToAction("Login", "Accounts")); } else { typeofuser = HttpContext.Session.GetString("TypeOfUserId"); PermisionAction = HttpContext.Session.GetString("PermisionAction"); if (PermisionHelper.CheckPermision(typeofuser, PermisionAction, page) == false) { Alert("คุณไม่มีสิทธิ์ใช้งานหน้าดังกล่าว", NotificationType.error); return(RedirectToAction("Index", "Home")); } } /*Check Session */ var queryData1 = "SELECT dbo." + Environment.GetEnvironmentVariable("Company") + "User Setup].[User ID] AS name,dbo." + Environment.GetEnvironmentVariable("Company") + "User Setup].[User ID] as code FROM [dbo]." + Environment.GetEnvironmentVariable("Company") + "User Setup] order by dbo." + Environment.GetEnvironmentVariable("Company") + "User Setup].[User ID] asc "; var sourceAutoCompletes = _navcontext.sourceAutoCompletes.FromSqlRaw(queryData1).ToList(); ViewData["SourceAutoCompletes"] = sourceAutoCompletes; ViewBag.StartDate = DateTime.Now.ToString("01/MM/yyyy"); ViewBag.EndDate = DateTime.Now.ToString("dd/MM/yyyy"); return(View()); }
public void Delete(int key) { /*Check Session */ var page = "221"; var typeofuser = ""; var PermisionAction = ""; // CheckSession if (string.IsNullOrEmpty(HttpContext.Session.GetString("Username"))) { Alert("กรุณา Login เข้าสู่ระบบ", NotificationType.error); } else { typeofuser = HttpContext.Session.GetString("TypeOfUserId"); PermisionAction = HttpContext.Session.GetString("PermisionAction"); if (PermisionHelper.CheckPermision(typeofuser, PermisionAction, page) == false) { Alert("คุณไม่มีสิทธิ์ใช้งานหน้าดังกล่าว", NotificationType.error); } var detailTableERP = _context.DetailTableERPs.First(a => a.ID == key); _context.DetailTableERPs.Remove(detailTableERP); _context.SaveChanges(); } /*Check Session */ }
public IActionResult Index() { /*Check Session */ var page = "235"; var typeofuser = ""; var PermisionAction = ""; // CheckSession if (string.IsNullOrEmpty(HttpContext.Session.GetString("Username"))) { Alert("คุณไม่มีสิทธิ์ใช้งานหน้าดังกล่าว", NotificationType.error); return(RedirectToAction("Index", "Home")); } else { typeofuser = HttpContext.Session.GetString("TypeOfUserId"); PermisionAction = HttpContext.Session.GetString("PermisionAction"); if (PermisionHelper.CheckPermision(typeofuser, PermisionAction, page) == false) { Alert("คุณไม่มีสิทธิ์ใช้งานหน้าดังกล่าว", NotificationType.error); return(RedirectToAction("Index", "Home")); } } /*Check Session */ var queryData1 = "SELECT dbo." + Environment.GetEnvironmentVariable("Company") + "Location].Code AS name,dbo." + Environment.GetEnvironmentVariable("Company") + "Location].Name as code FROM [dbo]." + Environment.GetEnvironmentVariable("Company") + "Location] order by dbo." + Environment.GetEnvironmentVariable("Company") + "Location].Code asc "; var sourceAutoCompletes = _navcontext.sourceAutoCompletes.FromSqlRaw(queryData1).ToList(); ViewData["SourceAutoCompletes"] = sourceAutoCompletes; return(View()); }
public object Get(DataSourceLoadOptions loadOptions) { /*Check Session */ var page = "217"; var typeofuser = ""; var PermisionAction = ""; // CheckSession if (string.IsNullOrEmpty(HttpContext.Session.GetString("Username"))) { Alert("กรุณา Login เข้าสู่ระบบ", NotificationType.error); return(RedirectToAction("Login", "Accounts")); } else { typeofuser = HttpContext.Session.GetString("TypeOfUserId"); PermisionAction = HttpContext.Session.GetString("PermisionAction"); if (PermisionHelper.CheckPermision(typeofuser, PermisionAction, page) == false) { Alert("คุณไม่มีสิทธิ์ใช้งานหน้าดังกล่าว", NotificationType.error); return(RedirectToAction("Index", "Home")); } } /*Check Session */ return(DataSourceLoader.Load(_context.DetailTableERPs.ToList(), loadOptions)); }
// GET: Manuals public async Task <IActionResult> Index() { /*Check Session */ var page = "202"; var typeofuser = ""; var PermisionAction = ""; // CheckSession if (string.IsNullOrEmpty(HttpContext.Session.GetString("Username"))) { Alert("คุณไม่มีสิทธิ์ใช้งานหน้าดังกล่าว", NotificationType.error); return(RedirectToAction("Index", "Home")); } else { typeofuser = HttpContext.Session.GetString("TypeOfUserId"); PermisionAction = HttpContext.Session.GetString("PermisionAction"); if (PermisionHelper.CheckPermision(typeofuser, PermisionAction, page) == false) { Alert("คุณไม่มีสิทธิ์ใช้งานหน้าดังกล่าว", NotificationType.error); return(RedirectToAction("Index", "Home")); } } /*Check Session */ var databaseContext = _context.Manuals.Include(m => m.ManualCats); return(View(await databaseContext.ToListAsync())); }
public IActionResult remove(string ReportName, string ReportDimension, string ReportValue) { /*Check Session */ var page = "252"; var typeofuser = ""; var PermisionAction = ""; // CheckSession if (string.IsNullOrEmpty(HttpContext.Session.GetString("Username"))) { Alert("คุณไม่มีสิทธิ์ใช้งานหน้าดังกล่าว", NotificationType.error); return(RedirectToAction("Index", "Home")); } else { typeofuser = HttpContext.Session.GetString("TypeOfUserId"); PermisionAction = HttpContext.Session.GetString("PermisionAction"); if (PermisionHelper.CheckPermision(typeofuser, PermisionAction, page) == false) { Alert("คุณไม่มีสิทธิ์ใช้งานหน้าดังกล่าว", NotificationType.error); return(RedirectToAction("Index", "Home")); } } /*Check Session */ List <ConditionReport> userJobs = _context.ConditionReports .Where(s => s.ReportName == ReportName && s.ReportDimension == ReportDimension && s.ReportValue == ReportValue) .ToList(); _context.ConditionReports.RemoveRange(userJobs); _context.SaveChanges(); return(Ok(userJobs)); }
public IActionResult Index() { /*Check Session */ var page = "179"; var typeofuser = ""; var PermisionAction = ""; // CheckSession if (string.IsNullOrEmpty(HttpContext.Session.GetString("Username"))) { Alert("กรุณา Login เข้าสู่ระบบ", NotificationType.error); return(RedirectToAction("Login", "Accounts")); } else { typeofuser = HttpContext.Session.GetString("TypeOfUserId"); PermisionAction = HttpContext.Session.GetString("PermisionAction"); if (PermisionHelper.CheckPermision(typeofuser, PermisionAction, page) == false) { Alert("คุณไม่มีสิทธิ์ใช้งานหน้าดังกล่าว", NotificationType.error); return(RedirectToAction("Index", "Home")); } } /*Check Session */ ViewData["JobNo"] = new SelectList(_context.UserJobs.Where(s => s.UserId == HttpContext.Session.GetInt32("Userid")).OrderBy(s => s.UserJobDetail).ToList(), "UserJobDetail", "UserJobDetail"); return(View()); }
// GET: Blogs public async Task <IActionResult> Index() { /*Check Session */ var page = "1"; var typeofuser = ""; var PermisionAction = ""; // CheckSession if (string.IsNullOrEmpty(HttpContext.Session.GetString("Username"))) { Alert("คุณไม่มีสิทธิ์ใช้งานหน้าดังกล่าว", NotificationType.error); return(RedirectToAction("Index", "Home")); } else { typeofuser = HttpContext.Session.GetString("TypeOfUserId"); PermisionAction = HttpContext.Session.GetString("PermisionAction"); if (PermisionHelper.CheckPermision(typeofuser, PermisionAction, page) == false) { Alert("คุณไม่มีสิทธิ์ใช้งานหน้าดังกล่าว", NotificationType.error); return(RedirectToAction("Index", "Home")); } } /*Check Session */ ViewBag.StartDate = DateTime.Now.ToString("01-MM-yyyy", new CultureInfo("en-US")); ViewBag.EndDate = DateTime.Now.ToString("dd-MM-yyyy", new CultureInfo("en-US")); return(View(await _context.Blogs.ToListAsync())); }
public IActionResult Index() { /*Check Session */ var page = "208"; var typeofuser = ""; var PermisionAction = ""; // CheckSession if (string.IsNullOrEmpty(HttpContext.Session.GetString("Username"))) { Alert("กรุณา Login เข้าสู่ระบบ", NotificationType.error); return(RedirectToAction("Login", "Accounts")); } else { typeofuser = HttpContext.Session.GetString("TypeOfUserId"); PermisionAction = HttpContext.Session.GetString("PermisionAction"); if (PermisionHelper.CheckPermision(typeofuser, PermisionAction, page) == false) { Alert("คุณไม่มีสิทธิ์ใช้งานหน้าดังกล่าว", NotificationType.error); return(RedirectToAction("Index", "Home")); } } /*Check Session */ ViewBag.Departments = _context.Departments.ToList(); ViewBag.branchs = _context.Branchs.ToList(); ViewBag.statusUsers = _context.statusUsers.ToList(); ViewBag.typeOfEmp = _context.typeOfEmployee.ToList(); return(View()); }
public async Task <IActionResult> remove(int id) { /*Check Session */ var page = "51"; var typeofuser = ""; var PermisionAction = ""; // CheckSession if (string.IsNullOrEmpty(HttpContext.Session.GetString("Username"))) { Alert("คุณไม่มีสิทธิ์ใช้งานหน้าดังกล่าว", NotificationType.error); return(RedirectToAction("Index", "Home")); } else { typeofuser = HttpContext.Session.GetString("TypeOfUserId"); PermisionAction = HttpContext.Session.GetString("PermisionAction"); if (PermisionHelper.CheckPermision(typeofuser, PermisionAction, page) == false) { Alert("คุณไม่มีสิทธิ์ใช้งานหน้าดังกล่าว", NotificationType.error); return(RedirectToAction("Index", "Home")); } } /*Check Session */ IActionResult response = Unauthorized(); var typeOfUsers = await _context.TypeOfUsers.FindAsync(id); var name = typeOfUsers.TypeOfUserName; _context.TypeOfUsers.Remove(typeOfUsers); await _context.SaveChangesAsync(); response = Ok(new { name = name }); return(response); }
// GET: TypeOfUsers/Create public IActionResult Create() { /*Check Session */ var page = "48"; var typeofuser = ""; var PermisionAction = ""; // CheckSession if (string.IsNullOrEmpty(HttpContext.Session.GetString("Username"))) { Alert("คุณไม่มีสิทธิ์ใช้งานหน้าดังกล่าว", NotificationType.error); return(RedirectToAction("Index", "Home")); } else { typeofuser = HttpContext.Session.GetString("TypeOfUserId"); PermisionAction = HttpContext.Session.GetString("PermisionAction"); if (PermisionHelper.CheckPermision(typeofuser, PermisionAction, page) == false) { Alert("คุณไม่มีสิทธิ์ใช้งานหน้าดังกล่าว", NotificationType.error); return(RedirectToAction("Index", "Home")); } } /*Check Session */ return(View()); }
public IActionResult Detailmail() { /*Check Session */ var page = "277"; var typeofuser = ""; var PermisionAction = ""; // CheckSession if (string.IsNullOrEmpty(HttpContext.Session.GetString("Username"))) { Alert("คุณไม่มีสิทธิ์ใช้งานหน้าดังกล่าว", NotificationType.error); return(RedirectToAction("Index", "Home")); } else { typeofuser = HttpContext.Session.GetString("TypeOfUserId"); PermisionAction = HttpContext.Session.GetString("PermisionAction"); if (PermisionHelper.CheckPermision(typeofuser, PermisionAction, page) == false) { Alert("คุณไม่มีสิทธิ์ใช้งานหน้าดังกล่าว", NotificationType.error); return(RedirectToAction("Index", "Home")); } } /*Check Session */ IActionResult response = Unauthorized(); var name = _config["Email:NameAccount"].ToString(); var email = _config["Email:MailAccount"]; response = Ok(new { name = name, email = email }); return(response); }
public async Task <IActionResult> Create([Bind("TypeOfUserId,TypeOfUserName")] TypeOfUser typeOfUsers) { /*Check Session */ var page = "48"; var typeofuser = ""; var PermisionAction = ""; // CheckSession if (string.IsNullOrEmpty(HttpContext.Session.GetString("Username"))) { Alert("คุณไม่มีสิทธิ์ใช้งานหน้าดังกล่าว", NotificationType.error); return(RedirectToAction("Index", "Home")); } else { typeofuser = HttpContext.Session.GetString("TypeOfUserId"); PermisionAction = HttpContext.Session.GetString("PermisionAction"); if (PermisionHelper.CheckPermision(typeofuser, PermisionAction, page) == false) { Alert("คุณไม่มีสิทธิ์ใช้งานหน้าดังกล่าว", NotificationType.error); return(RedirectToAction("Index", "Home")); } } /*Check Session */ if (ModelState.IsValid) { _context.Add(typeOfUsers); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(typeOfUsers)); }
// GET: CheckGL public ActionResult Index() { /*Check Session */ var page = "149"; var typeofuser = ""; var PermisionAction = ""; // CheckSession if (string.IsNullOrEmpty(HttpContext.Session.GetString("Username"))) { Alert("คุณไม่มีสิทธิ์ใช้งานหน้าดังกล่าว", NotificationType.error); return(RedirectToAction("Index", "Home")); } else { typeofuser = HttpContext.Session.GetString("TypeOfUserId"); PermisionAction = HttpContext.Session.GetString("PermisionAction"); if (PermisionHelper.CheckPermision(typeofuser, PermisionAction, page) == false) { Alert("คุณไม่มีสิทธิ์ใช้งานหน้าดังกล่าว", NotificationType.error); return(RedirectToAction("Index", "Home")); } } ViewData["JobNo"] = new SelectList(_context.UserJobs.Where(s => s.UserId == HttpContext.Session.GetInt32("Userid")).OrderBy(s => s.UserJobDetail).ToList(), "UserJobDetail", "UserJobDetail"); ViewBag.StartDate = DateTime.Now.ToString("01-01-2018", new CultureInfo("en-US")); ViewBag.EndDate = DateTime.Now.ToString("dd-MM-yyyy", new CultureInfo("en-US")); return(View()); }
// GET: Permisions public async Task <IActionResult> Index() { /*Check Session */ var page = "27"; var typeofuser = ""; var PermisionAction = ""; // CheckSession if (string.IsNullOrEmpty(HttpContext.Session.GetString("Username"))) { Alert("คุณไม่มีสิทธิ์ใช้งานหน้าดังกล่าว", NotificationType.error); return(RedirectToAction("Index", "Home")); } else { typeofuser = HttpContext.Session.GetString("TypeOfUserId"); PermisionAction = HttpContext.Session.GetString("PermisionAction"); if (PermisionHelper.CheckPermision(typeofuser, PermisionAction, page) == false) { Alert("คุณไม่มีสิทธิ์ใช้งานหน้าดังกล่าว", NotificationType.error); return(RedirectToAction("Index", "Home")); } } /*Check Session */ var webModuls = _context.WebModuls.ToList(); ViewData["WebModuls"] = webModuls; return(View(await _context.Permisions.ToListAsync())); }
// GET: TitleOfUsers public async Task <IActionResult> Index() { /*Check Session */ var page = "42"; var typeofuser = ""; var PermisionAction = ""; // CheckSession if (string.IsNullOrEmpty(HttpContext.Session.GetString("Username"))) { Alert("คุณไม่มีสิทธิ์ใช้งานหน้าดังกล่าว", NotificationType.error); return(RedirectToAction("Index", "Home")); } else { typeofuser = HttpContext.Session.GetString("TypeOfUserId"); PermisionAction = HttpContext.Session.GetString("PermisionAction"); if (PermisionHelper.CheckPermision(typeofuser, PermisionAction, page) == false) { Alert("คุณไม่มีสิทธิ์ใช้งานหน้าดังกล่าว", NotificationType.error); return(RedirectToAction("Index", "Home")); } } /*Check Session */ //var titleOfUser = await _context.TitleOfUsers // .FirstOrDefaultAsync(m => m.TitleOfUserId == id); //ViewData["TitleOfUserId"] = titleOfUser.TitleOfUserId; //ViewData["TitleOfUserName"] = titleOfUser.TitleOfUserName; return(View(await _context.TitleOfUsers.ToListAsync())); }
public IActionResult WHT53() { /*Check Session */ var page = "185"; var typeofuser = ""; var PermisionAction = ""; // CheckSession if (string.IsNullOrEmpty(HttpContext.Session.GetString("Username"))) { Alert("กรุณา Login เข้าสู่ระบบ", NotificationType.error); return(RedirectToAction("Login", "Accounts")); } else { typeofuser = HttpContext.Session.GetString("TypeOfUserId"); PermisionAction = HttpContext.Session.GetString("PermisionAction"); if (PermisionHelper.CheckPermision(typeofuser, PermisionAction, page) == false) { Alert("คุณไม่มีสิทธิ์ใช้งานหน้าดังกล่าว", NotificationType.error); return(RedirectToAction("Index", "Home")); } } /*Check Session */ ViewBag.StartDate = DateTime.Now.ToString("01-01-yyyy", new CultureInfo("en-US")); ViewBag.EndDate = DateTime.Now.ToString("dd-MM-yyyy", new CultureInfo("en-US")); return(View()); }
public IActionResult GetPoData() { /*Check Session */ var page = "158"; var typeofuser = ""; var PermisionAction = ""; // CheckSession if (string.IsNullOrEmpty(HttpContext.Session.GetString("Username"))) { Alert("กรุณา Login เข้าสู่ระบบ", NotificationType.error); return(RedirectToAction("Login", "Accounts")); } else { typeofuser = HttpContext.Session.GetString("TypeOfUserId"); PermisionAction = HttpContext.Session.GetString("PermisionAction"); if (PermisionHelper.CheckPermision(typeofuser, PermisionAction, page) == false) { Alert("คุณไม่มีสิทธิ์ใช้งานหน้าดังกล่าว", NotificationType.error); return(RedirectToAction("Index", "Home")); } } IActionResult response = Unauthorized(); var queryData = " SELECT ROW_NUMBER() OVER (ORDER BY dbo." + Environment.GetEnvironmentVariable("Company") + "Purchase Header].[Document Date]) as ID,convert(varchar,dbo." + Environment.GetEnvironmentVariable("Company") + "Purchase Header].[Document Date] , 23) AS DocumentDate, " + " dbo." + Environment.GetEnvironmentVariable("Company") + "Purchase Line].[Location Code] AS LocationCode," + " dbo." + Environment.GetEnvironmentVariable("Company") + "Purchase Line].[Document No_] AS DocumentNo," + " dbo." + Environment.GetEnvironmentVariable("Company") + "Purchase Line].No_ AS ItemNo," + " dbo." + Environment.GetEnvironmentVariable("Company") + "Purchase Line].Description AS Description," + " dbo." + Environment.GetEnvironmentVariable("Company") + "Purchase Line].[Description 2] AS Description2," + " convert(varchar,FORMAT(dbo." + Environment.GetEnvironmentVariable("Company") + "Purchase Line].Quantity,'###,###,###.00','en-US')) as Quantity," + " convert(varchar,FORMAT(dbo." + Environment.GetEnvironmentVariable("Company") + "Purchase Line].Amount,'###,###,###.00','en-US')) as Amount," + " dbo." + Environment.GetEnvironmentVariable("Company") + "Purchase Header].[Last Receiving No_] as LastReceive," + " dbo." + Environment.GetEnvironmentVariable("Company") + "Purchase Header].[Assigned User ID] as UserCreate" + " FROM dbo." + Environment.GetEnvironmentVariable("Company") + "Purchase Header]" + " INNER JOIN dbo." + Environment.GetEnvironmentVariable("Company") + "Purchase Line] ON dbo." + Environment.GetEnvironmentVariable("Company") + "Purchase Line].[Document No_] = dbo." + Environment.GetEnvironmentVariable("Company") + "Purchase Header].No_" + " WHERE (([Outstanding Quantity]!=[Outstanding Qty_ (Base)]) or (dbo." + Environment.GetEnvironmentVariable("Company") + "Purchase Line].No_ LIKE 'PC%' AND dbo." + Environment.GetEnvironmentVariable("Company") + "Purchase Line].[Job Task No_] <> '' " + " and dbo." + Environment.GetEnvironmentVariable("Company") + "Purchase Header].[Document Date]>'2019-03-01 00:00:00') " + " or ((dbo." + Environment.GetEnvironmentVariable("Company") + "Purchase Line].[Shortcut Dimension 1 Code]='2070' or dbo." + Environment.GetEnvironmentVariable("Company") + "Purchase Line].[Shortcut Dimension 1 Code]='2071' " + " or dbo." + Environment.GetEnvironmentVariable("Company") + "Purchase Header].[Shortcut Dimension 1 Code]='2071' or dbo." + Environment.GetEnvironmentVariable("Company") + "Purchase Header].[Shortcut Dimension 1 Code]='2070' " + " or dbo." + Environment.GetEnvironmentVariable("Company") + "Purchase Line].[Shortcut Dimension 1 Code]='1041' or dbo." + Environment.GetEnvironmentVariable("Company") + "Purchase Line].[Shortcut Dimension 1 Code]='1040' " + " or dbo." + Environment.GetEnvironmentVariable("Company") + "Purchase Header].[Shortcut Dimension 1 Code]='1041' or dbo." + Environment.GetEnvironmentVariable("Company") + "Purchase Header].[Shortcut Dimension 1 Code]='1040') and dbo." + Environment.GetEnvironmentVariable("Company") + "Purchase Line].[Document No_]<>'POPMKR-62060030' " + ")) " + " ORDER BY dbo." + Environment.GetEnvironmentVariable("Company") + "Purchase Header].[Document Date] DESC"; //ViewBag.sql = queryData; var CheckPOPCJobtasks = _navcontext.v_CheckPOPCJobtasks.FromSqlRaw(queryData).ToList(); response = Ok(new { data = CheckPOPCJobtasks }); return(response); }
// GET: Blogs/Edit/5 public async Task <IActionResult> Edit(int?id) { /*Check Session */ var page = "3"; var typeofuser = ""; var PermisionAction = ""; // CheckSession if (string.IsNullOrEmpty(HttpContext.Session.GetString("Username"))) { Alert("คุณไม่มีสิทธิ์ใช้งานหน้าดังกล่าว", NotificationType.error); return(RedirectToAction("Index", "Home")); } else { typeofuser = HttpContext.Session.GetString("TypeOfUserId"); PermisionAction = HttpContext.Session.GetString("PermisionAction"); if (PermisionHelper.CheckPermision(typeofuser, PermisionAction, page) == false) { Alert("คุณไม่มีสิทธิ์ใช้งานหน้าดังกล่าว", NotificationType.error); return(RedirectToAction("Index", "Home")); } } /*Check Session */ ViewData["BlogCatId"] = new SelectList(_context.BlogCats, "BlogCatId", "BlogCatName"); if (id == null) { return(NotFound()); } var blog = await _context.Blogs.FindAsync(id); if (blog == null) { return(NotFound()); } var blogPic = _context.BlogPics .Where(s => s.BlogId == id) .ToList(); var blogFile = _context.BlogFiles .Where(s => s.BlogId == id) .ToList(); ViewData["BlogPic"] = blogPic; ViewData["blogFile"] = blogFile; ViewBag.BlogPicTitle = blog.BlogPicTitle; var StartDate = blog.BlogDate; var EndDate = blog.BlogEndDate; ViewBag.StartDate = StartDate.ToString("dd/MM/yyyy"); ViewBag.EndDate = EndDate.ToString("dd/MM/yyyy");; ViewBag.BlogStatus = blog.BlogStatus; return(View(blog)); }
public IActionResult Profit() { /*Check Session */ var page = "252"; var typeofuser = ""; var PermisionAction = ""; // CheckSession if (string.IsNullOrEmpty(HttpContext.Session.GetString("Username"))) { Alert("กรุณา Login เข้าสู่ระบบ", NotificationType.error); return(RedirectToAction("Login", "Accounts")); } else { typeofuser = HttpContext.Session.GetString("TypeOfUserId"); PermisionAction = HttpContext.Session.GetString("PermisionAction"); if (PermisionHelper.CheckPermision(typeofuser, PermisionAction, page) == false) { Alert("คุณไม่มีสิทธิ์ใช้งานหน้าดังกล่าว", NotificationType.error); return(RedirectToAction("Index", "Home")); } } /*Check Session */ //Account No //var query = "SELECT DISTINCT [G_L Account No_] as LocationCode,[G_L Account No_] as JobNo FROM dbo."+ Environment.GetEnvironmentVariable("Company") +"G_L Entry] ORDER BY [G_L Account No_] asc"; var query = "SELECT " + "dbo." + Environment.GetEnvironmentVariable("Company") + "G_L Account].No_ as LocationCode, " + "dbo." + Environment.GetEnvironmentVariable("Company") + "G_L Account].No_ as JobNo " + "FROM [dbo]." + Environment.GetEnvironmentVariable("Company") + "G_L Account] " + "Order by dbo." + Environment.GetEnvironmentVariable("Company") + "G_L Account].No_ "; var jobNo = _navcontext.v_Job.FromSqlRaw(query).ToList(); var AccountNo = _context.ConditionReports.Where(p => p.ReportDimension == "ChartOfAccount" && p.ReportName == "AccountProfit").ToList(); ViewData["AccountNo"] = AccountNo; ViewData["JobNo"] = jobNo; //GL var queryGL = "SELECT Code as JobNo ,Name as LocationCode FROM dbo." + Environment.GetEnvironmentVariable("Company") + "Dimension Value] WHERE [Dimension Code]='JOB_GL'"; var jobNoGL = _navcontext.v_Job.FromSqlRaw(queryGL).ToList(); ViewData["JobGL"] = jobNoGL; var AccountNoGL = _context.ConditionReports.Where(p => p.ReportDimension == "GLOpen" && p.ReportName == "AccountProfit").ToList(); ViewData["AccountGL"] = AccountNoGL; return(View()); }
public IActionResult GetData(string Startdate, string EndDate) { /*Check Session */ var page = "181"; var typeofuser = ""; var PermisionAction = ""; // CheckSession if (string.IsNullOrEmpty(HttpContext.Session.GetString("Username"))) { Alert("กรุณา Login เข้าสู่ระบบ", NotificationType.error); return(RedirectToAction("Login", "Accounts")); } else { typeofuser = HttpContext.Session.GetString("TypeOfUserId"); PermisionAction = HttpContext.Session.GetString("PermisionAction"); if (PermisionHelper.CheckPermision(typeofuser, PermisionAction, page) == false) { Alert("คุณไม่มีสิทธิ์ใช้งานหน้าดังกล่าว", NotificationType.error); return(RedirectToAction("Index", "Home")); } } /*Check Session */ var date1 = Startdate.Substring(6, 4) + "-" + Startdate.Substring(3, 2) + "-" + Startdate.Substring(0, 2) + " 00:00:00"; var date2 = EndDate.Substring(6, 4) + "-" + EndDate.Substring(3, 2) + "-" + EndDate.Substring(0, 2) + " 23:59:59"; IActionResult response = Unauthorized(); var queryData = " SELECT b.WHTno,b.WHTName,b.SumAmount as SumAmount,b.SumBase as SumBase, " + " (CASE WHEN (b.SumBase<=1620000) THEN '<span class=''label label-primary''>Success</span>' " + " WHEN (b.SumBase<=1800000) THEN '<span class=''label label-warning''>Warning</span>' " + " WHEN (b.SumBase>1800000) THEN '<span class=''label label-danger''>Danger</span>' " + " END )as SumData" + " FROM(SELECT a.WHTno," + " (SELECT TOP 1 [WHT Name] FROM dbo." + Environment.GetEnvironmentVariable("Company") + "WHT Entry] WHERE [WHT Registration No_]=a.WHTno) as WHTName, " + " (SELECT isnull(SUM(dbo." + Environment.GetEnvironmentVariable("Company") + "WHT Entry].Amount),0) FROM [dbo]." + Environment.GetEnvironmentVariable("Company") + "WHT Entry] WHERE dbo." + Environment.GetEnvironmentVariable("Company") + "WHT Entry].[WHT Registration No_]=a.WHTno AND (dbo." + Environment.GetEnvironmentVariable("Company") + "WHT Entry].[WHT Bus_ Posting Group]='CES-WHT03' or dbo." + Environment.GetEnvironmentVariable("Company") + "WHT Entry].[WHT Bus_ Posting Group]='BANK-WHT03') AND dbo." + Environment.GetEnvironmentVariable("Company") + "WHT Entry].[Posting Date]>={0} and dbo." + Environment.GetEnvironmentVariable("Company") + "WHT Entry].[Posting Date]<={1}) as SumAmount, " + " (SELECT isnull(SUM(dbo." + Environment.GetEnvironmentVariable("Company") + "WHT Entry].Base),0) FROM [dbo]." + Environment.GetEnvironmentVariable("Company") + "WHT Entry] WHERE dbo." + Environment.GetEnvironmentVariable("Company") + "WHT Entry].[WHT Registration No_]=a.WHTno AND (dbo." + Environment.GetEnvironmentVariable("Company") + "WHT Entry].[WHT Bus_ Posting Group]='CES-WHT03' or dbo." + Environment.GetEnvironmentVariable("Company") + "WHT Entry].[WHT Bus_ Posting Group]='BANK-WHT03') AND dbo." + Environment.GetEnvironmentVariable("Company") + "WHT Entry].[Posting Date]>={0} and dbo." + Environment.GetEnvironmentVariable("Company") + "WHT Entry].[Posting Date]<={1}) as SumBase" + " FROM (SELECT DISTINCT " + " dbo." + Environment.GetEnvironmentVariable("Company") + "WHT Entry].[WHT Registration No_] as WHTno " //+ " dbo."+ Environment.GetEnvironmentVariable("Company") +"WHT Entry].[WHT Name] as WHTName " + " FROM [dbo]." + Environment.GetEnvironmentVariable("Company") + "WHT Entry] WHERE (dbo." + Environment.GetEnvironmentVariable("Company") + "WHT Entry].[WHT Bus_ Posting Group]='CES-WHT03' or dbo." + Environment.GetEnvironmentVariable("Company") + "WHT Entry].[WHT Bus_ Posting Group]='BANK-WHT03') ) as a " + " )as b"; //SqlParameter parameterStartDate = new SqlParameter("@StartDate", date1); //SqlParameter parameterEndDate = new SqlParameter("@EndDate", date2); ////ViewBag.sql = queryData; var v_WHT03s = _navcontext.v_WHT03s.FromSqlRaw(queryData, date1, date2).ToList(); response = Ok(new { data = v_WHT03s }); return(response); }