/// <summary>Begin page running after session validations</summary> private void Go() { if (this.Request.QueryString["id"] != null) { this.employeeId = Convert.ToInt32(this.Request.QueryString["id"].ToString()); } if (this.Request.QueryString["New"] != null) { this.returnScript = "document.location = 'EmployeesList.aspx';"; } else { this.returnScript = "document.location = referrer;"; } this.formFooter = new FormFooter(); this.formFooterLearning = new FormFooter(); this.formFooterInternalLearning = new FormFooter(); this.user = (ApplicationUser)Session["User"]; this.company = (Company)Session["company"]; this.Dictionary = Session["Dictionary"] as Dictionary <string, string>; string label = this.employeeId == -1 ? "Item_Employee_Button_New" : "Item_Employee_Title_EmployeeData"; this.master = this.Master as Giso; this.master.AdminPage = true; string serverPath = this.Request.Url.AbsoluteUri.Replace(this.Request.RawUrl.Substring(1), string.Empty); this.master.AddBreadCrumb("Item_Employees", "EmployeesList.aspx", false); this.master.AddBreadCrumb("Item_Employee_Title_EmployeeData"); this.master.TitleInvariant = true; this.master.Titulo = this.Dictionary["Item_Employee_Title_EmployeeData"]; if (employeeId > 0) { bool grantDelete = UserGrant.HasWriteGrant(this.user.Grants, ApplicationGrant.Employee); bool grantJobPositionView = UserGrant.HasReadGrant(this.user.Grants, ApplicationGrant.JobPosition); bool grantDepartmentsView = UserGrant.HasReadGrant(this.user.Grants, ApplicationGrant.Department); this.Employee = new Employee(this.employeeId, true); if (this.Employee.CompanyId != this.company.Id) { this.Response.Redirect("NoAccesible.aspx", false); Context.ApplicationInstance.CompleteRequest(); this.Employee = Employee.Empty; } if (this.Employee.DisabledDate.HasValue) { this.Active = false; } label = string.Format(CultureInfo.InvariantCulture, "{0}: <strong>{1}</strong>", this.Dictionary["Item_Employee"], Employee.FullName); this.master.Titulo = label; this.departmentsEmployeeJson = new StringBuilder("[").Append(Environment.NewLine); this.departmentsEmployeeJson.Append(Environment.NewLine).Append("\t]"); this.jobPositionAcademic = new StringBuilder(); this.jobPositionSpecific = new StringBuilder(); this.jobPositionWorkExperience = new StringBuilder(); this.jobPositionHability = new StringBuilder(); var tableJobAsignements = new StringBuilder(); this.jobpositionEmployeeJson = new StringBuilder("["); bool firstJobPosition = true; this.Employee.ObtainJobPositionsHistoric(); var JobPositionAdded = new List <long>(); foreach (var jobAsignement in this.Employee.JobPositionAssignment) { if (!JobPositionAdded.Contains(jobAsignement.JobPosition.Id) || true) { JobPositionAdded.Add(jobAsignement.JobPosition.Id); var actualJobPosition = new JobPosition(jobAsignement.JobPosition.Id, this.company.Id); if (firstJobPosition) { firstJobPosition = false; } else { this.jobpositionEmployeeJson.Append(","); } this.jobpositionEmployeeJson.Append(jobAsignement.Json); if (!string.IsNullOrEmpty(actualJobPosition.AcademicSkills)) { if (this.jobPositionAcademic.ToString().IndexOf(actualJobPosition.AcademicSkills) == -1) { this.jobPositionAcademic.Append(actualJobPosition.AcademicSkills); this.jobPositionAcademic.Append(Environment.NewLine); } } if (!string.IsNullOrEmpty(actualJobPosition.SpecificSkills)) { if (this.jobPositionSpecific.ToString().IndexOf(actualJobPosition.SpecificSkills) == -1) { this.jobPositionSpecific.Append(actualJobPosition.SpecificSkills); this.jobPositionSpecific.Append(Environment.NewLine); } } if (!string.IsNullOrEmpty(actualJobPosition.WorkExperience)) { if (this.jobPositionWorkExperience.ToString().IndexOf(actualJobPosition.WorkExperience) == -1) { this.jobPositionWorkExperience.Append(actualJobPosition.WorkExperience); this.jobPositionWorkExperience.Append(Environment.NewLine); } } if (!string.IsNullOrEmpty(actualJobPosition.Habilities)) { if (this.jobPositionHability.ToString().IndexOf(actualJobPosition.Habilities) == -1) { this.jobPositionHability.Append(actualJobPosition.Habilities); this.jobPositionHability.Append(Environment.NewLine); } } tableJobAsignements.Append(jobAsignement.TableRow(this.Dictionary, grantDelete, grantJobPositionView, grantDepartmentsView)); } } this.jobpositionEmployeeJson.Append("]"); this.TableExperiencia.Text = tableJobAsignements.ToString(); this.companyUserNames = new StringBuilder(); bool firstUserName = true; foreach (var userName in ApplicationUser.CompanyUserNames(this.company.Id)) { if (firstUserName) { firstUserName = false; } else { this.companyUserNames.Append(","); } this.companyUserNames.Append(string.Format(@"{{""UserName"":""{0}"",""EmployeeId"":{1}}}", userName.Key, userName.Value)); } var tableAssistance = new StringBuilder(); this.Employee.ObtainLearningAssistance(); foreach (LearningAssistance assistance in this.Employee.LearningAssistance) { tableAssistance.Append(assistance.TableRowProfile(this.Dictionary)); } this.TableLearningAssistance.Text = tableAssistance.ToString(); this.LtTrazas.Text = ActivityTrace.RenderTraceTableForItem(this.employeeId, TargetType.Employee); this.Employee.ObtainEmployeeSkills(); this.formFooter.ModifiedBy = this.Employee.ModifiedBy.Description; this.formFooter.ModifiedOn = this.Employee.ModifiedOn; if (this.Employee.EmployeeSkills != null && this.Employee.EmployeeSkills.ModifiedBy != null) { this.formFooterLearning.ModifiedBy = this.Employee.EmployeeSkills.ModifiedBy.Description; this.formFooterLearning.ModifiedOn = this.Employee.EmployeeSkills.ModifiedOn; } if (this.Employee.User == null) { this.Employee.User = ApplicationUser.GetByEmployee(this.Employee.Id, this.Employee.CompanyId); this.employeeUserId = this.Employee.User.Id; this.userName = this.Employee.User.UserName; } this.RenderDocuments(); } else { this.Employee = Employee.Empty; this.departmentsEmployeeJson = new StringBuilder(Constant.EmptyJsonList); this.jobpositionEmployeeJson = new StringBuilder(Constant.EmptyJsonList); this.employeeUserId = -1; this.userName = string.Empty; this.companyUserNames = new StringBuilder(); this.Employee.Address = EmployeeAddress.Empty; } this.RenderCountries(); if (this.Active) { if (employeeId > 0) { this.formFooter.AddButton(new UIButton { Id = "BtnAnular", Icon = "icon-ban-circle", Text = this.Dictionary["Item_Employee_Btn_Inactive"], Action = "danger" }); } this.formFooter.AddButton(new UIButton { Id = "BtnSave", Icon = "icon-ok", Text = this.Dictionary["Common_Accept"], Action = "success" }); } else { this.formFooter.AddButton(new UIButton { Id = "BtnRestore", Icon = "icon-undo", Text = this.Dictionary["Item_Employee_Button_Restore"], Action = "primary" }); //this.formFooter.AddButton(new UIButton { Id = "BtnRestore", Icon = "icon-ok", Text = this.Dictionary["Item_Employee_Button_Restore"], Action = "success" }); } this.formFooter.AddButton(new UIButton { Id = "BtnCancel", Icon = "icon-undo", Text = this.Dictionary["Common_Cancel"] }); if (this.Active) { this.formFooterInternalLearning.ModifiedBy = this.formFooter.ModifiedBy; this.formFooterInternalLearning.ModifiedOn = this.formFooter.ModifiedOn; this.formFooterLearning.AddButton(new UIButton { Id = "BtnSaveFormacion", Icon = "icon-ok", Text = this.Dictionary["Common_Accept"], Action = "success" }); this.formFooterLearning.AddButton(new UIButton { Id = "BtnCancelFormacion", Icon = "icon-undo", Text = this.Dictionary["Common_Cancel"] }); this.formFooterInternalLearning.AddButton(new UIButton { Id = "BtnSaveInternalLearning", Icon = "icon-ok", Text = this.Dictionary["Common_Accept"], Action = "success" }); this.formFooterInternalLearning.AddButton(new UIButton { Id = "BtnCancelInternalLearning", Icon = "icon-undo", Text = this.Dictionary["Common_Cancel"] }); } this.SelectedTab = "home"; if (this.Request.QueryString["Tab"] != null) { SelectedTab = this.Request.QueryString["Tab"].ToString().Trim().ToLowerInvariant(); } this.tabBar.AddTab(new Tab { Id = "home", Selected = SelectedTab == "home", Active = true, Label = this.Dictionary["Item_Employee_Tab_Principal"], Available = true }); this.tabBar.AddTab(new Tab { Id = "formacion", Available = true, Active = this.employeeId > 0, Hidden = this.employeeId < 1, Label = this.Dictionary["Item_Employee_Tab_Learning"] }); this.tabBar.AddTab(new Tab { Id = "formacionInterna", Selected = SelectedTab == "formacioninterna", Available = true, Active = this.employeeId > 0, Hidden = this.employeeId < 1, Label = this.Dictionary["Item_Employee_Tab_InternalLearning"] }); this.tabBar.AddTab(new Tab { Id = "uploadFiles", Selected = SelectedTab == "uploadfiles", Available = true, Active = this.employeeId > 0, Hidden = this.employeeId < 1, Label = this.Dictionary["Item_Employee_Tab_UploadFiles"] }); //// this.tabBar.AddTab(new Tab { Id = "trazas", Available = this.user.HasTraceGrant() && this.employeeId > 0, Active = this.employeeId > 0, Label = this.dictionary["Item_Employee_Tab_Traces"] }); }
/// <summary>Begin page running after session validations</summary> private void Go() { this.Dictionary = Session["Dictionary"] as Dictionary <string, string>; this.company = this.Session["Company"] as Company; this.master = this.Master as Giso; this.master.AdminPage = true; string serverPath = this.Request.Url.AbsoluteUri.Replace(this.Request.RawUrl.Substring(1), string.Empty); this.master.AddBreadCrumb("Item_Equipments"); this.master.Titulo = "Item_Equipments"; if (this.user.HasGrantToWrite(ApplicationGrant.Equipment)) { this.master.ButtonNewItem = UIButton.NewItemButton("Item_Equipment_Button_New", "EquipmentView.aspx"); } this.DataHeader = new UIDataHeader { Id = "ListDataHeader", ActionsItem = 2 }; this.DataHeader.AddItem(new UIDataHeaderItem { Id = "th0", HeaderId = "ListDataHeader", DataId = "ListDataTable", Text = this.Dictionary["Item_Equipment_Header_Code"], Sortable = true, Filterable = true, HiddenMobile = true }); this.DataHeader.AddItem(new UIDataHeaderItem { Id = "th1", HeaderId = "ListDataHeader", DataId = "ListDataTable", Text = this.Dictionary["Item_Equipment_Header_Description"], Sortable = true, Filterable = true }); this.DataHeader.AddItem(new UIDataHeaderItem { Id = "th2", HeaderId = "ListDataHeader", DataId = "ListDataTable", Text = this.Dictionary["Item_Equipment_Header_Location"], Sortable = true, HiddenMobile = true }); this.DataHeader.AddItem(new UIDataHeaderItem { Id = "th3", HeaderId = "ListDataHeader", DataId = "ListDataTable", Text = this.Dictionary["Item_Equipment_Header_Responsible"], Sortable = true, HiddenMobile = true }); bool grantWrite = UserGrant.HasWriteGrant(this.user.Grants, ApplicationGrant.Equipment); bool grantDelete = UserGrant.HasDeleteGrant(this.user.Grants, ApplicationGrant.Equipment); bool grantEmployee = UserGrant.HasReadGrant(this.user.Grants, ApplicationGrant.Employee); bool first = true; var equipments = Equipment.ByCompany(this.company); var searchList = new List <string>(); foreach (var equipment in equipments) { if (!searchList.Contains(equipment.Code)) { searchList.Add(equipment.Code); } if (!searchList.Contains(equipment.Description)) { searchList.Contains(equipment.Description); } } searchList.Sort(); var sea = new StringBuilder(); foreach (string item in searchList) { if (first) { first = false; } else { sea.Append(","); } if (item.IndexOf("\"") != -1) { sea.Append(string.Format(@"'{0}'", item)); } else { sea.Append(string.Format(@"""{0}""", item)); } } this.master.SearcheableItems = sea.ToString(); this.RenderCosts(); }