Example #1
0
        //新增供应商
        private void addProviderTool_Click(object sender, EventArgs e)
        {
            int rindex = -1;
            int cindex = -1;
            if (dgvCustomerList.CurrentCell != null)
            {
                rindex = dgvCustomerList.CurrentCell.RowIndex;
                cindex = dgvCustomerList.CurrentCell.ColumnIndex;
            }

            var form = new ProviderForm(db, null);
            if (form.ShowDialog() == DialogResult.OK)
            {
                dgvProviderList_show();
                if (rindex != -1 && cindex != -1)
                    dgvCustomerList.CurrentCell = dgvCustomerList[cindex, rindex];
            }
        }
Example #2
0
        //编辑供应商
        private void editProviderTool_Click(object sender, EventArgs e)
        {
            if (dgvCustomerList.CurrentCell == null)
            {
                BathClass.printErrorMsg("需要选择行!");
                return;
            }

            int rindex = dgvCustomerList.CurrentCell.RowIndex;
            int cindex = dgvCustomerList.CurrentCell.ColumnIndex;

            var p    = db.Provider.FirstOrDefault(x => x.name == dgvCustomerList.CurrentRow.Cells[0].Value.ToString());
            var form = new ProviderForm(db, p);

            if (form.ShowDialog() == DialogResult.OK)
            {
                dgvProviderList_show();
                dgvCustomerList.CurrentCell = dgvCustomerList[cindex, rindex];
            }
        }
Example #3
0
        //新增供应商
        private void addProviderTool_Click(object sender, EventArgs e)
        {
            int rindex = -1;
            int cindex = -1;

            if (dgvCustomerList.CurrentCell != null)
            {
                rindex = dgvCustomerList.CurrentCell.RowIndex;
                cindex = dgvCustomerList.CurrentCell.ColumnIndex;
            }

            var form = new ProviderForm(db, null);

            if (form.ShowDialog() == DialogResult.OK)
            {
                dgvProviderList_show();
                if (rindex != -1 && cindex != -1)
                {
                    dgvCustomerList.CurrentCell = dgvCustomerList[cindex, rindex];
                }
            }
        }
Example #4
0
        //编辑供应商
        private void editProviderTool_Click(object sender, EventArgs e)
        {
            if (dgvCustomerList.CurrentCell == null)
            {
                BathClass.printErrorMsg("需要选择行!");
                return;
            }

            int rindex = dgvCustomerList.CurrentCell.RowIndex;
            int cindex = dgvCustomerList.CurrentCell.ColumnIndex;

            var p = db.Provider.FirstOrDefault(x => x.name == dgvCustomerList.CurrentRow.Cells[0].Value.ToString());
            var form = new ProviderForm(db, p);
            if (form.ShowDialog() == DialogResult.OK)
            {
                dgvProviderList_show();
                dgvCustomerList.CurrentCell = dgvCustomerList[cindex, rindex];
            }
        }
Example #5
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (name.Text == "")
            {
                BathClass.printErrorMsg("需要选择商品名称");
                return;
            }

            if (amount.Text.Trim() == "")
            {
                BathClass.printErrorMsg("需要输入数量!");
                return;
            }

            if (stock.Text == "")
            {
                BathClass.printErrorMsg("需要选择仓库!");
                return;
            }

            if (transactor.Text == "")
            {
                BathClass.printErrorMsg("需要输入经手人!");
                return;
            }

            if (checker.Text == "")
            {
                BathClass.printErrorMsg("需要输入审核!");
                return;
            }

            if (provider.Text.Trim() == "")
            {
                BathClass.printErrorMsg("需要选择供应商!");
                return;
            }

            //StockIn inStock = new StockIn();
            inStock.name = name.Text;
            if (cost.Text != "")
            {
                inStock.cost = Convert.ToDouble(cost.Text);
            }
            inStock.amount = Convert.ToDouble(amount.Text);

            if (unit.Text != "")
            {
                inStock.unit = unit.Text;
            }

            inStock.stockId    = db.Stock.FirstOrDefault(x => x.name == stock.Text).id;
            inStock.note       = note.Text;
            inStock.date       = dtPickerIntoStock.Value;
            inStock.transactor = transactor.Text;
            inStock.checker    = checker.Text;
            inStock.money      = totalmoney;

            var p = db.Provider.FirstOrDefault(x => x.name == provider.Text.Trim());

            if (p == null)
            {
                p      = new Provider();
                p.name = provider.Text.Trim();
                var form = new ProviderForm(db, p);
                if (form.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                db.Provider.InsertOnSubmit(p);
                db.SubmitChanges();
            }
            inStock.providerId = p.id;
            db.SubmitChanges();
            this.DialogResult = DialogResult.OK;
        }
