Example #1
0
        /// <summary>
        /// 得到一个对象实体列表
        /// </summary>
        public IList <Model.wx_orders> GetModelList(string sqlWhere)
        {
            IList <Model.wx_orders> retlist = new List <Model.wx_orders>();
            StringBuilder           strSql  = new StringBuilder();

            strSql.Append("select   id,order_no,trade_no,user_id,user_name,payment_id,payment_fee,payment_status,payment_time,express_id,express_no,express_fee,express_status,express_time,accept_name,post_code,telphone,mobile,area,address,message,remark,payable_amount,real_amount,order_amount,point,status,add_time,confirm_time,complete_time,wid,openid ");
            strSql.Append(" from " + databaseprefix + "orders ");
            if (sqlWhere.Trim() != "")
            {
                strSql.Append(" where " + sqlWhere);
            }

            Model.wx_orders model = new Model.wx_orders();
            DataSet         ds    = DbHelperSQL.Query(strSql.ToString());
            DataSet         ds2   = new DataSet();
            List <Model.wx_shop_product> models = new List <Model.wx_shop_product>();

            if (ds.Tables[0].Rows.Count > 0)
            {
                DataRow dr;
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    model = new Model.wx_orders();
                    dr    = ds.Tables[0].Rows[i];
                    #region 父表信息
                    if (dr["id"].ToString() != "")
                    {
                        model.id = int.Parse(dr["id"].ToString());
                    }
                    model.order_no = dr["order_no"].ToString();
                    model.trade_no = dr["trade_no"].ToString();
                    if (dr["user_id"].ToString() != "")
                    {
                        model.user_id = int.Parse(dr["user_id"].ToString());
                    }
                    model.user_name = dr["user_name"].ToString();
                    if (dr["payment_id"].ToString() != "")
                    {
                        model.payment_id = int.Parse(dr["payment_id"].ToString());
                    }
                    if (dr["payment_fee"].ToString() != "")
                    {
                        model.payment_fee = decimal.Parse(dr["payment_fee"].ToString());
                    }
                    if (dr["payment_status"].ToString() != "")
                    {
                        model.payment_status = int.Parse(dr["payment_status"].ToString());
                    }
                    if (dr["payment_time"].ToString() != "")
                    {
                        model.payment_time = DateTime.Parse(dr["payment_time"].ToString());
                    }
                    if (dr["express_id"].ToString() != "")
                    {
                        model.express_id = int.Parse(dr["express_id"].ToString());
                    }
                    model.express_no = dr["express_no"].ToString();
                    if (dr["express_fee"].ToString() != "")
                    {
                        model.express_fee = decimal.Parse(dr["express_fee"].ToString());
                    }
                    if (dr["express_status"].ToString() != "")
                    {
                        model.express_status = int.Parse(dr["express_status"].ToString());
                    }
                    if (dr["express_time"].ToString() != "")
                    {
                        model.express_time = DateTime.Parse(dr["express_time"].ToString());
                    }
                    model.accept_name = dr["accept_name"].ToString();
                    model.post_code   = dr["post_code"].ToString();
                    model.telphone    = dr["telphone"].ToString();
                    model.mobile      = dr["mobile"].ToString();
                    model.area        = dr["area"].ToString();
                    model.address     = dr["address"].ToString();
                    model.message     = dr["message"].ToString();
                    model.remark      = dr["remark"].ToString();
                    if (dr["payable_amount"].ToString() != "")
                    {
                        model.payable_amount = decimal.Parse(dr["payable_amount"].ToString());
                    }
                    if (dr["real_amount"].ToString() != "")
                    {
                        model.real_amount = decimal.Parse(dr["real_amount"].ToString());
                    }
                    if (dr["order_amount"].ToString() != "")
                    {
                        model.order_amount = decimal.Parse(dr["order_amount"].ToString());
                    }
                    if (dr["point"].ToString() != "")
                    {
                        model.point = int.Parse(dr["point"].ToString());
                    }
                    if (ds.Tables[0].Rows[0]["status"].ToString() != "")
                    {
                        model.status = int.Parse(dr["status"].ToString());
                    }
                    if (dr["add_time"].ToString() != "")
                    {
                        model.add_time = DateTime.Parse(dr["add_time"].ToString());
                    }
                    if (dr["confirm_time"].ToString() != "")
                    {
                        model.confirm_time = DateTime.Parse(dr["confirm_time"].ToString());
                    }
                    if (dr["complete_time"].ToString() != "")
                    {
                        model.complete_time = DateTime.Parse(dr["complete_time"].ToString());
                    }
                    if (dr["wid"] != null && dr["wid"].ToString() != "")
                    {
                        model.wid = int.Parse(dr["wid"].ToString());
                    }
                    if (dr["openid"] != null)
                    {
                        model.openid = dr["openid"].ToString();
                    }

                    #endregion

                    #region 子表信息
                    StringBuilder strSql2 = new StringBuilder();
                    strSql2.Append("select  (select top 1 original_path from  wx_shop_albums where  productId=p.id) as productpic,p.*,og.quantity,og.real_price from wx_shop_product p right join  dt_order_goods og on p.id=og.goods_id where og.order_id=@id");

                    SqlParameter[] parameters2 =
                    {
                        new SqlParameter("@id", SqlDbType.Int, 4)
                    };
                    parameters2[0].Value = model.id;

                    ds2 = DbHelperSQL.Query(strSql2.ToString(), parameters2);
                    if (ds2.Tables[0].Rows.Count > 0)
                    {
                        int count = ds2.Tables[0].Rows.Count;
                        models = new List <Model.wx_shop_product>();
                        Model.wx_shop_product modelt;
                        for (int n = 0; n < count; n++)
                        {
                            modelt = new Model.wx_shop_product();
                            #region 子表,for循环

                            if (ds2.Tables[0].Rows[n]["id"] != null && ds2.Tables[0].Rows[n]["id"].ToString() != "")
                            {
                                modelt.id = int.Parse(ds2.Tables[0].Rows[n]["id"].ToString());
                            }

                            if (ds2.Tables[0].Rows[n]["quantity"] != null && ds2.Tables[0].Rows[n]["quantity"].ToString() != "")
                            {
                                modelt.stock = int.Parse(ds2.Tables[0].Rows[n]["quantity"].ToString());
                            }

                            if (ds2.Tables[0].Rows[n]["wid"] != null && ds2.Tables[0].Rows[n]["wid"].ToString() != "")
                            {
                                modelt.wid = int.Parse(ds2.Tables[0].Rows[n]["wid"].ToString());
                            }
                            if (ds2.Tables[0].Rows[n]["categoryId"] != null && ds2.Tables[0].Rows[n]["categoryId"].ToString() != "")
                            {
                                modelt.categoryId = int.Parse(ds2.Tables[0].Rows[n]["categoryId"].ToString());
                            }
                            if (ds2.Tables[0].Rows[n]["brandId"] != null && ds2.Tables[0].Rows[n]["brandId"].ToString() != "")
                            {
                                modelt.brandId = int.Parse(ds2.Tables[0].Rows[n]["brandId"].ToString());
                            }
                            if (ds2.Tables[0].Rows[n]["sku"] != null)
                            {
                                modelt.sku = ds2.Tables[0].Rows[n]["sku"].ToString();
                            }
                            if (ds2.Tables[0].Rows[n]["productName"] != null)
                            {
                                modelt.productName = ds2.Tables[0].Rows[n]["productName"].ToString();
                            }
                            if (ds2.Tables[0].Rows[n]["shortDesc"] != null)
                            {
                                modelt.shortDesc = ds2.Tables[0].Rows[n]["shortDesc"].ToString();
                            }
                            if (ds2.Tables[0].Rows[n]["unit"] != null)
                            {
                                modelt.unit = ds2.Tables[0].Rows[n]["unit"].ToString();
                            }
                            if (ds2.Tables[0].Rows[n]["weight"] != null && ds2.Tables[0].Rows[n]["weight"].ToString() != "")
                            {
                                modelt.weight = decimal.Parse(ds2.Tables[0].Rows[n]["weight"].ToString());
                            }
                            if (ds2.Tables[0].Rows[n]["description"] != null)
                            {
                                modelt.description = ds2.Tables[0].Rows[n]["description"].ToString();
                            }
                            if (ds2.Tables[0].Rows[n]["seo_title"] != null)
                            {
                                modelt.seo_title = ds2.Tables[0].Rows[n]["seo_title"].ToString();
                            }
                            if (ds2.Tables[0].Rows[n]["seo_keywords"] != null)
                            {
                                modelt.seo_keywords = ds2.Tables[0].Rows[n]["seo_keywords"].ToString();
                            }
                            if (ds2.Tables[0].Rows[n]["seo_description"] != null)
                            {
                                modelt.seo_description = ds2.Tables[0].Rows[n]["seo_description"].ToString();
                            }
                            if (ds2.Tables[0].Rows[n]["focusImgUrl"] != null)
                            {
                                modelt.focusImgUrl = ds2.Tables[0].Rows[n]["productpic"].ToString();
                            }
                            if (ds2.Tables[0].Rows[n]["thumbnailsUrll"] != null)
                            {
                                modelt.thumbnailsUrll = ds2.Tables[0].Rows[n]["thumbnailsUrll"].ToString();
                            }
                            if (ds2.Tables[0].Rows[n]["recommended"] != null && ds2.Tables[0].Rows[n]["recommended"].ToString() != "")
                            {
                                if ((ds2.Tables[0].Rows[n]["recommended"].ToString() == "1") || (ds2.Tables[0].Rows[n]["recommended"].ToString().ToLower() == "true"))
                                {
                                    modelt.recommended = true;
                                }
                                else
                                {
                                    modelt.recommended = false;
                                }
                            }
                            if (ds2.Tables[0].Rows[n]["latest"] != null && ds2.Tables[0].Rows[n]["latest"].ToString() != "")
                            {
                                if ((ds2.Tables[0].Rows[n]["latest"].ToString() == "1") || (ds2.Tables[0].Rows[n]["latest"].ToString().ToLower() == "true"))
                                {
                                    modelt.latest = true;
                                }
                                else
                                {
                                    modelt.latest = false;
                                }
                            }
                            if (ds2.Tables[0].Rows[n]["hotsale"] != null && ds2.Tables[0].Rows[n]["hotsale"].ToString() != "")
                            {
                                if ((ds2.Tables[0].Rows[n]["hotsale"].ToString() == "1") || (ds2.Tables[0].Rows[n]["hotsale"].ToString().ToLower() == "true"))
                                {
                                    modelt.hotsale = true;
                                }
                                else
                                {
                                    modelt.hotsale = false;
                                }
                            }
                            if (ds2.Tables[0].Rows[n]["specialOffer"] != null && ds2.Tables[0].Rows[n]["specialOffer"].ToString() != "")
                            {
                                if ((ds2.Tables[0].Rows[n]["specialOffer"].ToString() == "1") || (ds2.Tables[0].Rows[n]["specialOffer"].ToString().ToLower() == "true"))
                                {
                                    modelt.specialOffer = true;
                                }
                                else
                                {
                                    modelt.specialOffer = false;
                                }
                            }
                            if (ds2.Tables[0].Rows[n]["costPrice"] != null && ds2.Tables[0].Rows[n]["costPrice"].ToString() != "")
                            {
                                modelt.costPrice = decimal.Parse(ds2.Tables[0].Rows[n]["costPrice"].ToString());
                            }
                            if (ds2.Tables[0].Rows[n]["marketPrice"] != null && ds2.Tables[0].Rows[n]["marketPrice"].ToString() != "")
                            {
                                modelt.marketPrice = decimal.Parse(ds2.Tables[0].Rows[n]["marketPrice"].ToString());
                            }
                            if (ds2.Tables[0].Rows[n]["salePrice"] != null && ds2.Tables[0].Rows[n]["salePrice"].ToString() != "")
                            {
                                modelt.salePrice = decimal.Parse(ds2.Tables[0].Rows[n]["salePrice"].ToString());
                            }
                            if (ds2.Tables[0].Rows[n]["upselling"] != null && ds2.Tables[0].Rows[n]["upselling"].ToString() != "")
                            {
                                if ((ds2.Tables[0].Rows[n]["upselling"].ToString() == "1") || (ds2.Tables[0].Rows[n]["upselling"].ToString().ToLower() == "true"))
                                {
                                    modelt.upselling = true;
                                }
                                else
                                {
                                    modelt.upselling = false;
                                }
                            }

                            if (ds2.Tables[0].Rows[n]["addDate"] != null && ds2.Tables[0].Rows[n]["addDate"].ToString() != "")
                            {
                                modelt.addDate = DateTime.Parse(ds2.Tables[0].Rows[n]["addDate"].ToString());
                            }
                            if (ds2.Tables[0].Rows[n]["vistiCounts"] != null && ds2.Tables[0].Rows[n]["vistiCounts"].ToString() != "")
                            {
                                modelt.vistiCounts = int.Parse(ds2.Tables[0].Rows[n]["vistiCounts"].ToString());
                            }
                            if (ds2.Tables[0].Rows[n]["sort_id"] != null && ds2.Tables[0].Rows[n]["sort_id"].ToString() != "")
                            {
                                modelt.sort_id = int.Parse(ds2.Tables[0].Rows[n]["sort_id"].ToString());
                            }
                            if (ds2.Tables[0].Rows[n]["productionDate"] != null && ds2.Tables[0].Rows[n]["productionDate"].ToString() != "")
                            {
                                modelt.productionDate = DateTime.Parse(ds2.Tables[0].Rows[n]["productionDate"].ToString());
                            }
                            if (ds2.Tables[0].Rows[n]["ExpiryEndDate"] != null && ds2.Tables[0].Rows[n]["ExpiryEndDate"].ToString() != "")
                            {
                                modelt.ExpiryEndDate = DateTime.Parse(ds2.Tables[0].Rows[n]["ExpiryEndDate"].ToString());
                            }
                            if (ds2.Tables[0].Rows[n]["updateDate"] != null && ds2.Tables[0].Rows[n]["updateDate"].ToString() != "")
                            {
                                modelt.updateDate = DateTime.Parse(ds2.Tables[0].Rows[n]["updateDate"].ToString());
                            }

                            if (ds2.Tables[0].Rows[n]["catalogId"] != null && ds2.Tables[0].Rows[n]["catalogId"].ToString() != "")
                            {
                                modelt.catalogId = int.Parse(ds2.Tables[0].Rows[n]["catalogId"].ToString());
                            }


                            #endregion
                            models.Add(modelt);
                        }
                        model.order_goods = models;
                    }
                    #endregion
                    retlist.Add(model);
                }


                return(retlist);
            }
            else
            {
                return(null);
            }
        }
