⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 upgoods.cs

📁 超市POS收银系统c.rar
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace FOUPOS
{
    public partial class UpGoods : Form
    {
        private POS.Model.FGoods m_Goods;
        public UpGoods(POS.Model.FGoods m_Goods)
        {
            InitializeComponent();
            this.m_Goods = m_Goods;
            BindClass();
            BindGoods();
        }
        private void BindGoods()
        {
            txtBuy.Text = m_Goods.SBuyPrice.ToString();
            txtCount.Text = m_Goods.SCount.ToString();
            txtName.Text = m_Goods.SName;
            txtNum.Text = m_Goods.SNum;
            txtRemark.Text = m_Goods.SRemark;
            txtSale.Text = m_Goods.SSalePrice.ToString();
            txtType.Text = m_Goods.SType;
            txtColor.Text = m_Goods.SColor;
            POS.Model.FClass m_Class = new POS.Model.FClass();
            POS.BLL.FClass b_Class = new POS.BLL.FClass();
            m_Class = b_Class.GetModel(m_Goods.CID);
            cbClass.Text = m_Class.CUnit;
        }
        private void UpGoods_Load(object sender, EventArgs e)
        {
            skinEngine1.SkinFile = "OneBlue.ssk";
            txtNum.Focus();
        }
        private void BindClass()
        {
            POS.BLL.FClass bll_Class = new POS.BLL.FClass();
            DataSet ds = bll_Class.GetAllList();
            cbClass.DataSource = ds.Tables[0];
            cbClass.DisplayMember = "CUnit";
            cbClass.ValueMember = "CID";
        }

        private void bnAdd_Click(object sender, EventArgs e)
        {
            #region 商品修改

            POS.BLL.FGoods b_Goods = new POS.BLL.FGoods();

            if (!string.IsNullOrEmpty(txtNum.Text))
            {
                m_Goods.SNum = txtNum.Text.Trim();
            }
            else
            {
                MessageBox.Show("商品编号/条形码不能为空.");
                return;
            }
            if (!string.IsNullOrEmpty(txtName.Text))
            {
                m_Goods.SName = txtName.Text.Trim();
            }
            else
            {
                MessageBox.Show("商品名称不能为空.");
                return;
            }
            if (cbClass.Text == "--请选择--")
            {
                MessageBox.Show("请选择商品单位.");
                return;
            }
            else
            {
                m_Goods.CID = Convert.ToInt32(((DataRowView)cbClass.SelectedItem).Row.ItemArray[0]);//获取valuemember值
            }
            if (string.IsNullOrEmpty(txtBuy.Text))
            {
                m_Goods.SBuyPrice = 0;
            }
            else if (POS.DBUtility.Validator.IsNumber(txtBuy.Text))
            {
                m_Goods.SBuyPrice = decimal.Parse(txtBuy.Text.Trim());
            }
            else
            {
                MessageBox.Show("商品进价输入错误,必须填写数字或小数.");
                return;
            }
            if (string.IsNullOrEmpty(txtSale.Text))
            {
                m_Goods.SSalePrice = 0;
            }
            else if (POS.DBUtility.Validator.IsNumber(txtSale.Text))
            {
                m_Goods.SSalePrice = decimal.Parse(txtSale.Text.Trim());
            }
            else
            {
                MessageBox.Show("商品售价输入错误,必须填写数字或小数.");
                return;
            }
            if (string.IsNullOrEmpty(txtCount.Text))
            {
                m_Goods.SCount = 0;
            }
            else if (POS.DBUtility.Validator.IsNumberId(txtCount.Text))
            {
                m_Goods.SCount = int.Parse(txtCount.Text.Trim());
            }
            else
            {
                MessageBox.Show("数量输入错误.");
                return;
            }

            m_Goods.SType = txtType.Text.Trim();
            m_Goods.SColor = txtColor.Text.Trim();
            m_Goods.SRemark = txtRemark.Text.Trim();
            m_Goods.SJoinTime = DateTime.Now;
            b_Goods.Update(m_Goods);
            #endregion
            MessageBox.Show("修改成功.");
            //MessageBox.Show("修改成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            this.Close();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            DialogResult = DialogResult.OK;
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -