private void PopulateEthnicity() { EthnicityData db = new EthnicityData(); _list = db.GetList(); dgEthnicity.AutoGenerateColumns = false; dgEthnicity.DataSource = _list; }
public void PopulateEthnicity() { EthnicityData et = new EthnicityData(); cmbEthnicity.DataSource = null; cmbEthnicity.DataSource = et.GetList(); cmbEthnicity.ValueMember = "EthnicityId"; cmbEthnicity.DisplayMember = "EthnicityName"; cmbEthnicity.DataBindings.Clear(); cmbEthnicity.DataBindings.Add("SelectedValue", _student, "EthnicityId"); }
protected override void Seed(DurandalAuthDbContext context) { var userManager = new UserManager <UserProfile>(new UserStore <UserProfile>(context)); var roleManager = new RoleManager <IdentityRole>(new RoleStore <IdentityRole>(context)); if (!roleManager.RoleExists("Administrator")) { roleManager.Create(new IdentityRole("Administrator")); } if (!roleManager.RoleExists("User")) { roleManager.Create(new IdentityRole("User")); } if (userManager.FindByName("admin") == null) { var user = new UserProfile { UserName = "******", Email = "*****@*****.**", EmailConfirmed = true }; var result = userManager.Create(user, "admin1234"); if (result.Succeeded) { userManager.AddToRole(user.Id, "Administrator"); } } var uow = new DurandalAuthDbContext(); var hasChanges = false; SetCategoryData(uow); ProvinceData.SetProvinceData(uow, ref hasChanges); GenderData.SetGenderData(uow, ref hasChanges); EthnicityData.SetEthnicityData(uow, ref hasChanges); LanguageData.SetLanguageData(uow, ref hasChanges); EmploymentData.SetEmploymentStatus(uow, ref hasChanges); PsiraGradeData.SetPsiraGradeData(uow, ref hasChanges); SecurityTrainingData.SetSecurityTrainingData(uow, ref hasChanges); DecisionData.SetYesNoLookupData(uow, ref hasChanges); PsiraCategoryData.SetPsiraCategoryLookup(uow, ref hasChanges); //CityData.SetCityNameData(uow, ref hasChanges); AddressData.SetAddressData(uow, ref hasChanges); MaritalStatusData.SetMaritalStatusData(uow, ref hasChanges); EntityTypeData.SetEntityData(uow, ref hasChanges); TitleData.SetTitleData(uow, ref hasChanges); if (hasChanges) { uow.SaveChanges(); } }
private void EthnicityEdit_FormClosing(object sender, FormClosingEventArgs e) { if (_changes.Count > 0) { EthnicityData ed = new EthnicityData(); ed.Update(_changes); if (Application.OpenForms["StudentAddEdit"] as StudentAddEdit != null) { StudentAddEdit frm1 = (StudentAddEdit)Application.OpenForms["StudentAddEdit"]; frm1.PopulateEthnicityComboBox(); } } }
private void btnAdd_Click(object sender, EventArgs e) { ep.Clear(); if (txtEthnicity.Text != string.Empty) { EthnicityData ed = new EthnicityData(); int ethnicityId = ed.Add(new Ethnicity { EthnicityName = txtEthnicity.Text }); this.DialogResult = DialogResult.OK; } else { ep.SetError(txtEthnicity, "Type ethnicity"); } }