/// <summary> /// 根据cookie查看它的状态(是否结束) /// </summary> /// <param name="session"></param> /// <param name="lstParams"> /// lstParams[0] : cookieID /// </param> /// <returns>opt.data = 0: 会话已经结束 1:会话未结束</returns> private OperationReturn GetCookieStatusByID(SessionInfo session, List <string> lstParams) { OperationReturn optReturn = new OperationReturn(); try { if (lstParams == null || lstParams.Count < 1 || session == null) { optReturn.Result = false; optReturn.Code = Defines.RET_PARAM_INVALID; optReturn.Message = string.Format("Request param is null or count invalid"); return(optReturn); } string strToken = session.RentInfo.Token; string strSql = string.Empty; switch (session.DBType) { case 2: strSql = "select * from t_16_001_{0} where C001 = {1}"; strSql = string.Format(strSql, strToken, lstParams[0]); optReturn = MssqlOperation.GetDataSet(session.DBConnectionString, strSql); break; case 3: strSql = "select * from t_16_001_{0} where C001 = {1}"; strSql = string.Format(strSql, strToken, lstParams[0]); optReturn = OracleOperation.GetDataSet(session.DBConnectionString, strSql); break; } optReturn.Message += "; " + strSql; if (!optReturn.Result) { optReturn.Code = (int)S1600WcfError.GetCookieStatusError; return(optReturn); } DataSet ds = optReturn.Data as DataSet; if (ds.Tables.Count <= 0 || ds.Tables[0].Rows.Count <= 0) { optReturn.Data = "0"; return(optReturn); } string str = ds.Tables[0].Rows[0]["C005"].ToString(); if (string.IsNullOrEmpty(str)) { optReturn.Data = "1"; } else { optReturn.Data = "0"; } optReturn.Result = true; } catch (Exception ex) { optReturn.Result = false; optReturn.Code = (int)S1600WcfError.GetCookieStatusException; optReturn.Message = ex.Message; } return(optReturn); }
private OperationReturn CheckUserPropertyByID(SessionInfo session) { OperationReturn optReturn = new OperationReturn(); try { string strRent = session.RentInfo.Token; string strSql = string.Empty; string strUserID = session.UserID.ToString(); //判断是坐席还是用户 string strType = strUserID.Substring(0, 3); if (strType == ConstValue.RESOURCE_AGENT.ToString()) { //坐席 switch (session.DBType) { case 2: strSql = "select * from t_11_101_{0} where C001 = {1} and C002 = 2"; strSql = string.Format(strSql, strRent, strUserID); optReturn = MssqlOperation.GetDataSet(session.DBConnectionString, strSql); break; case 3: strSql = "select * from t_11_101_{0} where C001 = {1} and C002 = 2"; strSql = string.Format(strSql, strRent, strUserID); optReturn = OracleOperation.GetDataSet(session.DBConnectionString, strSql); break; } } else if (strType == ConstValue.RESOURCE_USER.ToString()) { //用户 switch (session.DBType) { case 2: strSql = "select * from t_11_101_{0} where C001 = {1} "; strSql = string.Format(strSql, strRent, strUserID); optReturn = MssqlOperation.GetDataSet(session.DBConnectionString, strSql); break; case 3: strSql = "select * from t_11_101_{0} where C001 = {1} "; strSql = string.Format(strSql, strRent, strUserID); optReturn = OracleOperation.GetDataSet(session.DBConnectionString, strSql); break; } } optReturn.Message += " ; " + strSql; if (!optReturn.Result) { optReturn.Code = (int)S1600WcfError.CheckUserPropertyError; return(optReturn); } DataSet ds = optReturn.Data as DataSet; if (ds.Tables.Count <= 0 || ds.Tables[0].Rows.Count <= 0) { optReturn.Result = true; optReturn.Code = (int)S1600WcfError.PropertyNone; return(optReturn); } optReturn.Result = true; optReturn.Code = Defines.RET_SUCCESS; } catch (Exception ex) { optReturn.Result = false; optReturn.Code = (int)S1600WcfError.CheckUserPropertyException; optReturn.Message = ex.Message; } return(optReturn); }