protected void btn_add_Click(object sender, EventArgs e) { ETO.Admin admin = ReceiveHtml(); try { AdminBSO adminBSO = new AdminBSO(); if (adminBSO.CheckExist(admin.AdminName)) { error.Text = String.Format(Resources.StringAdmin.CheckExist, admin.AdminName); } else if (adminBSO.CheckExistEmail(admin.AdminEmail)) { error.Text = "<font color = 'red'>Địa chỉ Email đã được đăng ký. Vui lòng đăng ký lại</font>"; } else { if (CheckedList().Equals("")) { error.Text = "Loi : Xin hay lua chon it nhat 1 quyen"; } else { adminBSO.CreateAdmin(admin); RolesBSO rolesBSO = new RolesBSO(); IRoles roles = rolesBSO.GetRolesByName("Guest"); AdminRolesBSO adminRolesBSO = new AdminRolesBSO(); AdminRoles adminRoles = new AdminRoles(); adminRoles.AdminUserName = admin.AdminName; adminRoles.RolesID = roles.RolesID; adminRoles.UserName = Session["Admin_UserName"].ToString(); adminRoles.Permission = ""; adminRoles.Created = DateTime.Now; adminRolesBSO.CreateAdminRoles(adminRoles); error.Text = String.Format(Resources.StringAdmin.AddNewsSuccessful); } } } catch (Exception ex) { error.Text = ex.Message.ToString(); } }