lign="justify"> {(addServiceForm.addService amp; amp;! addServiceForm.Visible)
{. addService=false; .Items.Clear (); (int i=0; i lt; addServiceForm.listViewObjectsServices.Items.Count; i ++)
{item=new ListViewItem ((listViewServices.Items.Count + 1).ToString());.SubItems.Add(((Service)addServiceForm.listViewObjectsServices.Items[i].Tag).Name);.SubItems.Add(((Service)addServiceForm.listViewObjectsServices.Items[i].Tag).SummaryCost.ToString());.SubItems.Add(((Service)addServiceForm.listViewObjectsServices.Items[i].Tag).Count.ToString());.Tag =AddServiceForm.listViewObjectsServices.Items [i] .Tag; .Items.Add (item) ;. Refresh ();
}. Close () ;. Stop ();
}
}
}
private void buttonAddConfiguration_Click (object sender, EventArgs e)
{= new AddConfigurationForm () ;. Start () ;. GetConnection (source); configurationCategory=sqlOperation.GetConfiguration (source) ;. Visible=true; .listViewObjectsConfigurations.Items.Clear () ;. categoryConfiguration=configurationCategory;
foreach (var listConfiguration in configurationCategory.Values)
{(var configuration in listConfiguration)
{item=new ListViewItem ((addConfigurationForm.listViewFindObjects.Items.Count + 1).ToString());.SubItems.Add(configuration.Name);.SubItems.Add(configuration.PriceWithMargin.ToString());.Tag =Configuration; .listViewFindObjects.Items.Add (item) ;. listViewFindObjects.Refresh ();
}
} (var category in configurationCategory.Keys)
{. comboBoxCategory.Items.Add (category);
} (listViewConfiguration.Items.Count gt; 0) (ListViewItem item in listViewConfiguration.Items)
{itx=new ListViewItem ((addConfigurationForm.listViewObjectsConfigurations.Items.Count + 1).ToString());.SubItems.Add(((Configuration)item.Tag).Name);.SubItems.Add(((Configuration)item.Tag).SummaryCost.ToString());.SubItems.Add(((Configuration)item.Tag).Count.ToString());.Tag =(Configuration) item.Tag; .listViewObjectsConfigurations.Items.Add (itx);
}
} void addConfigurationTimer_Tick (object sender, EventArgs e)
{(addConfigurationForm!=null)
{(addConfigurationForm.addConfiguration amp; amp;! addConfigurationForm.Visible)
{. addConfiguration=false; .Items.Clear (); (int i=0; i lt; addConfigurationForm.listViewObjectsConfigurations.Items.Count; i ++)
{item=new ListViewItem ((listViewConfiguration.Items.Count + 1).ToString());.SubItems.Add(((Configuration)addConfigurationForm.listViewObjectsConfigurations.Items[i].Tag).Name);.SubItems.Add(((Configuration)addConfigurationForm.listViewObjectsConfigurations.Items[i].Tag).SummaryCost.ToString());.SubItems.Add(((Configuration)addConfigurationForm.listViewObjectsConfigurations.Items[i].Tag).Count.ToString());.Tag =AddConfigurationForm.listViewObjectsConfigurations.Items [i] .Tag; .Items.Add (item) ;. Refresh ();
}. Close () ;. Stop ();
}
}
}
private void buttonCalculateCost_Click (object sender, EventArgs e)
{summaryCost=0; (listViewConfiguration.Items.Count gt; 0) (ListViewItem item in listViewConfiguration.Items)
{+=((Configuration) item.Tag) .SummaryCost;
}
{. Show ( Чи не задана комплектація raquo ;, Некоректна сума raquo ;, MessageBoxButtons.OK, .Information);
} (listViewServices.Items.Count gt; 0) (ListViewItem item in listViewServices.Items)
{+=((Service) item.Tag) .SummaryCost;
}
{. Show ( Чи не задані послуги raquo ;, Некоректна сума raquo ;, MessageBoxButtons.OK, .Information);
}. Text=summaryCost.ToString ();
}
private void buttonSelectCustomer_Click (object sender, EventArgs e)
{. Start ();=new AddCustomerForm () ;. source=source; .Visible=true;
} void MainForm_Load (object sender, EventArgs e)
{();
{. CheckConnection (source);
} (Exception)
{= new AuthorizationAndSelectDBForm () ;. Visible=true; .Start () ;. Show ( Не вдається підключитися до БД. Введіть ім'я іншої БД raquo ;, Увага raquo ;, MessageBoxButtons.OK , MessageBoxIcon.Error) ;;
} () ;. Visible=true; (admin)