public bool register(string username, string password, string realname, string telephone, int deptno, List <int> roleid, string createby) { List <string> list = new List <string>(); list.Add(@"insert into sysuser(username,password,realname,telephone,deptno,createtime,createby,status) values ('" + username + "','" + password + "','" + realname + "','" + telephone + "'," + deptno + ",getdate(),'" + createby + "',1)"); foreach (int id in roleid) { list.Add(@"insert into user_role (username,roleid) values('" + username + "'," + id + ")"); } return(sqlconn.ExecuteSqlTran_SQL(list) > 0 ? true : false); }
public int UpdateRoleMenu(int roleid, List <int> listMenuid) { List <string> listsql = new List <string> { "delete from role_menu where roleid =" + roleid + "" }; foreach (int menuid in listMenuid) { listsql.Add("insert into role_menu values(" + roleid + "," + menuid + ")"); } return(sqlconn.ExecuteSqlTran_SQL(listsql)); }