コード例 #1
0
 protected void DeleteRecord()
 {
     if (dataGridView1.SelectedRows.Count == 1)
     {
         StrelbaDTO strelba = dataGridView1.SelectedRows[0].DataBoundItem as StrelbaDTO;
         Strelba.delete(Strelba.getById(strelba.Id));
         GetData();
     }
 }
コード例 #2
0
 private Strelba GetSelectedStr()
 {
     // The "SelectionMode" property of the data grid view must be set to "FullRowSelect".
     if (dataGridView1.SelectedRows.Count == 1)
     {
         StrelbaDTO strelba = dataGridView1.SelectedRows[0].DataBoundItem as StrelbaDTO;
         return(Strelba.getById(strelba.Id));
     }
     else
     {
         return(null);
     }
 }
コード例 #3
0
ファイル: DStrelba.cs プロジェクト: Buliik/CS-IS-3LA
        public bool OpenRecord(object primaryKey)
        {
            if (primaryKey != null)
            {
                int idStr = (int)primaryKey;
                strelba   = Strelba.getById(idStr);
                newRecord = false;
            }
            else
            {
                strelba   = new Strelba();
                newRecord = true;
            }

            TimeSpan span = strelba.Konec.Subtract(strelba.Zacatek);

            txtMin.Text = span.TotalMinutes.ToString();

            BindData();
            return(true);
        }