public HttpResponseBase SaveBaseInfo()
        {
            string json = "{success:true}";
            int transportDays = -1;///初始化
            uint product_mode = 0;
            uint brand_id = 0;
            try
            {
                string prod_name = (Request.Form["prod_name"] ?? "").Trim();
                string prod_sz = (Request.Form["prod_sz"] ?? "").Trim();
                if (!Product.CheckProdName(prod_name) || !Product.CheckProdName(prod_sz))
                {
                    json = "{success:false,msg:'" + Resources.Product.FORBIDDEN_CHARACTER + "'}";
                    this.Response.Clear();
                    this.Response.Write(json);
                    this.Response.End();
                    return this.Response;
                }
                ProductTemp pTemp = new ProductTemp();
                _productTempMgr = new ProductTempMgr(connectionString);
                _productMgr = new ProductMgr(connectionString);
                Caller _caller = (Session["caller"] as Caller);
                Product p = new Product();
             

                ///add by wwei0216w 2015/8/24
                ///根據product_mode查找供應商對應的自出,寄倉,調度欄位,如果為0則不予保存
                 brand_id = uint.Parse(Request.Form["brand_id"]?? "0");
                 product_mode = uint.Parse(Request.Form["product_mode"]??"0");///獲得product_mode
                 string msg = "寄倉";
                IVendorImplMgr _vendorMgr = new VendorMgr(connectionString);
                List<Vendor> vendorList = _vendorMgr.GetArrayDaysInfo(brand_id);
                if (vendorList.Count > 0)
                {
                    switch (product_mode)
                    {
                        case 1:
                            transportDays = vendorList.FirstOrDefault<Vendor>().self_send_days;
                            msg = "自出";
                            break;
                        case 2:
                            transportDays = vendorList.FirstOrDefault<Vendor>().stuff_ware_days;
                            msg = "寄倉";
                            break;
                        case 3:
                            msg = "調度";
                            transportDays = vendorList.FirstOrDefault<Vendor>().dispatch_days;
                            break;
                        default:
                            break;
                    }
                }

                if (transportDays == 0)
                {
                    json = "{success:false,msg:'" + msg + Resources.Product.TRANSPORT_DAYS + "'}";
                    this.Response.Clear();
                    this.Response.Write(json);
                    this.Response.End();
                    return this.Response;
                }

                //查詢product表。
                if (Request.Params["product_id"] != "")
                {
                    p.Product_Id = uint.Parse(Request.Params["product_id"]);
                    p = _productMgr.Query(p)[0];
                }


                uint product_sort = 0;
                string product_vendor_code = "";
                uint product_start = 0;
                uint product_end = 0;
                uint expect_time = 0;
                uint product_freight_set = 0;
                int tax_type = 0;
                uint combination = 0;
                string expect_msg = string.Empty;
                int show_in_deliver = 0;
                int process_type = 0;
                int product_type = 0;
                uint recommedde_jundge = 0;
                uint recommedde_expend_day = 0;
                string recommededcheckall = string.Empty;
                int purchase_in_advance = 0;
                uint purchase_in_advance_start = 0;
                uint purchase_in_advance_end = 0;
                //庫存
                if (!string.IsNullOrEmpty(Request.Params["ig_sh_InsertValue"]))
                {
                    string[] Value = Request.Params["ig_sh_InsertValue"].Split(',');
                    pTemp.Ignore_Stock = int.Parse(Value[0]);
                    pTemp.Shortage = int.Parse(Value[1]);
                    pTemp.stock_alarm = int.Parse(Value[2]);

                    if (Request.Params["product_id"] != "")
                    {
                        p.Ignore_Stock = int.Parse(Value[0]);
                        p.Shortage = int.Parse(Value[1]);
                        p.stock_alarm = int.Parse(Value[2]);
                    }
                }
                else
                {
                    //brand_id = uint.Parse(Request.Form["brand_id"]);
                    product_sort = uint.Parse(Request.Form["product_sort"]);
                    product_vendor_code = Request.Form["product_vendor_code"];
                    product_start = uint.Parse(CommonFunction.GetPHPTime(Request.Form["product_start"]).ToString());
                    product_end = uint.Parse(CommonFunction.GetPHPTime(Request.Form["product_end"]).ToString());
                    expect_time = uint.Parse(CommonFunction.GetPHPTime(Request.Form["expect_time"]).ToString());
                    product_freight_set = uint.Parse(Request.Form["product_freight_set"]);
                    tax_type = int.Parse(Request.Form["tax_type"]);
                    combination = uint.Parse(Request.Form["combination"]);
                    //product_mode = uint.Parse(Request.Params["product_mode"]);
                    expect_msg = Request.Form["expect_msg"] ?? "";
                    //商品新增欄位 add by  xiangwang0413w 2014/09/15
                    show_in_deliver = int.Parse(Request.Form["show_in_deliver"]);
                    process_type = int.Parse(Request.Form["process_type"]);
                    product_type = int.Parse(Request.Form["product_type"]);
                    //add by dongya 2015/08/26 
                    recommedde_jundge = uint.Parse(Request.Form["recommedde_jundge"]);//是否選擇了推薦商品屬性 1 表示推薦
                    recommedde_expend_day = 0;
                    if (recommedde_jundge == 1)
                    {
                        if (!string.IsNullOrEmpty(Request.Params["recommededcheckall"]))
                        {
                            recommededcheckall = Request.Params["recommededcheckall"].ToString().TrimEnd(',');//選擇的所有的月數
                        }
                        recommedde_expend_day = uint.Parse(Request.Form["recommedde_expend_day"]);
                    }
                    //add by dongya 2015/09/02 
                    purchase_in_advance = Convert.ToInt32(Request.Form["purchase_in_advance"]);
                    purchase_in_advance_start = uint.Parse(Request.Form["purchase_in_advance_start"]);
                    purchase_in_advance_end = uint.Parse(Request.Form["purchase_in_advance_end"]);
                }

             

                if (string.IsNullOrEmpty(Request.Params["product_id"]))
                {
                    pTemp.Brand_Id = brand_id;
                    pTemp.Prod_Name = prod_name;
                    pTemp.Prod_Sz = prod_sz;
                    pTemp.Product_Name = pTemp.GetProductName();

                    pTemp.Product_Sort = product_sort;
                    pTemp.Product_Vendor_Code = product_vendor_code;
                    pTemp.Product_Start = product_start;
                    pTemp.Product_End = product_end;
                    pTemp.Expect_Time = expect_time;
                    pTemp.Product_Freight_Set = product_freight_set;
                    pTemp.Product_Mode = product_mode;
                    pTemp.Tax_Type = tax_type;
                    pTemp.Combination = combination;
                    pTemp.expect_msg = expect_msg;
                    pTemp.Combo_Type = COMBO_TYPE;
                    pTemp.Create_Channel = 1;// 1:後台管理者(manage_user) edit by xiagnwang0413w 2014/08/09
                    //商品新增欄位 add by  xiangwang0413w 2014/09/15
                    pTemp.Show_In_Deliver = show_in_deliver;
                    pTemp.Process_Type = process_type;
                    pTemp.Product_Type = product_type;

                    //add by zhuoqin0830w  增加新的欄位  2015/03/17
                    pTemp.Deliver_Days = 3;
                    pTemp.Min_Purchase_Amount = 1;
                    pTemp.Safe_Stock_Amount = 1;
                    pTemp.Extra_Days = 0;
                    //add by dongya
                    pTemp.recommedde_jundge = recommedde_jundge;//推薦商品 1表示推薦 0表示不推薦
                    pTemp.months = recommededcheckall;//以1,3,這樣的形式顯示
                    pTemp.expend_day = recommedde_expend_day;
                    //add by dongya 2015/09/02 
                    pTemp.purchase_in_advance = purchase_in_advance;
                    pTemp.purchase_in_advance_start = purchase_in_advance_start;
                    pTemp.purchase_in_advance_end = purchase_in_advance_end;

                    if (!string.IsNullOrEmpty(Request.Form["OldProductId"]))
                    {
                        pTemp.Product_Id = Request.Form["OldProductId"];
                    }

                    //查找臨時表是否存在數據,存在:更新,不存在插入
                    pTemp.Writer_Id = _caller.user_id;
                    pTemp.Product_Status = 0;
                    if (!string.IsNullOrEmpty(Request.Form["OldProductId"]))
                    {
                        pTemp.Product_Id = Request.Form["OldProductId"];
                    }

                   

                    ProductTemp query = new ProductTemp { Writer_Id = pTemp.Writer_Id, Combo_Type = COMBO_TYPE, Product_Id = pTemp.Product_Id };
                    ProductTemp pTempList = _productTempMgr.GetProTemp(query);
                    if (pTempList == null)
                    {
                        //插入
                        int result = 0;
                        result = _productTempMgr.baseInfoSave(pTemp);
                        if (result >0)
                        {
                            json = "{success:true}";
                        }
                        else
                        {
                            json = "{success:false}";
                        }
                    }
                    else
                    {

                        //更新
                        if (!string.IsNullOrEmpty(Request.Params["ig_sh_InsertValue"]))
                        {
                            _productTempMgr.ProductTempUpdate(pTemp, "stock");
                        }
                        else
                        {
                            if (pTemp.Product_Mode != 2)
                            {
                                pTemp.Bag_Check_Money = 0;
                            }
                            else
                            {
                                pTemp.Bag_Check_Money = pTempList.Bag_Check_Money;
                            }
                            _productTempMgr.baseInfoUpdate(pTemp);
                        }

                    }
                }
                else
                {
                   
                    if (string.IsNullOrEmpty(Request.Params["ig_sh_InsertValue"]))
                    {
                        p.Brand_Id = brand_id;
                        p.Prod_Name = prod_name;
                        p.Prod_Sz = prod_sz;
                        p.Product_Name = p.GetProductName();

                        p.Product_Sort = product_sort;
                        p.Product_Vendor_Code = product_vendor_code;
                        p.Product_Start = product_start;
                        p.Product_End = product_end;
                        p.Expect_Time = expect_time;
                        p.Product_Freight_Set = product_freight_set;
                        p.Product_Mode = product_mode;
                        p.Tax_Type = tax_type;
                        p.expect_msg = expect_msg;//預留商品信息
                        p.Combination = combination;
                        //商品新增欄位 add by  xiangwang0413w 2014/09/15
                        p.Show_In_Deliver = show_in_deliver;
                        p.Process_Type = process_type;
                        p.Product_Type = product_type;

                        //add by zhuoqin0830w  增加新的欄位  2015/03/17
                        p.Deliver_Days = 3;
                        p.Min_Purchase_Amount = 1;
                        p.Safe_Stock_Amount = 1;
                        p.Extra_Days = 0;
                        p.off_grade = int.Parse(Request.Form["off-grade"]);
                        //add by dongya
                        p.recommedde_jundge = recommedde_jundge;//推薦商品 1表示推薦 0表示不推薦
                        p.months = recommededcheckall;//以1,3,這樣的形式顯示
                        p.expend_day = recommedde_expend_day;
                        //add by dongya 0410j
                        p.purchase_in_advance = purchase_in_advance;
                        p.purchase_in_advance_start = purchase_in_advance_start;
                        p.purchase_in_advance_end = purchase_in_advance_end;
                        //更新正式表
                        p.Product_Id = uint.Parse(Request.Params["product_id"]);
                        if (p.Product_Mode != 2)
                        {
                            p.Bag_Check_Money = 0;
                        }

                        #region ScheduleRelation
                        int scheduleId = int.Parse(Request.Form["schedule_id"]);
                        IScheduleRelationImplMgr _srMgr = new ScheduleRelationMgr(connectionString);
                        _srMgr.Save(new ScheduleRelation { relation_table = "product", relation_id = (int)p.Product_Id, schedule_id = scheduleId });
                        #endregion

                    }
                    _tableHistoryMgr = new TableHistoryMgr(connectionString);
                    _productMgr = new ProductMgr(connectionString);
                    _categorySetMgr = new ProductCategorySetMgr(connectionString);
                    ArrayList aList = new ArrayList();
                    aList.Add(_productMgr.Update(p));
                    aList.Add(_categorySetMgr.UpdateBrandId(new ProductCategorySet { Product_Id = p.Product_Id, Brand_Id = p.Brand_Id })); //add by wwei0216w 2015/2/24 品牌名稱變更后,product_category_set表所對應的品牌名稱也需要更新

                    _functionMgr = new FunctionMgr(connectionString);
                    string function = Request.Params["function"] ?? "";
                    Function fun = _functionMgr.QueryFunction(function, "/ProductCombo");
                    int functionid = fun == null ? 0 : fun.RowId;
                    HistoryBatch batch = new HistoryBatch { functionid = functionid };
                    batch.batchno = Request.Params["batch"] ?? "";
                    batch.kuser = (Session["caller"] as Caller).user_email;

                    if (_tableHistoryMgr.SaveHistory<Product>(p, batch, aList))
                    {
                        #region add by zhuoqin0830w  2015/06/25  判斷修改的商品是否是失格商品  1為失格 0為正常
                        if (!string.IsNullOrEmpty(Request.Params["product_id"]))
                        {
                            _productMgr.UpdateOff_Grade(p.Product_Id, p.off_grade);
                        }
                        #endregion
                        //add by wwei0216 2015/1/9 刪除不符合條件的物品匹配模式
                        if (!p.CheckdStoreFreight())
                        {
                            IProductDeliverySetImplMgr _productDeliverySetMgr = new ProductDeliverySetMgr(connectionString);
                            _productDeliverySetMgr.Delete(
                                new ProductDeliverySet { Freight_big_area = 1, Freight_type = 12 }, p.Product_Id);
                        }

                        #region 推薦商品屬性插入/修改recommended_product_attribute表中做記錄 add by dongya 2015/09/30 ----目前只針對單一商品
                        RecommendedProductAttributeMgr rProductAttributeMgr = new RecommendedProductAttributeMgr(connectionString);
                        RecommendedProductAttribute rPA = new RecommendedProductAttribute();
                        rPA.product_id = Convert.ToUInt32(p.Product_Id);
                        rPA.time_start = 0;
                        rPA.time_end = 0;
                        rPA.expend_day = recommedde_expend_day;
                        rPA.months = recommededcheckall;
                        rPA.combo_type = 2;//組合商品
                        //首先判斷表中是否對該product_id設置為推薦
                        int productId = Convert.ToInt32(rPA.product_id);
                        if (rProductAttributeMgr.GetMsgByProductId(productId) > 0)//如果大於0,表示推薦表中存在數據
                        {
                            if (recommedde_jundge == 1)//==1表示推薦 
                            {
                                rProductAttributeMgr.Update(rPA);
                            }
                            else if (recommedde_jundge == 0)//==0表示不推薦 
                            {
                                rProductAttributeMgr.Delete(productId);
                            }
                        }
                        else
                        {
                            if (recommedde_jundge == 1)//==1表示推薦 
                            {
                                rProductAttributeMgr.Save(rPA);
                            }
                        }
                        #endregion
                        json = "{success:true,msg:'" + Resources.Product.SAVE_SUCCESS + "'}";
                    }
                    else
                    {
                        json = "{success:false,msg:'" + Resources.Product.SAVE_FAIL + "'}";
                    }
                }
            }
            catch (Exception ex)
            {
                Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
                logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
                logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                log.Error(logMessage);
                json = "{success:false,msg:'" + Resources.Product.SAVE_FAIL + "'}";
            }

            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();
            return this.Response;
        }
