예제 #1
0
 void Save()
 {
     foreach (DataGridViewRow row in dataGridView1.Rows)
     {
         // Yes
         if ((bool)row.Cells[2].Value == true && (bool)row.Cells[3].Value == false)
         {
             currentobj.ID = (int)row.Cells[0].Value;
             currentobj.AmenitiesTypeID = (int)CMBAmenitiesType.SelectedValue;
             currentobj.AmenitiesName   = row.Cells[1].Value.ToString();
             currentobj.Statuis         = true;
             currentobj.Update();
             //
             frm.Add((int)row.Cells[0].Value);
         }
         // No
         if ((bool)row.Cells[3].Value == true || (bool)row.Cells[2].Value == (bool)row.Cells[3].Value)
         {
             currentobj = currentobj.GetByID((int)row.Cells[0].Value);
             if (currentobj.Statuis == true)
             {
                 currentobj.ID = (int)row.Cells[0].Value;
                 currentobj.AmenitiesTypeID = (int)CMBAmenitiesType.SelectedValue;
                 currentobj.AmenitiesName   = row.Cells[1].Value.ToString();
                 currentobj.Statuis         = false;
                 currentobj.Update();
                 //
                 Amenitiestobj.Delete((int)row.Cells[0].Value);
             }
         }
     }
 }
예제 #2
0
        private void dataGridView1_SelectionChanged(object sender, EventArgs e)
        {
            int rowindex = dataGridView1.CurrentRow.Index;

            ID         = int.Parse(dataGridView1.Rows[rowindex].Cells[0].Value.ToString());
            currentobj = currentobj.GetByID(ID);
            push();
        }