private List <NoteInfoDetail> GetNoteInfoDetail(int mode) { if (!string.IsNullOrEmpty(InformTo_CheckedComboBoxEdit.EditValue.ToString())) { string noteId = null; if (mode == 2) { NoteInfo selected = Main_GridView.GetFocusedRow().CastTo <NoteInfo>(); if (selected == null) { return(new List <NoteInfoDetail>()); } noteId = selected.NoteID; } return(InformTo_CheckedComboBoxEdit.EditValue.ToString().Split(',') .Select(o => new NoteInfoDetail { NoteID = noteId, UserID = o.Trim(), NoteStatus = "0" }).ToList()); } else { return(new List <NoteInfoDetail>()); } }
private NoteInfo GetNoteInfo(int mode) { if (mode == 2) { NoteInfo selected = Main_GridView.GetFocusedRow().CastTo <NoteInfo>(); if (selected == null) { return(null); } return(new NoteInfo { NoteID = selected.NoteID, NoteType = selected.NoteType ?? "NK", InformTo = InformTo_CheckedComboBoxEdit.EditValue.ToString(), NoteContent = NoteContent_MemoEdit.Text }); } else { return(new NoteInfo { NoteType = "NK", InformTo = InformTo_CheckedComboBoxEdit.EditValue.ToString(), NoteContent = NoteContent_MemoEdit.Text }); } }
/// <summary> /// /// </summary> /// <param name="mode"></param> /// <returns></returns> private bool IsCheckValidate(int mode) { if (mode.In(2, 3)) { var selected = Main_GridView.GetFocusedRow().CastTo <NoteInfo>(); if (selected == null) { MessageBoxHelper.ShowErrorMessage(BSMessage.BSM000026); return(false); } if (selected.UpdateUser.ToUpper() != UserInfo.UserID.ToUpper()) { MessageBoxHelper.ShowErrorMessage("Không thể sửa/xóa nhật ký của người khác!"); return(false); } } if (mode.In(1, 2)) { if (string.IsNullOrEmpty(NoteContent_MemoEdit.EditValue.ToString())) { MessageBoxHelper.ShowErrorMessage(BSMessage.BSM000041, NoteContent_Label.Text); NoteContent_MemoEdit.Focus(); return(false); } } return(true); }
private void bunifuCustomDataGrid1_MouseClick(object sender, MouseEventArgs e) { try { Main_GridView.ClearSelection(); var hti = Main_GridView.HitTest(e.X, e.Y); this.Main_GridView.Rows[hti.RowIndex].Selected = true; this.Row_Index = hti.RowIndex; this.Column_Index = hti.ColumnIndex; } catch (Exception) { } if (e.Button == MouseButtons.Right) { try { Main_GridView.ClearSelection(); var hti = Main_GridView.HitTest(e.X, e.Y); this.Main_GridView.Rows[hti.RowIndex].Selected = true; this.Row_Index = hti.RowIndex; this.Column_Index = hti.ColumnIndex; this.m.Show(this.Main_GridView, e.Location); m.Show(Cursor.Position); } catch (Exception) { } } }
private void ALL_CheckEdit_CheckedChanged(object sender, EventArgs e) { //if (ALL_CheckEdit.Checked) //{ // ReportItem_CheckedListBox.CheckAll(); //} //else //{ // ReportItem_CheckedListBox.UnCheckAll(); //} ReportList.ForEach(o => o.IsPrintReport = ALLReport_CheckEdit.Checked); Main_GridView.RefreshData(); }
private void btnReload_Click(object sender, EventArgs e) { Function_Settings dta = new Function_Settings(); Total_Status(); if (this.Default_GridView == 1) { dta.reload(Main_GridView, this.select, this.View_Column_Type); Main_GridView.ClearSelection(); } else { MessageBox.Show("dashboard"); } color(); }
private void Main_GridView_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { Update_Button.Enabled = false; NoteInfo selected = Main_GridView.GetFocusedRow().CastTo <NoteInfo>(); if (selected == null) { return; } SetScreenData(selected); new Thread(() => UpdateNoteStatus(selected)) { IsBackground = true }.Start(); }
private void SetEnabledEditButton() { if (IsLoaded == false) { return; } var selected = Main_GridView.GetFocusedRow().CastTo <NoteInfo>(); if (selected == null) { Update_Button.Enabled = false; return; } if (NoteContent_MemoEdit.EditValue?.ToString() != selected.NoteContent || InformTo_CheckedComboBoxEdit.EditValue?.ToString() != selected.LargeCharAttribute) { Update_Button.Enabled = true; return; } }
private void Default_Template_Gridview() { try { Main_GridView.DataSource = null; Main_GridView.Refresh(); Main_GridView.RowHeadersVisible = false; Main_GridView.AllowUserToAddRows = false; Log_GridView.RowHeadersVisible = false; Log_GridView.AllowUserToAddRows = false; Main_GridView.ColumnHeadersHeight = 45; Main_GridView.HeaderBgColor = Color.SeaGreen; Main_GridView.HeaderForeColor = Color.White; Log_GridView.HeaderForeColor = Color.White; Main_GridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; Log_GridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void Delete_Button_Click(object sender, EventArgs e) { if (!IsCheckValidate(3)) { return; } if (MessageBoxHelper.ShowConfirmMessage(BSMessage.BSM000037) != System.Windows.Forms.DialogResult.Yes) { return; } NoteInfo selected = Main_GridView.GetFocusedRow().CastTo <NoteInfo>(); if (DoDelete(selected)) { LoadDataGridView(); } else { MessageBoxHelper.ShowErrorMessage(BSMessage.BSM000031); } }
private void ALLExcel_CheckEdit_CheckedChanged(object sender, EventArgs e) { ReportList.ForEach(o => o.IsExportExcel = ALLExcel_CheckEdit.Checked); Main_GridView.RefreshData(); }