Example #2
0
        /// <summary>
        /// 刪除臨時表
        /// </summary>
        /// <returns></returns>
        public bool DeleteTemp(int writerId, int combo_type, string product_Id)
        {
            try
            {
                ArrayList sqls = new ArrayList();
                sqls.Add(Delete(new ProductTemp { Writer_Id = writerId, Combo_Type = combo_type, Product_Id = product_Id.ToString() }));

                //edit by xiangwang0413w 2015/03/11
                ICourseProductTempImplMgr _courProdTempMgr = new CourseProductTempMgr("");
                _courProdTempMgr.DeleteSql(new CourseProductTemp { Writer_Id = writerId , Product_Id = uint.Parse(product_Id)});

                ProductItemTempMgr proItemTempMgr = new ProductItemTempMgr("");
                sqls.Add(proItemTempMgr.DeleteSql(new ProductItemTemp { Writer_Id = writerId, Product_Id = product_Id }));

                //edit by xiangwang0413w 2015/03/11
                ICourseDetailItemTempImplMgr _courDetaItemTempMgr = new CourseDetailItemTempMgr("");
                sqls.Add(_courDetaItemTempMgr.DeleteSql(writerId));

                //add by xiangwang0413w 2014/11/06
                ProductDeliverySetTempMgr proDelSetTempMgr = new ProductDeliverySetTempMgr("");
                sqls.Add(proDelSetTempMgr.Delete(new ProductDeliverySetTemp { Writer_Id = writerId,Combo_Type = combo_type, Product_id = int.Parse(product_Id) }));

                ProductNoticeSetTempMgr proNoticeSetTempMgr = new ProductNoticeSetTempMgr("");
                sqls.Add(proNoticeSetTempMgr.Delete(new ProductNoticeSetTemp { Writer_Id = writerId, Combo_Type = combo_type, product_id = product_Id }));

                ProductTagSetTempMgr proTagSetTempMgr = new ProductTagSetTempMgr("");
                sqls.Add(proTagSetTempMgr.Delete(new ProductTagSetTemp { Writer_Id = writerId, Combo_Type = combo_type, product_id = product_Id }));

                ProductSpecTempMgr proSpecTempMgr = new ProductSpecTempMgr("");
                sqls.Add(proSpecTempMgr.TempDelete(new ProductSpecTemp { Writer_Id = writerId, product_id = product_Id }));

                ProductPictureTempImplMgr proPicTempMgr = new ProductPictureTempImplMgr("");
                sqls.Add(proPicTempMgr.Delete(new ProductPictureTemp { writer_Id = writerId, combo_type = combo_type, product_id = product_Id },1)); //刪除說明圖
                sqls.Add(proPicTempMgr.Delete(new ProductPictureTemp { writer_Id = writerId, combo_type = combo_type, product_id = product_Id },2)); //刪除APP圖

                ProductCategorySetTempMgr proCateSetTempMgr = new ProductCategorySetTempMgr("");
                sqls.Add(proCateSetTempMgr.TempDelete(new ProductCategorySetTemp { Writer_Id = writerId, Combo_Type = combo_type, Product_Id = product_Id }));

                ItemPriceTempMgr itemPriceMgr = new ItemPriceTempMgr("");
                sqls.Add(itemPriceMgr.Delete(product_Id, combo_type, writerId));

                PriceMasterTempMgr priceMasterTempMgr = new PriceMasterTempMgr("");
                sqls.Add(priceMasterTempMgr.Delete(new PriceMasterTemp { writer_Id = writerId, product_id = product_Id, combo_type = combo_type }));

                ProductComboTempMgr proComboTempMgr = new ProductComboTempMgr("");
                sqls.Add(proComboTempMgr.TempDelete(new ProductComboTemp { Writer_Id = writerId, Parent_Id = product_Id }));
                //add by dongya 2015/08/25 14:03 根據writeid和productId刪除商品推薦屬性臨時表中信息  複製的邏輯:首先是刪除臨時表中的數據,然後把數據插入到臨時表;
                RecommendedProductAttributeMgr rmendeAttribute =new RecommendedProductAttributeMgr("");
                sqls.Add(rmendeAttribute.TempDelete(writerId,Convert.ToInt32(product_Id),combo_type));
                MySqlDao mySqlDao = new MySqlDao(connStr);
                return mySqlDao.ExcuteSqls(sqls);
            }
            catch (Exception ex)
            {
                throw new Exception("ProductTempMg.DeleteTemp-->" + ex.Message, ex);
            }
        }
