Esempio n. 1
0
        private void butAdd_Click(object sender, EventArgs e)
        {
            FormOrthoChartAddDate FormOCAD = new FormOrthoChartAddDate();

            FormOCAD.ShowDialog();
            if (FormOCAD.DialogResult != DialogResult.OK)
            {
                return;
            }
            for (int i = 0; i < table.Rows.Count; i++)
            {
                if (FormOCAD.SelectedDate == (DateTime)table.Rows[i]["Date"])
                {
                    MsgBox.Show(this, "That date already exists.");
                    return;
                }
            }
            //listDatesAdditional.Add(FormOCAD.SelectedDate);
            //Move data from grid to table, add new date row to datatable, then fill grid from table.
            for (int i = 0; i < gridMain.Rows.Count; i++)
            {
                table.Rows[i]["Date"] = gridMain.Rows[i].Tag;              //store date
                for (int j = 0; j < listOrthDisplayFields.Count; j++)
                {
                    table.Rows[i][j + 1] = gridMain.Rows[i].Cells[j + 1].Text;
                }
            }
            DataRow row;

            row         = table.NewRow();
            row["Date"] = FormOCAD.SelectedDate;
            for (int i = 0; i < listOrthDisplayFields.Count; i++)
            {
                row[i + 1] = "";            //j+1 because first row is date field.
            }
            //insert new row in proper ascending datetime order to dataTable
            for (int i = 0; i <= table.Rows.Count; i++)
            {
                if (i == table.Rows.Count)
                {
                    table.Rows.InsertAt(row, i);
                    break;
                }
                if ((DateTime)row["Date"] > (DateTime)table.Rows[i]["Date"])
                {
                    continue;
                }
                table.Rows.InsertAt(row, i);
                break;
            }
            FillGrid();
        }
Esempio n. 2
0
 private void butAdd_Click(object sender,EventArgs e)
 {
     FormOrthoChartAddDate FormOCAD = new FormOrthoChartAddDate();
     FormOCAD.ShowDialog();
     if(FormOCAD.DialogResult!=DialogResult.OK) {
         return;
     }
     for(int i=0;i<table.Rows.Count;i++) {
         if(FormOCAD.SelectedDate==(DateTime)table.Rows[i]["Date"]) {
             MsgBox.Show(this,"That date already exists.");
             return;
         }
     }
     //listDatesAdditional.Add(FormOCAD.SelectedDate);
     //Move data from grid to table, add new date row to datatable, then fill grid from table.
     for(int i=0;i<gridMain.Rows.Count;i++) {
         table.Rows[i]["Date"]=gridMain.Rows[i].Tag;//store date
         for(int j=0;j<listOrthDisplayFields.Count;j++) {
             table.Rows[i][j+1]=gridMain.Rows[i].Cells[j+1].Text;
         }
     }
     DataRow row;
     row=table.NewRow();
     row["Date"]=FormOCAD.SelectedDate;
     for(int i=0;i<listOrthDisplayFields.Count;i++) {
         row[i+1]="";//j+1 because first row is date field.
     }
     //insert new row in proper ascending datetime order to dataTable
     for(int i=0;i<=table.Rows.Count;i++){
         if(i==table.Rows.Count){
             table.Rows.InsertAt(row,i);
             break;
         }
         if((DateTime)row["Date"]>(DateTime)table.Rows[i]["Date"]){
             continue;
         }
         table.Rows.InsertAt(row,i);
         break;
     }
     FillGrid();
 }
Esempio n. 3
0
        private void butAdd_Click(object sender, EventArgs e)
        {
            FormOrthoChartAddDate FormOCAD = new FormOrthoChartAddDate();

            FormOCAD.ShowDialog();
            if (FormOCAD.DialogResult != DialogResult.OK)
            {
                return;
            }
            if (_listDatesAdded.Contains(FormOCAD.SelectedDate))
            {
                return;                //No need to refill the grid
            }
            _listDatesAdded.Add(FormOCAD.SelectedDate);
            if (_dictOrthoCharts.ContainsKey(FormOCAD.SelectedDate))
            {
                FillGrid();
                return;
            }
            SaveAndSetSignatures(gridMain.SelectedCell.Y);
            _dictOrthoCharts.Add(FormOCAD.SelectedDate, new List <OrthoChart>());          //COULD HAVE TO DO WITH EMPTY SIG ITEM HERE??
            _hasChanged = true;
            FillGrid();
        }