using System; using System.Collections.Generic; using System.Text; using System.Data; using Gm_WMS.DataAccess.DataService; using Stone.Common; namespace Stone.DataService.Biz.Info { public class F_User { public static DataSet UserList(Command cmd) { string sql = "select [Name] as UserName from t_Sys_User where [Enabled]=1 order by [Name] asc"; LocalDBService db = new LocalDBService(); return db.Exec_DataSet(sql); } public static DataSet UserLogin(Command cmd) { string UserName = cmd.Pars[0]; string Password = cmd.Pars[1]; string sql = "select [Name] as UserName, [Password] as [Password], '' as UserAuthority from t_Sys_User where [Name] = '{0}' and [Enabled]=1"; object[] obj = new object[2]; obj[0] = MyStrings.GetString(UserName); sql = string.Format(sql, obj); LocalDBService db = new LocalDBService(); DataSet dsData = db.Exec_DataSet(sql); if (dsData.Tables[0].Rows.Count <= 0) throw new Exception("用户名不正确!"); if (dsData.Tables[0].Rows[0]["Password"].ToString() != MyStrings.EncryptStr(Password)) throw new Exception("密码不正确"); //sql = "select Authority_Name from v_User where [User_Name] = '" + dsData.Tables[0].Rows[0]["UserName"].ToString() + "'"; //string UserAuthority = ""; //DataSet dsAuthority = db.Exec_DataSet(sql); //foreach (DataRow dr in dsAuthority.Tables[0].Rows) //{ // UserAuthority += dr["Authority_Name"].ToString() + ","; //} //dsData.Tables[0].Rows[0]["UserAuthority"] = UserAuthority; return dsData; } } }