コード例 #1
0
        private void button6_Click(object sender, EventArgs e)
        {
            AddEQuipment formUpdate5 = new AddEQuipment("Update");
            int          index5      = FFood1.ListeQuipment.IndexOf(this.eQuipmentSelected);

            AddEQuipment.eQuipment.ID   = eQuipmentSelected.ID;
            AddEQuipment.eQuipment.Name = eQuipmentSelected.Name;
            AddEQuipment.eQuipment.Unit = eQuipmentSelected.Unit;
            AddEQuipment.eQuipment.Kind = eQuipmentSelected.Kind;
            AddEQuipment.eQuipment.DateOfManufacture = eQuipmentSelected.DateOfManufacture;

            formUpdate5.ShowDialog();

            EQuipment d = (EQuipment)ListeQuipment[index5];

            d.ID   = AddEQuipment.eQuipment.ID;
            d.Name = AddEQuipment.eQuipment.Name;
            d.Unit = AddEQuipment.eQuipment.Unit;
            d.Kind = AddEQuipment.eQuipment.Kind;
            d.DateOfManufacture = AddEQuipment.eQuipment.DateOfManufacture;;

            AddEQuipment.eQuipment = null;
            LoadEQuipment1();
            MessageBox.Show("Update successful");
        }
コード例 #2
0
        private void lvEQuipment2_SelectedIndexChanged(object sender, EventArgs e)
        {
            ListView lsveq = sender as ListView;

            if (lsveq.SelectedItems.Count == 1)
            {
                ListViewItem item   = lsveq.SelectedItems[0];
                int          index5 = Convert.ToInt32(item.Text);
                eQuipmentSelected = (EQuipment)FFood1.ListeQuipment[index5];
            }
        }
コード例 #3
0
        public void CreateDataEQuipment()
        {
            EQuipment eq1 = new EQuipment("0001", "Drag", "2500", "Cut", "15/3/2020");
            EQuipment eq2 = new EQuipment("0002", "Hammer", "110", "Medical", "18/12/2019");
            EQuipment eq3 = new EQuipment("0003", "Pliers", "287", "Tools", "30/02/2020");
            EQuipment eq4 = new EQuipment("0004", "Knife", "342", "Tools", "12/01/2020");
            EQuipment eq5 = new EQuipment("0005", "Syringe", "1135", "Medical", "16/05/2020");

            ListeQuipment.Add(eq1);
            ListeQuipment.Add(eq2);
            ListeQuipment.Add(eq3);
            ListeQuipment.Add(eq4);
            ListeQuipment.Add(eq5);
        }
コード例 #4
0
        public static string LastIdEQuipment(List <EQuipment> list)
        {
            string id = "";

            EQuipment temp4 = (EQuipment)list[list.Count() - 1];

            int lastId = Convert.ToInt32(temp4.ID);

            for (int i = 0; i < 4 - lastId.ToString().Length; i++)
            {
                id += "0";
            }
            return(id + (lastId + 1).ToString());
        }
コード例 #5
0
        private void button4_Click(object sender, EventArgs e)
        {
            AddEQuipment formAddEquipment = new AddEQuipment("Add");

            formAddEquipment.ShowDialog();
            if (AddEQuipment.eQuipment != null)
            {
                EQuipment d5 = new EQuipment(AddEQuipment.eQuipment);


                if (string.IsNullOrEmpty(d5.ID.ToString()) || string.IsNullOrEmpty(d5.Name.ToString()) || string.IsNullOrEmpty(d5.Unit.ToString()) || string.IsNullOrEmpty(d5.Kind.ToString()) || string.IsNullOrEmpty(d5.DateOfManufacture.ToString()))
                {
                }
                else
                {
                    ListeQuipment.Add(d5);
                    MessageBox.Show("Add successful");
                    LoadEQuipment1();
                }
            }
        }