Example #3
0
        public bool CopyProduct(int writerId, int combo_type, string product_Id)
        {
            try
            {
                if (DeleteTemp(writerId, combo_type, product_Id)) 
                {
                    ArrayList sqls = new ArrayList();
                    var prodTemp = new ProductTemp { Writer_Id = writerId, Combo_Type = combo_type, Product_Id = product_Id, Create_Channel = 1 };
                    sqls.Add(SaveFromPro(prodTemp));

                    //add by xiangwang0413w 2014/11/06
                    ProductDeliverySetTempMgr proDelSetTempMgr = new ProductDeliverySetTempMgr("");
                    sqls.Add(proDelSetTempMgr.SaveFromProDeliverySet(new ProductDeliverySetTemp { Writer_Id = writerId, Combo_Type = combo_type, Product_id = int.Parse(product_Id) }));

                    ProductNoticeSetTempMgr proNoticeSetTempMgr = new ProductNoticeSetTempMgr("");
                    sqls.Add(proNoticeSetTempMgr.SaveFromProNotice(new ProductNoticeSetTemp { Writer_Id = writerId, Combo_Type = combo_type, product_id = product_Id }));

                    ProductTagSetTempMgr proTagSetTempMgr = new ProductTagSetTempMgr("");
                    sqls.Add(proTagSetTempMgr.SaveFromTag(new ProductTagSetTemp { Writer_Id = writerId, Combo_Type = combo_type, product_id = product_Id }));

                    ProductPictureTempImplMgr proPicTempMgr = new ProductPictureTempImplMgr("");
                    sqls.Add(proPicTempMgr.SaveFromProPicture(new ProductPictureTemp { writer_Id = writerId, combo_type = combo_type, product_id = product_Id },1));//複製商品說明圖
                    sqls.Add(proPicTempMgr.SaveFromProPicture(new ProductPictureTemp { writer_Id = writerId, combo_type = combo_type, product_id = product_Id }, 2));//複製手機app圖

                    ProductCategorySetTempMgr proCateSetTempMgr = new ProductCategorySetTempMgr("");
                    sqls.Add(proCateSetTempMgr.SaveFromCategorySet(new ProductCategorySetTemp { Writer_Id = writerId, Combo_Type = combo_type, Product_Id = product_Id }));

                    PriceMasterTempMgr priceMasterTempMgr = new PriceMasterTempMgr("");

                    ArrayList specs = new ArrayList();
                    if (combo_type == 1)//單一商品
                    {
                        sqls.Add(priceMasterTempMgr.SaveFromPriceMaster(new PriceMasterTemp { writer_Id = writerId, product_id = product_Id, combo_type = combo_type }));
                        //add by dongya 2015/08/25 添加信息到商品推薦臨時表  用來複製商品 
                        RecommendedProductAttributeMgr recommendAttributeMgr = new RecommendedProductAttributeMgr("");
                        sqls.Add(recommendAttributeMgr.SaveRecommendedProductAttributSet(new RecommendedRroductAttributeTemp{write_id = writerId, product_id = UInt32.Parse(product_Id),combo_type=combo_type}));
                        ProductItemTempMgr proItemTempMgr = new ProductItemTempMgr("");
                        var prodItemTemp = new ProductItemTemp { Writer_Id = writerId, Product_Id = product_Id };

                        sqls.Add(proItemTempMgr.SaveFromProItem(prodItemTemp));

                        ProductSpecMgr proSpecMgr = new ProductSpecMgr(connStr);
                        List<ProductSpec> proSpecs = proSpecMgr.Query(new ProductSpec { product_id = uint.Parse(product_Id) });
                        if (proSpecs != null)
                        {
                            ProductSpecTempMgr proSpecTempMgr = new ProductSpecTempMgr("");
                            StringBuilder str;
                            foreach (var item in proSpecs)
                            {
                                sqls.Add(proSpecTempMgr.SaveFromSpec(new ProductSpecTemp { Writer_Id = writerId, product_id = product_Id, spec_id = item.spec_id }));

                                str = new StringBuilder();
                                str.Append(proSpecTempMgr.UpdateCopySpecId(new ProductSpecTemp { Writer_Id = writerId, product_id = product_Id, spec_id = item.spec_id }));
                                str.Append(proItemTempMgr.UpdateCopySpecId(new ProductItemTemp { Writer_Id = writerId, Product_Id = product_Id, Spec_Id_1 = item.spec_id, Spec_Id_2 = item.spec_id }));
                                specs.Add(str.ToString());
                            }
                        }
                        return _pTempDao.CopyProduct(sqls, specs, null, null, null);
                    }
                    else
                    {
                        PriceMasterMgr priceMasterMgr = new PriceMasterMgr("");
                        string selMaster = priceMasterMgr.SelectChild(new PriceMaster { product_id = uint.Parse(product_Id) });

                        string moveMaster = priceMasterTempMgr.SaveFromPriceMasterByMasterId(new PriceMasterTemp { combo_type = combo_type, writer_Id = writerId });

                        ItemPriceTempMgr itemPriceTempMgr = new ItemPriceTempMgr("");
                        string movePrice = itemPriceTempMgr.SaveFromItemPriceByMasterId();

                        //add by dongya 2015/08/25 添加信息到商品推薦臨時表  用來複製商品 
                        RecommendedProductAttributeMgr recommendAttributeMgr = new RecommendedProductAttributeMgr("");
                        sqls.Add(recommendAttributeMgr.SaveRecommendedProductAttributSet(new RecommendedRroductAttributeTemp { write_id = writerId, product_id = UInt32.Parse(product_Id),combo_type=combo_type }));
                        ProductComboTempMgr proComboTempMgr = new ProductComboTempMgr("");
                        sqls.Add(proComboTempMgr.SaveFromCombo(new ProductComboTemp { Writer_Id = writerId, Parent_Id = product_Id }));

                        return _pTempDao.CopyProduct(sqls, specs, selMaster, moveMaster, movePrice);
                    }
                }
                return false;
            }
            catch (Exception ex)
            {
                throw new Exception("ProductTempMgr.CopyProduct-->" + ex.Message, ex);
            }
        }
