Example #1
0
 public AliProduct GetAliProduct(int Id)
 {
     string sql = "SELECT Id,Keywords, IsKeywords, Status, GroupId,"
         + " GroupName1,GroupName2,GroupName3, Subject, RedModel, DetailUrl,AbsImageUrl,AbsSummImageUrl,IsWindowProduct,  "
         + "GmtModified, Type, IsDisplay, OwnerMemberId, OwnerMemberName, IsLowScore from AliProducts where id = " + Id;
     DataTable dt = dbHelper.ExecuteDataTable(sql, null);
     if(dt != null && dt.Rows.Count > 0)
     {
         DataRow row = dt.Rows[0];
         AliProduct kw = new AliProduct();
         kw.Id = Convert.ToInt32(row["Id"]);
         kw.Keywords = (string)row["Keywords"];
         kw.IsKeywords = Convert.ToBoolean(row["IsKeywords"]);
         kw.Status = (string)row["Status"];
         kw.GroupName1 = (string)row["GroupName1"];
         kw.GroupName2 = (string)row["GroupName2"];
         kw.GroupName3 = (string)row["GroupName3"];
         kw.Subject = (string)row["Subject"];
         kw.RedModel = (string)row["RedModel"];
         kw.DetailUrl = (string)row["DetailUrl"];
         kw.AbsImageUrl = (string)row["AbsImageUrl"];
         kw.AbsSummImageUrl = (string)row["AbsSummImageUrl"];
         kw.IsWindowProduct = Convert.ToBoolean(row["IsWindowProduct"]);
         kw.GmtModified = (string)row["GmtModified"];
         kw.Type = (string)row["Type"];
         kw.IsDisplay = (string)row["IsDisplay"];
         kw.OwnerMemberId = (string)row["OwnerMemberId"];
         kw.OwnerMemberName = (string)row["OwnerMemberName"];
         kw.IsLowScore = (string)row["IsLowScore"];
         return kw;
     }
     return null;
 }
Example #2
0
 public ProductDetail GetEditFormElements(AliProduct product)
 {
     string url = "http://hz.productposting.alibaba.com/product/editing.htm?id=" + product.Id;
     string html = HttpClient.RemoteRequest(url, null);
     HtmlNode.ElementsFlags.Remove("form");
     HtmlDocument document = new HtmlDocument();
     document.LoadHtml(html);
     HtmlNode productFormEl = document.GetElementbyId("productForm");
     ProductDetail detail = PrintElementsValue(productFormEl);
     detail.pid = product.Id;
     detail.gmtModified = product.GmtModified;
     html = html.Replace("\r", "").Replace("\n", "").Replace("\t", "");
     detail.SysAttr = GetSysAttr(html);
     detail.FixAttr = GetFixAttr(html);
     detail.imageFiles.Value = GetImageFilesJsonString(html);
     html = null;
     return detail;
 }
Example #3
0
        public QueryObject<AliProduct> GetAliProductList(QueryObject<AliProduct> query)
        {
            string sql = "SELECT Id,Keywords, IsKeywords, Status, GroupId,"
                + " GroupName1,GroupName2,GroupName3, Subject, RedModel, DetailUrl,AbsImageUrl,AbsSummImageUrl,IsWindowProduct,  "
                + "GmtModified, Type, IsDisplay, OwnerMemberId, OwnerMemberName, IsLowScore from AliProducts where 1 = 1";
            int GroupId = Convert.ToInt32(query.Condition.GroupId);
            if (GroupId > 0)
            {
                sql = sql + " and GroupId like '%" + GroupId.ToString() + "%'";
            }
            else {
                bool IsWindowProduct = query.Condition.IsWindowProduct;
                if (IsWindowProduct)
                {
                    sql = sql + " and IsWindowProduct = 1";
                }
            }

            query.RecordCount = dbHelper.GetItemCount(sql, null);
            sql = sql + " order by GmtModified desc limit " + query.Start + ", " + query.PageSize;
            DataTable dt = dbHelper.ExecuteDataTable(sql , null);
            List<AliProduct> list = new List<AliProduct>();
            foreach (DataRow row in dt.Rows)
            {
                AliProduct kw = new AliProduct();
                kw.Id = Convert.ToInt32(row["Id"]);
                kw.Keywords = (string)row["Keywords"];
                kw.IsKeywords = Convert.ToBoolean(row["IsKeywords"]);
                kw.Status = (string)row["Status"];
                kw.GroupName1 = (string)row["GroupName1"];
                kw.GroupName2 = (string)row["GroupName2"];
                kw.GroupName3 = (string)row["GroupName3"];
                kw.Subject = (string)row["Subject"];
                kw.RedModel = (string)row["RedModel"];
                kw.DetailUrl = (string)row["DetailUrl"];
                kw.AbsImageUrl = (string)row["AbsImageUrl"];
                kw.AbsSummImageUrl = (string)row["AbsSummImageUrl"];
                kw.IsWindowProduct = Convert.ToBoolean(row["IsWindowProduct"]);
                kw.GmtModified = (string)row["GmtModified"];
                kw.Type = (string)row["Type"];
                kw.IsDisplay = (string)row["IsDisplay"];
                kw.OwnerMemberId = (string)row["OwnerMemberId"];
                kw.OwnerMemberName = (string)row["OwnerMemberName"];
                kw.IsLowScore = (string)row["IsLowScore"];
                list.Add(kw);
            }
            query.Result = list;
            return query;
        }