예제 #1
0
        private void lstviewİsci_DoubleClick(object sender, EventArgs e)
        {
            int           index      = lstviewİsci.Items.IndexOf(lstviewİsci.SelectedItems[0]);
            FormAddUpdate formupdate = new FormAddUpdate();

            formupdate.Staff = employees[index];
            int indexofemp = formupdate.Staff._id - 1;

            formupdate.ShowDialog();



            lstviewİsci.Items.RemoveAt(index);
            employees.RemoveAt(index);
            employee yeni = formupdate.Staff;

            yeni._id = indexofemp + 1;
            employee.Counter--;
            if (employees.Count >= indexofemp)
            {
                employees.Insert(indexofemp, yeni);
            }
            else
            {
                employees.Add(yeni);
            }
            string[] isciozellik = new string[5];
            isciozellik[0] = yeni._id.ToString();
            isciozellik[1] = yeni._isim;
            isciozellik[2] = yeni._soyisim;
            isciozellik[3] = yeni._maas.ToString();
            isciozellik[4] = yeni.Bmoo.ToString();
            ListViewItem isci = new ListViewItem(isciozellik);

            if (lstviewİsci.Items.Count > indexofemp)
            {
                lstviewİsci.Items.Insert(indexofemp, isci);
            }
            else
            {
                lstviewİsci.Items.Add(isci);
            }
        }
예제 #2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            FormAddUpdate formaddupdate = new FormAddUpdate();

            formaddupdate.ShowDialog();
            employee yeni = formaddupdate.Staff;

            formaddupdate.Dispose();
            string[] isciozellik = new string[5];
            if (yeni != null)
            {
                isciozellik[0] = yeni._id.ToString();
                isciozellik[1] = yeni._isim;
                isciozellik[2] = yeni._soyisim;
                isciozellik[3] = yeni._maas.ToString();
                isciozellik[4] = yeni.Bmoo.ToString();
                ListViewItem isci = new ListViewItem(isciozellik);
                lstviewİsci.Items.Add(isci);
                employees.Add(yeni);
            }
        }