Example #4
0
        /// <summary>
        /// 刪除商品
        /// </summary>
        /// <returns></returns>
        public bool Delete(uint product_Id)
        {
            ArrayList delList = new ArrayList();
            ProductComboMgr proComboMgr = new ProductComboMgr("");
            delList.Add(proComboMgr.Delete(Convert.ToInt32(product_Id)));

            ItemPriceMgr itemPriceMgr = new ItemPriceMgr("");
            delList.Add(itemPriceMgr.DeleteByProductId(Convert.ToInt32(product_Id)));

            PriceMasterMgr priceMaster = new PriceMasterMgr("");
            delList.Add(priceMaster.DeleteByProductId(Convert.ToInt32(product_Id)));

            ProductTagSetMgr proTagSetMgr = new ProductTagSetMgr("");
            delList.Add(proTagSetMgr.Delete(new ProductTagSet { product_id = product_Id }));

            ProductNoticeSetMgr proNoticeSetMgr = new ProductNoticeSetMgr("");
            delList.Add(proNoticeSetMgr.Delete(new ProductNoticeSet { product_id = product_Id }));

            ProductPictureMgr proPicMgr = new ProductPictureMgr("");
            delList.Add(proPicMgr.Delete(Convert.ToInt32(product_Id)));

            ProductSpecMgr proSpecMgr = new ProductSpecMgr("");
            delList.Add(proSpecMgr.Delete(product_Id));

            ProductCategorySetMgr proCategorySetMgr = new ProductCategorySetMgr("");
            delList.Add(proCategorySetMgr.Delete(new ProductCategorySet { Product_Id = product_Id }));

            #region 課程相關
            CourseProductMgr courProdMgr = new CourseProductMgr("");
            delList.Add(courProdMgr.Delete(product_Id));

            CourseDetailItemMgr courDetaItemMgr = new CourseDetailItemMgr("");
            delList.Add(courDetaItemMgr.Delete(product_Id));
            #endregion

            ProductItemMgr proItemMgr = new ProductItemMgr("");
            delList.Add(proItemMgr.Delete(new ProductItem { Product_Id = product_Id }));

            ProductStatusHistoryMgr proStatusHistoryMgr = new ProductStatusHistoryMgr("");
            delList.Add(proStatusHistoryMgr.Delete(new ProductStatusHistory { product_id = product_Id }));

            #region 推薦商品刪除  add by zhuoqin0830w  2015/10/08
            RecommendedProductAttributeMgr recommendedProductAttributeMgr = new RecommendedProductAttributeMgr("");
            delList.Add(recommendedProductAttributeMgr.DeleteProductAttribute(Convert.ToInt32(product_Id)));
            #endregion

            delList.Add(_productDao.Delete(product_Id));

            MySqlDao mySqlDao = new MySqlDao(connectionStr);
            return mySqlDao.ExcuteSqls(delList);
        }