private void btnSave_Click(object sender, EventArgs e) { lbAlertMessage.Text = ""; if (GridUsertype.CurrentRow != null) { string UserID = Convert1.ToString(GridUsertype.CurrentRow.Cells[1].Value); string UserName = GridUsertype.CurrentRow.Cells[2].Value.ToString(); var listUserroom = (from t1 in dbc.mst_user_rooms where t1.mut_username == UserName select t1); dbc.mst_user_rooms.DeleteAllOnSubmit(listUserroom); for (int i = 0; i <= dataGridView1.Rows.Count - 1; i++) { if (Convert1.ToBoolean(dataGridView1[0, i].Value) == true) { int mrmid = Utility.GetInteger(dataGridView1[1, i].Value); mst_user_type usermut = (from t1 in dbc.mst_user_types where t1.mut_username == UserName select t1).FirstOrDefault(); mst_user_room newitem = new mst_user_room(); newitem.mst_user_type = usermut; newitem.mut_id = usermut.mut_id; newitem.mut_username = UserName; newitem.mrm_id = mrmid; dbc.mst_user_rooms.InsertOnSubmit(newitem); } } dbc.SubmitChanges(); lbAlertMessage.Text = "Save data completed."; } else { lbAlertMessage.Text = "Please select user for edit."; } }
private void btnUnlockRoom_Click(object sender, EventArgs e) { lbmsgAlert.Text = ""; string msgdisplay = ""; DateTime dateNow = Program.GetServerDateTime(); for (int iRow = 0; iRow <= GridRoomLock.Rows.Count - 1; iRow++) { Boolean isselect = Convert1.ToBoolean(GridRoomLock["Colselect", iRow].Value); int mrdid = Convert1.ToInt32(GridRoomLock["Colmrd_id", iRow].Value); if (isselect == true) { using (InhCheckupDataContext cdc = new InhCheckupDataContext()) { cdc.log_user_logins.Where(x => x.mrd_id == mrdid && x.lug_end_date == null).ToList() .ForEach(x => x.lug_end_date = dateNow); cdc.SubmitChanges(); } msgdisplay = "Unlock completed."; } } btnsearch_Click(null, null); ShowRoomLock(0); lbmsgAlert.Text = msgdisplay; }
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { if (dataGridView1.CurrentRow != null && dataGridView1.ReadOnly == false) { bool ischeck = Convert1.ToBoolean(dataGridView1[0, e.RowIndex].Value); if (ischeck == false) { dataGridView1[0, e.RowIndex].Value = true; } else { dataGridView1[0, e.RowIndex].Value = false; } } }
private List <int> GetSelectEvent_mvtid() { List <int> mvtidlist = new List <int>(); for (int iRow = 0; iRow <= GridRoomEvent_Event.Rows.Count - 1; iRow++) { Boolean isselect = Convert1.ToBoolean(GridRoomEvent_Event["ColRoomEvent_EventSelect", iRow].Value); int mvtid = Utility.GetInteger(GridRoomEvent_Event["ColRoomEvent_Event_mvtid", iRow].Value); if (isselect == true) { mvtidlist.Add(mvtid); } } return(mvtidlist); //ColRoomEvent_Event_mvtid }