private void createProfileForUser(string email) { Applicant newUser = ApplicationBLL.GetByEmail(email); if (newUser == null) { Response.Redirect(RecruitmentConfiguration.ErrorPage(RecruitmentConfiguration.ErrorType.AUTH)); return; } //Create a blank profile for the logged in user Profile blankProfile = new Profile(); blankProfile.AssociatedApplicant = newUser; blankProfile.FirstName = string.Empty; blankProfile.LastName = string.Empty; blankProfile.Address1 = string.Empty; blankProfile.City = string.Empty; blankProfile.State = string.Empty; blankProfile.LastUpdated = null; using (var ts = new TransactionScope()) { ProfileBLL.EnsurePersistent(blankProfile); ts.CommitTransaction(); } }
public IActionResult DeleteProfile(int IDNumber) { ProfileBLL profileBLL = new ProfileBLL(); profileBLL.DeleteProfile(IDNumber); return(View("ViewAllRegisteredProfiles")); }
public override void LoadData() { base.LoadData(); //Add some applications Profile profile = ProfileBLL.GetByID(StaticProperties.ExistingProfileID); Application application = new Application(); application.AppliedPosition = PositionBLL.GetByID(StaticProperties.ExistingPositionID); application.AssociatedProfile = profile; application.Email = StaticProperties.ExistingApplicantEmail; application.LastUpdated = DateTime.Now; profile.Applications = new List <Application> { application }; using (var ts = new TransactionScope()) { ApplicationBLL.EnsurePersistent(application); ProfileBLL.EnsurePersistent(profile); ts.CommitTransaction(); } }
/// <summary> /// Salvar os itens selecionados no listview em um profile /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSalvar_Click(object sender, EventArgs e) { try { if (listViewProgramas.Items.Count > 0) { Profile profile = new Profile(); List <Aplicacao> listAplicacoes = new List <Aplicacao>(); foreach (ListViewItem item in listViewProgramas.Items) { if (item.Checked) { Aplicacao aplicacao = new Aplicacao(); aplicacao.DisplayName = item.Text; aplicacao.DisplayVersion = item.SubItems[3].Text; aplicacao.InstallSource = item.SubItems[4].Text; aplicacao.Publisher = item.SubItems[1].Text; listAplicacoes.Add(aplicacao); } } profile.Nome = cmbProfile.Text; profile.DataCriacao = DateTime.Now; ProfileBLL.Criar(profile); MessageBox.Show("Perfil salvo com sucesso!", "Perfil salvo", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public IActionResult UpdateProfile(string PhoneNumber, string Name, int IDNumber) { //BillingSystemContext context = new BillingSystemContext(); ProfileBLL bll = new ProfileBLL(); bll.UpdateProfile(PhoneNumber, Name, IDNumber); return(RedirectToAction("ProfileDetails", new { ID = IDNumber })); }
private void FrmProfile_Load(object sender, EventArgs e) { try { //Traducciones SessionHelper.RegisterForTranslation(this, Codes.MNU_GE004); SessionHelper.RegisterForTranslation(cmdAccept, Codes.BTN_ACCEPT); SessionHelper.RegisterForTranslation(cmdClose, Codes.BTN_CLOSE); SessionHelper.RegisterForTranslation(lblPermission, Codes.LBL_PERMISSIONS); SessionHelper.RegisterForTranslation(lblDescription, Codes.LBL_DESCRIPTION); SessionHelper.RegisterForTranslation(lblProfile, Codes.LBL_PROFILE); // Se recuperan los permisos (root) y se llena la lista ProfileBLL profileBll = new ProfileBLL(); ResultBM result = profileBll.GetSystemPermissions(); if (result.IsValid()) { chkListProfile.DataSource = result.GetValue <List <PermissionMDL> >(); chkListProfile.DisplayMember = "description"; } else { MessageBox.Show(result.description, "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } //En caso de ser nuevo, se requiere contar con un permiso "nodo" que facilita su muestra por pantalla y al momento de guardarlo. //Si se trata de una actualización, se debe recuperar el listado con los permisos y sus exclusiones. if (!this.isUpdate) { //Si se quiere dar de alta un nuevo permiso, se genera un root para mantener ordenado los permisos que se agreguen this.Entity = new PermissionsMDL(null, GenCode(5), "descripcion", false); } else { txtDescription.Text = this.entity.Description; this.Entity = GetPermissionHierarchy(this.Entity); PopulateTree(treeProfile, this.Entity); treeProfile.ExpandAll(); //No es performante, pero funciona. //Recorre todos los permisos que se listan en la lista de profile y en caso de que el usuario tenga dicho privilegio, los checkea chkListProfile.ItemCheck -= chkListProfile_ItemCheck; for (int i = 0; i < chkListProfile.Items.Count; ++i) { if (this.entity.HasPermission(((PermissionMDL)chkListProfile.Items[i]).code)) { chkListProfile.SetItemCheckState(i, CheckState.Checked); } } chkListProfile.ItemCheck += chkListProfile_ItemCheck; } } catch (Exception exception) { MessageBox.Show("Se ha producido el siguiente error: " + exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
/// <summary> /// Devuelve la jerarquía de permisos para el elemento seleccionado /// </summary> /// <param name="sender"></param> /// <returns></returns> private ProfileBM GetPermissionHierarchy(ProfileBM selection) { ProfileBLL profileBll = new ProfileBLL(); ResultBM result = profileBll.GetProfile(selection.code); if (!result.IsValid()) { MessageBox.Show(result.description, "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } return(result.GetValue() as ProfileBM); }
public void ChangePassword(ProfileBLL profile, string password) { Profile whom = _unitOfWork.Profiles.GetOneByPredicate(p => p.Id == profile.Id); if (whom.Password == password) { whom.Password = password; _unitOfWork.Profiles.Update(whom); _unitOfWork.Commit(); } ; }
public IActionResult UpdateProfile(int IDNumber) { ProfileBLL profileBLL = new ProfileBLL(); Profile profile = profileBLL.GetProfile(IDNumber); if (profile == null) { NotFound(); } return(View(profile)); }
//protected void GetUsersPerformance() //{ // int UsersId = Convert.ToInt32(userId); // try // { // DataTable dt = null; // ProfileBLL profileBLL = new ProfileBLL(); // dt = profileBLL.GetUsersPerformance(UsersId); // if (dt.Rows.Count == 1) // { // int costingNew =Convert.ToInt32( dt.Rows[0]["CostingStyleNumber"]); // int costingRevised = Convert.ToInt32(dt.Rows[0]["CostingSampleStage"]); // int Revised = costingRevised - costingNew; // costingStyleNumberLabel.Text = "Inputed Total Costing New : " + dt.Rows[0]["CostingStyleNumber"].ToString(); // costingSampleStageLabel.Text = "Inputed Total Costing Revised : " + Revised.ToString(); // bulkStyleNumberLabel.Text = "Inputed Total Issued OB : " + dt.Rows[0]["BulkStyleNumber"].ToString(); // bulkSampleStageLabel.Text = "Inputed Total Bulk Revised : " + dt.Rows[0]["BulkSampleStage"].ToString(); // } // } // catch (Exception) // { // } //} protected string GetCostingStyleInfoByUser() { string table = ""; int UsersId = Convert.ToInt32(userId); try { ProfileBLL profileBLL = new ProfileBLL(); table = profileBLL.GetCostingStyleInfoByUser(UsersId).ToString(); } catch (Exception ex) { } return(table); }
public IActionResult AddProfile( string PhoneNumber, string Name) { ProfileBLL profile = new ProfileBLL(); if (Name != null) { profile.Add( PhoneNumber, Name); return(RedirectToAction("ViewAllRegisteredProfiles")); } return(View("AddProfile")); }
public IActionResult ProfileDetails() { ProfileBLL profileBLL = new ProfileBLL(); //string userName = this.User.Claims.FirstOrDefault(c => c.Type == "Name").Value; string userName = HttpContext.User.FindFirst(ClaimTypes.Name).Value; BillingSystemContext context = new BillingSystemContext(); Users currUser = context.Users.FirstOrDefault(u => u.UserName == userName); Profile prof = profileBLL.GetProfile(currUser.ProfileID); if (prof == null) { NotFound(); } return(View(prof)); }
protected void GetUserProfileName() { int UsersId = Convert.ToInt32(userId); try { DataTable dt = null; ProfileBLL profileBLL = new ProfileBLL(); dt = profileBLL.GetUserProfileName(UsersId); if (dt.Rows.Count == 1) { fullNameLabel.Text = dt.Rows[0]["FullName"].ToString(); } } catch (Exception) { } }
private void cmdAccept_Click(object sender, EventArgs e) { try { ResultBM result; ProfileBLL profileBll = new ProfileBLL(); if (isUpdate) { result = profileBll.UpdateProfile(this.Entity); if (result.IsValid()) { Close(); } else { MessageBox.Show(result.description, "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { result = profileBll.CreateProfile(this.Entity); if (result.IsValid()) { Close(); } else { MessageBox.Show(result.description, "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } catch (Exception exception) { MessageBox.Show("Se ha producido el siguiente error: " + exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void button1_Click(object sender, EventArgs e) { ProfileBLL objBll = new ProfileBLL(); dataGridView1.DataSource = objBll.GetProfile(); }
private void signin_Click(object sender, EventArgs e) { user = Username.Text; pass = Password.Text; if (user == "Username" && pass == "Password") { MetroFramework.MetroMessageBox.Show(this, "Please Enter Login Credentials", "Message", MessageBoxButtons.OK, MessageBoxIcon.Warning); this.Close(); th = new Thread(foodForm); th.SetApartmentState(ApartmentState.STA); th.Start(); } //MetroFramework.MetroMessageBox.Show(this, "Information", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information); else if (user == "" && pass == "") {//MetroFramework.MetroMessageBox.Show(this, "Empty Fields Detected ! Please fill up all the fields", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information); //MessageBox.Show("Empty Fields Detected ! Please fill up all the fields"); this.Close(); th = new Thread(mainpage); th.SetApartmentState(ApartmentState.STA); th.Start(); } else if (user == "garment" && pass == "") { this.Close(); th = new Thread(garment_mainpage); th.SetApartmentState(ApartmentState.STA); th.Start(); } else if (user == "haar" && pass == "") { this.Close(); th = new Thread(facedet_reg); th.SetApartmentState(ApartmentState.STA); th.Start(); } else if (user == "haar2" && pass == "") { this.Close(); th = new Thread(haar22); th.SetApartmentState(ApartmentState.STA); th.Start(); } else if (user == "open" && pass == "") { this.Close(); th = new Thread(open); th.SetApartmentState(ApartmentState.STA); th.Start(); } else { ProfileBLL objbll = new ProfileBLL(); int count = (int)objbll.GetProfile(user, pass); Console.WriteLine("COUNT IS---------->" + count.ToString()); if (count == 0) { MetroFramework.MetroMessageBox.Show(this, "Error", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error); //MessageBox.Show("Error "); } Console.WriteLine(count); if (count > 0) { this.Close(); th = new Thread(mainpage); th.SetApartmentState(ApartmentState.STA); th.Start(); Console.WriteLine("Correct Login Cresentials"); } } }
private void FrmUser_Load(object sender, EventArgs e) { try { //Traducciones SessionHelper.RegisterForTranslation(this, Codes.MNU_GE003); SessionHelper.RegisterForTranslation(cmdAccept, Codes.BTN_ACCEPT); SessionHelper.RegisterForTranslation(cmdClose, Codes.BTN_CLOSE); SessionHelper.RegisterForTranslation(lblName, Codes.LBL_NAME); SessionHelper.RegisterForTranslation(lblPassword, Codes.LBL_PASSWORD); SessionHelper.RegisterForTranslation(lblPasswordConfirm, Codes.LBL_PASSWORD_CHECK); SessionHelper.RegisterForTranslation(lblLanguage, Codes.LBL_LANGUAGE); SessionHelper.RegisterForTranslation(lblProfile, Codes.LBL_PROFILE); SessionHelper.RegisterForTranslation(chkIsActive, Codes.LBL_ACTIVE); //Idioma LanguageBLL languageBll = new LanguageBLL(); ResultBM language = languageBll.GetLanguages(); //Permisos ProfileBLL profileBll = new ProfileBLL(); ResultBM profile = profileBll.GetProfiles(); if (language.IsValid()) { cmbLanguage.DataSource = language.GetValue <List <LanguageBM> >(); cmbLanguage.DisplayMember = "Name"; } else { MessageBox.Show(language.description, "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } if (profile.IsValid()) { cmbProfile.DataSource = profile.GetValue <List <PermissionMDL> >(); cmbProfile.DisplayMember = "Description"; } else { MessageBox.Show(profile.description, "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } //Si se está actualizando, entonces se completan los campos if (isUpdate) { txtName.Text = this.Entity.Name; chkIsActive.Checked = this.Entity.Active; //Desprolijo - mejorar (BAJA PRIORIDAD) bool found = false; for (int i = 0; i < language.GetValue <List <LanguageBM> >().Count&& !found; ++i) { found = language.GetValue <List <LanguageBM> >()[i].Id == entity.LanguageId; if (found) { cmbLanguage.SelectedIndex = i; } } found = false; for (int i = 0; i < profile.GetValue <List <PermissionMDL> >().Count&& !found; ++i) { found = profile.GetValue <List <PermissionMDL> >()[i].Code == entity.PermissionId; if (found) { cmbProfile.SelectedIndex = i; } } } } catch (Exception exception) { MessageBox.Show("Se ha producido el siguiente error: " + exception.Message, "EXCEPCIÓN", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void signin_Click(object sender, EventArgs e) { user = Username.Text; pass = Password.Text; if (user == "" && pass == "") { //MessageBox.Show("Empty Fields Detected ! Please fill up all the fields"); this.Close(); th = new Thread(mainpage); th.SetApartmentState(ApartmentState.STA); th.Start(); } else if (user == "garment" && pass == "") { this.Close(); th = new Thread(garment_mainpage); th.SetApartmentState(ApartmentState.STA); th.Start(); } else if (user == "haar" && pass == "") { this.Close(); th = new Thread(facedet_reg); th.SetApartmentState(ApartmentState.STA); th.Start(); } else if (user == "haar2" && pass == "") { this.Close(); th = new Thread(haar22); th.SetApartmentState(ApartmentState.STA); th.Start(); } else if (user == "open" && pass == "") { this.Close(); th = new Thread(open); th.SetApartmentState(ApartmentState.STA); th.Start(); } else { ProfileBLL objbll = new ProfileBLL(); int count = (int)objbll.GetProfile(user, pass); if (count == -1) { MessageBox.Show("Error "); } Console.WriteLine(count); if (count > 0) { this.Close(); th = new Thread(mainpage); th.SetApartmentState(ApartmentState.STA); th.Start(); Console.WriteLine("Correct Login Cresentials"); } } }
public IActionResult Index() { ProfileBLL profileBll = new ProfileBLL(); return(View(profileBll.GetUserProfiles())); }