public ActionResult UploadUserGuide() { try { if (Request.Files.Count > 0) { var file = Request.Files["file"]; string response = Common.ValidateFileUpload(file); if (response.Equals("true")) { if (file != null) { var fileName = Path.GetFileNameWithoutExtension(WebConfigure.GetUserGuideNameFileWithExtention()) + Path.GetExtension(file.FileName); var path = Path.Combine(System.Web.HttpContext.Current.Server.MapPath("~/Upload/Document"), fileName); file.SaveAs(path); } } } return(Content("<script language='javascript' type='text/javascript'>alert('Upload User Guide was Successfull'); location.href = '" + WebConfigure.GetDomain() + "/Admin/Default/Index';</script>")); } catch { return(Content("<script language='javascript' type='text/javascript'>alert('Upload User Guide was Failed, Please Make to Sure About Format File and then upload it'); location.href = '" + WebConfigure.GetDomain() + "/Admin/Default/Index';</script>")); } }
// GET: Account public ActionResult Index() { ViewBag.Download = WebConfigure.GetDomain() + "/Upload/Document/" + WebConfigure.GetUserGuideNameFileWithExtention(); if (Session["userid"] == null) { return(RedirectToAction("Login", "Account")); } else { //if (Common.GetUserXupj().ToLower() != Session["username"].ToString().ToLower()) //{ // return RedirectToAction("Login", "Account"); //} var userT = _userBService.GetDetail(Convert.ToInt32(Session["userid"])); ViewBag.MsgReject = _userMessageBService.GetListByEmployeeId(userT.EmployeeId); User app1 = userT.Approval1 == 0 ? null : _userBService.GetDetailByEmployeeId(userT.Approval1); User app2 = userT.Approval2 == 0 ? null : _userBService.GetDetailByEmployeeId(userT.Approval2); EmployeeMaster userEmpMst = _mstEmployeeBService.GetDetailbyUserName(userT.Username); EmployeeMaster empMstApp1 = userEmpMst == null ? null : _mstEmployeeBService.GetDetail(userEmpMst.Superior_ID); EmployeeMaster empMstApp2 = empMstApp1 == null ? null : _mstEmployeeBService.GetDetail(empMstApp1.Superior_ID); ViewBag.App1 = app1 == null ? null : app1; ViewBag.App2 = app2 == null ? null : app2; ViewBag.empMstApp1 = empMstApp1 == null ? null : empMstApp1; ViewBag.empMstApp2 = empMstApp2 == null ? null : empMstApp2; UserTsManager tsmanager = userT.UserTsManager1Id == 0 ? null : _userTsManagerBusinessService.GetDetail(userT.UserTsManager1Id); ViewBag.TSManager = tsmanager == null ? null : _userBService.GetDetailByEmployeeId(tsmanager.EmployeeId); ViewBag.Recent = _ticketBs.GetRecent(); var Employemst = _mstEmployeeBService.GetDetail(userT.EmployeeId); if (Employemst == null) { ViewBag.EmployeeMaster_empId = String.Empty; ViewBag.EmployeeMaster_POH_Id = String.Empty; ViewBag.EmployeeMaster_POH_Name = "-"; } else { ViewBag.EmployeeMaster_empId = Convert.ToString(Employemst.Employee_Id); ViewBag.EmployeeMaster_POH_Id = string.IsNullOrWhiteSpace(Employemst.Business_Area) ? "-" : "ID : " + Employemst.Business_Area; ViewBag.EmployeeMaster_POH_Name = string.IsNullOrWhiteSpace(Employemst.Business_Area_Desc) ? "-" : Employemst.Business_Area_Desc; } return(View(userT)); } }
// GET: Library public ActionResult Index(String keyword = "", String category = "") { if (Session["userid"] == null) { return(RedirectToAction("Login", "Account")); } if (WebConfigure.GetLoginPortal() == "true" && Common.GetUserXupj().ToLower() != Session["username"].ToString().ToLower()) { return(RedirectToAction("Login", "Account")); } try { ViewBag.Download = WebConfigure.GetDomain() + "/Upload/Document/" + WebConfigure.GetUserGuideNameFileWithExtention(); ViewBag.Domain = WebConfigure.GetDomain(); if (WebConfigure.GetLoginPortal() == "true" && Common.GetUserXupj() != "" && Session["userid"] == null) { return(RedirectToAction("Login", "Account")); } if (Session["username"] != null) { if (WebConfigure.GetLoginPortal() == "true" && Common.GetUserXupj().ToLower() != Session["username"].ToString().ToLower()) { return(RedirectToAction("Login", "Account")); } } ViewBag.UseFullLink = _articleBs.getUseFullLink().Count > 0 ? _articleBs.getUseFullLink() : null; ViewBag.key = keyword; ViewBag.Category = category; return(View()); } catch (Exception ex) { _logErrorBService.WriteLog("Library Index", MethodBase.GetCurrentMethod().Name, ex.ToString()); throw; } }
public ActionResult Index(int?page, int Category = 0, String keyword = "") { if (Session["userid"] == null) { return(RedirectToAction("Login", "Account")); } if (WebConfigure.GetLoginPortal() == "true" && Common.GetUserXupj().ToLower() != Session["username"].ToString().ToLower()) { return(RedirectToAction("Login", "Account")); } ViewBag.Download = WebConfigure.GetDomain() + "/Upload/Document/" + WebConfigure.GetUserGuideNameFileWithExtention(); ViewBag.Domain = domain(isLocal); ViewBag.CategoryName = Category == 0 ? null : _articleCategoryBs.GetDetail(Category).Name; ViewBag.IconCategory = Category == 0 ? null : _articleCategoryBs.GetDetail(Category).Icon; if (WebConfigure.GetLoginPortal() == "true" && Common.GetUserXupj() != "" && Session["userid"] == null) { return(RedirectToAction("Login", "Account")); } if (Session["username"] != null) { if (WebConfigure.GetLoginPortal() == "true" && Common.GetUserXupj().ToLower() != Session["username"].ToString().ToLower()) { return(RedirectToAction("Login", "Account")); } } ViewBag.UseFullLink = _articleBs.getUseFullLink().Count > 0 ? _articleBs.getUseFullLink() : null; List <Article> listArtikel = null; //var start = 6 * (Convert.ToInt32(1) - 1); if (Category == 0) { listArtikel = _literatureService.GetListkeyword(keyword); } else { listArtikel = _literatureService.GetListbyCategory(Category, keyword); } #region Category ViewBag.Domain = WebConfigure.GetDomain(); ViewBag.ListCategory1 = _articleCategoryBs.GetListCategoryMostUsedLiterature(0); ViewBag.key = keyword; #endregion List <ArticleFileData> ArticleData = new List <ArticleFileData>(); List <CustomArticleTags> ArticleTagsData = new List <CustomArticleTags>(); if (listArtikel != null) { foreach (var item in listArtikel) { List <String> FileData = _articleFileBs.GetNamefileByRoleColor(item.ArticleId, item.LevelUser); if (FileData.Count > 0) { ArticleFileData filedata = new ArticleFileData() { idFile = item.ArticleId, Name = FileData, Level = _articleFileBs.GetLevelFileByRoleColor(item.ArticleId, item.LevelUser) }; ArticleData.Add(filedata); } var TagsData = _articleTagsBs.GetTagsByArticle(item.ArticleId); CustomArticleTags tags = new CustomArticleTags() { ArticleId = item.ArticleId, Object = TagsData.Count == 0 ? null : TagsData }; ArticleTagsData.Add(tags); } } ViewBag.LiteratureTags = ArticleTagsData; ViewBag.keyword = keyword; ViewBag.LiteratureItem = ArticleData; int pageSize = 50; int pageNumber = (page ?? 1); return(View(listArtikel.ToPagedList(pageNumber, pageSize))); }
public ActionResult LoadMore(int?page, int Category = 0, String keyword = "") { if (Session["userid"] == null) { return(RedirectToAction("Login", "Account")); } if (WebConfigure.GetLoginPortal() == "true" && Common.GetUserXupj().ToLower() != Session["username"].ToString().ToLower()) { return(RedirectToAction("Login", "Account")); } ViewBag.Download = WebConfigure.GetDomain() + "/Upload/Document/" + WebConfigure.GetUserGuideNameFileWithExtention(); ViewBag.CategoryName = Category == 0 ? null : _articleCategoryBs.GetDetail(Category).Name; ViewBag.IconCategory = Category == 0 ? null : _articleCategoryBs.GetDetail(Category).Icon; ViewBag.UseFullLink = _articleBs.getUseFullLink().Count > 0 ? _articleBs.getUseFullLink() : null; List <Article> listArtikel = null; if (Category == 0) { listArtikel = _literatureService.GetListkeyword(keyword); } else { listArtikel = _literatureService.GetListbyCategory(Category, keyword); } #region Category ViewBag.Domain = domain(isLocal); ViewBag.ListCategory1 = _articleCategoryBs.GetListCategoryMostUsedLiterature(0); #endregion List <ArticleFile> ArticleData = new List <ArticleFile>(); List <CustomArticleTags> ArticleTagsData = new List <CustomArticleTags>(); if (listArtikel != null) { foreach (var artikel in listArtikel) { var FileData = _articleFileBs.GetListByArtikelId(artikel.ArticleId); if (FileData != null) { foreach (var FileItem in FileData) { var fileCek = _articleFileBs.GetDetail(FileItem.ArticleId); if (fileCek != null) { ArticleFile file = new ArticleFile() { ArticleId = artikel.ArticleId, Name = fileCek.Name, }; ArticleData.Add(file); } var TagsData = _articleTagsBs.GetTagsByArticle(artikel.ArticleId); CustomArticleTags tags = new CustomArticleTags() { ArticleId = artikel.ArticleId, Object = TagsData.Count == 0 ? null : TagsData }; ArticleTagsData.Add(tags); } } } } ViewBag.LiteratureTags = ArticleTagsData; ViewBag.LiteratureData = listArtikel; ViewBag.LiteratureItem = ArticleData; int pageSize = 50; int pageNumber = (page ?? 1); return(View(listArtikel.ToPagedList(pageNumber, pageSize))); }
public ActionResult Testing(int parent = 0) { #region Category ViewBag.Download = WebConfigure.GetDomain() + "/Upload/Document/" + WebConfigure.GetUserGuideNameFileWithExtention(); ViewBag.Domain = WebConfigure.GetDomain(); ViewBag.ListCategoryChild = _articleCategoryBs.GetListCategoryMostUsedLiterature(parent); /*_articleCategoryBs.GetListMainCategory(parent);*/ #endregion return(View()); }
// GET: Admin/Default public ActionResult Index(String alert = "") { if (Common.CheckAdmin()) { return(RedirectToAction("Login")); } ViewBag.Result = alert; ViewBag.DownloadTelematics = WebConfigure.GetDomain() + "/Upload/telematics.xlsx"; ViewBag.DownloadWarranty = WebConfigure.GetDomain() + "/Upload/Document/WarrantyList_File.csv"; ViewBag.DownloadJCode = WebConfigure.GetDomain() + "/Upload/Document/Location_File.csv"; ViewBag.DownloadMEP = WebConfigure.GetDomain() + "/Upload/MEP.xlsx"; ViewBag.DownloadPIS = WebConfigure.GetDomain() + "/Upload/Document/PIS_File.csv"; ViewBag.DownloadComment = WebConfigure.GetDomain() + "/Upload/Document/Comment_File.csv"; ViewBag.DownloadUserGuide = WebConfigure.GetDomain() + "/Upload/Document/" + WebConfigure.GetUserGuideNameFileWithExtention(); ViewBag.DownloadDPPM = WebConfigure.GetDomain() + "/Upload/Document/DPPMSummary_FIle.csv"; ViewBag.DownloadDPPMAffectedUnit = WebConfigure.GetDomain() + "/Upload/Document/DPPMAffectedUnit_File.csv"; ViewBag.DownloadDPPMAffectedPart = WebConfigure.GetDomain() + "/Upload/Document/DPPMAffectedPart_File.csv"; ViewBag.DownloadSIMSErrorSummary = WebConfigure.GetDomain() + "/Upload/Document/SIMSErrorSummary_File.csv"; ViewBag.DownloadOrganization = WebConfigure.GetDomain() + "/Upload/Document/Organization_File.csv"; //return View(); return(RedirectToAction("Index", "User")); }
#pragma warning disable 1998 public async Task <ActionResult> Login(User model) #pragma warning restore 1998 { ViewBag.Download = WebConfigure.GetDomain() + "/Upload/Document/" + WebConfigure.GetUserGuideNameFileWithExtention(); ViewBag.Domain = WebConfigure.GetDomain(); try { if (ModelState.IsValid) { #region cek EmployeeID if (LoginValidate(model)) { #region session User var user = _userBService.GetDetailbyUsername(model.Username); if (user != null)// User registered at TREND system { if (user.Status.Equals(7)) { var userT = _userBService.GetDetailbyUsername(model.Username); Session["userid"] = userT.UserId; Session["role"] = userT.RoleId; Session["roleColor"] = _userRoleBService.GetDetail(userT.RoleId).Description; Session["username"] = userT.Username; Session["name"] = userT.Name; Session["status"] = userT.Status; Session["photo"] = userT.PhotoProfile; Session["loginPortal"] = WebConfigure.GetLoginPortal(); if (userT.IsDelegate != 0) { Delegation delegationData = _userBService.GetDetailDelegation(userT.IsDelegate); Session["DelegateStatus"] = delegationData.Status; Session["DelegateTo"] = _userBService.GetDetail(delegationData.ToUser).Name; Session["DelegateUntil"] = delegationData.EndDate; Session["DelegateStart"] = delegationData.StartDate; } else if (user.IsDelegate == 0) { Session["DelegateStatus"] = null; Session["DelegateUntil"] = null; Session["DelegateTo"] = null; Session["DelegateStart"] = null; } return(RedirectToAction("Summary", "TechnicalRequest")); #endregion } else//user Registered but Inactive { Session["userid"] = user.UserId; Session["role"] = user.RoleId; Session["roleColor"] = "Guest"; Session["username"] = user.Username; Session["name"] = user.Name; Session["status"] = user.Status; Session["photo"] = user.PhotoProfile; Session["loginPortal"] = WebConfigure.GetLoginPortal(); Session["DelegateStatus"] = null; Session["DelegateUntil"] = null; Session["DelegateTo"] = null; Session["DelegateStart"] = null; return(RedirectToAction("Index", "Library")); } } else if (user == null) {//As Guest //return RedirectToAction("Register", "Account"); var userguest = _userBService.GetDetailbyUsername("Guest"); Session["userid"] = userguest.UserId; Session["role"] = userguest.RoleId; Session["roleColor"] = "Guest"; Session["username"] = userguest.Username; Session["name"] = userguest.Name; Session["status"] = userguest.Status; Session["photo"] = userguest.PhotoProfile; Session["loginPortal"] = WebConfigure.GetLoginPortal(); Session["DelegateStatus"] = null; Session["DelegateUntil"] = null; Session["DelegateTo"] = null; Session["DelegateStart"] = null; return(RedirectToAction("Index", "Library")); } } #endregion } return(View(model)); } catch (Exception er) { _logErrorBService.WriteLog("Account", MethodBase.GetCurrentMethod().Name, er.ToString()); return(View("Login", "Default")); } }
public ActionResult Login() { string userPortal = Common.GetUserXupj().ToLower(); try { if (Session["userid"] != null) { ClearSessionData(); } ViewBag.Download = WebConfigure.GetDomain() + "/Upload/Document/" + WebConfigure.GetUserGuideNameFileWithExtention(); ViewBag.UrlApp = WebConfigure.GetDomain(); ViewBag.CheckLogin = WebConfigure.GetLoginPortal(); if (WebConfigure.GetLoginPortal() == "false") { ViewBag.ListUser = _userBService.GetList(); return(View()); } else { if (userPortal != "") { var user = _userBService.GetDetailbyUsername(userPortal); if (user != null)// User registered at TREND system { if (user.Status.Equals(7)) { Session["userid"] = user.UserId; Session["role"] = user.RoleId; Session["roleColor"] = _userRoleBService.GetDetail(user.RoleId).Description; Session["username"] = user.Username; Session["name"] = user.Name; Session["status"] = user.Status; Session["photo"] = user.PhotoProfile; Session["loginPortal"] = WebConfigure.GetLoginPortal(); if (user.IsDelegate != 0) { Delegation delegationData = _userBService.GetDetailDelegation(user.IsDelegate); Session["DelegateStatus"] = delegationData.Status; Session["DelegateTo"] = _userBService.GetDetail(delegationData.ToUser).Name; Session["DelegateUntil"] = delegationData.EndDate; Session["DelegateStart"] = delegationData.StartDate; } else if (user.IsDelegate == 0) { Session["DelegateStatus"] = null; Session["DelegateUntil"] = null; Session["DelegateTo"] = null; Session["DelegateStart"] = null; } _logReportBService.WriteLog("[SUCCESS] Account Login", MethodBase.GetCurrentMethod().Name, "User Portal :" + userPortal + " has Login"); return(RedirectToAction("Index", "Library")); } else { Session["userid"] = user.UserId; Session["role"] = user.RoleId; Session["roleColor"] = "Guest"; Session["username"] = user.Username; Session["name"] = user.Name; Session["status"] = user.Status; Session["photo"] = user.PhotoProfile; Session["loginPortal"] = WebConfigure.GetLoginPortal(); Session["DelegateStatus"] = 0; Session["DelegateUntil"] = null; Session["DelegateTo"] = null; Session["DelegateStart"] = null; _logReportBService.WriteLog("[SUCCESS] Account Login", MethodBase.GetCurrentMethod().Name, "User Portal :" + userPortal + " has Login"); return(RedirectToAction("Index", "Library")); } } else //As Guest { EmployeeMaster UserfromPortal = _mstEmployeeBService.GetDetailbyUserName(userPortal); if (UserfromPortal != null) { User model = new User(); model.CreatedAt = DateTime.Now; model.Status = 0; var mEmployee = userPortal.Equals("ict.development") ? _mstEmployeeBService.GetDetailbyUserName("XUPJ21IYN") : UserfromPortal; model.Name = mEmployee.Employee_Name; model.EmployeeId = mEmployee.Employee_Id; model.Username = userPortal.Equals("ict.development") ? "ict.development" : mEmployee.Employee_xupj; model.Position = mEmployee.Position_Name; model.Email = mEmployee.Email; model.AreaCode = mEmployee.Location_Id; model.AreaName = mEmployee.Location_Name; model.BranchCode = mEmployee.Branch_Id; model.Dob = DateTime.ParseExact(mEmployee.Birth_date, "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture); model.RoleId = 0; model = _userBService.Add(model); var userguest = _userBService.GetDetailbyUsername(userPortal); Session["userid"] = userguest.UserId; Session["role"] = userguest.RoleId; Session["roleColor"] = "Guest"; Session["username"] = userPortal; Session["name"] = userguest.Name; Session["status"] = userguest.Status; Session["photo"] = userguest.PhotoProfile; Session["loginPortal"] = WebConfigure.GetLoginPortal(); Session["DelegateStatus"] = 0; Session["DelegateUntil"] = null; Session["DelegateTo"] = null; Session["DelegateStart"] = null; _logReportBService.WriteLog("[SUCCESS] Account Login", MethodBase.GetCurrentMethod().Name, "User Portal :" + userPortal + " has Login"); return(RedirectToAction("Index", "Library")); } else { var userguest = _userBService.GetDetailbyUsername("Guest"); Session["userid"] = userguest.UserId; Session["role"] = userguest.RoleId; Session["roleColor"] = "Guest"; Session["username"] = userguest.Username; Session["name"] = userPortal; Session["status"] = userguest.Status; Session["photo"] = userguest.PhotoProfile; Session["loginPortal"] = WebConfigure.GetLoginPortal(); Session["DelegateStatus"] = 0; Session["DelegateUntil"] = null; Session["DelegateTo"] = null; Session["DelegateStart"] = null; return(Content("<script language='javascript' type='text/javascript'>alert('Your Portal Account Has Not Registered in Employee Master Database'); location.href = '" + WebConfigure.GetDomain() + "/Library';</script>")); // return RedirectToAction("Index", "Library"); } } } else { Uri uri = new Uri(ConfigurationManager.AppSettings["Domain"]); string requested = uri.Scheme + Uri.SchemeDelimiter + uri.Host + ":" + uri.Port; string protokol = Common.GetProtocol(); string portalUrl = WebConfigure.GetLoginHost() + "/_layouts/15/Trakindo/Authentication/Login.aspx?ReturnUrl=" + protokol + uri.Host + uri.AbsolutePath + "/Library"; ViewBag.portalDomain = portalUrl; return(View("RedirectToPortal")); } } } catch (Exception er) { _logErrorBService.WriteLog("[FAILED] Account Login", MethodBase.GetCurrentMethod().Name, er.ToString(), userPortal); return(RedirectToAction("Index", "Library")); //ClearSessionData(); //Uri uri = new Uri(ConfigurationManager.AppSettings["Domain"]); //string requested = uri.Scheme + Uri.SchemeDelimiter + uri.Host + ":" + uri.Port; //string protokol = Common.GetProtocol(); //string portalUrl = WebConfigure.GetLoginHost() + "/_layouts/15/Trakindo/Authentication/Login.aspx?ReturnUrl=" + protokol + uri.Host + uri.AbsolutePath + "/Library"; //ViewBag.portalDomain = portalUrl; //return View("RedirectToPortal"); } }
public void setViewBag() { ViewBag.Domain = WebConfigure.GetDomain(); ViewBag.UseFullLink = _articleBs.getUseFullLink().Count > 0 ? _articleBs.getUseFullLink() : null; ViewBag.Download = WebConfigure.GetDomain() + "/Upload/Document/" + WebConfigure.GetUserGuideNameFileWithExtention(); }