示例#1
0
        public void GetAccList(string svrName)
        {
            string pubConnStr = DataBaseConfigcs.GetPubConnString(svrName);
            string dbType     = DataBaseConfigcs.GetDbType(svrName);

            string sql = "select ucode,ucode + '-' + uname  uname from ngusers";

            if ("OracleClient" == dbType)
            {
                sql = "select ucode,ucode||'-'||uname  uname from ngusers";
            }


            DataTable dt = NG3.Data.Service.DbHelper.GetDataTable(pubConnStr, sql);

            Ajax.WriteRaw(dt.ToJSON("ucode", "uname"));
        }
示例#2
0
        protected override object Run(object[] ps)
        {
            #region 提交数据初始
            string Product = ConfigurationManager.AppSettings["Product"];
            //数据库服务器
            string svrName = ps.GetOrDefault <string>(0);
            //帐套
            string account = "NG" + ps.GetOrDefault <string>(1);
            //用户名
            string logid = ps.GetOrDefault <string>(2);
            //密码
            string pwd       = string.IsNullOrEmpty(ps.GetOrDefault <string>(3)) ? string.Empty : ps.GetOrDefault <string>(3);
            string pubConn   = DataBaseConfigcs.GetPubConnString(svrName);
            string userConn  = DataBaseConfigcs.GetUserConnString(svrName, account);
            string RealPwd   = string.Empty;
            string UseGroup  = string.Empty;
            string UserOcode = string.Empty;
            string UserName  = string.Empty;
            #endregion

            string PostPwdWithEn = NG3.NGEncode.EncodeMD5(pwd);
            //校验用户
            DataTable UserDt = DbHelper.GetDataTable(userConn, string.Format("select logid,u_name,pwd,ocode,usergroup from secuser where logid='{0}' ", logid));

            if (UserDt.Rows.Count == 0)
            {
                //检测用户是否存在
                this.SetErrMsg(ps, "不存在该用户!");
                return(false);
            }
            else
            {
                RealPwd   = UserDt.Rows[0]["pwd"] == DBNull.Value ? string.Empty : UserDt.Rows[0]["pwd"].ToString();
                UseGroup  = UserDt.Rows[0]["usergroup"] == DBNull.Value ? string.Empty : UserDt.Rows[0]["usergroup"].ToString().ToUpper();
                UserOcode = UserDt.Rows[0]["ocode"] == DBNull.Value ? string.Empty : UserDt.Rows[0]["ocode"].ToString();
                UserName  = UserDt.Rows[0]["u_name"] == DBNull.Value ? string.Empty : UserDt.Rows[0]["u_name"].ToString();
                if (!RealPwd.Equals(PostPwdWithEn))
                {
                    this.SetErrMsg(ps, "用户密码错误!");
                    return(false);
                }

                if (string.IsNullOrEmpty(UseGroup) && !UseGroup.Equals("M") && !UseGroup.Equals("S") && !UseGroup.Equals("T"))
                {
                    this.SetErrMsg(ps, "该用户不隶属于任何角色,请联系管理员!");
                    return(false);
                }
            }

            I6WebAppInfo appInfo = new I6WebAppInfo();
            appInfo.PubConnectString  = pubConn;
            appInfo.UserConnectString = userConn;
            appInfo.LoginID           = logid;
            appInfo.UserName          = UserName;
            appInfo.OCode             = UserOcode;
            appInfo.UserGroup         = UseGroup;

            HttpContext.Current.Session[UPAppInfoNameInSession] = appInfo;
            NG3.Data.Service.ConnectionInfoService.SetSessionConnectString(appInfo.UserConnectString);//初始化2.0的dbhelper

            return(true);
        }