Exemplo n.º 1
0
        private void frmEditGoods_Load(object sender, EventArgs e)
        {
            Dong.BLL.Category catebll = new Dong.BLL.Category();
            ddlCategory.DataSource    = catebll.GetAllList().Tables[0];
            ddlCategory.DisplayMember = "Name";
            ddlCategory.ValueMember   = "Id";
            //绑定单位
            Dong.BLL.Unit unitbll = new Dong.BLL.Unit();
            ddlUnit.DataSource    = unitbll.GetAllList().Tables[0];
            ddlUnit.DisplayMember = "Name";
            ddlUnit.ValueMember   = "Id";
            //绑定供应商
            Dong.BLL.Supplier supplierbll = new Dong.BLL.Supplier();
            ddlSupper.DataSource    = supplierbll.GetAllList().Tables[0];
            ddlSupper.DisplayMember = "Name";
            ddlSupper.ValueMember   = "Id";

            Dong.BLL.GoodsInfo   bll   = new Dong.BLL.GoodsInfo();
            Dong.Model.GoodsInfo model = new Dong.Model.GoodsInfo();
            model = bll.GetModelById(int.Parse(this.Tag.ToString()));
            if (model != null)
            {
                tbCode.Text               = model.Code;
                tbName.Text               = model.GoodsName;
                tbFactory.Text            = model.Factory;
                ddlCategory.SelectedValue = model.Category;
                ddlUnit.SelectedValue     = model.Unit;
                ddlSupper.SelectedValue   = model.Supplier;
                txtPrice0.Text            = model.Price0 == null ? "" : model.Price0.ToString();
                txtPrice1.Text            = model.Price1 == null ? "" : model.Price1.ToString();
                txtPrice2.Text            = model.Price2 == null ? "" : model.Price2.ToString();
            }
        }
Exemplo n.º 2
0
        private void frmEditSup_Load(object sender, EventArgs e)
        {
            Dong.BLL.Supplier   bll   = new Dong.BLL.Supplier();
            Dong.Model.Supplier model = new Dong.Model.Supplier();
            model = bll.GetModel(int.Parse(this.Tag.ToString()));
            if (model != null)
            {
                txtName.Text    = model.Name;
                txtAdd.Text     = model.Addr;
                txtContact.Text = model.Contact;
                txtPhone.Text   = model.Phone;
                txtCode.Text    = model.Code;
                txtaccount.Text = model.Account;

                txtbank.Text = model.Bank;
            }
        }
Exemplo n.º 3
0
 private void frmAddGoods_Load(object sender, EventArgs e)
 {
     //绑定商品类别
     Dong.BLL.Category catebll = new Dong.BLL.Category();
     ddlCategory.DataSource    = catebll.GetAllList().Tables[0];
     ddlCategory.DisplayMember = "Name";
     ddlCategory.ValueMember   = "Id";
     //绑定单位
     Dong.BLL.Unit unitbll = new Dong.BLL.Unit();
     ddlUnit.DataSource    = unitbll.GetAllList().Tables[0];
     ddlUnit.DisplayMember = "Name";
     ddlUnit.ValueMember   = "Id";
     //绑定供应商
     Dong.BLL.Supplier supplierbll = new Dong.BLL.Supplier();
     ddlSupper.DataSource    = supplierbll.GetAllList().Tables[0];
     ddlSupper.DisplayMember = "Name";
     ddlSupper.ValueMember   = "Id";
 }
Exemplo n.º 4
0
        private void fillGVList(string key, int pageSize, int page)
        {
            strSql  = key;
            intPage = page;
            Dong.BLL.Supplier bll = new Dong.BLL.Supplier();
            DataSet           ds  = new DataSet();

            ds = bll.GetListPage(key, pageSize, page);

            gvList.DataSource = ds.Tables[0];
            if (ds.Tables[0].Rows.Count > 0)
            {
                intPages();
            }
            else
            {
                MessageBoxEx.Show("对不起,没有您搜索的记录!");
            }
        }
Exemplo n.º 5
0
        private void btnDel_Click(object sender, EventArgs e)
        {
            //删除会员
            string id = gvList.SelectedRows[0].Cells[0].Value.ToString();

            if (id != "")
            {
                if (MessageBoxEx.Show("确定删除该记录?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                {
                    Dong.BLL.Supplier bll = new Dong.BLL.Supplier();
                    bll.Delete(int.Parse(id));
                    this.gvList.Rows[0].Selected = true;
                    fillGVList(strSql, intPageSize, intPage);
                }
            }
            else
            {
                MessageBoxEx.Show("请选择要删除的行!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 6
0
        private void intPages()
        {
            Dong.BLL.Supplier bVip = new Dong.BLL.Supplier();
            int counts             = bVip.GetRecordCount(strSql);

            lblCounts.Text = counts.ToString();
            if (counts % intPageSize == 0)
            {
                pageCounts = counts / intPageSize;
            }
            else
            {
                pageCounts = (counts / intPageSize) + 1;
            }

            cbPage.Items.Clear();
            for (int i = 1; i <= pageCounts; i++)
            {
                cbPage.Items.Add(i.ToString());
            }
            cbPage.SelectedIndex = intPage - 1;
        }
Exemplo n.º 7
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            //验证商家名称
            if (txtName.Text.Trim() == "")
            {
                MessageBoxEx.Show("请输入商家名称!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtName.Focus();
                return;
            }

            if (txtAdd.Text.Trim() == "")
            {
                MessageBoxEx.Show("请输入地址!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtAdd.Focus();
                return;
            }

            if (txtContact.Text.Trim() == "")
            {
                MessageBoxEx.Show("请输入联系人!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtContact.Focus();
                return;
            }

            if (txtPhone.Text.Trim() == "")
            {
                MessageBoxEx.Show("请输入电话!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtPhone.Focus();
                return;
            }

            if (txtCode.Text.Trim() == "")
            {
                txtCode.Text = "无";
            }

            if (txtaccount.Text.Trim() == "")
            {
                txtaccount.Text = "无";
            }

            if (txtbank.Text.Trim() == "")
            {
                txtbank.Text = "无";
            }


            Dong.BLL.Supplier   bll   = new Dong.BLL.Supplier();
            Dong.Model.Supplier model = new Dong.Model.Supplier();
            model.Id      = int.Parse(this.Tag.ToString());
            model.Name    = txtName.Text;
            model.Addr    = txtAdd.Text;
            model.Contact = txtContact.Text;
            model.Phone   = txtPhone.Text;
            model.Code    = txtCode.Text;
            model.Account = txtaccount.Text;
            model.Bank    = txtbank.Text;
            model.Oper    = Dong.Model.GlobalsInfo.UserName;

            model.OperDate = DateTime.Now;


            if (bll.Update(model))
            {
                MessageBoxEx.Show("修改成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                frmSup fvip = (frmSup)this.Owner;
                fvip.refreshData();
                this.Close();
            }
            else
            {
                MessageBoxEx.Show("修改失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }