Exemplo n.º 1
0
 public List<ProductComboCustom> priceComboQuery(ProductComboCustom query)
 {
     StringBuilder sql = new StringBuilder("select m.child_id,c.pile_id from price_master_temp m");
     sql.Append(" inner join product_combo_temp c on m.child_id = c.child_id and m.product_id = c.parent_id and m.writer_id = c.writer_id");
     sql.AppendFormat(" where m.writer_id = {0} and m.combo_type = 2 and m.product_id = {1}", query.Writer_Id, query.Parent_Id);
     return _access.getDataTableForObj<ProductComboCustom>(sql.ToString());
 }
Exemplo n.º 2
0
 public List<ProductComboCustom> sameSpecQuery(ProductComboCustom query)
 {
     StringBuilder sql = new StringBuilder("select c.id,c.parent_id,c.child_id,m.product_name as Product_Name,p.product_name,p.prod_sz,s_must_buy,g_must_buy,pile_id,buy_limit,m.price_master_id,m.price as item_money,m.event_price as event_money");
     sql.Append(",m.cost as item_cost,m.event_cost from product p");
     sql.AppendFormat(" inner join product_combo c on p.product_id = c.child_id and c.parent_id = {0}",query.Parent_Id);
     sql.AppendFormat(" left join price_master m on c.child_id = m.child_id and c.parent_id = m.product_id and m.user_id = {0} and m.user_level = {1} and m.site_id = {2}", query.user_id, query.user_level, query.site_id);
     return _access.getDataTableForObj<ProductComboCustom>(sql.ToString());
 }
Exemplo n.º 3
0
 public List<MakePriceCustom> differentSpecQuery(ProductComboCustom query)
 {
     try
     {
         return _combDao.differentSpecQuery(query);
     }
     catch (Exception ex)
     {
         throw new Exception("ProductComboMgr-->differentSpecQuery-->" + ex.Message, ex);
     }
 }
Exemplo n.º 4
0
 public List<ProductComboCustom> getChildren(ProductComboCustom query)
 {
     try
     {
         return _combDao.getChildren(query);
     }
     catch (Exception ex)
     {
         throw new Exception("ProductComboMgr-->getChildren-->" + ex.Message, ex);
     }
 }
Exemplo n.º 5
0
 public List<ProductComboCustom> combNoPriceQuery(ProductComboCustom query)
 {
     try
     {
         return _combDao.combNoPriceQuery(query);
     }
     catch (Exception ex)
     {
         throw new Exception("ProductComboMgr-->combQuery-->" + ex.Message, ex);
     }
 }
Exemplo n.º 6
0
 public List<MakePriceCustom> differentSpecQuery(ProductComboCustom query)
 {
     StringBuilder stb = new StringBuilder("select a.product_id as child_id,a.item_id,b.product_name,b.prod_sz,c.spec_name as spec_1,d.spec_name as spec_2,e.s_must_buy,e.g_must_buy,  ");
     stb.Append("e.parent_id,e.pile_id,e.buy_limit,g.item_money,g.item_cost,g.event_money,g.event_cost,g.item_price_id,f.price_master_id ");
     stb.Append(" from product_item a ");
     stb.Append("left join product b on a.product_id=b.product_id ");
     stb.Append("left join product_spec c on a.spec_id_1=c.spec_id ");
     stb.Append("left join product_spec d on a.spec_id_2=d.spec_id ");
     stb.AppendFormat("left join (select pile_id,s_must_buy,g_must_buy,child_id,parent_id,writer_id,buy_limit from product_combo_temp where writer_id={0} and parent_id={1}) e on a.product_id=e.child_id ", query.Writer_Id, query.Parent_Id);
     stb.AppendFormat(" left join price_master_temp f on  f.combo_type=2 and f.writer_id={0} and f.child_id<>'0' and a.product_id=f.child_id and f.product_id={1} ", query.Writer_Id, query.Parent_Id );
     stb.AppendFormat(" left join item_price_temp g on g.price_master_id=f.price_master_id and a.item_id=g.item_id ");
     stb.AppendFormat("where a.product_id in (select child_id from product_combo_temp where writer_id={0} and parent_id='{1}')", query.Writer_Id, query.Parent_Id);
     stb.AppendFormat(" and e.parent_id='{0}'", query.Parent_Id );
     return _access.getDataTableForObj<MakePriceCustom>(stb.ToString());
 }
