Inheritance: IdentifiedEntity
Beispiel #1
0
        private async void EditOfficeForm_Load(object sender, EventArgs e)
        {
            if (officeId != Guid.Empty)
            {
                Enabled = false;

                using (var channel = ChannelManager.CreateChannel())
                {
                    try
                    {
                        Office = await taskPool.AddTask(channel.Service.GetOffice(officeId));

                        Enabled = true;
                    }
                    catch (OperationCanceledException) { }
                    catch (CommunicationObjectAbortedException) { }
                    catch (ObjectDisposedException) { }
                    catch (InvalidOperationException) { }
                    catch (FaultException exception)
                    {
                        UIHelper.Warning(exception.Reason.ToString());
                    }
                    catch (Exception exception)
                    {
                        UIHelper.Warning(exception.Message);
                    }
                }
            }
            else
            {
                Office = new Office()
                {
                    Name = "Новый филиал",
                    Endpoint = "net.tcp://queue:4505"
                };
            }
        }
Beispiel #2
0
 private void OfficesGridViewRenderRow(DataGridViewRow row, Office office)
 {
     row.Cells["nameColumn"].Value = office.Name;
     row.Tag = office;
 }
Beispiel #3
0
        private async void saveButton_Click(object sender, EventArgs e)
        {
            using (var channel = ChannelManager.CreateChannel())
            {
                try
                {
                    saveButton.Enabled = false;

                    Office = await taskPool.AddTask(channel.Service.EditOffice(office));

                    if (Saved != null)
                    {
                        Saved(this, EventArgs.Empty);
                    }
                }
                catch (OperationCanceledException) { }
                catch (CommunicationObjectAbortedException) { }
                catch (ObjectDisposedException) { }
                catch (InvalidOperationException) { }
                catch (FaultException exception)
                {
                    UIHelper.Warning(exception.Reason.ToString());
                }
                catch (Exception exception)
                {
                    UIHelper.Warning(exception.Message);
                }
                finally
                {
                    saveButton.Enabled = true;
                }
            }
        }