Пример #1
0
        public string[] GetProList(string prefixText, string count)
        {
            SqlComm sqlcomm = new SqlComm();
            System.Data.DataTable dt = sqlcomm.getDataByCondition("dbo.View_Product", "top " + count + " product_name,product_id", " product_name like '%" + prefixText + "%'  order by product_name desc");
            if (dt != null && dt.Rows.Count > 0)
            {
                string[] prolist = new string[dt.Rows.Count];
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    prolist[i] = dt.Rows[i]["product_name"].ToString();
                }

                return prolist;
            }
            else
            {
                return null;
            }
        }
Пример #2
0
        public string[] GetNewsList(string prefixText, string count)
        {
            SqlComm sqlcomm = new SqlComm();
            System.Data.DataTable dt = sqlcomm.getDataByCondition("dbo.Veiw_News", " top " + count + " NewsID,NewsTitle", " NewsTitle like '%" + prefixText + "%' order by NewsTitle desc");
            if (dt != null && dt.Rows.Count > 0)
            {
                string[] newstitle = new string[dt.Rows.Count];

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    newstitle[i] = dt.Rows[i]["NewsTitle"].ToString();

                }

                return newstitle;
            }
            else
            {
                return null;
            }
        }
Пример #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["username"] != null)
            {
                this.lbUserName.Text = Session["username"].ToString();
                lbUser.Visible = true;
            }

            if (Session["Cid"] != null)
            {
                SqlComm sql = new SqlComm();
               System.Data.DataTable dt= sql.getDataByCondition("dbo.TbCat", "isnull(sum(num),0)", "Customerid=" + Session["Cid"].ToString() + " AND isOrders=0");
               if (dt != null && dt.Rows.Count > 0)
               {
                   sum = int.Parse(dt.Rows[0][0].ToString());
               }
               else
               {
                   sum = 0;
               }
            }
        }