예제 #1
0
        private void s_ServiceEdit_Click(object sender, EventArgs e)
        {
            CService tmpService = s_ServicesList.SelectedItem as CService;
            serviceForm newForm = new serviceForm();
            newForm.Text = "Editing" + tmpService.name;
            newForm.edit = true;
            newForm.service = tmpService;
            if (newForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                s_ServicesList.Items[s_ServicesList.SelectedIndex] = newForm.service;

                for (int i = 0; i < s_PackagesList.Items.Count; i++)
                {
                    CPackage tmpPackage = s_PackagesList.Items[i] as CPackage;

                    for (int j = 0; j < tmpPackage.services.Count; j++)
                    {
                        if (tmpPackage.services[j].id.Equals(newForm.service.id))
                        {
                            tmpPackage.services[j].name = newForm.service.name;
                            tmpPackage.services[j].price = newForm.service.price;
                        }
                    }
                }

                int index = s_PackagesList.SelectedIndex;
                s_PackagesList.ClearSelected();
                s_PackagesList.SelectedIndex = index;
            }
        }
예제 #2
0
 private void s_ServiceAdd_Click(object sender, EventArgs e)
 {
     serviceForm newForm = new serviceForm();
     newForm.Text = "Add New Service";
     newForm.edit = false;
     if (newForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         s_ServicesList.Items.Add(newForm.service);
         s_ServiceDelete.Enabled = true;
         s_ServiceEdit.Enabled = true;
         s_PackageAdd.Enabled = true;
         s_ServicesList.SelectedIndex = s_ServicesList.Items.Count - 1;
     }
 }