Example #6
0
        //确定
        private void okBtn_Click(object sender, EventArgs e)
        {
            if (name.Text == "")
            {
                BathClass.printErrorMsg("需要选择商品名称");
                return;
            }

            if (amount.Text.Trim() == "")
            {
                BathClass.printErrorMsg("需要输入数量!");
                return;
            }

            if (stock.Text == "")
            {
                BathClass.printErrorMsg("需要选择仓库!");
                return;
            }

            if (transactor.Text == "")
            {
                BathClass.printErrorMsg("需要输入经手人!");
                return;
            }

            if (checker.Text == "")
            {
                BathClass.printErrorMsg("需要输入审核!");
                return;
            }


            if (provider.Text.Trim() == "")
            {
                BathClass.printErrorMsg("需要选择供应商!");
                return;
            }
            stockin.name = name.Text;
            stockin.cost = MConvert <double> .ToTypeOrDefault(cost.Text.Trim(), 0);

            stockin.amount = MConvert <double> .ToTypeOrDefault(amount.Text.Trim(), 0);

            stockin.unit       = unit.Text;
            stockin.stockId    = db.Stock.FirstOrDefault(x => x.name == stock.Text).id;
            stockin.note       = note.Text;
            stockin.date       = dtPickerIntoStock.Value;
            stockin.transactor = transactor.Text;
            stockin.checker    = checker.Text;
            stockin.money      = totalmoney;

            //StockIn inStock = new StockIn();
            if (newStockin)
            {
                if (db.Unit.Where(x => x.name == unit.Text.Trim()).Count() == 0)
                {
                    Unit u = new Unit();
                    u.name = unit.Text.Trim();
                    db.Unit.InsertOnSubmit(u);
                    db.SubmitChanges();
                }

                var p = db.Provider.FirstOrDefault(x => x.name == provider.Text.Trim());
                if (p == null)
                {
                    p      = new Provider();
                    p.name = provider.Text.Trim();
                    var form = new ProviderForm(db, p);
                    if (form.ShowDialog() != DialogResult.OK)
                    {
                        return;
                    }
                    db.Provider.InsertOnSubmit(p);
                    db.SubmitChanges();
                }
                stockin.providerId = p.id;
                db.StockIn.InsertOnSubmit(stockin);
                db.SubmitChanges();
                stockin = new StockIn();
                goodsCat.SelectedIndex = -1;
                name.Text              = "";
                stock.SelectedIndex    = -1;
                unit.Text              = "";
                amount.Text            = "";
                provider.SelectedIndex = -1;
                cost.Text              = "";
                money.Text             = "";
                checker.Text           = "";
                transactor.Text        = "";
                note.Text              = "";
                checker.Text           = LogIn.m_User.name;
                transactor.Text        = LogIn.m_User.name;
            }
            else
            {
                db.SubmitChanges();
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
        }
Example #7
0
        //确定
        private void okBtn_Click(object sender, EventArgs e)
        {
            if (name.Text == "")
            {
                BathClass.printErrorMsg("需要选择商品名称");
                return;
            }

            if (amount.Text.Trim() == "")
            {
                BathClass.printErrorMsg("需要输入数量!");
                return;
            }

            if (stock.Text=="")
            {
                BathClass.printErrorMsg("需要选择仓库!");
                return;
            }

            if (transactor.Text=="")
            {
                BathClass.printErrorMsg("需要输入经手人!");
                return;
            }

            if (checker.Text=="")
            {
                BathClass.printErrorMsg("需要输入审核!");
                return;
            }

            if (provider.Text.Trim() == "")
            {
                BathClass.printErrorMsg("需要选择供应商!");
                return;
            }
            stockin.name = name.Text;
            stockin.cost = MConvert<double>.ToTypeOrDefault(cost.Text.Trim(), 0);
            stockin.amount = MConvert<double>.ToTypeOrDefault(amount.Text.Trim(),0);
            stockin.unit = unit.Text;
            stockin.stockId = db.Stock.FirstOrDefault(x => x.name == stock.Text).id;
            stockin.note = note.Text;
            stockin.date = dtPickerIntoStock.Value;
            stockin.transactor = transactor.Text;
            stockin.checker = checker.Text;
            stockin.money = totalmoney;

            //StockIn inStock = new StockIn();
            if (newStockin)
            {

            if (db.Unit.Where(x=>x.name==unit.Text.Trim()).Count()==0)
            {
                Unit u = new Unit();
                u.name = unit.Text.Trim();
                db.Unit.InsertOnSubmit(u);
                db.SubmitChanges();
            }

            var p = db.Provider.FirstOrDefault(x => x.name == provider.Text.Trim());
            if (p==null)
            {
                p = new Provider();
                p.name = provider.Text.Trim();
                var form = new ProviderForm(db, p);
                if (form.ShowDialog() != DialogResult.OK)
                    return;
                db.Provider.InsertOnSubmit(p);
                db.SubmitChanges();
            }
                stockin.providerId = p.id;
                db.StockIn.InsertOnSubmit(stockin);
            db.SubmitChanges();
                stockin = new StockIn();
                goodsCat.SelectedIndex = -1;
                name.Text = "";
                stock.SelectedIndex = -1;
                unit.Text = "";
                amount.Text = "";
                provider.SelectedIndex = -1;
                cost.Text = "";
                money.Text = "";
                checker.Text = "";
                transactor.Text = "";
                note.Text = "";
                checker.Text = LogIn.m_User.name;
                transactor.Text = LogIn.m_User.name;

            }
            else
            {
                db.SubmitChanges();
            this.DialogResult=DialogResult.OK;
                this.Close();
            }
        }
Example #8
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (name.Text == "")
            {
                BathClass.printErrorMsg("需要选择商品名称");
                return;
            }

            if (amount.Text.Trim() == "")
            {
                BathClass.printErrorMsg("需要输入数量!");
                return;
            }

            if (stock.Text == "")
            {
                BathClass.printErrorMsg("需要选择仓库!");
                return;
            }

            if (transactor.Text == "")
            {
                BathClass.printErrorMsg("需要输入经手人!");
                return;
            }

            if (checker.Text == "")
            {
                BathClass.printErrorMsg("需要输入审核!");
                return;
            }

            if (provider.Text.Trim() == "")
            {
                BathClass.printErrorMsg("需要选择供应商!");
                return;
            }

            //StockIn inStock = new StockIn();
            inStock.name = name.Text;
            if (cost.Text != "")
                inStock.cost = Convert.ToDouble(cost.Text);
            inStock.amount = Convert.ToDouble(amount.Text);

            if (unit.Text != "")
                inStock.unit = unit.Text;

            inStock.stockId = db.Stock.FirstOrDefault(x => x.name == stock.Text).id;
            inStock.note = note.Text;
            inStock.date = dtPickerIntoStock.Value;
            inStock.transactor = transactor.Text;
            inStock.checker = checker.Text;
            inStock.money = totalmoney;

            var p = db.Provider.FirstOrDefault(x => x.name == provider.Text.Trim());
            if (p == null)
            {
                p = new Provider();
                p.name = provider.Text.Trim();
                var form = new ProviderForm(db, p);
                if (form.ShowDialog() != DialogResult.OK)
                    return;

                db.Provider.InsertOnSubmit(p);
                db.SubmitChanges();
            }
            inStock.providerId = p.id;
            db.SubmitChanges();
            this.DialogResult = DialogResult.OK;
        }