示例#1
0
        protected void btnInsert_Click(object sender, EventArgs e)
        {
            try
            {
                Roles role = new Roles();

                bll.Add(role);
                Response.Write("<script type='text/javascript'>alert('Details Inserted Successfully');</script>");
                Response.Redirect("RolesSearch.aspx");
            }
            catch (RolesException ex)
            {
                Response.Write("<script type='text/javascript'>alert('" + ex.Message + "');</script>");
            }
            catch (SystemException ex)
            {
                Response.Write("<script type='text/javascript'>alert('" + ex.Message + "');</script>");
            }
        }
示例#2
0
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Roles r = new Roles();
                r.RoleName = txtRoleName.Text;
                bll.Add(r);
                lsSearch.ItemsSource       = bll.GetAll();
                lsSearch.DisplayMemberPath = "RoleId";

                dgRecords.ItemsSource = bll.GetAll();
                txtRoleId.Text        = bll.GetRoleId().ToString();
                ClearWindow();
                MessageBox.Show("Role Added Sucessfully");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }