/// <summary>
 /// hàm dùng cho EventsSetter trong form display
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void DoubleClick(object sender, RoutedEventArgs e)
 {
     try
     {
         Product_Info _Product_Info = (Product_Info)dgrProduct.SelectedItem;
         if (_Product_Info != null)
         {
             if (c_is_QuickSearch == true)
             {
                 Product_View();
             }
             else
             {
                 c_Product_Info_Search = _Product_Info;
                 c_ok = 1;
                 this.Close();
             }
         }
         e.Handled = true;
     }
     catch (Exception ex)
     {
         CommonData.log.Error(ex.ToString());
     }
 }
        void Product_Insert()
        {
            try
            {
                Frm_NhapHang _Frm_NhapHang = new Frm_NhapHang();
                _Frm_NhapHang.Owner = Window.GetWindow(this);
                _Frm_NhapHang.ShowDialog();

                if (_Frm_NhapHang.c_id_insert != 0)
                {
                    LoadData();

                    for (int i = 0; i < c_lst.Count; i++)
                    {
                        Product_Info ui = (Product_Info)c_lst[i];
                        if (ui.Supplier_Id == _Frm_NhapHang.c_id_insert)
                        {
                            c_row_select = i;
                            _Frm_NhapHang.c_id_insert = 0;
                            break;
                        }
                    }
                }

                DataGridHelper.NVSFocus(dgrProduct, c_row_select, 0);
            }
            catch (Exception ex)
            {
                CommonData.log.Error(ex.ToString());
            }
        }
        void Product_Delete()
        {
            try
            {
                c_row_select = dgrProduct.SelectedIndex;
                Product_Info _Product_Info = (Product_Info)dgrProduct.SelectedItem;

                if (_Product_Info == null)
                {
                    return;
                }

                MessageBoxResult result = NoteBox.Show("Bạn chắc chắn muốn xóa lô hàng hay không?", "Thông báo", NoteBoxLevel.Question);
                if (MessageBoxResult.Yes == result)
                {
                    if (c_Product_Controller.Product_Delete(_Product_Info.Product_Id))
                    {
                        NoteBox.Show("Xóa dữ liệu thành công");
                        LoadData();
                    }
                }
                else
                {
                    DataGridHelper.NVSFocus(dgrProduct, c_row_select, 0);
                }
            }
            catch (Exception ex)
            {
                CommonData.log.Error(ex.ToString());
            }
        }
Exemple #4
0
        private void btnQuickSearch_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                frmSearchProduct _frmSearchProduct = new frmSearchProduct();
                _frmSearchProduct.Owner = Window.GetWindow(this);
                _frmSearchProduct.ShowDialog();
                if (_frmSearchProduct.c_ok == 1)
                {
                    c_Product_Info_Search   = _frmSearchProduct.c_Product_Info_Search;
                    lblProduct_Name.Content = c_Product_Info_Search.Name.ToUpper();

                    lblSalePrice.Content = c_Product_Info_Search.BanLe_Price.ToString("###,###");
                    lblRemain.Content    = c_Product_Info_Search.Total_Remain.ToString("###,###");
                    txtProductCode.Text  = c_Product_Info_Search.Product_Code.ToUpper();
                    txtCount.Text        = "";

                    Get_Product_Color(c_Product_Info_Search.Product_Id);
                }
            }
            catch (Exception ex)
            {
                CommonData.log.Error(ex.ToString());
            }
        }
Exemple #5
0
        private void dgrProduct_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
        {
            try
            {
                int          _rowselect    = dgrProduct.SelectedIndex;
                Product_Info _Product_Info = (Product_Info)dgrProduct.SelectedItem;

                string tem = "";
                if (e.EditingElement.ToString() != "")
                {
                    tem = ((System.Windows.Controls.TextBox)(e.EditingElement)).Text;
                    tem = tem.Replace(",", "").Trim();
                    tem = tem.Replace(".", "").Trim();
                }

                if (tem != "" && !Check_Price(tem))
                {
                    DataGridHelper.NVSFocus(dgrProduct, _rowselect, 10);
                    NoteBox.Show("Chiết khấu không đúng định dạng", "Lỗi", NoteBoxLevel.Error);
                }
                else
                {
                    Call_Price_Sale_Header();
                }
            }
            catch (Exception ex)
            {
                CommonData.log.Error(ex.ToString());
            }
        }
        /// <summary>
        /// 产品编辑
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult Edit(int id = 0)
        {
            Product_Info model    = null;
            string       parProNo = string.Empty;
            string       parSize  = string.Empty;
            string       parColor = string.Empty;

            if (id == 0)
            {
                model = new Product_Info();
            }
            else
            {
                model = Bll.BllProduct_Info.First(o => o.Id == id);
                if (model == null)
                {
                    return(LayerAlertErrorAndClose("产品不存在!"));
                }
            }

            //属性列表
            var attrlist       = Tools.Tool.JsonHelper.Deserialize <AttrJson>(model?.Attribute ?? "");
            var attrlistCustom = Tools.Tool.JsonHelper.Deserialize <AttrJson>(model?.AttributeCustom ?? "");

            ViewBag.attrHtml       = GetAttrStr(model?.ClassId ?? 0, attrlist, attrlistCustom, "skuObj");
            ViewBag.classHtml      = Bll.BllProduct_Class.Instance().ShowClass(0, (model?.ClassId ?? 0), true);
            ViewBag.patternOptions = Bll.BllProduct_Pattern.GetOptions(model?.PatternId ?? 0);
            ViewBag.parProNo       = parProNo;
            return(View(model));
        }
        void Get_Product_ByCode(string p_code)
        {
            try
            {
                if (txtProductCode.Text == "")
                {
                    lblProduct_Name.Content = "";
                    lblSalePrice.Content    = "";
                    lblRemain.Content       = "";
                    c_Product_Info_Search   = null;

                    return;
                }

                List <Product_Info> _lst = c_Product_Controller.Product_Get_By_Code(p_code);

                if (_lst.Count == 1)
                {
                    lblProduct_Name.Content = _lst[0].Name.ToUpper();

                    lblSalePrice.Content  = _lst[0].BanLe_Price.ToString("###,###");
                    lblRemain.Content     = _lst[0].Total_Remain.ToString("###,###");
                    txtProductCode.Text   = _lst[0].Product_Code.ToUpper();
                    txtCount.Text         = "";
                    c_Product_Info_Search = _lst[0];

                    Get_Product_Color(c_Product_Info_Search.Product_Id);
                }
                else if (_lst.Count == 0)
                {
                    lblProduct_Name.Content = "";
                    lblSalePrice.Content    = "";
                    lblRemain.Content       = "";
                    c_Product_Info_Search   = null;
                }
                else
                {
                    frmSearchProduct _frmSearchProduct = new frmSearchProduct();
                    _frmSearchProduct.Owner = Window.GetWindow(this);
                    _frmSearchProduct.c_lst_Product_Info = _lst;
                    _frmSearchProduct.ShowDialog();
                    if (_frmSearchProduct.c_ok == 1)
                    {
                        c_Product_Info_Search   = _frmSearchProduct.c_Product_Info_Search;
                        lblProduct_Name.Content = c_Product_Info_Search.Name.ToUpper();

                        lblSalePrice.Content = c_Product_Info_Search.BanLe_Price.ToString("###,###");
                        lblRemain.Content    = c_Product_Info_Search.Total_Remain.ToString("###,###");
                        txtProductCode.Text  = c_Product_Info_Search.Product_Code.ToUpper();
                        txtCount.Text        = "";

                        Get_Product_Color(c_Product_Info_Search.Product_Id);
                    }
                }
            }
            catch (Exception ex)
            {
                CommonData.log.Error(ex.ToString());
            }
        }
Exemple #8
0
        // GET: Product/Search
        public ActionResult Index()
        {
            string spu  = RequestString("spu");
            string tag  = RequestString("tag");
            byte   type = RequestByte("type");

            //标签列表
            var taglist = Bll.BllProduct_ImageTag.GetAll();

            Product_Info model = Bll.BllProduct_Info.First(o => o.Spu == Tools.Usual.Utils.CheckSqlValue(spu));

            string className             = string.Empty;
            List <Product_Image> imglist = null;

            if (model != null)
            {
                imglist   = Bll.BllProduct_Image.GetList(model.Id, tag, type);
                className = Bll.BllProduct_Class.Instance().GetClassName(model.ClassId);
            }

            ViewBag.typeHtml  = Tools.Enums.Tools.GetOptionHtml(typeof(Tools.Enums.ESite.ImageType), type);
            ViewBag.className = className;
            ViewBag.tag       = tag;
            ViewBag.spu       = spu;
            ViewBag.type      = type;
            ViewBag.taglist   = taglist;
            ViewBag.imglist   = imglist;
            return(View(model));
        }
Exemple #9
0
        public ActionResult DeleteConfirmed(Guid id)
        {
            Product_Info product_Info = db.Product_Info.Find(id);

            db.Product_Info.Remove(product_Info);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #10
0
        public ActionResult PayNotify(int tenantId)
        {
            Action <NotifyResult> successAction = result =>
            {
                var resultLog = JsonConvert.SerializeObject(result);
                using (var context = new AppDbContext())
                {
                    var order = context.Order_Infos.FirstOrDefault(o => o.Code == result.OutTradeNo);
                    if (null != order)
                    {
                        //修改订单状态
                        order.State        = EnumOrderStatus.Overhang;
                        order.ThirdPayType = EnumThirdPayType.WX;
                        order.PaymentOn    = DateTime.Now;
                        order.UpdateTime   = DateTime.Now;
                        //需要更新订单对应的商品的已成交数
                        var lst_details = db.Order_Details.Where(p => p.OrderID == order.Id).ToList();
                        foreach (Order_Detail detail in lst_details)
                        {
                            Product_Info product = db.Product_Infos.FirstOrDefault(
                                p => p.Id == detail.ProductID);
                            product.SellCount = product.SellCount + detail.Quantity;
                        }
                        context.SaveChanges();
                        //记录支付日志
                        using (var payLogDo = new PayLogDO(order.TenantId, order.OpenId, order.ClientIpAddress, context))
                        {
                            payLogDo.AddOrderLog(order.Id, order.TotalPrice, paymentInterfaceLog: resultLog);
                        }
                    }
                    else
                    {
                        logger.Log(LoggerLevels.Error, "Order information does not exist!OrderId:" + result.OutTradeNo);
                    }
                }
                //此处编写成功处理逻辑
                logger.Log(LoggerLevels.Debug, "Success: JSON:" + resultLog);
            };
            Action <NotifyResult> failAction = result =>
            {
                //此处编写失败处理逻辑
                var failLog = JsonConvert.SerializeObject(result);
                logger.Log(LoggerLevels.Error, "Fail: JSON:" + failLog);
                using (var context = new AppDbContext())
                {
                    var order = context.Order_Infos.FirstOrDefault(o => o.Code == result.OutTradeNo);
                    //记录支付日志
                    using (var payLogDo = new PayLogDO(order.TenantId, order.OpenId, order.ClientIpAddress, context))
                    {
                        payLogDo.AddOrderLog(order.Id, order.TotalPrice, paymentInterfaceLog: failLog, errorLog: failLog);
                    }
                }
            };

            return
                (Content(WeChatApisContext.Current.TenPayV3Api.NotifyAndReurnResult(Request.InputStream, successAction,
                                                                                    failAction)));
        }
 public async Task CreateAsync([FromBody] Product_Info item)
 {
     try
     {
         _context.Product_Info.Add(item);
         await _context.SaveChangesAsync();
     }catch (Exception ex) {
         throw new Exception(ex.Message);
     }
 }
Exemple #12
0
        public NormalResult UpdateProduct(Product_Info product, int [] catalogIdList, int[] attributeIdList)
        {
            product.modify_date_time = DateTime.Now;

            using (Entities db = new Entities())
            {
                if (db.Product_Info.Any(s => s.product_code == product.product_code && s.id != product.id))
                {
                    return(new NormalResult("商品编码重复,已被其他商品占用。"));
                }

                IQueryable <Product_Info> queryable = db.Product_Info.Include(c => c.Product_Category);

                Product_Info dbProduct_Info = queryable.FirstOrDefault(e => e.id == product.id);
                if (dbProduct_Info == null)
                {
                    return(new NormalResult("指定的数据不存在。"));
                }

                ShengMapper.SetValuesWithoutProperties(product, dbProduct_Info,
                                                       new string[] { "sales_num", "browse_count" }, true);

                dbProduct_Info.Product_Category.Clear();

                if (catalogIdList != null && catalogIdList.Length > 0)
                {
                    List <Product_Category> dictionaryItemList =
                        db.Product_Category.Where(c => catalogIdList.Contains(c.id)).ToList();
                    foreach (var item in dictionaryItemList)
                    {
                        dbProduct_Info.Product_Category.Add(item);
                    }
                }


                dbProduct_Info.Product_Attribute.Clear();

                if (attributeIdList != null && attributeIdList.Length > 0)
                {
                    List <Product_Attribute> dictionaryItemList =
                        db.Product_Attribute.Where(c => attributeIdList.Contains(c.id)).ToList();
                    foreach (var item in dictionaryItemList)
                    {
                        dbProduct_Info.Product_Attribute.Add(item);
                    }
                }


                dbProduct_Info.modify_date_time = DateTime.Now;

                db.SaveChanges();
            }

            return(new NormalResult());
        }
Exemple #13
0
 public static int Product_Update(Product_Info _obj)
 {
     try
     {
         return(ProductDA.Product_Update(_obj));
     }
     catch (Exception ex)
     {
         Common.log.Error(ex.ToString());
         return(-1);
     }
 }
Exemple #14
0
 public Product_Info GetProduct(int id)
 {
     using (Entities db = new Entities())
     {
         Product_Info product = db.Product_Info
                                .Include(c => c.Product_Category)
                                .Include(c => c.Product_Attribute)
                                .AsNoTracking()
                                .FirstOrDefault(e => e.id == id);
         return(product);
     }
 }
Exemple #15
0
 public static decimal Product_Insert(Product_Info _obj)
 {
     try
     {
         return(ProductDA.Product_Insert(_obj));
     }
     catch (Exception ex)
     {
         Common.log.Error(ex.ToString());
         return(-1);
     }
 }
Exemple #16
0
        public string Sync(Product_Info item, string UserName, string connectionString)
        {
            List <SqlParameter> lstParameter = new List <SqlParameter>();

            if (!CheckBeforeSync(item))
            {
                return("Sản phẩm chưa đủ điều kiện Sync !\n Vui lòng kiểm tra tất cả trạng thái !");
            }
            lstParameter.Clear();
            lstParameter.Add(new SqlParameter("@id", item.id));
            lstParameter.Add(new SqlParameter("@ma_san_pham", item.ma_san_pham));
            using (var db = new OrmliteConnection().openConn(connectionString))
            {
                using (var dbTrans = db.OpenTransaction(IsolationLevel.ReadCommitted))
                {
                    try
                    {
                        var pro_hier = db.FirstOrDefault <Product_Hierarchy>(s => s.ma_san_pham == item.ma_san_pham && s.trang_thai == AllConstant.trang_thai.DANG_SU_DUNG);
                        if (pro_hier != null)
                        {
                            pro_hier.ngay_cap_nhat  = DateTime.Now;
                            pro_hier.nguoi_cap_nhat = UserName;
                            db.Update(pro_hier);
                        }
                        else
                        {
                            dbTrans.Rollback();
                            return("Cây phân cấp chưa có hoặc trạng thái không hoạt động!");
                        }
                        var pro_price = db.Select <Product_Price>(s => s.ma_san_pham == item.ma_san_pham && s.trang_thai == AllConstant.trang_thai.DANG_SU_DUNG && s.trang_thai_duyet == AllConstant.trang_thai_duyet.DA_DUYET && s.trang_thai_xuat_ban == AllConstant.trang_thai_xuat_ban.DA_XUAT_BAN);
                        if (pro_price == null)
                        {
                            return("Chưa có giá sản phẩm thõa mãn!");
                        }
                        foreach (Product_Price iitem in pro_price)
                        {
                            iitem.ngay_cap_nhat  = DateTime.Now;
                            iitem.nguoi_cap_nhat = UserName;
                            db.Update(iitem);
                        }
                        dbTrans.Commit();
                    }
                    catch (Exception e)
                    {
                        dbTrans.Rollback();
                        return(e.Message);
                    }
                }
            }
            new SqlHelper(connectionString).ExecuteNoneQuery("p_Product_SyncFullToMySQL", lstParameter);
            return("");
        }
        public ActionResult GetProduct(int id)
        {
            Product_Info product = _productManager.GetProduct(id);

            if (product == null)
            {
                return(FailedResult("指定的数据不存在。"));
            }

            Product_InfoDto productDto = Mapper.Map <Product_InfoDto>(product);

            return(DataResult(productDto));
        }
Exemple #18
0
        public JsonHelp Save(Product_Info entity)
        {
            JsonHelp json = new JsonHelp()
            {
                Status = "n", Msg = "保存失败"
            };

            entity.CategoryName = DB.Sys_BasicData.FindEntity(p => p.Id == entity.CategoryId).BasicDataName;
            if (entity.ProductId == 0)
            {
                entity.CreateTime = DateTime.Now;
                if (Insert(entity))
                {
                    json.Status = "y";
                    json.Msg    = "保存成功";
                    //添加操作日志
                    DB.SysLogs.setAdminLog("Add", "新建名称为[" + entity.ProductName + "]的商品");
                }
            }
            else
            {
                var m    = DB.Product_Info.FindEntity(entity.ProductId);
                var type = DB.Sys_BasicData.FindEntity(a => a.Id == entity.CategoryId);
                m.CategoryId = entity.CategoryId;
                if (type != null)
                {
                    m.CategoryName = type.BasicDataName;
                }
                m.SalePrice      = entity.SalePrice;
                m.Discount       = entity.Discount;
                m.ImgUrl         = entity.ImgUrl;
                m.ModelName      = entity.ModelName;
                m.OriginalPrice  = entity.OriginalPrice;
                m.ProductComment = entity.ProductComment;
                m.ProductName    = entity.ProductName;
                m.PubTime        = entity.PubTime;
                m.SaledQty       = entity.SaledQty;
                m.StockQty       = entity.StockQty;
                m.SortValue      = entity.SortValue;
                m.State          = entity.State;
                //db.AddDisableUpdateColumn("CreateTime", "CreateEmpId", "CreateEmpName", "PV");
                if (Update(m))
                {
                    json.Status = "y";
                    json.Msg    = "保存成功";
                    //添加操作日志
                    DB.SysLogs.setAdminLog("Edit", "更新名称为[" + entity.ProductName + "]的商品");
                }
            }
            return(json);
        }
        public async Task <List <Product_Info> > GetByIdAsync(int id)
        {
            Product_Info objectProductInfo = await _context.Product_Info.FindAsync(id);

            List <Product_Info> product = new List <Product_Info>();

            try
            {
                product.Add(objectProductInfo);
            }catch (Exception ex) {
                throw new Exception(ex.Message);
            }
            return(product);
        }
Exemple #20
0
        public static Product_Info Product_GetByID(decimal _productId)
        {
            var p_object = new Product_Info();

            try
            {
                p_object = (Product_Info)CBO.FillObjectFromDataSet(ProductDA.Product_GetById(_productId), typeof(Product_Info));
            }
            catch (Exception ex)
            {
                Common.log.Error(ex.ToString());
            }
            return(p_object);
        }
Exemple #21
0
        /// <summary>
        /// 下架
        /// </summary>
        /// <param name="id"></param>
        public void RemoveProduct(int id)
        {
            using (Entities db = new Entities())
            {
                Product_Info product = db.Product_Info.FirstOrDefault(e => e.id == id);
                if (product != null)
                {
                    //db.Product_Info.Remove(product);

                    product.status = 0;
                    db.SaveChanges();
                }
            }
        }
Exemple #22
0
        public ActionResult Product_View_Update(decimal _productId)
        {
            var _obj = new Product_Info();

            try
            {
                _obj = ProductBL.Product_GetByID(_productId);
            }
            catch (Exception ex)
            {
                Common.log.Error(ex.ToString());
            }
            return(PartialView("_Product_Update", _obj));
        }
Exemple #23
0
        // GET: Product_Info/Edit/5
        public ActionResult Edit(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Product_Info product_Info = db.Product_Info.Find(id);

            if (product_Info == null)
            {
                return(HttpNotFound());
            }
            return(View(product_Info));
        }
Exemple #24
0
        public ActionResult Product_Update(Product_Info _obj)
        {
            decimal p_success = -1;

            try
            {
                p_success = ProductBL.Product_Update(_obj);
            }
            catch (Exception ex)
            {
                Common.log.Error(ex.ToString());
            }
            return(Json(new { success = p_success }));
        }
        public async Task UpdateAsync(int id, [FromBody] Product_Info item)
        {
            var result = _context.Product_Info.FirstOrDefault(t => t.Id == id);

            result.Id   = item.Id;
            result.name = item.name;
            try
            {
                _context.Product_Info.Update(result);
                await _context.SaveChangesAsync();
            }catch (Exception ex) {
                throw new Exception(ex.Message);
            }
        }
        public ActionResult CreateProduct()
        {
            Product_InfoDto args = RequestArgs <Product_InfoDto>();

            if (args == null)
            {
                return(FailedResult("参数无效。"));
            }

            Product_Info product = Mapper.Map <Product_Info>(args);

            NormalResult result = _productManager.CreateProduct(product, args.catalog_idList, args.attribute_idList);

            return(ApiResult(result.Successful, result.Message));
        }
        /// <summary>
        /// 添加图片
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult Add(int id)
        {
            if (id == 0)
            {
                return(LayerAlertErrorAndReturn("请选择一个产品!"));
            }
            Product_Info model = Bll.BllProduct_Info.First(o => o.Id == id);

            if (model == null)
            {
                return(Response404());
            }
            ViewBag.type = RequestByte("type");
            return(View(model));
        }
        public ActionResult SaveSpu()
        {
            Product_Info modPro  = new Product_Info();
            int          classId = RequestInt("classid");
            string       spu     = RequestString("spu");

            //产品分类验证
            Product_Class modClass = null;

            if (classId > 0)
            {
                modClass = Bll.BllProduct_Class.First(o => o.Id == classId);
                if (modClass == null)
                {
                    return(LayerAlertErrorAndReturn("分类不存在!"));
                }
                var classIds = modClass.ParPath.TrimEnd(',').Split(',');
                modPro.ClassId_1    = classIds.Length > 0 ? classIds[0].ToInt32() : 0;
                modPro.ClassId_2    = classIds.Length > 1 ? classIds[1].ToInt32() : 0;
                modPro.ClassId      = modClass.Id;
                modPro.ClassParPath = modClass.ParPath;
            }
            else
            {
                return(LayerAlertErrorAndReturn("请选择一个产品分类!"));
            }

            //spu编号重复验证
            if (Bll.BllProduct_Info.IsExistsSpu(spu))
            {
                return(LayerAlertErrorAndReturn("该SPU编号已存在,请修改!"));
            }

            modPro.Spu        = spu;
            modPro.IsShow     = false;
            modPro.CreateDate = DateTime.Now;
            modPro.AdminId    = MyInfo.Id;
            int proId = Bll.BllProduct_Info.Insert(modPro);

            if (proId > 0)
            {
                return(LayerAlertSuccessAndRefresh("添加成功"));
            }
            else
            {
                return(LayerAlertErrorAndReturn("添加失败"));
            }
        }
Exemple #29
0
        /// <summary>
        /// Lấy dữ liệu ItemInfo từ control
        /// </summary>
        /// <returns></returns>
        Product_Info Get_ItemInfo_FromControl()
        {
            try
            {
                Product_Info _Product_Info = new Product_Info();
                _Product_Info.Name          = txtProduct_Name.Text;                     // tên
                _Product_Info.Receive_Price = Convert.ToDecimal(txtReceive_Price.Text); //
                _Product_Info.Per_BanBuon   = Convert.ToDecimal(txtPerBanLe.Text);      //
                _Product_Info.Per_BanLe     = Convert.ToDecimal(txtPerBanBuon.Text);    //

                _Product_Info.BanBuon_Price = Convert.ToDecimal(txtPrice_BanBuon.Text); //
                _Product_Info.BanLe_Price   = Convert.ToDecimal(txtPrice_BanLe.Text);   //

                _Product_Info.Category_Id   = Convert.ToDecimal(cboItem_Type.SelectedValue);
                _Product_Info.Receive_Date  = ConvertData.ConvertString2Date(dpReceiveDate.Text);
                _Product_Info.Color_Name    = Get_Color();
                _Product_Info.Receive_Count = c_j_ao;
                _Product_Info.Count_by_Ri   = c_count;
                _Product_Info.Total_Receive = c_j_ao * c_count;
                _Product_Info.Total_Sale    = 0;
                _Product_Info.Unit          = Convert.ToInt16(cboUnit.SelectedValue);

                if (txtShip_Price.Text != "")
                {
                    _Product_Info.Ship_Price = Convert.ToDecimal(txtShip_Price.Text);
                }
                else
                {
                    _Product_Info.Ship_Price = 0;
                }

                if (cboSupplier.Text != "")
                {
                    _Product_Info.Supplier_Id = Convert.ToDecimal(cboSupplier.SelectedValue);
                }
                _Product_Info.Product_Code = txtProductCode.Text;
                _Product_Info.Note         = txtNote.Text;
                _Product_Info.Size         = c_from.ToString() + " - " + c_to.ToString();
                _Product_Info.User_Name    = CommonData.c_Urser_Info.User_Name;

                return(_Product_Info);
            }
            catch (Exception ex)
            {
                CommonData.log.Error(ex.ToString());
                return(null);
            }
        }
        public ActionResult List(int id)
        {
            if (id == 0)
            {
                return(LayerAlertErrorAndReturn("请选择一个产品!"));
            }
            Product_Info model = Bll.BllProduct_Info.First(o => o.Id == id);

            if (model == null)
            {
                return(Response404());
            }

            ViewBag.typeHtml = Tools.Enums.Tools.GetOptionHtml(typeof(Tools.Enums.ESite.ImageType));
            return(View(model));
        }