Ejemplo n.º 1
0
 public ProductStatusApply Query(ProductStatusApply query)
 {
     StringBuilder stb = new StringBuilder("select apply_id, prev_status,online_mode from product_status_apply where 1=1");
     if (query.product_id != 0)
     {
         stb.AppendFormat(" and product_id = {0}", query.product_id);
     }
     return _access.getSinggleObj<ProductStatusApply>(stb.ToString());
 }
Ejemplo n.º 2
0
 public string Delete(ProductStatusApply apply)
 {
     try
     {
         return _applyDao.Delete(apply);
     }
     catch (Exception ex)
     {
         throw new Exception("ProductStatusApplyMgr-->Delete-->" + ex.Message, ex);
     }
 }
Ejemplo n.º 3
0
 public string Save(ProductStatusApply apply)
 {
     try
     {
         return _applyDao.Save(apply);
     }
     catch (Exception ex)
     {
         throw new Exception("ProductStatusApplyMgr-->SingleCompareSave-->" + ex.Message, ex);
     }
 }
Ejemplo n.º 4
0
 public ProductStatusApply Query(ProductStatusApply query)
 {
     try
     {
         return _applyDao.Query(query);
     }
     catch (Exception ex)
     {
         throw new Exception("ProductStatusApplyMgr-->Query-->" + ex.Message, ex);
     }
 }
Ejemplo n.º 5
0
        public HttpResponseBase verifyApply()
        {
            List<QueryandVerifyCustom> resultList = new List<QueryandVerifyCustom>();
            string result = "{success:false}";
            bool resl = true;
            try
            {
                string prodcutIdStr = Request.Params["prodcutIdStr"];
                string[] productIds = prodcutIdStr.Split(',');
                string method = Request.Params["method"];
                Caller _caller = (Session["caller"] as Caller);
                _prodMgr = new ProductMgr(connectionString);
                _applyMgr = new ProductStatusApplyMgr(connectionString);
                _statusHistoryMgr = new ProductStatusHistoryMgr(connectionString);
                _tableHistoryMgr = new TableHistoryMgr(connectionString);
                _functionMgr = new FunctionMgr(connectionString);
                string function = Request.Params["function"] ?? "";
                Function fun = _functionMgr.QueryFunction(function, "/ProductList") ?? _functionMgr.QueryFunction(function, "/ProductList/ReplaceVerify");
                int functionid = fun == null ? 0 : fun.RowId;
                HistoryBatch batch = new HistoryBatch { functionid = functionid, kuser = (Session["caller"] as Caller).user_email };
                string batchNo = CommonFunction.GetPHPTime().ToString() + "_" + (Session["caller"] as Caller).user_id + "_";

                string msg = "";
                foreach (string item in productIds.Distinct())
                {
                    ArrayList sqls = new ArrayList();
                    Product update = _prodMgr.Query(new Product { Product_Id = uint.Parse(item) }).FirstOrDefault();
                    //選擇自動上架時間時更改商品上架時間為選定時間
                    if (method.Equals("3"))
                    {
                        update.Product_Start = uint.Parse(BLL.gigade.Common.CommonFunction.GetPHPTime(Request.Params["product_start"]).ToString());
                        method = "1";
                    }
                    //若當前商品狀態不是新建商品或下架,則跳過申請
                    if (update.Product_Status != 0 && update.Product_Status != 6 && update.Product_Status!=7)
                    {
                        break;
                    }
                    //判斷商品是否失格 則 直接取消申請  add by  zhuoqin0830w 20105/07/01
                    if (update.off_grade == 1)
                    {
                        msg += "【" + update.Product_Id + "】商品是失格商品,不可申請審核!</br>";
                        break;
                    }
                    ProductStatusApply apply = new ProductStatusApply();
                    apply.product_id = uint.Parse(item);
                    apply.prev_status = update.Product_Status;
                    apply.online_mode = uint.Parse(method);
                    sqls.Add(_applyMgr.Save(apply));

                    ProductStatusHistory history = new ProductStatusHistory();
                    history.product_id = uint.Parse(item);
                    history.user_id = uint.Parse(_caller.user_id.ToString());
                    history.type = 1;               //操作類型        ???????????????????                      
                    history.product_status = 1;     //操作後狀態
                    //edit by zhuoqin0830w  2015/06/30  添加備註欄位
                    history.remark = Request.Form["Remark"];
                    sqls.Add(_statusHistoryMgr.Save(history));

                    batch.batchno = batchNo + update.Product_Id;
                    update.Product_Status = 1;    //狀態 -> 申請審核
                    sqls.Add(_prodMgr.Update(update, _caller.user_id));
                    if (!_tableHistoryMgr.SaveHistory<Product>(update, batch, sqls))
                    {
                        resl = false;
                    }
                    //若當前商品為單一商品並且商品狀態為新建商品,則將product_item.export_flag改為1
                    if (resl && update.Combination == 1 && apply.prev_status == 0)
                    {
                        _productItemMgr = new ProductItemMgr(connectionString);
                        ProductItem proItem = new ProductItem() { Product_Id = update.Product_Id, Export_flag = 1 };
                        _productItemMgr.UpdateExportFlag(proItem);
                    }
                }
                result = "{success:" + resl.ToString().ToLower() + ",'msg':'" + msg + "'}";
            }
            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(result);
            Response.End();
            return this.Response;
        }
Ejemplo n.º 6
0
 public string Delete(ProductStatusApply apply)
 {
     StringBuilder strSql = new StringBuilder();
     strSql.AppendFormat("set sql_safe_updates = 0; delete from product_status_apply where apply_id = {0};set sql_safe_updates = 1;", apply.apply_id);
     return strSql.ToString();
 }
Ejemplo n.º 7
0
 public string Save(ProductStatusApply apply)
 {
     StringBuilder strSql = new StringBuilder("insert into product_status_apply(`product_id`,`prev_status`,`apply_time`,`online_mode`)values(");
     strSql.AppendFormat("{0},{1},now(),{2})", apply.product_id, apply.prev_status, apply.online_mode);
     return strSql.ToString();
 }