예제 #1
0
        public HttpResponseBase vaiteVerifyBack()
        {
            string resultStr = "{success:false}";
            bool result = true;
            try
            {
                string productIds = Request.Params["productIds"];
                string backReason = Request.Params["backReason"];

                Caller _caller = (Session["caller"] as Caller);
                _applyMgr = new ProductStatusApplyMgr(connectionString);
                _statusHistoryMgr = new ProductStatusHistoryMgr(connectionString);
                _prodMgr = new ProductMgr(connectionString);
                _tableHistoryMgr = new TableHistoryMgr(connectionString);
                string[] products = productIds.Split(',');

                _functionMgr = new FunctionMgr(connectionString);
                string function = Request.Params["function"] ?? "";
                Function fun = _functionMgr.QueryFunction(function, "/ProductList/VerifyList");
                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 + "_";

                foreach (string item in products)
                {
                    Product product = _prodMgr.Query(new Product { Product_Id = uint.Parse(item) }).FirstOrDefault();
                    ArrayList sqls = new ArrayList();
                    if (_applyMgr.Query(new ProductStatusApply { product_id = uint.Parse(item) }) != null)
                    {
                        ProductStatusApply queryApply = _applyMgr.Query(new ProductStatusApply { product_id = uint.Parse(item) });
                        uint prev_status = queryApply.prev_status;
                        product.Product_Status = prev_status;
                        sqls.Add(_prodMgr.Update(product, _caller.user_id));

                        ProductStatusHistory save = new ProductStatusHistory();
                        save.product_id = product.Product_Id;
                        save.user_id = uint.Parse(_caller.user_id.ToString());
                        save.type = 3;           //操作類型(駁回)
                        save.product_status = int.Parse(product.Product_Status.ToString());
                        save.remark = backReason;
                        sqls.Add(_statusHistoryMgr.Save(save));

                        batch.batchno = batchNo + product.Product_Id;

                        sqls.Add(_applyMgr.Delete(queryApply));
                        if (!_tableHistoryMgr.SaveHistory<Product>(product, batch, sqls))
                        {
                            result = false;
                            break;
                        }
                    }
                    else
                    {
                        result = false;
                        break;
                    }
                }

                resultStr = "{success:" + result.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);
            }

            Response.Clear();
            Response.Write(resultStr);
            Response.End();
            return this.Response;
        }
