/// <summary> /// 得到组织和模块信息 /// </summary> /// <returns></returns> public static DataSet GetUnitAndModel() { DBOperate db = new DBOperate("CFDBPOOL"); DataSet ds = null; string sql = @"SELECT UnitID,ZJM,UnitName FROM MN_Units; select ModelID,ModelName from MN_Model; select MN_ModelEx.ModelID,ModelExID,ModelExName from MN_ModelEx inner join MN_Model on MN_ModelEx.ModelID=MN_Model.ModelID; select MN_Business.ModelExID,ScreenID,ScreenName from MN_Business inner join MN_ModelEx on MN_ModelEx.ModelExID = MN_Business.ModelExID;"; try { ds = db.RunSql(sql); ds.Tables[1].TableName = "Model"; //模块信息 ds.Tables[2].TableName = "ModelEx"; //子模块信息 ds.Tables[3].TableName = "Business"; //窗体信息 } catch (Exception ex) { throw new Exception(ex.ToString()); } finally { db.Despose(); } return(ds); }
/// <summary> /// 根据条件得到用户列表 /// </summary> /// <param name="condation">条件字符串</param> /// <returns></returns> public static DataSet GetUserListByCondation(string condation) { DBOperate db = new DBOperate("CFDBPOOL"); string sql = @"select UserID,UserCode,UserName,Sex,OfficeTel,Email,case when Status='1' then '正常' when Status='0' then '停用' else null end Status,Birthday,DepartMent,UnitName from MN_User inner join MN_Units on MN_User.DepartMent = MN_Units.UnitID where 0=0 " ; if (condation != null || condation != "") { sql += condation; } DataSet ds = null; try { ds = db.RunSql(sql); } catch (Exception ex) { throw new Exception(ex.ToString()); } finally { db.Despose(); } return(ds); }
//根据条件得到用户列表 public static DataSet GetUserListByReq(string unitID, string userCode, string userName) { DBOperate db = new DBOperate("CFDBPOOL"); string sql = @"select UserID,UserCode,UserName,Sex,OfficeTel,Email,case when Status='1' then '正常' when Status='0' then '停用' else null end Status,Birthday,DepartMent,UnitName from MN_User inner join MN_Units on MN_User.DepartMent = MN_Units.UnitID" ; if (unitID != "") { sql += string.Format(" and DepartMent='{0}'", unitID); } else if (userCode != "") { sql += string.Format(" and UserCode='{0}'", userCode); } else if (userName != "") { sql += string.Format(" and UserName='******'", userName); } DataSet ds = null; try { ds = db.RunSql(sql); } catch (Exception ex) { throw new Exception(ex.ToString()); } finally { db.Despose(); } return(ds); }
/// <summary> /// 修改用户信息 /// </summary> /// <param name="UserCode">用户编号</param> /// <param name="UserPwd">用户密码</param> /// <param name="UserName">用户姓名</param> /// <param name="Sex">性别</param> /// <param name="LinkTel">联系电话</param> /// <param name="Email">邮箱</param> /// <param name="State">状态</param> /// <param name="Describe">描述</param> /// <param name="LoginIP">登录IP地址</param> /// <param name="UserID">ID</param> /// <returns></returns> //public static string UpdateUserByID(string UserCode, string UserPwd, string UserName, string Sex, string LinkTel, string Email, string Describe,string SSQ, string UserID) //{ // string result = "0"; // DBOperate db = new DBOperate("DADB"); // try // { // string strSql = "update UserInfo set UserCode=:UserCode,UserName=:UserName,Sex=:Sex,LinkTel=:LinkTel,Email=:Email,Describe=:Describe,SSQ=:SSQ where UserID=:UserID"; // OracleParameter[] sps = new OracleParameter[] {new OracleParameter("UserCode",UserCode), // new OracleParameter("UserName",UserName), // new OracleParameter("Sex",Sex), // new OracleParameter("LinkTel",LinkTel), // new OracleParameter("Email",Email), // new OracleParameter("Describe",Describe), // new OracleParameter("SSQ",SSQ), // new OracleParameter("UserID",UserID)}; // db.RunSqlNonQuery(strSql, sps); // result = "1"; // } // catch (Exception ex) // { // throw new Exception(ex.ToString()); // } // finally // { // db.Despose(); // } // return result; //} public static string UpdateUserByID(UserInfo ui) { string result = "0"; DBOperate db = new DBOperate("DADB"); try { string strSql = "update UserInfo set UserCode=@UserCode,UserName=@UserName,Sex=@Sex,LinkTel=@LinkTel,Email=@Email,Describe=@Describe,SSQ=@SSQ where UserID=@UserID"; SqlParameter[] sps = new SqlParameter[] { new SqlParameter("@UserCode", ui.UserCode), new SqlParameter("@UserName", ui.UserName), new SqlParameter("@Sex", ui.Sex), new SqlParameter("@LinkTel", ui.LinkTel), new SqlParameter("@Email", ui.Email), new SqlParameter("@Describe", ui.Describe), new SqlParameter("@SSQ", ui.Ssq), new SqlParameter("@UserID", ui.UserId) }; db.RunSqlNonQuery(strSql, sps); result = "1"; } catch (Exception ex) { throw new Exception(ex.ToString()); } finally { db.Despose(); } return(result); }
public static DataSet GetDutyFun(string dutyid) { DataSet dsAllUser = new DataSet(); DataTable dt = new DataTable(); DBOperate db = new DBOperate("DADB"); try { SqlParameter[] sps = new SqlParameter[] { new SqlParameter("@dutyid", dutyid) }; string strSql = "select MENUID,Code,Name,Layer,IsDetail,InvokingConfig from DSPFUNC where MENUID in (select FunID as ID from DutyFun where DutyID =@dutyid)order by Code"; dsAllUser = db.RunSql(strSql, sps); strSql = "select MENUID,Code,Name,Layer,IsDetail,InvokingConfig from DSPFUNC where MENUID not in (select FunID as ID from DutyFun where DutyID =@dutyid and layer='3')order by Code"; dt = db.RunSql(strSql, sps).Tables[0].Copy(); dt.TableName = "dtDuty"; dsAllUser.Tables.Add(dt); } catch (Exception ex) { throw new Exception(ex.ToString()); } finally { db.Despose(); } return(dsAllUser); }
/// <summary> /// 插入职责信息 /// </summary> /// <param name="duty">职责对象</param> /// <returns></returns> public static string InsertDuty(Duty duty) { string result = "0"; DBOperate db = new DBOperate("DADB"); try { string DutyId = Guid.NewGuid().ToString(); string strSql = "insert into Duty(DutyId,DutyCode,DutyName,Describe) values(@DutyId,@DutyCode,@DutyName,@Describe)"; db.RunSqlNonQuery(strSql, new SqlParameter[] { new SqlParameter("@DutyId", DutyId), new SqlParameter("@DutyCode", duty.DutyCode), new SqlParameter("@DutyName", duty.DutyName), new SqlParameter("@Describe", duty.Describe) }); result = "1"; } catch (Exception ex) { throw new Exception(ex.ToString()); } finally { db.Despose(); } return(result); }
public static bool AddFun(DataSet ds) { bool result = true; DBOperate db = new DBOperate("DADB"); //DataSet ds; //DBOperate db = new DBOperate(@"Data Source=.;Initial Catalog=DZFrame;User ID=sa;Password=sa"); try { //DataBaseEx db = new DataBaseEx(DataBaseEx.DBTypes.SQLServer, @"Data Source=2011-20110902HE\SQLSERVER2005;Initial Catalog=AHMS;User ID=sa;Password=111111"); DataRow dr = ds.Tables[0].Rows[0]; string sql = string.Format(@"delete DSPFUNC where ID='{0}'; insert into DSPFUNC(ID,Code,Name,Layer,IsDetail,InvokingConfig) values('{0}','{1}','{2}','{3}','{4}','{5}');", dr["ID"], dr["Code"], dr["Name"], dr["Layer"], dr["IsDetail"], dr["InvokingConfig"]); db.RunSqlNonQuery(sql); } catch { result = false; } finally { db.Despose(); } return(result); }
public static bool DeleteFun(string id) { bool result = true; //DataSet ds; //DBOperate db = new DBOperate(@"Data Source=.;Initial Catalog=DZFrame;User ID=sa;Password=sa");; DBOperate db = null; try { //DataBaseEx db = new DataBaseEx(DataBaseEx.DBTypes.SQLServer, @"Data Source=2011-20110902HE\SQLSERVER2005;Initial Catalog=AHMS;User ID=sa;Password=111111"); db = new DBOperate("DADB"); SqlParameter[] sps = new SqlParameter[] { new SqlParameter("@id", id) }; string sql = "delete DSPFUNC where ID=@id;"; db.RunSqlNonQuery(sql, sps); } catch { result = false; } finally { if (db != null) { db.Despose(); } } return(result); }
public static bool SetFun(string dutyid, string[] funids) { bool result = true; DBOperate db = new DBOperate("DADB"); try { List <SqlParameter> splist = new List <SqlParameter>(); splist.Add(new SqlParameter("@dutyid", dutyid)); StringBuilder strSql = new StringBuilder("begin Delete DutyFun where DutyID =@dutyid;"); string dfid = Guid.NewGuid().ToString(); for (int i = 0; i < funids.Length; i++) { dfid = Guid.NewGuid().ToString(); strSql.Append("insert into DutyFun(DF_ID,DutyID,FunID) values(@DF_ID" + i.ToString() + ",@dutyid,@funid" + i.ToString() + ");"); splist.Add(new SqlParameter("@DF_ID" + i.ToString(), dfid)); splist.Add(new SqlParameter("@funid" + i.ToString(), funids[i])); } strSql.Append(" end;"); SqlParameter[] sps = splist.ToArray(); db.RunSqlNonQuery(strSql.ToString(), sps); } catch (Exception ex) { result = false; throw new Exception(ex.ToString()); } finally { db.Despose(); } return(result); }
/// <summary> /// 给用户授权 /// </summary> /// <param name="ds"></param> /// <returns></returns> public static string SetUserBusiness(DataSet ds) { string result = "1"; DBOperate db = new DBOperate("CFDBPOOL"); StringBuilder sql = new StringBuilder(); sql.Append(string.Format("DELETE MN_UserBusiness WHERE UserID='{0}';", ds.Tables[0].Rows[0]["UserID"])); foreach (DataRow dr in ds.Tables[0].Rows) { sql.Append(string.Format("INSERT INTO MN_UserBusiness(UserID,ScreenID) VALUES('{0}','{1}');", dr["UserID"], dr["ScreenID"])); } try { db.RunSqlNonQuery(sql.ToString()); } catch (Exception ex) { result = "0"; throw new Exception(ex.ToString()); } finally { db.Despose(); } return(result); }
/// <summary> /// 插入用户信息 /// </summary> /// <param name="UserCode">用户编号</param> /// <param name="UserPwd">用户密码</param> /// <param name="UserName">用户姓名</param> /// <param name="Sex">性别</param> /// <param name="LinkTel">联系电话</param> /// <param name="Email">邮箱</param> /// <param name="State">状态</param> /// <param name="Describe">描述</param> /// <returns></returns> //public static string InsertUser(string UserID,string UserCode, string UserPwd, string UserName, string Sex, string LinkTel, string Email, string State, string Describe,string SSQ) //{ // string result = "0"; // DBOperate db = new DBOperate("DADB"); // try // { // string strSql = "insert into UserInfo(UserID,UserCode,UserPwd,UserName,Sex,LinkTel,Email,\"State\",Describe,SSQ)values(:UserID,:UserCode,:UserPwd,:UserName,:Sex,:LinkTel,:Email,:State,:Describe,:SSQ)"; // OracleParameter[] sps = new OracleParameter[] {new OracleParameter("UserID",UserID), // new OracleParameter("UserCode",UserCode), // new OracleParameter("UserPwd",UserPwd), // new OracleParameter("UserName",UserName), // new OracleParameter("Sex",Sex), // new OracleParameter("LinkTel",LinkTel), // new OracleParameter("Email",Email), // new OracleParameter("State",State), // new OracleParameter("Describe",Describe), // new OracleParameter("SSQ",SSQ)}; // db.RunSqlNonQuery(strSql, sps); // result = "1"; // } // catch (Exception ex) // { // throw new Exception(ex.ToString()); // } // finally // { // db.Despose(); // } // return result; //} public static string InsertUser(UserInfo ui) { string result = "0"; DBOperate db = new DBOperate("DADB"); try { string strSql = "insert into UserInfo(UserID,UserCode,UserPwd,UserName,Sex,LinkTel,Email,\"State\",Describe,SSQ)values(@UserID,@UserCode,@UserPwd,@UserName,@Sex,@LinkTel,@Email,@State,@Describe,@SSQ)"; SqlParameter[] sps = new SqlParameter[] { new SqlParameter("@UserID", ui.UserId), new SqlParameter("@UserCode", ui.UserCode), new SqlParameter("@UserPwd", ui.UserPwd), new SqlParameter("@UserName", ui.UserName), new SqlParameter("@Sex", ui.Sex), new SqlParameter("@LinkTel", ui.LinkTel), new SqlParameter("@Email", ui.Email), new SqlParameter("@State", ui.State), new SqlParameter("@Describe", ui.Describe), new SqlParameter("@SSQ", ui.Ssq) }; db.RunSqlNonQuery(strSql, sps); result = "1"; } catch (Exception ex) { throw new Exception(ex.ToString()); } finally { db.Despose(); } return(result); }
/// <summary> /// 根据用户编号得到用户职责信息 /// </summary> /// <param name="UserID">用户编号</param> /// <returns></returns> public static DataSet GetUserDutyByID(string UserID) { DataSet ds = new DataSet(); DataTable dt = new DataTable(); DBOperate db = new DBOperate("DADB"); try { string strSql = "select UserDutyID,Duty.DutyID,DutyCode,DutyName from Duty inner join UserDuty on Duty.DutyID=UserDuty.DutyID where UserID='" + UserID + "'"; ds = db.RunSql(strSql).Copy(); strSql = "select DutyID,DutyCode,DutyName from Duty where DutyID not in (select DutyID from UserDuty where UserID='" + UserID + "')"; dt = db.RunSql(strSql).Tables[0].Copy(); dt.TableName = "dtDuty"; ds.Tables.Add(dt); } catch (Exception ex) { throw new Exception(ex.ToString()); } finally { db.Despose(); } return(ds); }
/// <summary> /// 取得用户的功能列表 /// </summary> /// <param name="userID"></param> /// <returns></returns> public static DataSet GetUserBusiness(string userID) { DBOperate db = new DBOperate("CFDBPOOL"); string sql = string.Format(@"select UserID,ScreenID from MN_UserBusiness where UserID='{0}';", userID); DataSet ds = null; try { ds = db.RunSql(sql); } catch (Exception ex) { throw new Exception(ex.ToString()); } finally { db.Despose(); } return(ds); }
/// <summary> /// 得到所有的职责 /// </summary> /// <returns></returns> public static DataSet GetAllDuty() { DataSet ds = new DataSet(); DBOperate db = new DBOperate("DADB"); try { string strSql = "select * from Duty"; ds = db.RunSql(strSql); } catch (Exception ex) { throw new Exception(ex.ToString()); } finally { db.Despose(); } return(ds); }
/// <summary> /// 根据编号删除指定职责 /// </summary> /// <param name="DutyID">编号</param> /// <returns></returns> public static string DeleteDutyByID(string DutyID) { string result = "0"; DBOperate db = new DBOperate("DADB"); try { string strSql = "delete from Duty where DutyID=@DutyID"; db.RunSqlNonQuery(strSql, new SqlParameter[] { new SqlParameter("@DutyID", DutyID) }); result = "1"; } catch (Exception ex) { throw new Exception(ex.ToString()); } finally { db.Despose(); } return(result); }
public static DataSet getFunData() { DataSet ds; DBOperate db = new DBOperate("DADB"); try { ds = db.RunSql("select * from DSPFUNC;"); ds.Tables[0].TableName = "UserFuc"; } catch (Exception ex) { throw new Exception(ex.ToString()); } finally { db.Despose(); } return(ds); }
/// <summary> /// 获取所有可用网点 /// </summary> /// <returns></returns> public static DataSet GetJG_Branches() { DataSet ds = null; DBOperate db = new DBOperate("DADB"); string sql = " select BR_BranchCode,BR_BranchName from JG_Branches where BR_State='1' "; try { ds = db.RunSql(sql); } catch (Exception ex) { throw ex; } finally { db.Despose(); } return(ds); }
//根据用户编号删除用户 public static string DelUser(string userID) { DBOperate db = new DBOperate("CFDBPOOL"); string sql = string.Format(@"delete from MN_User where UserID='{0}';", userID); string resule = "1"; try { db.RunSqlNonQuery(sql); } catch (Exception ex) { resule = "0"; throw new Exception(ex.ToString()); } finally { db.Despose(); } return(resule); }
//根据条件添加授权 public static string AddBusiness(string userID, string screenID) { string result = "1"; DBOperate db = new DBOperate("CFDBPOOL"); string sql = string.Format(@"insert into MN_UserBusiness(UserID,ScreenID) values('{0}','{2}');", userID, screenID); try { db.RunSqlNonQuery(sql); } catch (Exception ex) { result = "0"; throw new Exception(ex.ToString()); } finally { db.Despose(); } return(result); }
/// <summary> /// 添加法院信息 /// </summary> /// <param name="unitID">法院编号</param> /// <param name="zjm">助记码</param> /// <param name="unitName">法院名称</param> /// <returns></returns> public static string AddCurt(string unitID, string zjm, string unitName) { string result = "1"; DBOperate db = new DBOperate("CFDBPOOL"); string sql = string.Format(@"insert into MN_Units(UnitID,UnitType,ZJM,UnitName) values('{0}','1','{1}','{2}');", unitID, zjm, unitName); try { db.RunSqlNonQuery(sql); } catch (Exception ex) { result = "0"; throw new Exception(ex.ToString()); } finally { db.Despose(); } return(result); }
/// <summary> /// 分配职责 /// </summary> /// <param name="lsUserDuty">用户职责</param> /// <returns></returns> public static string LicendToUser(UserDuty[] userdutys) { string result = "0"; DBOperate db = new DBOperate("DADB"); db.BeginTransaction(); try { StringBuilder sb = new StringBuilder(); int count = userdutys.Length; string UserDutyId = Guid.NewGuid().ToString(); if (count > 1) { sb.Append("begin "); for (int i = 0; i < count; i++) { UserDutyId = Guid.NewGuid().ToString(); sb.Append(string.Format("insert into UserDuty(USERDUTYID,UserID,DutyID) values('{0}','{1}','{2}');", UserDutyId, userdutys[i].UserID, userdutys[i].DutyID)); } sb.Append(" end;"); } else { sb.Append(string.Format("insert into UserDuty(USERDUTYID,UserID,DutyID) values('{0}','{1}','{2}')", UserDutyId, userdutys[0].UserID, userdutys[0].DutyID)); } db.RunSqlNonQuery(sb.ToString()); db.Commit(); result = "1"; } catch (Exception ex) { db.Rollback(); throw new Exception(ex.ToString()); } finally { db.Despose(); } return(result); }
/// <summary> /// 根据组织编号和组织类别的到相应用户信息 /// </summary> /// <returns></returns> public static DataSet GetData() { DBOperate db = new DBOperate("CFDBPOOL"); DataSet ds = null; try { string sql = @"SELECT UnitID,ZJM,UnitName FROM MN_Units where unittype='1'; select UserID,UserCode,UserName,Sex,OfficeTel,Email,case when Status='1' then '正常' when Status='0' then '停用' else null end Status,Birthday,DepartMent from MN_User inner join MN_Units on MN_User.DepartMent = MN_Units.UnitID where MN_Units.unittype='1'; select UserID,UserCode,UserName,Sex,OfficeTel,Email,case when Status='1' then '正常' when Status='0' then '停用' else null end Status,Birthday,DepartMent from MN_User inner join MN_Units on MN_User.DepartMent = MN_Units.UnitID where MN_Units.unittype='2'; select UserID,UserCode,UserName,Sex,OfficeTel,Email,case when Status='1' then '正常' when Status='0' then '停用' else null end Status,Birthday,DepartMent from MN_User inner join MN_Units on MN_User.DepartMent = MN_Units.UnitID where MN_Units.unittype='3'; select UserID,UserCode,UserName,Sex,OfficeTel,Email,case when Status='1' then '正常' when Status='0' then '停用' else null end Status,Birthday,DepartMent from MN_User inner join MN_Units on MN_User.DepartMent = MN_Units.UnitID where MN_Units.unittype='4'; select UserID,UserCode,UserName,Sex,OfficeTel,Email,case when Status='1' then '正常' when Status='0' then '停用' else null end Status,Birthday,DepartMent,UnitName from MN_User inner join MN_Units on MN_User.DepartMent = MN_Units.UnitID;" ; ds = db.RunSql(sql); ds.Tables[0].TableName = "Court"; //法院列表 ds.Tables[1].TableName = "CourtUser"; //法院用户 ds.Tables[2].TableName = "ArchieveUser"; //档案馆用户 ds.Tables[3].TableName = "CodeUser"; //法规科用户 ds.Tables[4].TableName = "InfoUser"; //信息中心用户 ds.Tables[5].TableName = "AllUser"; //系统所有用户 } catch (Exception ex) { throw new Exception(ex.ToString()); } finally { db.Despose(); } return(ds); }
/// <summary> /// 根据编号移除用户职责 /// </summary> /// <param name="UserDutyIDs">编号</param> /// <returns></returns> public static string RemoveDuty(string[] UserDutyIDs) { string result = "0"; DBOperate db = new DBOperate("DADB"); db.BeginTransaction(); int count = UserDutyIDs.Length; try { StringBuilder sb = new StringBuilder(); if (count > 0) { sb.Append("begin "); for (int i = 0; i < count; i++) { sb.Append(string.Format("delete from UserDuty where UserDutyID='{0}';", UserDutyIDs[i])); } sb.Append(" end;"); } else { sb.Append(string.Format("delete from UserDuty where UserDutyID='{0}'", UserDutyIDs[0])); } db.RunSqlNonQuery(sb.ToString()); result = "1"; db.Commit(); } catch (Exception ex) { db.Rollback(); throw new Exception(ex.ToString()); } finally { db.Despose(); } return(result); }
/// <summary> /// 根据单位编号删除单位信息 /// </summary> /// <param name="unitID">单位编号</param> /// <returns></returns> public static string DelUnit(string unitID) { string result = "1"; DBOperate db = new DBOperate("CFDBPOOL"); string sql = string.Format(@"delete from MN_Units where UnitID='{0}';", unitID); //DataSet ds = null; try { db.RunSqlNonQuery(sql); } catch (Exception ex) { result = "0"; throw new Exception(ex.ToString()); } finally { db.Despose(); } return(result); }
/// <summary> /// 根据用户编号删除用户信息 /// </summary> /// <param name="UserID">用户编号</param> /// <returns></returns> public static string DeleteUserByID(string UserID) { string result = "0"; DBOperate db = new DBOperate("DADB"); try { string strSql = "delete from UserInfo where UserID=@UserID"; SqlParameter[] sps = new SqlParameter[] { new SqlParameter("@UserID", UserID) }; db.RunSqlNonQuery(strSql, sps); result = "1"; } catch (Exception ex) { throw new Exception(ex.ToString()); } finally { db.Despose(); } return(result); }
/// <summary> /// 根据用户编号修改用户状态 /// </summary> /// <param name="UserID">用户编号</param> /// <param name="State">状态</param> /// <returns></returns> public static string UpdataStateByID(string UserID, string State) { string result = "0"; DBOperate db = new DBOperate("DADB"); try { string strSql = "Update UserInfo set \"State\"=@State where UserID=@UserID"; SqlParameter[] sps = new SqlParameter[] { new SqlParameter("@State", State), new SqlParameter("@UserID", UserID) }; db.RunSqlNonQuery(strSql, sps); result = "1"; } catch (Exception ex) { throw new Exception(ex.ToString()); } finally { db.Despose(); } return(result); }
/// <summary> /// 获取各业务的流水号 /// </summary> /// <returns></returns> public static DataSet GetNumbers() { DataSet ds = null; string sql = string.Format(@";SELECT ISNULL (MAX(SerialNo),'000000000000') SerialNo From ArchiveIndex where SerialNo like '{0}%'; SELECT ISNULL (MAX(ListNumber),'000000000000') ListNumber From ArchiveIndex where substring(ListNumber,len(ListNumber)-11,8)='{0}'; SELECT ISNULL (MAX(BusiCode),'000000000000') ListNumber From UseBusiness where BusiCode like '{0}%';", DateTime.Now.ToString("yyyyMMdd")); DBOperate dbop = new DBOperate("DADB"); try { ds = dbop.RunSql(sql); } catch (Exception e) { throw e; } finally { dbop.Despose(); } return(ds); }
//根据用户编号修改用户信息 public static string UpdateUser(string userID, string userCode, string userName, string psw, string userType, string status, string sex, string birthday, string officeTel, string departMent, string email) { DBOperate db = new DBOperate("CFDBPOOL"); string sql = string.Format(@"update MN_User set UserCode='{0}', UserName='******',Psw='{2}', UserType='{3}',status='{4}',sex='{5}',birthday='{6}', officeTel='{7}',departMent='{8}',email='{9}' where UserID='{10}';", userCode, userName, psw, userType, status, sex, birthday, officeTel, departMent, email, userID); string resule = "1"; try { db.RunSqlNonQuery(sql); } catch (Exception ex) { resule = "0"; throw new Exception(ex.ToString()); } finally { db.Despose(); } return(resule); }
/// <summary> /// 得到所有现存用户信息 /// </summary> /// <returns></returns> public static DataSet GetAllUser() { DataSet dsAllUser = new DataSet(); DBOperate db = new DBOperate("DADB"); try { string strSql = @"select UserID,UserCode,UserPWD,UserName,UNITID,SEX,LINKTEL,EMAIL,State,DESCRIBE,LOGINIP, case when State='1' then '正常' when State='0' then '停用' end as UserState,SSQ,jb.BR_BranchName as SSQNAME from UserInfo u inner join dbo.JG_Branches jb on u.ssq=jb.BR_BranchCode"; dsAllUser = db.RunSql(strSql); } catch (Exception ex) { throw new Exception(ex.ToString()); } finally { db.Despose(); } return(dsAllUser); }
//添加用户信息 public static string AddUser(string userID, string userCode, string userName, string psw, string userType, string status, string sex, string birthday, string officeTel, string departMent, string email) { //DBOperate db = new DBOperate("CFDBPOOL"); DBOperate db = new DBOperate("CFDBPOOL"); string sql = string.Format(@"insert into MN_User(UserID,UserCode,UserName,Psw,UserType,Status,Sex,Birthday,OfficeTel,DepartMent,Email) values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}')", userID, userCode, userName, psw, userType, status, sex, birthday, officeTel, departMent, email); string resule = "1"; try { db.RunSqlNonQuery(sql); } catch (Exception ex) { resule = "0"; throw new Exception(ex.ToString()); } finally { db.Despose(); } return(resule); }