protected void update_Click(object sender, EventArgs e) { Int32 myid = 0; Int32.TryParse(id.Text.ToString(), out myid); Int32 roleid = 0; bool cek = RepositoryUser.cekID(myid); if (cek) { Int32.TryParse(RepositoryUser.FindID(myid).RoleID.ToString(), out roleid); if (RepositoryUser.FindID(myid).Email != Session["Email"].ToString()) { if (roleid == 2) { RepositoryUser.ChangeToAdmin(myid); } else if (roleid == 1) { RepositoryUser.ChangeToMember(myid); } } else { Response.Write("<script>alert('Can not change current login admin role.')</script>"); } refresh(); } else { Response.Write("<script>alert('ID does not exists.')</script>"); } }