Ejemplo n.º 1
0
        private void btnNext_Click(object sender, EventArgs e)
        {
            if (txtUnitName.Text.Length != 0)
            {
                if (lsbUnitNames.Items.Contains(txtUnitName.Text))
                {
                    MessageBox.Show("Unit already exist");
                }
                else
                {
                    Test.Inventory.Database.CreateUMData UM = new Inventory.Database.CreateUMData();
                    UM.UnitName = txtUnitName.Text;

                    UM.FnConn();
                    UM.fnTransactionData();
                    UM.FnTrans();

                    if (UM.Result == "Success")
                    {
                        MessageBox.Show("Unit Created", "ALERT", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show("Unit Creation failed", "ALERT", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }

                    txtUnitName.Text = "";
                    txtUnitName.Focus();
                    LoadList();
                }
            }
        }
Ejemplo n.º 2
0
        public void LoadList()
        {
            lsbUnitNames.Items.Clear();
            Test.Inventory.Database.CreateUMData UM = new Inventory.Database.CreateUMData();
            UM.FnConn();
            DataTable dtUnit = UM.FillData();

            UM.FnTrans();

            foreach (DataRow dr in dtUnit.Rows)
            {
                lsbUnitNames.Items.Add(dr["unitName"] + "");
            }
        }
Ejemplo n.º 3
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            DialogResult rs = MessageBox.Show(" Procced ?", "Alert", MessageBoxButtons.YesNo);

            if (rs == DialogResult.Yes)
            {
                Test.Inventory.Database.CreateUMData UM = new Inventory.Database.CreateUMData();

                UM.FnConn();
                UM.DeleteData(lsbUnitNames.SelectedItem + "");
                UM.FnTrans();

                LoadList();
            }
        }