/// <summary> /// 获取所有品牌 /// </summary> /// <returns></returns> public DataTable GetAllBrand() { dh.Open(); DataTable dt = dh.GetDataTable(CommandType.Text, SelectBrand + OrderCondition1, null); dh.Close(); return(dt); }
/// <summary> /// 通过指定id获取信息 /// </summary> /// <param name="id"></param> /// <returns></returns> public TInformation GetInfo(int id) { TInformation tinfo = new TInformation(); string cmdtxt = "Select InfoTitle,InfoSubMemo,InfoMemo,BrandID,InfoPic,InfoType,ShopID,InfoStartTime,InfoEndTime,InfoFrom,InfoAddTime,InfoAdder,InfoClicks,IsRecom,SortID,IsHtml,HtmlPath,IsRemote,IsCheck,InfoCateID,InfoETitle,InfoTag from T_InfoList where InfoID=@InfoID"; NameValueCollection nvc = new NameValueCollection(); nvc.Add("@InfoID", id.ToString()); dh.Open(); using (DbDataReader dr = dh.ExecuteReader(CommandType.Text, cmdtxt, nvc)) { if (dr.HasRows) { dr.Read(); #region 变量赋值 tinfo.InfoID = id; tinfo.InfoTitle = dr["InfoTitle"].ToString(); tinfo.InfoSubMemo = dr["InfoSubMemo"].ToString(); tinfo.InfoMemo = dr["InfoMemo"].ToString(); int BrandID = 0; Int32.TryParse(dr["BrandID"].ToString(), out BrandID); tinfo.BrandID = BrandID; tinfo.InfoPic = dr["InfoPic"].ToString().Trim(); int infotype = 0; Int32.TryParse(dr["InfoType"].ToString(), out infotype); tinfo.InfoType = infotype; int ShopID = 0; Int32.TryParse(dr["ShopID"].ToString(), out ShopID); tinfo.ShopID = ShopID; tinfo.InfoStartTime = dr["InfoStartTime"].ToString(); tinfo.InfoEndTime = dr["InfoEndTime"].ToString(); tinfo.InfoFrom = dr["InfoFrom"].ToString(); DateTime addtime; DateTime.TryParse(dr["InfoAddTime"].ToString(), out addtime); tinfo.InfoAddTime = addtime; tinfo.InfoAdder = dr["InfoAdder"].ToString(); int InfoClicks = 0; Int32.TryParse(dr["InfoClicks"].ToString(), out InfoClicks); bool IsRecom = false; bool.TryParse(dr["IsRecom"].ToString(), out IsRecom); tinfo.IsRecom = IsRecom; int SortID = 0; Int32.TryParse(dr["SortID"].ToString(), out SortID); tinfo.SortID = SortID; bool IsHtml = false; bool.TryParse(dr["IsHtml"].ToString(), out IsHtml); tinfo.IsHtml = IsHtml; tinfo.HtmlPath = dr["HtmlPath"].ToString(); bool IsRemote = false; bool.TryParse(dr["IsRemote"].ToString(), out IsRemote); tinfo.IsRemote = IsRemote; bool IsCheck = false; bool.TryParse(dr["IsCheck"].ToString(), out IsCheck); tinfo.IsCheck = IsCheck; int InfoCateID = 0; Int32.TryParse(dr["InfoCateID"].ToString(), out InfoCateID); tinfo.InfoCateID = InfoCateID; tinfo.InfoETitle = dr["InfoETitle"].ToString(); tinfo.InfoTag = dr["InfoTag"].ToString(); #endregion } } dh.Close(); return(tinfo); }
public TAdmin GetAdmin(int id) { TAdmin ta = new TAdmin(); string cmdtxt = "select Admin_ID,Admin_UID,Admin_PWD,Admin_Stat,Admin_RealName,Admin_RegTime,Admin_LogTimes,Admin_Flag,SortID from T_Admin where Admin_ID=@Admin_ID and IsDelete=0"; NameValueCollection nvc = new NameValueCollection(); nvc.Add("@Admin_ID", id.ToString()); dh.Open(); using (DbDataReader dr = dh.ExecuteReader(CommandType.Text, cmdtxt, nvc)) { if (dr.HasRows) { dr.Read(); int Admin_id = 0; Int32.TryParse(dr["Admin_ID"].ToString().Trim(), out Admin_id); ta.Admin_ID = Admin_id; ta.Admin_UID = dr["Admin_UID"].ToString(); ta.Admin_PWD = dr["Admin_PWD"].ToString(); bool stat = false; bool.TryParse(dr["Admin_Stat"].ToString().Trim(), out stat); ta.Admin_Stat = stat; ta.Admin_RealName = dr["Admin_RealName"].ToString().Trim(); DateTime Addtime; DateTime.TryParse(dr["Admin_RegTime"].ToString().Trim(), out Addtime); ta.Admin_RegTime = Addtime; ta.Admin_LogTimes = Convert.ToInt32(dr["Admin_LogTimes"].ToString()); ta.Admin_Flag = dr["Admin_Flag"].ToString(); int sortid = 0; Int32.TryParse(dr["SortID"].ToString(), out sortid); ta.SortID = sortid; } } dh.Close(); return(ta); }
/// <summary> /// 获取所有节点 /// </summary> /// <returns></returns> public DataTable GetAllNode() { dh.Open(); DataTable dt = dh.GetDataTable(CommandType.Text, SelectNodes + "order by "+OrderCondition1, null); dh.Close(); return dt; }
/// <summary> /// 获取所有省 /// </summary> /// <returns></returns> public DataTable GetAllProvince() { dh.Open(); DataTable dt = dh.GetDataTable(CommandType.Text, "Select ID,code,name from province order by ID asc", null); dh.Close(); return(dt); }