Ejemplo n.º 1
0
        private void buttonAddService_Click(object sender, EventArgs e)
        {
            ServiceWindow serviceWindow = new ServiceWindow();
            DialogResult okFlag = serviceWindow.ShowDialog();
            if (okFlag == DialogResult.OK)
            {

                serviceList.Add(serviceWindow.GetLine());
                dataGridView1.DataSource = PrintOnTable();
            }
            serviceWindow.Dispose();
        }
Ejemplo n.º 2
0
        public bool EditServiceLine(string selectName)
        {
            bool flag = false;
            int numberLine = SearchService(selectName); ;
            if (numberLine >= 0)
            {
                ServiceWindow serviceWindow = new ServiceWindow(serviceList[numberLine]);
                DialogResult okFlag = serviceWindow.ShowDialog();
                if (okFlag == DialogResult.OK)
                {
                    serviceList[numberLine] = serviceWindow.GetLine();
                    //записать изменения в файл?
                    flag = true;
                }
                else
                {
                    if (okFlag == DialogResult.Abort)
                    {
                        serviceList.RemoveAt(numberLine);
                        flag = true;
                    }
                }
                serviceWindow.Dispose();
            }

            return flag;
        }