Exemplo n.º 1
0
        public string login(string name, string pwd)
        {
            string retVal = "";

            try
            {
                //todo:HIS系统先验证用户名和密码

                //调用接口认证
                LoginAuth service = new LoginAuth();

                //直接塞参数进入Dictionary,由框架自动组装顺序
                Dictionary <string, string> requestParam = new Dictionary <string, string>();
                requestParam.Add("USER_CODE", name);
                requestParam.Add("USER_PASS", pwd);

                //使用executeSql重载的Dictionary参数方法
                string response = service.executeSql(requestParam);
                Dictionary <string, string> responseDict = service.getResponseResultWrapperMap();
                //登录失败
                if (service.getExecuteStatus() == false)
                {
                    retVal = "";
                    //记日志
                    XnhLogger.log(this.GetType().ToString() + service.getExecuteResultPlainString());
                }
                else
                {
                    //登录成功,缓存用户信息,服务器缓存以每个用户的user_id作为区分的cookie
                    string user_id = responseDict["USER_ID"];
                    foreach (KeyValuePair <string, string> item in responseDict)
                    {
                        BufferUtil.setBuffer(user_id, item.Key, item.Value);
                    }

                    retVal = MsgConvert.Dict2Json(responseDict);
                }
            }
            catch (Exception ex)
            {
                XnhLogger.log(this.GetType().ToString() + " " + ex.StackTrace);
                retVal = "";
            }

            return(retVal);
        }
Exemplo n.º 2
0
        public string login(string name, string pwd)
        {
            string retVal = "";

            try
            {
                //todo:HIS系统先验证用户名和密码

                /*
                 * string str_sql;
                 * str_sql = "select oper_name,pwd from code_operator where oper_code='" + name + "'";
                 * DataTable dt1 = DBUtil.queryExecute(str_sql);
                 *
                 * long ll_c;
                 * ll_c = dt1.Rows.Count;
                 * if (ll_c > 0)
                 * {
                 *  //p===pass
                 *  if (dt1.Rows[0]["pwd"].ToString() != pwd)
                 *  {
                 *      return "";//==
                 *  }
                 *  else
                 *  {
                 *      return "0;10011;admin;admin;刘德华;8881122;18012345678;天泰医院;DEP_AREA;USER_JG;DEP_LEVEL;AREA_CODE;T_IS_FLASH_AUTHORIZED;T_YEARS;T_IS_SK;T_IS_SK_HOSP;T_IS_XJ;T_RJZ_DATE;T_CH_START_DATE;T_CH_END_DATE;T_DY_MX_IS_HZ;T_IS_BLUSH_DAY;T_BLUSH_DAY;";
                 *  }
                 * }
                 * else
                 * {
                 *  return "";
                 * }
                 */
                // return "0;10011;admin;admin;刘德华;8881122;18012345678;天泰医院;DEP_AREA;USER_JG;DEP_LEVEL;AREA_CODE;T_IS_FLASH_AUTHORIZED;T_YEARS;T_IS_SK;T_IS_SK_HOSP;T_IS_XJ;T_RJZ_DATE;T_CH_START_DATE;T_CH_END_DATE;T_DY_MX_IS_HZ;T_IS_BLUSH_DAY;T_BLUSH_DAY;";

                //调用接口认证
                LoginAuth service = new LoginAuth();

                //直接塞参数进入Dictionary,由框架自动组装顺序
                Dictionary <string, string> requestParam = new Dictionary <string, string>();
                requestParam.Add("USER_CODE", name);
                requestParam.Add("USER_PASS", pwd);

                //使用executeSql重载的Dictionary参数方法
                string response = service.executeSql("", requestParam, "&");
                Dictionary <string, string> responseDict = service.getResponseResultWrapperMap();
                //登录失败
                if (service.getExecuteStatus() == false)
                {
                    retVal = "";
                    //记日志
                    XnhLogger.log(this.GetType().ToString() + service.getExecuteResultPlainString());
                }
                else
                {
                    //登录成功,缓存用户信息,服务器缓存以每个用户的user_id作为区分的cookie
                    string user_id = responseDict["USER_ID"];
                    foreach (KeyValuePair <string, string> item in responseDict)
                    {
                        BufferUtil.setBuffer(user_id, item.Key, item.Value);
                    }

                    retVal = DataConvert.Dict2Json(responseDict);
                }
            }
            catch (Exception ex)
            {
                XnhLogger.log(this.GetType().ToString() + " " + ex.StackTrace);
                retVal = "";
            }

            return(retVal);
        }