public ActionResult ProductStatus(FormCollection collection)
        {
            var barcode = collection["BarCode"];
            var result  = _iReportManager.IsValiedBarcode(barcode);
            ProductStatusModel model = new ProductStatusModel
            {
                IsValid = result
            };

            if (result)
            {
                int status = _iInventoryManager.GetProductStatusInFactoryByBarCode(barcode);
                model.FactoryStatus = status;
                int bStatus = _iInventoryManager.GetProductStatusInBranchInventoryByBarCode(barcode);
                if (bStatus != -1)
                {
                    if (bStatus == -1)
                    {
                        model.Description = "<p style='color:red;'> The product Sent from Factory but not received By Barnch</p>";
                    }
                    else if (bStatus == 0)
                    {
                        model.Description = "<p style='color:green;'>The Product is in Branch Inventory</p>";
                    }
                    else if (bStatus == 1)
                    {
                        model.Description = "<p style='color:green;'>The Product is delivered to Delear Or receive by other Branch</p>";
                    }
                }
                else
                {
                    if (status == -1)
                    {
                        model.Description = "<p style='color:red;'> Not Scanned By Production</p>";
                    }
                    else if (status == 0)
                    {
                        model.Description = "<p style='color:green;'>The Product is in Factory Inventory</p>";
                    }
                    else if (status == 1)
                    {
                        model.Description = "<p style='color:green;'>The Product was dispatched form factory but not receive by Barnch yet</p>";
                    }
                    else if (status == 2)
                    {
                        model.Description = "<p style='color:green;'>The Product is delivered to Delear Or receive by Branch</p>";
                    }
                }
            }
            else
            {
                model.Description = "<p style='color:red;'>Invalid BarCode</p>";
            }
            TempData["T"] = model;
            return(View());
        }
Exemple #2
0
        /// <summary>
        /// 更新指定产品状态信息
        /// </summary>
        /// <param name="productStatus">产品状态模型</param>
        /// <returns>返回更新指定产品状态信息所影响的行数</returns>
        public static int UpdProductStatusByID(ProductStatusModel productStatus)
        {
            SqlParameter[] sparams = new SqlParameter[]
            {
                new SqlParameter("@productStatusID", SqlDbType.Int),
                new SqlParameter("@productStatusName", SqlDbType.VarChar, 50),
                new SqlParameter("@productStatusDescr", SqlDbType.VarChar, 50)
            };
            sparams[0].Value = productStatus.ProductStatusID;
            sparams[1].Value = productStatus.ProductStatusName;
            sparams[2].Value = productStatus.ProductStatusDescr;

            return(DBHelper.ExecuteNonQuery("UpdProductStatusByID", sparams, CommandType.StoredProcedure));
        }
Exemple #3
0
        /// <summary>
        /// 向产品状态表中插入记录
        /// </summary>
        /// <param name="productStatus">产品状态模型</param>
        /// <returns>返回向产品状态表中插入记录所影响的行数</returns>
        public static int AddProductStatus(SqlTransaction tran, ProductStatusModel productStatus, out int id)
        {
            int addCount = 0;

            SqlParameter[] sparams = new SqlParameter[]
            {
                new SqlParameter("@productStatusName", SqlDbType.VarChar, 50),
                new SqlParameter("@productStatusDescr", SqlDbType.VarChar, 50),
                new SqlParameter("@identityId", SqlDbType.Int)
            };
            sparams[0].Value = productStatus.ProductStatusName;
            sparams[1].Value = productStatus.ProductStatusDescr;
            sparams[2].Value = ParameterDirection.Output;

            addCount = DBHelper.ExecuteNonQuery("AddProductStatus", sparams, CommandType.StoredProcedure);
            id       = Convert.ToInt32(sparams[2].Value);
            return(addCount);
        }
Exemple #4
0
        /// <summary>
        /// 查询产品状态
        /// </summary>
        /// <param name="productStatusID"></param>
        /// <returns></returns>
        public static ProductStatusModel GetProductStatusItem(int productStatusID)
        {
            string cmd = "select ProductStatusID,ProductStatusName,ProductStatusDescr from ProductStatus where ProductStatusID=@ProductStatusID";

            SqlParameter[] param = new SqlParameter[]
            {
                new SqlParameter("@ProductStatusID", productStatusID)
            };

            SqlDataReader dr = DBHelper.ExecuteReader(cmd, param, CommandType.Text);

            dr.Read();

            ProductStatusModel psm = new ProductStatusModel();

            psm.ProductStatusID    = Convert.ToInt32(dr["ProductStatusID"]);
            psm.ProductStatusName  = dr["ProductStatusName"].ToString();
            psm.ProductStatusDescr = dr["ProductStatusDescr"].ToString();

            dr.Close();

            return(psm);
        }
Exemple #5
0
 /// <summary>
 /// 向产品状态表中插入记录
 /// </summary>
 /// <param name="productStatus">产品状态模型</param>
 /// <returns>返回向产品状态表中插入记录所影响的行数</returns>
 public static int AddProductStatus(SqlTransaction tran, ProductStatusModel productStatus, out int id)
 {
     return(ProductStatusDAL.AddProductStatus(tran, productStatus, out id));
 }
Exemple #6
0
 /// <summary>
 /// 更新指定产品状态信息
 /// </summary>
 /// <param name="productStatus">产品状态模型</param>
 /// <returns>返回更新指定产品状态信息所影响的行数</returns>
 public static int UpdProductStatusByID(ProductStatusModel productStatus)
 {
     return(ProductStatusDAL.UpdProductStatusByID(productStatus));
 }
Exemple #7
0
        public async Task <IHttpActionResult> UpdateStatus([FromBody] ProductStatusModel model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var list = ProductService.GetAll().Where(x => model.Ids.Contains(x.Id)).ToList();

            foreach (var product in list)
            {
                switch (model.ProductStatusType)
                {
                case ProductStatusType.IsAgreeActive:
                    product.isAgreeActive = true;
                    break;

                case ProductStatusType.DeAgreeActive:
                    product.isAgreeActive = false;
                    break;

                case ProductStatusType.IsVipAlbum:
                    product.IsVipAlbum = true;
                    break;

                case ProductStatusType.DeVipAlbum:
                    product.IsVipAlbum = false;
                    break;

                case ProductStatusType.IsFeaturedProduct:
                    product.IsFeaturedProduct = true;
                    break;

                case ProductStatusType.DeFeaturedProduct:
                    product.IsFeaturedProduct = false;
                    break;

                case ProductStatusType.IsMatchAllCar:
                    product.IsMatchAllCar = true;
                    break;

                case ProductStatusType.DeMatchAllCar:
                    product.IsMatchAllCar = false;
                    break;

                case ProductStatusType.IsPublished:
                    product.Published = true;
                    break;

                case ProductStatusType.DePublished:
                    product.Published = false;
                    break;

                default:
                    break;
                }

                await ProductService.UpdateAsync(list);
            }

            return(Ok());
        }