/// <summary> /// Builds a list of Institutions /// </summary> private void BuildInstitutions() { DataView institutions = BOL.Institution.GetAllAsDataView <BOL.Institution>(); InstitutionGrid.DataSource = institutions; InstitutionGrid.DataBind(); }
protected void AddInstitution(object sender, CommandEventArgs e) { string instName = InstitutionName.Text; if (!string.IsNullOrEmpty(instName)) { InstitutionDa da = new InstitutionDa(); DataTable dt = da.GetInstitutions(); bool isDuplicate = false; if (dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { if (row[Institution.Institution_Field].ToString() == instName) { isDuplicate = true; } } } if (!isDuplicate) { Institution biz = new Institution(); biz[Institution.Institution_Field] = instName; biz.Save(); } } SetEditInstitutionsMode(); InstitutionGrid.DataBind(); }
protected void DeleteInstitution(object sender, CommandEventArgs e) { int key = int.Parse(e.CommandArgument.ToString()); Institution biz = new Institution(); biz.Delete(key); InstitutionGrid.DataBind(); }
private void SetAddInstitutionMode() { AddPanel.Visible = true; AddInstitutionsBtn.Enabled = false; AddInstitutionsBtn.ImageUrl = "~/Images/DataEntryButtons/Button_New_Off.gif"; SaveInstitutionsBtn.Enabled = false; SaveInstitutionsBtn.ImageUrl = "~/Images/DataEntryButtons/Button_Save_Off.gif"; EditInstitutionsBtn.Enabled = false; EditInstitutionsBtn.ImageUrl = "~/Images/DataEntryButtons/Button_Edit_Off.gif"; CancelInstitutionsBtn.Enabled = false; CancelInstitutionsBtn.ImageUrl = "~/Images/DataEntryButtons/Button_Cancel_Off.gif"; InstitutionName.Text = ""; InstitutionGrid.DataBind(); }