コード例 #1
0
 public void AddTableTeeth(Everytooth _t)
 {
     try
     {
         using (IController <Everytooth> sql = new Controller <Everytooth>())
         {
             sql.Create(_t);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Ошибка" + ex.Message);
     }
 }
コード例 #2
0
        private void button4_Click(object sender, EventArgs e)
        {
            _proc.DeleteAllTableTeeth((int)(clientlist.SelectedItem as ComboboxItem).Value);
            foreach (DataGridViewRow row in dataGridView1.Rows)
            {
                Everytooth tooths = new Everytooth();
                foreach (DataGridViewCell cell in row.Cells)
                {
                    switch (cell.ColumnIndex)
                    {
                    case 0:
                        if (cell.Value != null)
                        {
                            tooths.Teeth_number = cell.Value.ToString();
                        }
                        break;

                    case 1:
                        if (cell.Value != null)
                        {
                            if ((bool)cell.Value)
                            {
                                tooths.O = 1;
                            }
                            else
                            {
                                tooths.O = 0;
                            }
                        }
                        else
                        {
                            tooths.O = 0;
                        }
                        break;

                    case 2:
                        if (cell.Value != null)
                        {
                            if ((bool)cell.Value)
                            {
                                tooths.R = 1;
                            }
                            else
                            {
                                tooths.R = 0;
                            }
                        }
                        else
                        {
                            tooths.R = 0;
                        }
                        break;

                    case 3:
                        if (cell.Value != null)
                        {
                            if ((bool)cell.Value)
                            {
                                tooths.C = 1;
                            }
                            else
                            {
                                tooths.C = 0;
                            }
                        }
                        else
                        {
                            tooths.C = 0;
                        }
                        break;

                    case 4:
                        if (cell.Value != null)
                        {
                            if ((bool)cell.Value)
                            {
                                tooths.P = 1;
                            }
                            else
                            {
                                tooths.P = 0;
                            }
                        }
                        else
                        {
                            tooths.P = 0;
                        }
                        break;

                    case 5:
                        if (cell.Value != null)
                        {
                            if ((bool)cell.Value)
                            {
                                tooths.Pt = 1;
                            }
                            else
                            {
                                tooths.Pt = 0;
                            }
                        }
                        else
                        {
                            tooths.Pt = 0;
                        }
                        break;

                    case 6:
                        if (cell.Value != null)
                        {
                            if ((bool)cell.Value)
                            {
                                tooths.Pi = 1;
                            }
                            else
                            {
                                tooths.Pi = 0;
                            }
                        }
                        else
                        {
                            tooths.Pi = 0;
                        }
                        break;

                    case 7:
                        if (cell.Value != null)
                        {
                            if ((bool)cell.Value)
                            {
                                tooths.A = 1;
                            }
                            else
                            {
                                tooths.A = 0;
                            }
                        }
                        else
                        {
                            tooths.A = 0;
                        }
                        break;

                    case 8:
                        if (cell.Value != null)
                        {
                            tooths.Movement = cell.Value.ToString();
                        }
                        break;

                    case 9:
                        if (cell.Value != null)
                        {
                            if ((bool)cell.Value)
                            {
                                tooths.K = 1;
                            }
                            else
                            {
                                tooths.K = 0;
                            }
                        }
                        else
                        {
                            tooths.K = 0;
                        }
                        break;

                    case 10:
                        if (cell.Value != null)
                        {
                            if ((bool)cell.Value)
                            {
                                tooths.I = 1;
                            }
                            else
                            {
                                tooths.I = 0;
                            }
                        }
                        else
                        {
                            tooths.I = 0;
                        }
                        break;

                    case 11:
                        if (cell.Value != null)
                        {
                            tooths.X = cell.Value.ToString();
                        }
                        break;

                    case 12:
                        if (cell.Value != null)
                        {
                            tooths.Y = cell.Value.ToString();
                        }
                        break;

                    case 13:
                        if (cell.Value != null)
                        {
                            tooths.Z = cell.Value.ToString();
                        }
                        break;
                    }
                }

                tooths.ClientId = (int)(clientlist.SelectedItem as ComboboxItem).Value;
                _proc.AddTableTeeth(tooths);
            }
            MessageBox.Show("Данные сохранены");
        }