예제 #1
0
 public string Save(Product product)
 {
     product.Replace4MySQL();
     StringBuilder strSql = new StringBuilder("insert into product( ");
     strSql.Append(" `product_id`,`brand_id`,`product_vendor_code`,");
     strSql.Append(" `product_name`,`product_price_list`,`product_spec`,`spec_title_1`,`spec_title_2`,");
     strSql.Append(" `product_freight_set`,`product_buy_limit`,`product_status`,`product_hide`,");
     strSql.Append(" `product_mode`,`product_sort`,`product_start`,`product_end`,`page_content_1`,`page_content_2`,");
     strSql.Append(" `page_content_3`,`product_keywords`,`product_recommend`,`product_password`,");
     strSql.Append(" `product_total_click`,`expect_time`,`product_image`,`product_createdate`,`product_updatedate`,");
     strSql.Append(" `product_ipfrom`,`goods_area`,`goods_image1`,`goods_image2`,`city`,");
     strSql.Append(" `bag_check_money`,`combination`,`bonus_percent`,`default_bonus_percent`,`bonus_percent_start`,`bonus_percent_end`,`tax_type`,`cate_id`,");
     strSql.Append(" `fortune_quota`,`fortune_freight`,`ignore_stock`,`shortage`,`stock_alarm`,`price_type`,`user_id`,`show_listprice`,`expect_msg`) values ({0},");
     strSql.AppendFormat(" '{0}','{1}',", product.Brand_Id, product.Product_Vendor_Code);
     strSql.AppendFormat(" '{0}','{1}','{2}','{3}','{4}',", product.Product_Name, product.Product_Price_List, product.Product_Spec, product.Spec_Title_1, product.Spec_Title_2);
     strSql.AppendFormat(" '{0}','{1}','{2}','{3}',", product.Product_Freight_Set, product.Product_Buy_Limit, product.Product_Status, product.Product_Hide == false ? 0 : 1);
     strSql.AppendFormat(" '{0}','{1}','{2}','{3}','{4}','{5}',", product.Product_Mode, product.Product_Sort, product.Product_Start, product.Product_End, product.Page_Content_1, product.Page_Content_2);
     strSql.AppendFormat(" '{0}','{1}','{2}','{3}',", product.Page_Content_3, product.Product_Keywords, product.Product_Recommend, product.Product_Password);
     strSql.AppendFormat(" '{0}','{1}','{2}','{3}','{4}',", product.Product_Total_Click, product.Expect_Time, product.Product_Image, product.Product_Createdate, product.Product_Updatedate);
     strSql.AppendFormat(" '{0}','{1}','{2}','{3}','{4}',", product.Product_Ipfrom, product.Goods_Area, product.Goods_Image1, product.Goods_Image2, product.City);
     strSql.AppendFormat(" '{0}','{1}','{2}','{3}','{4}',", product.Bag_Check_Money, product.Combination, product.Bonus_Percent, product.Default_Bonus_Percent, product.Bonus_Percent_Start);
     strSql.AppendFormat(" '{0}','{1}','{2}','{3}','{4}',", product.Bonus_Percent_End, product.Tax_Type, product.Cate_Id, product.Fortune_Quota, product.Fortune_Freight);
     strSql.AppendFormat(" '{0}','{1}','{2}','{3}',", product.Ignore_Stock, product.Shortage, product.stock_alarm, product.Price_type);
     strSql.AppendFormat(" '{0}','{1}','{2}');select @@identity;", product.user_id, product.show_listprice, product.expect_msg);
     return strSql.ToString();
 }
예제 #2
0
        /// <summary>
        /// 編輯商品詳情文字
        /// </summary>
        /// <param name="p"></param>
        /// <returns></returns>
        public int UpdateProductDeatail(Product p)
        {
            StringBuilder sql = new StringBuilder();
            p.Replace4MySQL();
            sql.AppendFormat(@"UPDATE product SET product_detail_text='{0}' ,detail_created='{1}',detail_createdate='{2}',detail_update='{3}',detail_updatedate='{4}'  ",
                p.product_detail_text, p.detail_created, Common.CommonFunction.DateTimeToString(p.detail_createdate), p.detail_update, Common.CommonFunction.DateTimeToString(p.detail_updatedate));

            sql.AppendFormat(@"  WHERE product_id='{0}'; ", p.Product_Id);
            try
            {
                return _dbAccess.execCommand(sql.ToString());
            }
            catch (Exception ex)
            {
                throw new Exception("ProductDao-->UpdateProductDeatail" + ex.Message + sql.ToString(), ex);
            }
        }