// GET: RolesMto public ActionResult Index() { RoleClient rc = new RoleClient(); var listRoles = rc.findAll(); return(View(listRoles)); }
public ActionResult DeleteConfirmed(int id) { RoleClient rc = new RoleClient(); var role = rc.Delete(id); return(RedirectToAction("Index")); }
public ActionResult AddNewEmployee() { EmployeeProfile profile = new EmployeeProfile(); if (this.IsAuthorized == "NoAuth") { Response.Redirect("~/Home/Unauthorized"); return(null); } else { using (var client = new OfficeLocationClient()) { var lstOfc = client.GetAllOfficeLocations(); DropDownItem di = new DropDownItem(); ViewBag.EmpOffice = lstOfc.Where(x => x.Key == Convert.ToString(OfficeId)).ToList(); di.Key = ""; di.Value = ""; lstOfc.Insert(0, di); ViewBag.OfficeLocationList = lstOfc; } using (var client = new RoleClient()) { ViewBag.RoleList = client.GetAllRoles(); } using (var client = new ShiftClient()) { ViewBag.ShiftList = client.GetShiftMaster(); } using (var client = new EmployeeClient()) { IList <DropDownItem> reptList = client.GetActiveEmpList(OfficeId, null); DropDownItem di = new DropDownItem { Key = "", Value = "" }; reptList.Insert(0, di); ViewBag.ReportToList = reptList; } profile.EmploymentTypeId = 1; using (var client = new EmployeeClient()) { var lstEmploymentTypes = client.GetEmploymentTypes(); DropDownItem di = new DropDownItem(); ViewBag.EmploymentTypeList = lstEmploymentTypes; } using (var client = new EmployeeClient()) { profile.EmployeeId = client.GetNewEmpId(OfficeId, profile.EmploymentTypeId); } profile.IsActive = true; profile.Mode = "Add"; profile.LogonId = "CORP\\"; profile.Sunday = true; profile.Saturday = true; return(View("EmployeeProfile", profile)); } }
public ActionResult Create() { RoleClient rc = new RoleClient(); var listRoles = rc.findAll(); ViewBag.RoleCode = new SelectList(listRoles, "RoleCode", "RoleDescription"); return(View()); }
public ActionResult Edit([Bind(Include = "id,RoleCode,RoleDescription")] Role role) { if (ModelState.IsValid) { db.Entry(role).State = EntityState.Modified; RoleClient rc = new RoleClient(); rc.Edit(role); return(RedirectToAction("Index")); } return(View(role)); }
public ActionResult Create([Bind(Include = "id,RoleCode,RoleDescription")] Role role) { if (ModelState.IsValid) { RoleClient rc = new RoleClient(); rc.Create(role); return(RedirectToAction("Index")); } return(View(role)); }
/// <summary> /// 物流菜单获取完毕 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void RoleClient_GetLMSysMenuByTypeCompleted(object sender, GetLMSysMenuByTypeCompletedEventArgs e) { if (!e.Cancelled) { if (e.Result != null) { LMMenu = e.Result.ToList(); } } //获取进销存的菜单 tablm.IsEnabled = true;//加载完菜单后启用LM标签 RoleClient.GetEDMSysMenuByTypeAsync("10"); }
/// <summary> /// FB 数据源 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void RoleClient_GetFBSysMenuByTypeCompleted(object sender, GetFBSysMenuByTypeCompletedEventArgs e) { if (!e.Cancelled) { if (e.Result != null) { FBMenu = e.Result.ToList(); } } //开始获取物流系统菜单 tabfb.IsEnabled = true;//加载完菜单后启用FB标签 RoleClient.GetLMSysMenuByTypeAsync("2"); }
/// <summary> /// oa 数据源 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void RoleClient_GetOASysMenuByTypeCompleted(object sender, GetOASysMenuByTypeCompletedEventArgs e) { if (!e.Cancelled) { if (e.Result != null) { OAMenu = e.Result.ToList(); DataGridBindingPcv(DaGrOA, OAMenu); //d.ItemsSource = pcv; } } //开始获取FB系统菜单 taboa.IsEnabled = true;//加载完菜单后启用OA标签 RoleClient.GetFBSysMenuByTypeAsync("3", Common.CurrentLoginUserInfo.EmployeeID); }
// GET: RolesMto/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } RoleClient rc = new RoleClient(); var role = rc.find(id); if (role == null) { return(HttpNotFound()); } return(View(role)); }
/// <summary> /// oa 数据源 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void RoleClient_GetEDMSysMenuByTypeCompleted(object sender, GetEDMSysMenuByTypeCompletedEventArgs e) { if (!e.Cancelled) { if (e.Result != null) { EDMMenu = e.Result.ToList(); DataGridBindingPcv(DaGrEDM, EDMMenu); //d.ItemsSource = pcv; } } //获取当前角色所有的实体菜单权限 tabedm.IsEnabled = true;//加载完菜单后启用EDM标签 //RoleClient.GetRoleEntityIDListInfosByRoleIDAsync(tmprole.ROLEID); RoleClient.GetPMSysMenuByTypeAsync("13"); }
/// <summary> /// Create a new instance of the GroupShare API v1 client using the specified connection. /// </summary> /// <param name="connection">The underlying <seealso cref="IConnection"/> used to make requests</param> public GroupShareClient(IConnection connection) { Ensure.ArgumentNotNull(connection, "connection"); Connection = connection; var apiConnection = new ApiConnection(connection); Project = new ProjectClient(apiConnection); User = new UserClient(apiConnection); Organization = new OrganizationClient(apiConnection); Authenticate = new AuthenticateClient(apiConnection); Role = new RoleClient(apiConnection); Permission = new PermissionClient(apiConnection); ModuleClient = new ModuleClient(apiConnection); License = new LicenseClient(apiConnection); TranslationMemories = new TranslationMemoriesClient(apiConnection); Terminology = new TerminologyClient(apiConnection); }
/// <summary> /// 获取权限项目列表并保存在tmpPermission权限列表中 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void RoleClient_GetSysPermissionAllCompleted(object sender, GetSysPermissionAllCompletedEventArgs e) { if (!e.Cancelled) { if (e.Error != null) { RefreshUI(RefreshedTypes.HideProgressBar); Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), e.Error.ToString()); return; } if (e.Result != null) { tmpPermission = e.Result.ToList(); } } //开始获取HR菜单 RoleClient.GetHRSysMenuByTypeAsync("0"); }
/// <summary> /// HR菜单数据源 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void RoleClient_GetHRSysMenuByTypeCompleted(object sender, GetHRSysMenuByTypeCompletedEventArgs e) { if (!e.Cancelled) { if (e.Error != null) { Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), e.Error.ToString()); return; } if (e.Result != null) { HrMenu = e.Result.ToList(); } } //开始获取OA系统菜单 tabhr.IsEnabled = true;//加载完菜单后启用HR标签 RoleClient.GetOASysMenuByTypeAsync("1"); }
void RoleClient_GetPMSysMenuByTypeCompleted(object sender, GetPMSysMenuByTypeCompletedEventArgs e) { if (!e.Cancelled) { if (e.Result != null) { PMMenu = e.Result.ToList(); DataGridBindingPcv(DaGrPM, PMMenu); RoleClient.GetRoleEntityIDListInfosByRoleIDNewAsync(tmprole.ROLEID); this.tabpm.IsEnabled = true; } else { RoleClient.GetRoleEntityIDListInfosByRoleIDNewAsync(tmprole.ROLEID); } } //loadbar.Stop(); }
public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } UserClient uc = new UserClient(); var user = uc.find(id); RoleClient rc = new RoleClient(); var listRoles = rc.findAll(); ViewBag.RoleCode = new SelectList(listRoles, "RoleCode", "RoleDescription", user.RoleCode); if (user == null) { return(HttpNotFound()); } return(View("Edit", user)); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { //RoleClient roleClient = new RoleClient(); //bool authenticated = roleClient.isEventFacilitator(NUSNetUser().UserID, EventID()); //roleClient.Close(); //int domain = int.Parse(Session["Domain"].ToString()); //if (domain >= 2) // authenticated = false; //if (!authenticated) // Response.Redirect("~/Error403.aspx"); lblSelectedFolder.Text = "-"; int domain = -1; try { domain = int.Parse(Session["Domain"].ToString()); } catch (Exception) { domain = -1; } if (domain != 1) Response.Redirect("~/Error404.aspx"); bool authenticated = false; if (EventID() == -1) Response.Redirect("~/Error404.aspx"); RoleClient roleClient = new RoleClient(); if (NUSNetUser() != null) { authenticated = roleClient.isEventFacilitator(NUSNetUser().UserID, EventID()); } roleClient.Close(); if (!authenticated) Response.Redirect("~/Error403.aspx"); } loadTreeView(); }
private void GetSysDictionaryInfos() { RoleClient.GetSysDictionaryByCategoryCompleted += new EventHandler <GetSysDictionaryByCategoryCompletedEventArgs>(RoleClient_GetSysDictionaryByCategoryCompleted); RoleClient.GetSysDictionaryByCategoryAsync("ASSIGNEDOBJECTTYPE"); }
/// <summary> /// 获取角色实体菜单完毕后保存在tmpEditRoleEntityLIst列表中 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void RoleClient_GetRoleEntityIDListInfosByRoleIDNewCompleted(object sender, GetRoleEntityIDListInfosByRoleIDNewCompletedEventArgs e) { if (e.Error != null) { Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), e.Error.ToString()); return; } if (!e.Cancelled) { if (e.Result != null) { tmpEditRoleEntityLIst = e.Result.ToList(); foreach (V_RoleEntity menu in tmpEditRoleEntityLIst) { tmpRoleEntityIDsList.Add(menu.ROLEENTITYMENUID); } RoleClient.GetPermissionByRoleIDSecondAsync(tmprole.ROLEID); //RoleClient.GetRolePermsAsync(tmpRoleEntityIDsList); } else { IsAdd = true; RefreshUI(RefreshedTypes.HideProgressBar); this.IsEnabled = true; DataGridColumnsAdd(DaGrOA, "myOACellTemplate"); DataGridColumnsAdd(DaGrOAHead, ""); DataGridColumnsAdd(DaGrHR, "HRCellTemplate"); DataGridColumnsAdd(DaGrHRHead, ""); DataGridColumnsAdd(DaGrFB, "myFBCellTemplate"); DataGridColumnsAdd(DaGrFBHead, ""); DataGridColumnsAdd(DaGrLM, "myLMCellTemplate"); DataGridColumnsAdd(DaGrLMHead, ""); DataGridColumnsAdd(DaGrEDM, "myEDMCellTemplate"); DataGridColumnsAdd(DaGrEDMHead, ""); DataGridColumnsAdd(DaGrPM, "myPMCellTemplate"); DataGridColumnsAdd(DaGrPMHead, ""); if (HrMenu != null) { this.DaGrHR.ItemsSource = HrMenu; } if (OAMenu != null) { SetDataGridHeaderCollasped(DaGrHR, HrMenu); } if (FBMenu != null) { this.DaGrFB.ItemsSource = FBMenu; } if (LMMenu != null) { this.DaGrLM.ItemsSource = LMMenu; //DaGrLM.HeadersVisibility = DataGridHeadersVisibility.None; } if (EDMMenu != null) { this.DaGrEDM.ItemsSource = EDMMenu; } if (PMMenu != null) { this.DaGrPM.ItemsSource = PMMenu; } //if (HrMenu != null) DataGridBindingPcv(DaGrHR,HrMenu);// this.DaGrHR.ItemsSource = HrMenu; //if (OAMenu != null) DataGridBindingPcv(DaGrOA, OAMenu); //this.DaGrOA.ItemsSource = OAMenu; //if (FBMenu != null) DataGridBindingPcv(DaGrFB, FBMenu); //this.DaGrFB.ItemsSource = FBMenu; //if (LMMenu != null) DataGridBindingPcv(DaGrLM, LMMenu); //this.DaGrLM.ItemsSource = LMMenu; } } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { lblSelectedFolder.Text = "-"; string eventOrganizerID = ""; int domain = -1; try { domain = int.Parse(Session["Domain"].ToString()); } catch (Exception) { domain = -1; } if (domain != 1) Response.Redirect("~/Error404.aspx"); if (EventID() == -1) Response.Redirect("~/Error404.aspx"); bool authenticated = false; EventClient evClient = new EventClient(); eventOrganizerID = evClient.GetEvent(EventID()).Organizerid; evClient.Close(); if (NUSNetUser() != null) { RoleClient roleClient = new RoleClient(); try { if (roleClient.haveRightsTo(EventID(), NUSNetUser().UserID, EnumFunctions.Manage_Artefacts)) { authenticated = true; } } catch (Exception ex) { authenticated = false; } finally { roleClient.Close(); } } if (!authenticated) Response.Redirect("~/Error403.aspx"); } loadTreeView(); }
protected void rptEvent_OnItemDataBound(object sender, RepeaterItemEventArgs e) { RoleClient client = new RoleClient(); // Execute the following logic for Items and Alternating Items. if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { Events ev = (Events)e.Item.DataItem; //List<EnumFunctions> fx = client.GetRights(ev.EventID, u.UserID).ToList<EnumFunctions>(); HyperLink hyperReq = (HyperLink)e.Item.FindControl("lnkRequest"); hyperReq.Attributes.Add("onclick", "window.open('RequestPage.aspx?EventID=" + ev.EventID + "', 'Request Page','left=250px, top=245px, width=1100px, height=650px, location=no, directories=no, scrollbars=yes, status=no, resizable=no');return false;"); //TODO: Turn on after enumfunctions for manage request is Up if (client.haveRightsTo(ev.EventID,NUSNetUser().UserID,EnumFunctions.Manage_Requests))//fx.Contains(EnumFunctions.Manage_Requests) || string.Compare(ev.Organizerid, u.UserID, true) == 0) { // If can manage requests, visible hyperReq.Visible = true; } else { //if cannot off it hyperReq.Visible = false; } HyperLink hyperArte = (HyperLink)e.Item.FindControl("lnkArtefact"); if (client.haveRightsTo(ev.EventID,NUSNetUser().UserID,EnumFunctions.Manage_Artefacts))//string.Compare(ev.Organizerid, NUSNetUser().UserID, true) == 0) { //if event organizer, go to the page that can edit folders //hyperArte.NavigateUrl = "ArtefactBin.aspx?EventID=" + ev.EventID; hyperArte.Attributes.Add("onclick", "window.open('ArtefactBin.aspx?EventID=" + ev.EventID + "', 'Artefact Bin','left=250px, top=245px, width=1100px, height=650px, location=no, directories=no, scrollbars=yes, status=no, resizable=no');return false;"); } else { //else go to the page that cannot edit folders //hyperArte.NavigateUrl = "ArtefactWorkspace.aspx?EventID=" + ev.EventID; hyperArte.Attributes.Add("onclick", "window.open('ArtefactWorkspace.aspx?EventID=" + ev.EventID + "', 'Artefact Workspace','left=250px, top=245px, width=1100px, height=650px, location=no, directories=no, scrollbars=yes, status=no, resizable=no');return false;"); } } client.Close(); }
private void GetPMDataInfos() { RoleClient.GetPMSysMenuByTypeCompleted += new EventHandler <GetPMSysMenuByTypeCompletedEventArgs>(RoleClient_GetPMSysMenuByTypeCompleted); RoleClient.GetPMSysMenuByTypeAsync("13"); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { bool authenticated=true; int domain = -1; try { domain = int.Parse(Session["Domain"].ToString()); } catch (Exception) { domain = -1; } if (domain != 1) authenticated = false; if (!authenticated) Response.Redirect("~/Error404.aspx"); //EventClient evClient = new EventClient(); //string eventOrganizerID = evClient.GetEvent(EventID()).Organizerid; //evClient.Close(); RoleClient roleClient = new RoleClient(); authenticated = false; if (NUSNetUser() != null) { if (roleClient.haveRightsTo(EventID(),NUSNetUser().UserID,EnumFunctions.Manage_Requests)) authenticated = true; } roleClient.Close(); if (!authenticated) Response.Redirect("~/Error403.aspx"); ddlStatus.Items.Clear(); ddlStatus.DataSource = Enum.GetNames(typeof(RequestStatus)); ddlStatus.DataBind(); ddlStatus.Items.Add("ALL"); ddlStatus.SelectedIndex = ddlStatus.Items.Count - 1; dpFrom.Enabled = false; dpTo.Enabled = false; getEventSummary(); RequestEvents(DateTime.Now.AddMonths(-1), DateTime.Now); } }
public ActionResult SaveProfile(EmployeeProfile employee) { bool isValid = true; if (ModelState.IsValid) { Regex regex = new Regex(@"^[\w!#$%&'*+\-/=?\^_`{|}~]+(\.[\w!#$%&'*+\-/=?\^_`{|}~]+)*" + "@" + @"((([\-\w]+\.)+[a-zA-Z]{2,4})|(([0-9]{1,3}\.){3}[0-9]{1,3}))$"); if (employee.EmailAddress != null) { if (employee.EmailAddress.Trim() != "") { Match match = regex.Match(employee.EmailAddress); if (!match.Success) { employee.ErrorMesage = "Invalid Email Address format."; isValid = false; } } } if ((!employee.IsActive) && (employee.RelievingDate == null)) { employee.ErrorMesage = "Enter Relieving Date."; isValid = false; } else if (employee.DOJ > employee.RelievingDate) { employee.ErrorMesage = "Relieving Date should be greater than Joining Date."; isValid = false; } else if (employee.DOJ > employee.ConfirmationDate) { employee.ErrorMesage = "Confirmation Date should be greater than Joining Date."; isValid = false; } if (employee.IsActive) { employee.RelievingDate = null; } if (isValid) { employee.LogonId = employee.LogonId.ToUpper(); employee.FirstName = System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(employee.FirstName.ToLower().Trim()); employee.LastName = System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(employee.LastName.ToLower().Trim()); employee.EmailAddress = employee.EmailAddress?.ToLower().Trim(); using (var client = new EmployeeClient()) { string result = client.UpdateEmployeeProfile(employee, UserId); if (result == "Saved") { employee.ErrorMesage = "Saved"; } else if (result == "NeedRole") { employee.ErrorMesage = "Only the user with role 'HR' is allowed to do this action."; } else if (result == "noChanges") { employee.ErrorMesage = "No changes made to Employee Profile."; } else if (result == "Duplicate") { employee.ErrorMesage = "The employee Id already exists."; } else if (result == "DupCorp") { employee.ErrorMesage = "The logon id was already assigned to another employee."; } else if (result == "DupCard") { employee.ErrorMesage = "The card number was already assigned to another employee."; } } } } else { employee.ErrorMesage = "Fix the error messages shown and try to Save again."; } using (var client = new OfficeLocationClient()) { var lstOfc = client.GetAllOfficeLocations(); ViewBag.EmpOffice = lstOfc.Where(x => x.Key == Convert.ToString(OfficeId)).ToList(); DropDownItem di = new DropDownItem { Key = "", Value = "" }; lstOfc.Insert(0, di); ViewBag.OfficeLocationList = lstOfc; } using (var client = new RoleClient()) { ViewBag.RoleList = client.GetAllRoles(); } using (var client = new ShiftClient()) { ViewBag.ShiftList = client.GetShiftMaster(); } using (var client = new EmployeeClient()) { var lstEmploymentTypes = client.GetEmploymentTypes(); DropDownItem di = new DropDownItem { Key = "", Value = "" }; lstEmploymentTypes.Insert(0, di); ViewBag.EmploymentTypeList = lstEmploymentTypes; } using (var client = new EmployeeClient()) { IList <DropDownItem> reptList = new List <DropDownItem>(); if (employee.Mode == "Add") { ViewBag.ReportToList = client.GetActiveEmpList(employee.OfficeId, null); } else { ViewBag.ReportToList = client.GetActiveEmpList(employee.OfficeId, employee.UserId); } DropDownItem di = new DropDownItem { Key = "", Value = "" }; reptList.Insert(0, di); } return(View("EmployeeProfile", employee)); }
public ActionResult ViewProfile() { ViewBag.PageTile = "Employee Profile"; ViewBag.TagLine = ""; ViewBag.IsSelfProfile = true; Int64 userIdForProfile = 0; EmployeeProfile profile = null; if (TempData["UserId"] == null) { userIdForProfile = UserId; } else { userIdForProfile = Convert.ToInt64(TempData["UserId"].ToString()); } using (var client = new EmployeeClient()) { profile = client.GetEmployeeProfile(userIdForProfile); } using (var client = new ShiftClient()) { ViewBag.ShiftList = client.GetShiftMaster(); } using (var client = new OfficeLocationClient()) { List <DropDownItem> lstOfc = client.GetAllOfficeLocations(); DropDownItem di = new DropDownItem(); ViewBag.EmpOffice = lstOfc.Where(x => x.Key == Convert.ToString(OfficeId)).ToList(); di.Key = ""; di.Value = ""; lstOfc.Insert(0, di); ViewBag.OfficeLocationList = lstOfc; } using (var client = new RoleClient()) { ViewBag.RoleList = client.GetAllRoles(); } using (var client = new EmployeeClient()) { var lstEmploymentTypes = client.GetEmploymentTypes(); DropDownItem di = new DropDownItem(); ViewBag.EmploymentTypeList = lstEmploymentTypes; } if (profile != null) { using (var client = new EmployeeClient()) { IList <DropDownItem> reptList = client.GetActiveEmpList(profile.OfficeId, userIdForProfile); DropDownItem di = new DropDownItem { Key = "", Value = "" }; reptList.Insert(0, di); ViewBag.ReportToList = reptList; } } if (TempData["Mode"] == null) { profile.Mode = "View"; } else { profile.Mode = TempData["Mode"].ToString(); } return(View("EmployeeProfile", profile)); }
public IamClient() { Role = new RoleClient(); IamToken = new IamTokenClient(); }