Example #2
0
        /// <summary>
        /// 得到一个对象实体列表
        /// </summary>
        public IList<Model.wx_orders> GetModelList(string sqlWhere)
        {
            IList<Model.wx_orders> retlist = new List<Model.wx_orders>();
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select   id,order_no,trade_no,user_id,user_name,payment_id,payment_fee,payment_status,payment_time,express_id,express_no,express_fee,express_status,express_time,accept_name,post_code,telphone,mobile,area,address,message,remark,payable_amount,real_amount,order_amount,point,status,add_time,confirm_time,complete_time,wid,openid ");
            strSql.Append(" from " + databaseprefix + "orders ");
            if (sqlWhere.Trim() != "") {
                strSql.Append(" where "+sqlWhere);
            }

            Model.wx_orders model = new Model.wx_orders();
            DataSet ds = DbHelperSQL.Query(strSql.ToString());
            DataSet ds2 = new DataSet();
            List<Model.wx_shop_product> models = new List<Model.wx_shop_product>();
            if (ds.Tables[0].Rows.Count > 0)
            {
                DataRow dr;
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    model = new Model.wx_orders();
                    dr = ds.Tables[0].Rows[i];
                    #region 父表信息
                    if (dr["id"].ToString() != "")
                    {
                        model.id = int.Parse(dr["id"].ToString());
                    }
                    model.order_no = dr["order_no"].ToString();
                    model.trade_no = dr["trade_no"].ToString();
                    if (dr["user_id"].ToString() != "")
                    {
                        model.user_id = int.Parse(dr["user_id"].ToString());
                    }
                    model.user_name = dr["user_name"].ToString();
                    if (dr["payment_id"].ToString() != "")
                    {
                        model.payment_id = int.Parse(dr["payment_id"].ToString());
                    }
                    if (dr["payment_fee"].ToString() != "")
                    {
                        model.payment_fee = decimal.Parse(dr["payment_fee"].ToString());
                    }
                    if (dr["payment_status"].ToString() != "")
                    {
                        model.payment_status = int.Parse(dr["payment_status"].ToString());
                    }
                    if (dr["payment_time"].ToString() != "")
                    {
                        model.payment_time = DateTime.Parse(dr["payment_time"].ToString());
                    }
                    if (dr["express_id"].ToString() != "")
                    {
                        model.express_id = int.Parse(dr["express_id"].ToString());
                    }
                    model.express_no = dr["express_no"].ToString();
                    if (dr["express_fee"].ToString() != "")
                    {
                        model.express_fee = decimal.Parse(dr["express_fee"].ToString());
                    }
                    if (dr["express_status"].ToString() != "")
                    {
                        model.express_status = int.Parse(dr["express_status"].ToString());
                    }
                    if (dr["express_time"].ToString() != "")
                    {
                        model.express_time = DateTime.Parse(dr["express_time"].ToString());
                    }
                    model.accept_name = dr["accept_name"].ToString();
                    model.post_code = dr["post_code"].ToString();
                    model.telphone = dr["telphone"].ToString();
                    model.mobile = dr["mobile"].ToString();
                    model.area = dr["area"].ToString();
                    model.address = dr["address"].ToString();
                    model.message = dr["message"].ToString();
                    model.remark = dr["remark"].ToString();
                    if (dr["payable_amount"].ToString() != "")
                    {
                        model.payable_amount = decimal.Parse(dr["payable_amount"].ToString());
                    }
                    if (dr["real_amount"].ToString() != "")
                    {
                        model.real_amount = decimal.Parse(dr["real_amount"].ToString());
                    }
                    if (dr["order_amount"].ToString() != "")
                    {
                        model.order_amount = decimal.Parse(dr["order_amount"].ToString());
                    }
                    if (dr["point"].ToString() != "")
                    {
                        model.point = int.Parse(dr["point"].ToString());
                    }
                    if (ds.Tables[0].Rows[0]["status"].ToString() != "")
                    {
                        model.status = int.Parse(dr["status"].ToString());
                    }
                    if (dr["add_time"].ToString() != "")
                    {
                        model.add_time = DateTime.Parse(dr["add_time"].ToString());
                    }
                    if (dr["confirm_time"].ToString() != "")
                    {
                        model.confirm_time = DateTime.Parse(dr["confirm_time"].ToString());
                    }
                    if (dr["complete_time"].ToString() != "")
                    {
                        model.complete_time = DateTime.Parse(dr["complete_time"].ToString());
                    }
                    if (dr["wid"] != null && dr["wid"].ToString() != "")
                    {
                        model.wid = int.Parse(dr["wid"].ToString());
                    }
                    if (dr["openid"] != null)
                    {
                        model.openid = dr["openid"].ToString();
                    }

                    #endregion

                    #region 子表信息
                    StringBuilder strSql2 = new StringBuilder();
                    strSql2.Append("select  (select top 1 original_path from  wx_shop_albums where  productId=p.id) as productpic,p.*,og.quantity,og.real_price from wx_shop_product p right join  dt_order_goods og on p.id=og.goods_id where og.order_id=@id");
                   
                    SqlParameter[] parameters2 = {
					    new SqlParameter("@id", SqlDbType.Int,4)};
                    parameters2[0].Value = model.id;

                    ds2 = DbHelperSQL.Query(strSql2.ToString(), parameters2);
                    if (ds2.Tables[0].Rows.Count > 0)
                    {
                        int count = ds2.Tables[0].Rows.Count;
                        models = new List<Model.wx_shop_product>();
                        Model.wx_shop_product modelt;
                        for (int n = 0; n < count; n++)
                        {
                            modelt = new Model.wx_shop_product();
                            #region 子表,for循环
                           
                            if (ds2.Tables[0].Rows[n]["id"] != null && ds2.Tables[0].Rows[n]["id"].ToString() != "")
                            {
                                modelt.id = int.Parse(ds2.Tables[0].Rows[n]["id"].ToString());
                            }

                            if (ds2.Tables[0].Rows[n]["quantity"] != null && ds2.Tables[0].Rows[n]["quantity"].ToString() != "")
                            {
                                modelt.stock = int.Parse(ds2.Tables[0].Rows[n]["quantity"].ToString());
                            }

                            if (ds2.Tables[0].Rows[n]["wid"] != null && ds2.Tables[0].Rows[n]["wid"].ToString() != "")
                            {
                                modelt.wid = int.Parse(ds2.Tables[0].Rows[n]["wid"].ToString());
                            }
                            if (ds2.Tables[0].Rows[n]["categoryId"] != null && ds2.Tables[0].Rows[n]["categoryId"].ToString() != "")
                            {
                                modelt.categoryId = int.Parse(ds2.Tables[0].Rows[n]["categoryId"].ToString());
                            }
                            if (ds2.Tables[0].Rows[n]["brandId"] != null && ds2.Tables[0].Rows[n]["brandId"].ToString() != "")
                            {
                                modelt.brandId = int.Parse(ds2.Tables[0].Rows[n]["brandId"].ToString());
                            }
                            if (ds2.Tables[0].Rows[n]["sku"] != null)
                            {
                                modelt.sku = ds2.Tables[0].Rows[n]["sku"].ToString();
                            }
                            if (ds2.Tables[0].Rows[n]["productName"] != null)
                            {
                                modelt.productName = ds2.Tables[0].Rows[n]["productName"].ToString();
                            }
                            if (ds2.Tables[0].Rows[n]["shortDesc"] != null)
                            {
                                modelt.shortDesc = ds2.Tables[0].Rows[n]["shortDesc"].ToString();
                            }
                            if (ds2.Tables[0].Rows[n]["unit"] != null)
                            {
                                modelt.unit = ds2.Tables[0].Rows[n]["unit"].ToString();
                            }
                            if (ds2.Tables[0].Rows[n]["weight"] != null && ds2.Tables[0].Rows[n]["weight"].ToString() != "")
                            {
                                modelt.weight = decimal.Parse(ds2.Tables[0].Rows[n]["weight"].ToString());
                            }
                            if (ds2.Tables[0].Rows[n]["description"] != null)
                            {
                                modelt.description = ds2.Tables[0].Rows[n]["description"].ToString();
                            }
                            if (ds2.Tables[0].Rows[n]["seo_title"] != null)
                            {
                                modelt.seo_title = ds2.Tables[0].Rows[n]["seo_title"].ToString();
                            }
                            if (ds2.Tables[0].Rows[n]["seo_keywords"] != null)
                            {
                                modelt.seo_keywords = ds2.Tables[0].Rows[n]["seo_keywords"].ToString();
                            }
                            if (ds2.Tables[0].Rows[n]["seo_description"] != null)
                            {
                                modelt.seo_description = ds2.Tables[0].Rows[n]["seo_description"].ToString();
                            }
                            if (ds2.Tables[0].Rows[n]["focusImgUrl"] != null)
                            {
                                modelt.focusImgUrl = ds2.Tables[0].Rows[n]["productpic"].ToString();
                            }
                            if (ds2.Tables[0].Rows[n]["thumbnailsUrll"] != null)
                            {
                                modelt.thumbnailsUrll = ds2.Tables[0].Rows[n]["thumbnailsUrll"].ToString();
                            }
                            if (ds2.Tables[0].Rows[n]["recommended"] != null && ds2.Tables[0].Rows[n]["recommended"].ToString() != "")
                            {
                                if ((ds2.Tables[0].Rows[n]["recommended"].ToString() == "1") || (ds2.Tables[0].Rows[n]["recommended"].ToString().ToLower() == "true"))
                                {
                                    modelt.recommended = true;
                                }
                                else
                                {
                                    modelt.recommended = false;
                                }
                            }
                            if (ds2.Tables[0].Rows[n]["latest"] != null && ds2.Tables[0].Rows[n]["latest"].ToString() != "")
                            {
                                if ((ds2.Tables[0].Rows[n]["latest"].ToString() == "1") || (ds2.Tables[0].Rows[n]["latest"].ToString().ToLower() == "true"))
                                {
                                    modelt.latest = true;
                                }
                                else
                                {
                                    modelt.latest = false;
                                }
                            }
                            if (ds2.Tables[0].Rows[n]["hotsale"] != null && ds2.Tables[0].Rows[n]["hotsale"].ToString() != "")
                            {
                                if ((ds2.Tables[0].Rows[n]["hotsale"].ToString() == "1") || (ds2.Tables[0].Rows[n]["hotsale"].ToString().ToLower() == "true"))
                                {
                                    modelt.hotsale = true;
                                }
                                else
                                {
                                    modelt.hotsale = false;
                                }
                            }
                            if (ds2.Tables[0].Rows[n]["specialOffer"] != null && ds2.Tables[0].Rows[n]["specialOffer"].ToString() != "")
                            {
                                if ((ds2.Tables[0].Rows[n]["specialOffer"].ToString() == "1") || (ds2.Tables[0].Rows[n]["specialOffer"].ToString().ToLower() == "true"))
                                {
                                    modelt.specialOffer = true;
                                }
                                else
                                {
                                    modelt.specialOffer = false;
                                }
                            }
                            if (ds2.Tables[0].Rows[n]["costPrice"] != null && ds2.Tables[0].Rows[n]["costPrice"].ToString() != "")
                            {
                                modelt.costPrice = decimal.Parse(ds2.Tables[0].Rows[n]["costPrice"].ToString());
                            }
                            if (ds2.Tables[0].Rows[n]["marketPrice"] != null && ds2.Tables[0].Rows[n]["marketPrice"].ToString() != "")
                            {
                                modelt.marketPrice = decimal.Parse(ds2.Tables[0].Rows[n]["marketPrice"].ToString());
                            }
                            if (ds2.Tables[0].Rows[n]["salePrice"] != null && ds2.Tables[0].Rows[n]["salePrice"].ToString() != "")
                            {
                                modelt.salePrice = decimal.Parse(ds2.Tables[0].Rows[n]["salePrice"].ToString());
                            }
                            if (ds2.Tables[0].Rows[n]["upselling"] != null && ds2.Tables[0].Rows[n]["upselling"].ToString() != "")
                            {
                                if ((ds2.Tables[0].Rows[n]["upselling"].ToString() == "1") || (ds2.Tables[0].Rows[n]["upselling"].ToString().ToLower() == "true"))
                                {
                                    modelt.upselling = true;
                                }
                                else
                                {
                                    modelt.upselling = false;
                                }
                            }
                            
                            if (ds2.Tables[0].Rows[n]["addDate"] != null && ds2.Tables[0].Rows[n]["addDate"].ToString() != "")
                            {
                                modelt.addDate = DateTime.Parse(ds2.Tables[0].Rows[n]["addDate"].ToString());
                            }
                            if (ds2.Tables[0].Rows[n]["vistiCounts"] != null && ds2.Tables[0].Rows[n]["vistiCounts"].ToString() != "")
                            {
                                modelt.vistiCounts = int.Parse(ds2.Tables[0].Rows[n]["vistiCounts"].ToString());
                            }
                            if (ds2.Tables[0].Rows[n]["sort_id"] != null && ds2.Tables[0].Rows[n]["sort_id"].ToString() != "")
                            {
                                modelt.sort_id = int.Parse(ds2.Tables[0].Rows[n]["sort_id"].ToString());
                            }
                            if (ds2.Tables[0].Rows[n]["productionDate"] != null && ds2.Tables[0].Rows[n]["productionDate"].ToString() != "")
                            {
                                modelt.productionDate = DateTime.Parse(ds2.Tables[0].Rows[n]["productionDate"].ToString());
                            }
                            if (ds2.Tables[0].Rows[n]["ExpiryEndDate"] != null && ds2.Tables[0].Rows[n]["ExpiryEndDate"].ToString() != "")
                            {
                                modelt.ExpiryEndDate = DateTime.Parse(ds2.Tables[0].Rows[n]["ExpiryEndDate"].ToString());
                            }
                            if (ds2.Tables[0].Rows[n]["updateDate"] != null && ds2.Tables[0].Rows[n]["updateDate"].ToString() != "")
                            {
                                modelt.updateDate = DateTime.Parse(ds2.Tables[0].Rows[n]["updateDate"].ToString());
                            }

                            if (ds2.Tables[0].Rows[n]["catalogId"] != null && ds2.Tables[0].Rows[n]["catalogId"].ToString() != "")
                            {
                                modelt.catalogId = int.Parse(ds2.Tables[0].Rows[n]["catalogId"].ToString());
                            }
                          

                            #endregion
                            models.Add(modelt);

                        }
                        model.order_goods = models;
                    }
                    #endregion
                    retlist.Add(model);
                }
               

                return retlist;
            }
            else
            {
                return null;
            }
        }