Exemplo n.º 7
0
 public List<ProductComboCustom> getChildren(ProductComboCustom query)
 {
     StringBuilder sql = new StringBuilder("select c.id,c.parent_id,c.child_id,m.product_name,s_must_buy,g_must_buy,pile_id,buy_limit,m.price_master_id,m.price as item_money,m.event_price as event_money,m.cost as item_cost,m.event_cost");
     if (query.price_type == 1)
     {
         sql.Append(" from product_combo c");
         sql.AppendFormat(" left join price_master m on m.product_id = c.child_id where c.parent_id={0}", query.Parent_Id);
     }
     else
     { 
        sql.AppendFormat(" from product_combo c inner join product p on p.product_id = c.child_id and c.parent_id = {0}",query.Parent_Id);
        sql.AppendFormat(" left join price_master m on c.child_id = m.child_id and c.parent_id = m.product_id   and m.child_id<>{0}", query.Parent_Id);
     }
     return _access.getDataTableForObj<ProductComboCustom>(sql.ToString());
 }
Exemplo n.º 8
0
        public List<ProductComboCustom> combQuery(ProductComboCustom query)
        {
            StringBuilder sql = new StringBuilder("select c.child_id,p.product_name,p.prod_sz,p.brand_id,c.s_must_buy,c.g_must_buy,c.pile_id,c.buy_limit from product p inner join product_combo_temp c  on p.product_id = c.child_id where 1=1");

            if (query.Writer_Id != 0)
            {
                sql.AppendFormat(" and c.writer_id = {0}", query.Writer_Id);
            }
            if (query.Pile_Id != 0)
            {
                sql.AppendFormat(" and c.pile_id = {0}", query.Pile_Id);
            }
            sql.AppendFormat(" and parent_id='{0}'", query.Parent_Id );
            //sql.AppendFormat(" and parent_id={0}", query.Parent_Id); // edit 2014/9/25
            return _access.getDataTableForObj<ProductComboCustom>(sql.ToString());
        }
Exemplo n.º 9
0
 public List<ProductComboCustom> comboPriceQuery(ProductComboCustom query)
 {
     StringBuilder sql = new StringBuilder("select c.child_id,p.product_name,p.prod_sz,c.s_must_buy,c.g_must_buy,c.pile_id,c.buy_limit,m.price_master_id,m.price as item_money,m.event_price as event_money,m.event_cost,m.cost as item_cost ");
     sql.Append(" from product p ");
     sql.Append(" inner join product_combo_temp c  on p.product_id = c.child_id ");
     sql.AppendFormat(" left join price_master_temp m on c.child_id = m.child_id and m.writer_id= {0} and m.product_id='{1}'", query.Writer_Id, query.Parent_Id );
     sql.Append(" where 1=1");
     if (query.Writer_Id != 0)
     {
         sql.AppendFormat(" and c.writer_id = {0}", query.Writer_Id);
     }
     if (query.Pile_Id != 0)
     {
         sql.AppendFormat(" and c.pile_id = {0}", query.Pile_Id);
     }
     sql.AppendFormat(" and parent_id='{0}'", query.Parent_Id );
     return _access.getDataTableForObj<ProductComboCustom>(sql.ToString());
 }
