public void addGeneralPart(GeneralPart _gp)
        {
            try
            {
                using (IController <GeneralPart> sql = new Controller <GeneralPart>())
                {
                    bool priznak = false;
                    foreach (GeneralPart gp in sql.GetAll())
                    {
                        if (gp.ClientId == _gp.ClientId)
                        {
                            gp.cureFeatures    = _gp.cureFeatures;
                            gp.curePlan        = _gp.curePlan;
                            gp.signConsulation = _gp.signConsulation;
                            gp.viewPlan        = _gp.viewPlan;

                            sql.Update(gp);

                            priznak = true;
                        }
                    }

                    if (!priznak)
                    {
                        sql.Create(_gp);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Ошибка" + ex.Message);
            }
        }
        private void loadGenerlPart()
        {
            GeneralPart gp = new GeneralPart();

            _proc.loadGeneralPart(ref gp, ((int)(clientlist.SelectedItem as ComboboxItem).Value));

            textBox10.Text = gp.terms == null ? "" : gp.terms.TrimEnd();
            textBox9.Text  = gp.viewPlan == null ? "" : gp.viewPlan.TrimEnd();
            textBox8.Text  = gp.curePlan == null ? "" : gp.curePlan.TrimEnd();
            textBox7.Text  = gp.cureFeatures == null ? "" : gp.cureFeatures.TrimEnd();
            textBox6.Text  = gp.signConsulation == null ? "" : gp.signConsulation.TrimEnd();
        }
        private void button7_Click(object sender, EventArgs e)
        {
            GeneralPart gp = new GeneralPart();

            gp.ClientId        = (int)(clientlist.SelectedItem as ComboboxItem).Value;
            gp.viewPlan        = textBox9.Text;
            gp.curePlan        = textBox8.Text;
            gp.cureFeatures    = textBox7.Text;
            gp.signConsulation = textBox6.Text;
            gp.terms           = textBox10.Text;

            _proc.addGeneralPart(gp);

            MessageBox.Show("Данные сохранены");
        }
 public void loadGeneralPart(ref GeneralPart gp, int id)
 {
     try
     {
         using (IController <GeneralPart> sql = new Controller <GeneralPart>())
         {
             foreach (GeneralPart t in sql.GetAll())
             {
                 if (t.ClientId == id)
                 {
                     gp = t;
                     break;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Ошибка" + ex.Message);
     }
 }