private OperationReturn GetRelation(SessionInfo session) { OperationReturn optReturn = new OperationReturn(); optReturn.Result = true; optReturn.Code = 0; try { string rentToken = session.RentInfo.Token; string strSql; DataSet objDataSet; switch (session.DBType) { case 2: strSql = string.Format("SELECT * from T_11_201_{0} where C003 LIKE '100%'", rentToken); optReturn = MssqlOperation.GetDataSet(session.DBConnectionString, strSql); if (!optReturn.Result) { return(optReturn); } objDataSet = optReturn.Data as DataSet; break; case 3: strSql = string.Format("SELECT * FROM T_11_201_{0} WHERE C003 LIKE '100%'", rentToken); optReturn = OracleOperation.GetDataSet(session.DBConnectionString, strSql); if (!optReturn.Result) { return(optReturn); } objDataSet = optReturn.Data as DataSet; break; default: optReturn.Result = false; optReturn.Code = Defines.RET_PARAM_INVALID; optReturn.Message = string.Format("Database type not surpport.\t{0}", session.DBType); return(optReturn); } if (objDataSet == null) { optReturn.Result = false; optReturn.Code = Defines.RET_OBJECT_NULL; optReturn.Message = string.Format("DataSet is null"); return(optReturn); } List <string> listReturn = new List <string>(); for (int i = 0; i < objDataSet.Tables[0].Rows.Count; i++) { DataRow dr = objDataSet.Tables[0].Rows[i]; Relation item = new Relation(); item.ResourceID = Convert.ToInt64(dr["C004"].ToString()); item.StartTime = Convert.ToDateTime(dr["C005"].ToString()); item.EndTime = Convert.ToDateTime(dr["C006"].ToString()); item.UserID = Convert.ToInt64(dr["C003"].ToString()); optReturn = XMLHelper.SeriallizeObject(item); if (!optReturn.Result) { return(optReturn); } listReturn.Add(optReturn.Data.ToString()); } optReturn.Data = listReturn; } catch (Exception ex) { optReturn.Result = false; optReturn.Code = Defines.RET_FAIL; optReturn.Message = ex.Message; return(optReturn); } return(optReturn); }
private OperationReturn GetVoiceIP_Name201(SessionInfo session) { OperationReturn optReturn = new OperationReturn(); optReturn.Result = true; optReturn.Code = 0; try { string rentToken = session.RentInfo.Token; string strSql; DataSet objDataSet; switch (session.DBType) { case 2: strSql = string.Format("SELECT * from T_11_101_{0} where C001 like '221%' and C002=1 ", rentToken); optReturn = MssqlOperation.GetDataSet(session.DBConnectionString, strSql); if (!optReturn.Result) { return(optReturn); } objDataSet = optReturn.Data as DataSet; break; case 3: strSql = string.Format("SELECT * FROM T_11_101_{0} WHERE C001 LIKE '221%' AND C002=1 ", rentToken); optReturn = OracleOperation.GetDataSet(session.DBConnectionString, strSql); if (!optReturn.Result) { return(optReturn); } objDataSet = optReturn.Data as DataSet; break; default: optReturn.Result = false; optReturn.Code = Defines.RET_PARAM_INVALID; optReturn.Message = string.Format("Database type not surpport.\t{0}", session.DBType); return(optReturn); } if (objDataSet == null) { optReturn.Result = false; optReturn.Code = Defines.RET_OBJECT_NULL; optReturn.Message = string.Format("DataSet is null"); return(optReturn); } List <string> listReturn = new List <string>(); for (int i = 0; i < objDataSet.Tables[0].Rows.Count; i++) { DataRow dr = objDataSet.Tables[0].Rows[i]; ResourceInfo item = new ResourceInfo(); string[] arrInfo = dr["C017"].ToString().Substring(3).Split(new[] { ConstValue.SPLITER_CHAR }, StringSplitOptions.RemoveEmptyEntries); if (arrInfo.Length >= 3) { string EnVoiceIP = arrInfo[2];//从数据库里面取出来加密的那个 //string strVoiceName = DecryptString(dr["C018"].ToString()); string strVoiceIP = DecryptString02(EnVoiceIP); string strInfo = string.Format("{0}{1}", ConstValue.SPLITER_CHAR, strVoiceIP); arrInfo = strInfo.Split(new[] { ConstValue.SPLITER_CHAR }, StringSplitOptions.RemoveEmptyEntries); if (arrInfo.Length >= 1) { item.ResourceName = arrInfo[0]; } } string[] NameInfo = dr["C018"].ToString().Substring(3).Split(new[] { ConstValue.SPLITER_CHAR }, StringSplitOptions.RemoveEmptyEntries); if (NameInfo.Length >= 3) { string EnVoiceIP = NameInfo[2];//从数据库里面取出来加密的那个 //string strVoiceName = DecryptString(dr["C018"].ToString()); string strVoiceIP = DecryptString02(EnVoiceIP); string strInfo = string.Format("{0}{1}", ConstValue.SPLITER_CHAR, strVoiceIP); arrInfo = strInfo.Split(new[] { ConstValue.SPLITER_CHAR }, StringSplitOptions.RemoveEmptyEntries); if (arrInfo.Length >= 1) { item.ResourceFullName = arrInfo[0]; } } item.ResourceID = Convert.ToInt64(dr["C001"].ToString()); item.ResourceCode = S1111Consts.VCLogServer; optReturn = XMLHelper.SeriallizeObject(item); if (!optReturn.Result) { return(optReturn); } listReturn.Add(optReturn.Data.ToString()); } optReturn.Data = listReturn; } catch (Exception ex) { optReturn.Result = false; optReturn.Code = Defines.RET_FAIL; optReturn.Message = ex.Message; return(optReturn); } return(optReturn); }
private OperationReturn GetRentInfo(SessionInfo session) { OperationReturn optReturn = new OperationReturn(); optReturn.Result = true; optReturn.Code = 0; try { string strSql; DataSet objDataSet; switch (session.DBType) { case 2: strSql = string.Format("SELECT * from T_00_121"); optReturn = MssqlOperation.GetDataSet(session.DBConnectionString, strSql); if (!optReturn.Result) { return(optReturn); } objDataSet = optReturn.Data as DataSet; break; case 3: strSql = string.Format("SELECT * FROM T_00_121"); optReturn = OracleOperation.GetDataSet(session.DBConnectionString, strSql); if (!optReturn.Result) { return(optReturn); } objDataSet = optReturn.Data as DataSet; break; default: optReturn.Result = false; optReturn.Code = Defines.RET_PARAM_INVALID; optReturn.Message = string.Format("Database type not surpport.\t{0}", session.DBType); return(optReturn); } if (objDataSet == null) { optReturn.Result = false; optReturn.Code = Defines.RET_OBJECT_NULL; optReturn.Message = string.Format("DataSet is null"); return(optReturn); } List <string> listReturn = new List <string>(); for (int i = 0; i < objDataSet.Tables[0].Rows.Count; i++) { DataRow dr = objDataSet.Tables[0].Rows[i]; DateTime today = System.DateTime.Now; DateTime Start = Convert.ToDateTime(DecryptString02(dr["C011"].ToString())); DateTime End = Convert.ToDateTime(DecryptString02(dr["C012"].ToString())); TimeSpan TS = today - Start; TimeSpan TE = End - today; if (TS.TotalSeconds >= 0 && TE.TotalSeconds >= 0) { TenantInfo item = new TenantInfo(); item.RentID = Convert.ToInt64(dr["C001"].ToString()); item.RentName = EncryptString04(DecryptString02(dr["C002"].ToString())); optReturn = XMLHelper.SeriallizeObject(item); if (!optReturn.Result) { return(optReturn); } listReturn.Add(optReturn.Data.ToString()); } } optReturn.Data = listReturn; } catch (Exception ex) { optReturn.Result = false; optReturn.Code = Defines.RET_FAIL; optReturn.Message = ex.Message; return(optReturn); } return(optReturn); }