Exemplo n.º 10
0
        public List<ProductComboCustom> combQuery(ProductComboCustom query)
        {
            StringBuilder sql = new StringBuilder("select c.id,c.parent_id,child_id,product_name,p.sale_status,p.prod_sz,p.brand_id,s_must_buy,g_must_buy,pile_id,buy_limit from product p inner join product_combo c  on p.product_id = c.child_id where 1=1"); //add by 
            if (query.Parent_Id != 0)
            {
                sql.AppendFormat(" and c.parent_id = {0}", query.Parent_Id);
            }
            if (query.Pile_Id != 0)
            {
                sql.AppendFormat(" and c.pile_id = {0}", query.Pile_Id);
            }
            if (query.Child_Id!="0")//edit 2014/09/24
            {
                sql.AppendFormat(" and c.child_id = {0}", query.Child_Id);//XXL
            }   

            return _access.getDataTableForObj<ProductComboCustom>(sql.ToString());
        }
Exemplo n.º 11
0
 public HttpResponseBase IsSameChildVendor()
 {
     string result = string.Empty;
     try
     {
         List<ProductComboCustom> combos;
         if (!string.IsNullOrEmpty(Request.Params["ProductId"]))
         {
             int parentId = int.Parse(Request.Params["ProductId"]);
             _combMgr = new ProductComboMgr(connectionString);
             combos = _combMgr.combQuery(new ProductComboCustom { Parent_Id = parentId });
         }
         else
         {
             Caller _caller = (Session["caller"] as Caller);
             _combTempMgr = new ProductComboTempMgr(connectionString);
             ProductComboCustom query = new ProductComboCustom { Writer_Id = _caller.user_id };
             //複製商品時
             if (!string.IsNullOrEmpty(Request.Form["OldProductId"]))
             {
                 query.Parent_Id = int.Parse(Request.Form["OldProductId"]);
             }
             combos = _combTempMgr.combQuery(query);
         }
         List<uint> brandIds = combos.GroupBy(m => m.brand_id).Select(m => m.Key).ToList();
         if (brandIds.Count == 1)
         {
             result = "{success:true,same:true}";
         }
         else
         {
             _vendorBrandMgr = new VendorBrandMgr(connectionString);
             List<uint> vendorIds = new List<uint>();
             VendorBrand vendorBrand;
             foreach (var id in brandIds)
             {
                 vendorBrand = _vendorBrandMgr.GetProductBrand(new VendorBrand { Brand_Id = id });
                 if (vendorBrand != null && !vendorIds.Contains(vendorBrand.Vendor_Id))
                 {
                     vendorIds.Add(vendorBrand.Vendor_Id);
                 }
             }
             result = "{success:true,same:" + (vendorIds.Count == 1).ToString().ToLower() + "}";
         }
     }
     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);
         result = "{success:true,same:false}";
     }
     this.Response.Clear();
     this.Response.Write(result);
     this.Response.End();
     return this.Response;
 }
Exemplo n.º 12
0
        public HttpResponseBase GetMakePrice()
        {
            resultStr = "{success:false}";
            try
            {
                int pileId = 0;
                int.TryParse(Request.Params["pileId"] ?? "0", out pileId);
                if (!string.IsNullOrEmpty(Request.Params["ProductId"]))
                {
                    _combMgr = new ProductComboMgr(connectionString);
                    ProductComboCustom query = new ProductComboCustom { Parent_Id = int.Parse(Request.Params["ProductId"]), Pile_Id = pileId };
                    //複製商品時
                    if (!string.IsNullOrEmpty(Request.Form["OldProductId"]))
                    {
                        query.Parent_Id = int.Parse(Request.Form["OldProductId"]);
                    }
                    resultStr = "{success:true,same:" + JsonConvert.SerializeObject(_combMgr.combNoPriceQuery(query)) + ",different:" + JsonConvert.SerializeObject(_combMgr.differentNoPriceSpecQuery(query)) + "}";
                }
                else
                {
                    Caller _caller = (Session["caller"] as Caller);
                    _combTempMgr = new ProductComboTempMgr(connectionString);
                    ProductComboCustom query = new ProductComboCustom { Writer_Id = _caller.user_id, Pile_Id = pileId };
                    //複製商品時
                    if (!string.IsNullOrEmpty(Request.Form["OldProductId"]))
                    {
                        query.Parent_Id = int.Parse(Request.Form["OldProductId"]);
                    }
                    resultStr = "{success:true,same:" + JsonConvert.SerializeObject(_combTempMgr.comboPriceQuery(query)) + ",different:" + JsonConvert.SerializeObject(_combTempMgr.differentSpecQuery(query)) + "}";
                }
            }
            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);
            }

            Response.Clear();
            Response.Write(resultStr);
            Response.End();
            return this.Response;
        }
