Example #1
0
        public void Vendors()
        {
            Vendors   vendor     = new Vendors();
            DataTable _vendorsDT = vendor.SelectAllVendords();

            DataRow _row = _vendorsDT.NewRow();

            _row[0] = 0;
            _row[1] = "Select Vendors";
            _vendorsDT.Rows.InsertAt(_row, 0);

            metroComboBox1.DisplayMember = _vendorsDT.Columns[1].ToString();
            metroComboBox1.ValueMember   = _vendorsDT.Columns[0].ToString();
            metroComboBox1.DataSource    = _vendorsDT;
            metroComboBox1.SelectedIndex = 0;
        }
        private void GetVendors()
        {
            Vendors vendorObj = new Vendors();

            this._dt = vendorObj.SelectAllVendords();

            DataRow row = this._dt.NewRow();

            row[0] = 0;
            row[1] = "Select Vendor";
            this._dt.Rows.InsertAt(row, 0);
            this.metroComboBox1.DisplayMember = this._dt.Columns[1].ToString();
            this.metroComboBox1.ValueMember   = this._dt.Columns[0].ToString();
            this.metroComboBox1.DataSource    = this._dt;

            this.metroComboBox1.SelectedIndex = 0;
        }
Example #3
0
        public void vendors()
        {
            try {
                Vendors   vendor = new Vendors();
                DataTable dt     = vendor.SelectAllVendords();

                metroComboBox1.DisplayMember = dt.Columns[1].ToString();
                metroComboBox1.ValueMember   = dt.Columns[0].ToString();
                metroComboBox1.DataSource    = dt;

                DataRow row = dt.NewRow();

                row[0] = 0;
                row[1] = "Select Vendor";

                dt.Rows.InsertAt(row, 0);
                metroComboBox1.SelectedIndex = 0;
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
            }
        }
Example #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                Vendors vendor = new Vendors()
                {
                    VendorName    = txt_vendorName.Text,
                    Address       = txt_address.Text,
                    ContactNumber = txt_contactNumber.Text,
                    EmailAddress  = txt_email.Text,
                    Tags          = txt_tags.Text
                };

                VendorRepository vendorRepository = new VendorRepository(vendor);
                switch (this._vendor_id)
                {
                case 0:
                    vendorRepository.CreateVendor();
                    MessageBox.Show("New Vendor Saved");
                    break;

                default:
                    vendor.ID = this._vendor_id;
                    vendorRepository.UpdateVendor();
                    MessageBox.Show("Vendor Updated");
                    break;
                }
                if (this._vendors != null)
                {
                    this._vendors.Vendors();
                }
                this.Close();
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
            }
        }
 public VendorRepository(Vendors vendors)
 {
     _connection = new Connection();
     _vendors    = vendors;
 }