예제 #2
0
        public HttpResponseBase vaiteVerifyPass()
        {
            string resultStr = "{success:false}";
            bool result = true;
            try
            {
                Caller _caller = (Session["caller"] as Caller);
                _applyMgr = new ProductStatusApplyMgr(connectionString);
                _statusHistoryMgr = new ProductStatusHistoryMgr(connectionString);
                _prodMgr = new ProductMgr(connectionString);
                _pMaster = new PriceMasterMgr(connectionString);
                _tableHistoryMgr = new TableHistoryMgr(connectionString);
                string productIds = Request.Params["prodcutIdStr"];
                string[] products = productIds.Split(',');

                _functionMgr = new FunctionMgr(connectionString);
                string function = Request.Params["function"] ?? "";
                Function fun = _functionMgr.QueryFunction(function, "/ProductList/VerifyList");
                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 + "_";

                foreach (string item in products)
                {
                    Product product = _prodMgr.Query(new Product { Product_Id = uint.Parse(item) }).FirstOrDefault();

                    ArrayList sqls = new ArrayList();
                    if (_applyMgr.Query(new ProductStatusApply { product_id = uint.Parse(item) }) != null)
                    {
                        batch.batchno = batchNo + product.Product_Id;
                        //更改商品价格之状态
                        PriceMaster pmQuery = new PriceMaster();
                        if (product.Combination != 0 && product.Combination != 1)   //组合商品
                        {
                            pmQuery.child_id = int.Parse(item);
                        }
                        else
                        {
                            pmQuery.child_id = 0;
                        }
                        pmQuery.product_id = uint.Parse(item);
                        pmQuery.price_status = 2;       //只更改价格状态为申请审核的商品价格        
                        List<PriceMaster> pmResultList = _pMaster.PriceMasterQuery(pmQuery);
                        if (pmResultList != null && pmResultList.Count() > 0)
                        {
                            _pHMgr = new PriceUpdateApplyHistoryMgr(connectionString);
                            List<PriceUpdateApplyHistory> pHList = new List<PriceUpdateApplyHistory>();
                            foreach (var pm in pmResultList)
                            {
                                ArrayList priceUpdateSqls = new ArrayList();
                                pm.price_status = 1;      //价格状态为上架
                                pm.apply_id = 0;
                                priceUpdateSqls.Add(_pMaster.Update(pm));
                                if (!_tableHistoryMgr.SaveHistory<PriceMaster>(pm, batch, priceUpdateSqls))
                                {
                                    result = false;
                                    break;
                                }

                                //价格异动记录(price_update_apply_history)                            
                                PriceUpdateApplyHistory pH = new PriceUpdateApplyHistory();
                                pH.apply_id = int.Parse(pm.apply_id.ToString());
                                pH.user_id = (Session["caller"] as Caller).user_id;
                                pH.price_status = 1;
                                pH.type = 1;
                                pHList.Add(pH);
                            }
                            if (!_pHMgr.Save(pHList))
                            {
                                result = false;
                                break;
                            }
                        }

                        //更改商品之状态
                        ProductStatusApply queryApply = _applyMgr.Query(new ProductStatusApply { product_id = uint.Parse(item) });
                        uint online_mode = queryApply.online_mode;
                        //申請狀態為審核後立即上架時將上架時間改為當前時間,商品狀態改為上架
                        if (online_mode == 2)
                        {
                            product.Product_Status = 5;
                            product.Product_Start = uint.Parse(BLL.gigade.Common.CommonFunction.GetPHPTime(DateTime.Now.ToLongTimeString()).ToString());
                        }
                        else
                        {
                            product.Product_Status = 2;
                            //product.Product_Start = online_mode;
                        }
                        sqls.Add(_prodMgr.Update(product, _caller.user_id));

                        ProductStatusHistory save = new ProductStatusHistory();
                        save.product_id = product.Product_Id;
                        save.user_id = uint.Parse(_caller.user_id.ToString());
                        save.type = 2;           //操作類型(核可)
                        save.product_status = int.Parse(product.Product_Status.ToString());

                        sqls.Add(_statusHistoryMgr.Save(save));         //保存历史记录

                        sqls.Add(_applyMgr.Delete(queryApply));         //刪除審核申請表中的數據

                        if (!_tableHistoryMgr.SaveHistory<Product>(product, batch, sqls))
                        {
                            result = false;
                            break;
                        }
                    }
                    else
                    {
                        result = false;
                        break;
                    }
                }
                resultStr = "{success:" + result.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);
            }

            Response.Clear();
            Response.Write(resultStr);
            Response.End();
            return this.Response;
        }
예제 #3
0
        public HttpResponseBase ProductUp()
        {
            string json = "{success:true}";
            try
            {
                if (!string.IsNullOrEmpty(Request.Form["Product_Id"]))
                {
                    string[] pro_Ids = Request.Form["Product_Id"].Split('|');

                    _functionMgr = new FunctionMgr(connectionString);
                    string function = Request.Params["function"] ?? "";
                    Function fun = _functionMgr.QueryFunction(function, "/ProductList");
                    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 + "_";

                    _prodMgr = new ProductMgr(connectionString);
                    _tableHistoryMgr = new TableHistoryMgr(connectionString);
                    _productStatusHistoryMgr = new ProductStatusHistoryMgr("");
                    ProductStatusHistory proStatusHistory = new ProductStatusHistory { product_status = 5, type = 6, user_id = Convert.ToUInt32((Session["caller"] as Caller).user_id) };
                    ArrayList sqls;
                    foreach (string str in pro_Ids.Distinct())
                    {
                        if (!string.IsNullOrEmpty(str))
                        {
                            uint product_id = uint.Parse(str);
                            Product pro = _prodMgr.Query(new Product { Product_Id = product_id }).FirstOrDefault();
                            //上架商品不能為失格商品  eidt by  zhuoqin0830w 20105/07/01  pro.off_grade != 1
                            string msg = "";
                            if (pro.off_grade == 1)
                            {
                                msg += "【" + pro.Product_Id + "】商品是失格商品,不可上架!</br>";
                                json = "{success:false,'msg':'" + msg + "'}";
                                break;
                            }
                            if (pro != null && pro.Product_Status == 2)//&& pro.user_id == (Session["caller"] as Caller).user_id 
                            {
                                pro.Product_Status = 5;//上架
                                pro.Product_Start = Convert.ToUInt32(CommonFunction.GetPHPTime());
                                sqls = new ArrayList();
                                sqls.Add(_prodMgr.Update(pro));

                                batch.batchno = batchNo + pro.Product_Id;

                                proStatusHistory.product_id = product_id;
                                //edit by zhuoqin0830w  2015/06/26  添加備註欄位
                                proStatusHistory.remark = Request.Form["Remark"];
                                sqls.Add(_productStatusHistoryMgr.Save(proStatusHistory));
                                if (!_tableHistoryMgr.SaveHistory<Product>(pro, batch, sqls))
                                {
                                    json = "{success:false}";
                                }
                            }
                        }
                    }
                }
            }
            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}";
            }
            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();
            return this.Response;
        }
예제 #4
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;
        }
예제 #5
0
        public HttpResponseBase ProductDown(int type = 1)
        {
            string json = "{success:true}";
            try
            {
                if (!string.IsNullOrEmpty(Request.Form["Product_Id"]))
                {
                    string[] pro_Ids = Request.Form["Product_Id"].Split('|');
                    uint product_end =0 ;
                    if (!string.IsNullOrEmpty(Request.Form["Product_End"]))
                    {
                        product_end = Convert.ToUInt32(CommonFunction.GetPHPTime(Request.Form["Product_End"]));
                    }
                    //立即下架不改變下架時間
                    //else
                    //{
                    //    product_end = Convert.ToUInt32(CommonFunction.GetPHPTime());
                    //}

                    _functionMgr = new FunctionMgr(connectionString);
                    string function = Request.Params["function"] ?? "";
                    Function fun = _functionMgr.QueryFunction(function, "/ProductList");
                    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 + "_";

                    _prodMgr = new ProductMgr(connectionString);
                    _tableHistoryMgr = new TableHistoryMgr(connectionString);
                    _productStatusHistoryMgr = new ProductStatusHistoryMgr("");
                    ProductStatusHistory proStatusHistory = new ProductStatusHistory { product_status = 6, type = 4, user_id = Convert.ToUInt32((Session["caller"] as Caller).user_id) };
                    ArrayList sqls;
                    foreach (string str in pro_Ids.Distinct())
                    {
                        if (!string.IsNullOrEmpty(str))
                        {
                            uint product_id = uint.Parse(str);
                            Product pro = _prodMgr.Query(new Product { Product_Id = product_id }).FirstOrDefault();
                            if (type == 1 && product_end == 0)//說明是立即下架,就用原來的時間
                            {
                                product_end = pro.Product_End;
                            }
                            //edit by zhuoqin0830w  2015/06/26  添加備註欄位
                            string remark = "";
                            if (pro != null && pro.Product_Status == 5)// && pro.user_id == (Session["caller"] as Caller).user_id
                            {
                                switch (type)
                                {
                                    case 1:
                                        pro.Product_Status = 6;//下架
                                        remark = Request.Form["UnShelve"]; //edit by zhuoqin0830w  2015/06/26  添加備註欄位
                                        pro.Product_End = product_end;  //將 pro.Product_End = product_end 代碼提前  避免下架不販售的時候沒有下架時間  edit by zhuoqin0830w  2015/07/15
                                        break;
                                    case 2:
                                        pro.Product_Status = 99;//下架不販售
                                        remark = Request.Form["Remark"]; //edit by zhuoqin0830w  2015/06/26  添加備註欄位
                                        IProductExtImplMgr _prodExtMgr = new ProductExtMgr(connectionString);
                                        _prodExtMgr.UpdatePendDel(product_id, true);
                                        break;
                                }

                                sqls = new ArrayList();
                                sqls.Add(_prodMgr.Update(pro));
                                batch.batchno = batchNo + pro.Product_Id;
                                proStatusHistory.product_id = product_id;
                                //edit by zhuoqin0830w  2015/06/26  添加備註欄位
                                proStatusHistory.remark = remark;
                                sqls.Add(_productStatusHistoryMgr.Save(proStatusHistory));
                                if (!_tableHistoryMgr.SaveHistory<Product>(pro, batch, sqls))
                                {
                                    json = "{success:false}";
                                }
                            }
                        }
                    }
                }
            }
            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}";
            }
            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();
            return this.Response;
        }