Exemplo n.º 13
0
        public HttpResponseBase GetUpdatePrice()
        {
            resultStr = "{success:false}";
            try
            {
                int pileId = 0;
                int.TryParse(Request.Params["pileId"] ?? "0", out pileId);
                if (!string.IsNullOrEmpty(Request.Params["ProductId"]))
                {
                    _combMgr = new ProductComboMgr(connectionString);
                    ProductComboCustom query = new ProductComboCustom { Parent_Id = int.Parse(Request.Params["ProductId"]), Pile_Id = pileId };
                    query.user_id = int.Parse(Request.Params["user_id"]);
                    query.user_level = int.Parse(Request.Params["user_level"]);
                    query.site_id = int.Parse(Request.Params["site_id"]);
                    if (string.IsNullOrEmpty(Request.Form["is_same"]))
                    {
                        resultStr = "{success:true,same:" + JsonConvert.SerializeObject(_combMgr.sameSpecQuery(query)) + ",different:" + JsonConvert.SerializeObject(_combMgr.differentSpecQuery(query)) + "}";
                    }
                    else if (Request.Form["is_same"] == "1")
                    {
                        resultStr = "{success:true,data:" + JsonConvert.SerializeObject(_combMgr.sameSpecQuery(query)) + "}";
                    }
                    else if (Request.Form["is_same"] == "0")
                    {
                        resultStr = "{success:true,data:" + JsonConvert.SerializeObject(_combMgr.differentSpecQuery(query)) + "}";
                    }
                }
            }
            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);
                resultStr = "{success:true,same:[],different:[]}";
            }

            Response.Clear();
            Response.Write(resultStr);
            Response.End();
            return this.Response;
        }
Exemplo n.º 14
0
 public List<ProductComboCustom> priceComboQuery(ProductComboCustom query)
 {
     try
     {
         return _tempDao.priceComboQuery(query);
     }
     catch (Exception ex)
     {
         throw new Exception("ProductComboTempMgr.priceComboQuery-->" + ex.Message, ex);
     }
 }
Exemplo n.º 15
0
 public List<MakePriceCustom> differentNoPriceSpecQuery(ProductComboCustom query)
 {
     StringBuilder stb = new StringBuilder("select a.product_id as child_id,a.item_id,b.product_name,b.prod_sz,c.spec_name as spec_1,d.spec_name as spec_2,e.s_must_buy,e.g_must_buy,  ");
     stb.Append("e.parent_id,e.pile_id ");
     stb.Append(" from product_item a ");
     stb.Append("left join product b on a.product_id=b.product_id ");
     stb.Append("left join product_spec c on a.spec_id_1=c.spec_id ");
     stb.Append("left join product_spec d on a.spec_id_2=d.spec_id ");
     stb.AppendFormat("left join (select pile_id,s_must_buy,g_must_buy,child_id,parent_id from product_combo where parent_id={0}) e on a.product_id=e.child_id ", query.Parent_Id);
     stb.AppendFormat("where a.product_id in (select child_id from product_combo where parent_id={0})", query.Parent_Id);
     stb.AppendFormat(" and e.parent_id={0}", query.Parent_Id );
     return _access.getDataTableForObj<MakePriceCustom>(stb.ToString()); 
 }