public DataTable GetUserList(RegUserInfo reguserinfo, AdsTypeEnum adstype, DateTime stime, DateTime etime) { List <SqlParameter> sqlprams = new List <SqlParameter>(); if (reguserinfo.Cid > 0) { sqlprams.Add(DataBase.MakeInParam("@Cid", SqlDbType.Int, 4, reguserinfo.Cid)); } if (reguserinfo.Uid > 0) { sqlprams.Add(DataBase.MakeInParam("@Uid", SqlDbType.Int, 4, reguserinfo.Uid)); } sqlprams.Add(DataBase.MakeInParam("@adstype", SqlDbType.TinyInt, 1, (int)adstype)); sqlprams.Add(DataBase.MakeInParam("@stime", SqlDbType.DateTime, 8, stime)); sqlprams.Add(DataBase.MakeInParam("@etime", SqlDbType.DateTime, 8, etime)); sqlprams.Add(DataBase.MakeInParam("@page", SqlDbType.Int, 4, base.Page)); sqlprams.Add(DataBase.MakeInParam("@pagesize", SqlDbType.Int, 4, base.PageSize)); SqlParameter _totalparm = DataBase.MakeOutParam("@total", SqlDbType.Int, 4); sqlprams.Add(_totalparm); SqlParameter[] prams = sqlprams.ToArray(); DataTable dt = DataBase.ExecuteDataset(CommandType.StoredProcedure, "GetRegUserList", prams).Tables[0]; base.Total = (int)_totalparm.Value; return(dt); }
private static IEnumerable <byte> GetBytesFromConvertible(AdsTypeEnum adsType, object value, uint defaultStringLength) { IEnumerable <byte> varValueBytes = null; if (value == null) { return(null); } switch (adsType) { case AdsTypeEnum.Bool: varValueBytes = BitConverter.GetBytes((bool)value); break; case AdsTypeEnum.Byte: varValueBytes = new byte[] { (byte)value }; break; case AdsTypeEnum.Char: varValueBytes = BitConverter.GetBytes((char)value); break; case AdsTypeEnum.Int16: varValueBytes = BitConverter.GetBytes((Int16)value); break; case AdsTypeEnum.Int32: varValueBytes = BitConverter.GetBytes((Int32)value); break; case AdsTypeEnum.Int64: varValueBytes = BitConverter.GetBytes((Int64)value); break; case AdsTypeEnum.UInt16: varValueBytes = BitConverter.GetBytes((UInt16)value); break; case AdsTypeEnum.UInt32: varValueBytes = BitConverter.GetBytes((UInt32)value); break; case AdsTypeEnum.UInt64: varValueBytes = BitConverter.GetBytes((UInt64)value); break; case AdsTypeEnum.Single: varValueBytes = BitConverter.GetBytes((Single)value); break; case AdsTypeEnum.Double: varValueBytes = BitConverter.GetBytes((Double)value); break; case AdsTypeEnum.DateTime: varValueBytes = BitConverter.GetBytes((Int32)value); break; case AdsTypeEnum.String: varValueBytes = value.ToString().ToAdsBytes(); break; case AdsTypeEnum.Date: varValueBytes = BitConverter.GetBytes((Int32)value); break; case AdsTypeEnum.Time: varValueBytes = BitConverter.GetBytes((Int32)value); break; } return(varValueBytes); }
private static object ConvertBytesToType(AdsTypeEnum adsType, byte[] value) { try { switch (adsType) { case AdsTypeEnum.Bool: return(BitConverter.ToBoolean(value, 0)); case AdsTypeEnum.Byte: return(value[0]); case AdsTypeEnum.Int16: return(BitConverter.ToInt16(value, 0)); case AdsTypeEnum.Int32: return(BitConverter.ToInt32(value, 0)); case AdsTypeEnum.Int64: return(BitConverter.ToInt64(value, 0)); case AdsTypeEnum.UInt16: return(BitConverter.ToUInt16(value, 0)); case AdsTypeEnum.UInt32: return(BitConverter.ToUInt32(value, 0)); case AdsTypeEnum.UInt64: return(BitConverter.ToUInt64(value, 0)); case AdsTypeEnum.Single: return(BitConverter.ToSingle(value, 0)); case AdsTypeEnum.Double: return(BitConverter.ToDouble(value, 0)); case AdsTypeEnum.String: return(ByteArrayHelper.ByteArrayToString(value)); case AdsTypeEnum.DateTime: return(ByteArrayHelper.ByteArrayToDateTime(value)); case AdsTypeEnum.Date: return(new Date(BitConverter.ToUInt32(value, 0))); case AdsTypeEnum.Time: return(new Time(BitConverter.ToUInt32(value, 0))); default: return(null); } } catch { return(null); } }
private static uint GetByteLengthFromConvertible(AdsTypeEnum adsType, uint defaultStringLength) { uint length; switch (adsType) { case AdsTypeEnum.Bool: length = 1; break; case AdsTypeEnum.Byte: length = 1; break; case AdsTypeEnum.Int16: length = 2; break; case AdsTypeEnum.Int32: length = 4; break; case AdsTypeEnum.Int64: length = 8; break; case AdsTypeEnum.UInt16: length = 2; break; case AdsTypeEnum.UInt32: length = 4; break; case AdsTypeEnum.UInt64: length = 8; break; case AdsTypeEnum.Single: length = 4; break; case AdsTypeEnum.Double: length = 8; break; case AdsTypeEnum.String: length = defaultStringLength; break; case AdsTypeEnum.DateTime: length = 4; break; case AdsTypeEnum.Date: length = 4; break; case AdsTypeEnum.Time: length = 4; break; case AdsTypeEnum.Char: length = 1; break; default: length = 0; break; } return(length); }
protected void Page_Load(object sender, EventArgs e) { string query = Request.QueryString["topic"]; // url: /affiliates/Box250x250.html if ("Box250x250".Equals(query)) { AdsType = AdsTypeEnum.Box250x250; } // url: /affiliates/Box160x600.html else if ("Box160x600".Equals(query)) { AdsType = AdsTypeEnum.Box160x600; } // url: /affiliates/Box728x90.html else if ("Box728x90".Equals(query)) { AdsType = AdsTypeEnum.Box728x90; } else { AdsType = AdsTypeEnum.Box728x90; } }