/// <summary> /// 取当前用户、单位编码 /// </summary> /// <param name="strName"></param> /// <param name="strMa"></param> /// <returns></returns> public bool GetUser(string strName, string strMa) { bool ret = false; try { //MsData m = new MsData(ConnStr.Instance().Constr); string str_con = ConnStr.Instance().Constr;// @"Data Source=169.85.170.18;Initial Catalog=gl;User ID=lzk;pwd=lzk2009~";// "pwd=sjfc_gks{;user id=gks;Initial Catalog=scgl;Data Source=169.85.170.18"; SqlConnection sqlc = new SqlConnection(str_con); string str_cm = "select dwmc from global_user where name='" + strName + "' and pwd='" + strMa + "'"; SqlCommand sqlcomd = new SqlCommand(str_cm, sqlc); sqlc.Open(); object obj = sqlcomd.ExecuteScalar(); if (obj != null)//存在用户 { this.dwmc = obj.ToString(); this.name = strName; this.pwd = strMa; yz = true; ret = true; } else { yz = false; } sqlc.Close(); return(ret); } catch { return(ret); } }
/// <summary> /// 取权限集合 /// </summary> public void getQxs() { try { string str_con = ConnStr.Instance().Constr;//@"Data Source=169.85.170.18;Initial Catalog=LZK;User ID=lzk;pwd=lzk2009~"; SqlConnection sqlc = new SqlConnection(str_con); string str_cm = "select global_qx.xtid,global_qx.qx from global_user,global_qx where global_user.userid=global_qx.userid and global_use.name='" + name + "' and global_use.pwd='" + pwd + "'"; SqlCommand sqlcomd = new SqlCommand(str_cm, sqlc); sqlc.Open(); SqlDataReader dr = sqlcomd.ExecuteReader(); while (dr.Read()) { Qx q1 = new Qx(); q1.xt = dr.GetInt16(0); q1.qx = dr.GetInt16(1); qxs.Add(q1); } dr.Close(); sqlc.Close(); } catch { } }