Beispiel #1
0
        private void AcceptEditButtonClick(object sender, EventArgs e)
        {
            ClientModel oldModel = clientCollection[ClientsList.SelectedIndices[ConstValues.Zero]];
            ClientModel client   = (ClientModel)oldModel.Clone();

            SwitchCurrentTargetToModelItem(ref client, editValueTextBox.Text);
            using AddditionalClientInfoData addditionalData = new AddditionalClientInfoData(parentForm.Settings.ConnectionString);
            if (oldModel.AddtionalInfo != null)
            {
                addditionalData.UpdateData(
                    client.AddtionalInfo,
                    nameof(SQLEnums.StoredProcedureNames.ДопинфоИзменить)
                    );
            }
            else
            {
                addditionalData.InsertData(
                    client.AddtionalInfo ?? new AddditionalClientInfoModel(true),
                    nameof(SQLEnums.StoredProcedureNames.ДопинфоДобавить)
                    );
            }

            using ClientData clientData = new ClientData(parentForm.Settings.ConnectionString);
            clientData.UpdateData(client, nameof(SQLEnums.StoredProcedureNames.КлиентыИзменить));
            editElemPanel.Visible = false;
            UpdateClientsList(ClientsList.SelectedIndices[ConstValues.Zero]);
        }