private void InsertCa() { DTO_Ca ca = new DTO_Ca(); //verified infor if (txtTenCa.Text == "") { MessageBox.Show("Tên ca còn trống. Vui lòng nhập lại."); txtTenCa.Focus(); return; } //get infor to object ca.TenCa = txtTenCa.Text; DialogResult resultDialog = MessageBox.Show("Bạn có muốn lưu ca này lại không?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (resultDialog == DialogResult.Yes) { bool InsertState = BUS_Ca.InsertCa(ca); if (InsertState) { dgvTableShow.DataSource = BUS_Ca.GetDataTable(); SetDisplay(DISPLAY.HOME); MessageBox.Show("Thêm thành công"); } else { MessageBox.Show("Thêm thất bại, thử lại"); } } else { return; } }
public void GridViewLookupEdit() { // Create an in-place LookupEdit control. //RepositoryItemLookUpEdit repositoryItemGridLookUpEdit1 = new RepositoryItemLookUpEdit(); DataTable dtShift = BUS_Ca.LoadCa(); repositoryItemLookUpEdit1.DataSource = dtShift; repositoryItemLookUpEdit1.ValueMember = "id"; repositoryItemLookUpEdit1.DisplayMember = "name"; // Enable the "best-fit" functionality mode in which columns have proportional widths and the popup window is resized to fit all the columns. repositoryItemGridLookUpEdit1.BestFitMode = DevExpress.XtraEditors.Controls.BestFitMode.BestFitResizePopup; // Specify the dropdown height. repositoryItemLookUpEdit1.DropDownRows = BUS_Ca.LoadCa().Rows.Count; // Enable the automatic completion feature. In this mode, when the dropdown is closed, // the text in the edit box is automatically completed if it matches a DisplayMember field value of one of dropdown rows. repositoryItemLookUpEdit1.SearchMode = DevExpress.XtraEditors.Controls.SearchMode.AutoComplete; // Specify the column against which an incremental search is performed in SearchMode.AutoComplete and SearchMode.OnlyInPopup modes repositoryItemLookUpEdit1.AutoSearchColumnIndex = 1; // Optionally hide the Description column in the dropdown. repositoryItemLookUpEdit1.PopulateColumns(); repositoryItemLookUpEdit1.Columns["id"].Visible = false; // Assign the in-place LookupEdit control to the grid's CategoryID column. // Note that the data types of the "ID" and "CategoryID" fields match. gridViewPhanCa.Columns["shift_id"].ColumnEdit = repositoryItemLookUpEdit1; gridViewPhanCa.BestFitColumns(); }
private void btnXoa_Click(object sender, EventArgs e) { int rowSelect = -1; rowSelect = dgvTableShow.CurrentCell.RowIndex; //rowSelect = dgvTableShow.GetCellCount(DataGridViewElementStates.Selected); DTO_Ca ca = new DTO_Ca(); ca.MaCa = Int32.Parse(dgvTableShow["MaCa", rowSelect].Value.ToString()); DialogResult resultDialog = MessageBox.Show("Bạn có muốn xóa ca này không?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (resultDialog == DialogResult.Yes) { bool InsertState = BUS_Ca.DeleteCa(ca); if (InsertState) { dgvTableShow.DataSource = BUS_Ca.GetDataTable(); SetDisplay(DISPLAY.HOME); MessageBox.Show("Xóa thành công"); } else { MessageBox.Show("Xóa thất bại, thử lại"); } } else { return; } }
private void btnThem_Click(object sender, EventArgs e) { DTO_Ca ca = new DTO_Ca(); //verified infor if (txtTenCa.Text == "") { MessageBox.Show("Thêm thất bại, tên ca còn trống"); return; } //get infor to object ca.TenCa = txtTenCa.Text; DialogResult resultDialog = MessageBox.Show("Bạn có muốn thêm dữ liệu ", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (resultDialog == DialogResult.Yes) { bool InsertState = BUS_Ca.InsertCa(ca); if (InsertState) { dgvTableShow.DataSource = BUS_Ca.GetDataTable(); MessageBox.Show("Thêm thành công"); } else { MessageBox.Show("Thêm thất bại, thử lại"); } } else { return; } }
private void LoadDataGridView() { dgvTableShow.DataSource = BUS_Ca.GetDataTable(); dgvTableShow.Columns["MaCa"].HeaderText = "Mã ca"; dgvTableShow.Columns["TenCa"].HeaderText = "Tên ca"; dgvTableShow.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; dgvTableShow.SelectionMode = DataGridViewSelectionMode.FullRowSelect; }
public frmDiemDanh(string ad_user_id, string ad_org_id, DataTable dtProcess) { InitializeComponent(); this.ad_user_id = ad_user_id; this.ad_org_id = ad_org_id; this.dtProcess = dtProcess; dtCa = BUS_Ca.LoadCaShift(DateTime.Now.Date, ad_org_id); dtboPhan = BUS_BoPhan.LoadBoPhan(ad_org_id); utility.SearchProcess(this.Controls, dtProcess); }
private void LoadDataGridView() { dgvTableShow.DataSource = BUS_Ca.GetDataTable(); dgvTableShow.Columns[0].HeaderText = "Mã ca"; dgvTableShow.Columns[1].HeaderText = "Tên ca"; dgvTableShow.Columns[0].Visible = false; dgvTableShow.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; dgvTableShow.ReadOnly = true; dgvTableShow.SelectionMode = DataGridViewSelectionMode.FullRowSelect; }
private void frmPhanCa_Load(object sender, EventArgs e) { dtpNgayHieuLuc.Format = DateTimePickerFormat.Custom; dtpNgayHieuLuc.CustomFormat = "yyyy-MM-dd"; gridControl1.DataSource = lstNhanVien; //List<DTO_Ca> lstCa = new List<DTO_Ca>(); DataTable dtCa = BUS_Ca.LoadCa(); lkShift.Properties.DataSource = dtCa; lkShift.Properties.DisplayMember = "name"; lkShift.Properties.ValueMember = "id"; lkShift.Properties.NullText = "Chọn ca làm việc"; lkShift.EditValue = dtCa.Rows[0][0]; lkShift.Properties.BestFitMode = DevExpress.XtraEditors.Controls.BestFitMode.BestFitResizePopup; // Specify the dropdown height. lkShift.Properties.DropDownRows = dtCa.Rows.Count; //lkInput.Properties.ReadOnly = true; }
private void UpdateCa() { int rowSelect = -1; rowSelect = dgvTableShow.CurrentCell.RowIndex; DTO_Ca ca = new DTO_Ca(); //verified infor if (txtTenCa.Text == "") { MessageBox.Show("Tên ca còn trống. Vui lòng nhập lại."); return; } //get new object ca.TenCa = txtTenCa.Text; ca.MaCa = Int32.Parse(dgvTableShow["MaCa", rowSelect].Value.ToString()); DialogResult resultDialog = MessageBox.Show("Bạn có muốn sửa dữ liệu ", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (resultDialog == DialogResult.Yes) { bool UpdateState = BUS_Ca.UpdateCa(ca); if (UpdateState) { dgvTableShow.DataSource = BUS_Ca.GetDataTable(); SetDisplay(DISPLAY.HOME); MessageBox.Show("Cập nhật thành công"); } else { MessageBox.Show("Cập nhật thất bại"); } } else { return; } }
private void frmKTPhanCa_Load(object sender, EventArgs e) { #region Xử lý lookupEdit dtboPhan = BUS_BoPhan.LoadBoPhan(ad_org_id); lkBoPhan.Properties.DataSource = dtboPhan; lkBoPhan.Properties.DisplayMember = "description"; lkBoPhan.Properties.ValueMember = "id"; lkBoPhan.Properties.NullText = "Chọn bộ phận"; lkBoPhan.EditValue = dtboPhan.Rows[0][0]; lkBoPhan.Properties.BestFitMode = DevExpress.XtraEditors.Controls.BestFitMode.BestFitResizePopup; // Specify the dropdown height. lkBoPhan.Properties.DropDownRows = dtboPhan.Rows.Count; //lkInput.Properties.ReadOnly = true //List<DTO_Ca> lstCa = new List<DTO_Ca>(); DataTable dtCa = BUS_Ca.LoadCa(); lkShift.Properties.DataSource = dtCa; lkShift.Properties.DisplayMember = "name"; lkShift.Properties.ValueMember = "id"; lkShift.Properties.NullText = "Chọn ca làm việc"; //lkShift.EditValue = dtCa.Rows[0][0]; lkShift.Properties.BestFitMode = DevExpress.XtraEditors.Controls.BestFitMode.BestFitResizePopup; // Specify the dropdown height. lkShift.Properties.DropDownRows = dtCa.Rows.Count; //lkInput.Properties.ReadOnly = true; #endregion radioGroup.SelectedIndex = 0; groupBox2.Enabled = false; groupBox3.Enabled = false; Reset.Enabled = false; dateEdit.EditValue = DateTime.Now.Date; dateEdit1.EditValue = DateTime.Now.Date; #region Redundance /* * //List<DTO_Ca> lstCa = new List<DTO_Ca>(); * DataTable dtCa = BUS_Ca.LoadCa(); * * * lkShift.Properties.DataSource = dtCa; * lkShift.Properties.DisplayMember = "name"; * lkShift.Properties.ValueMember = "id"; * lkShift.Properties.NullText = "Chọn ca làm việc"; * lkShift.EditValue = dtCa.Rows[0][0]; * * lkShift.Properties.BestFitMode = DevExpress.XtraEditors.Controls.BestFitMode.BestFitResizePopup; * // Specify the dropdown height. * lkShift.Properties.DropDownRows = dtCa.Rows.Count; * //lkInput.Properties.ReadOnly = true; #endregion * radioGroup.SelectedIndex = 0; * * int i = Convert.ToInt16(user_level_id); * if (i > 1) * { * btnUpdate.Enabled = true; * } * else * { * btnUpdate.Enabled = false; * } */ #endregion }
public frmAttReport(string ad_user_id, string ad_org_id, DataTable dtProcess) { InitializeComponent(); dateEdit.DateTime = DateTime.Now; dateEdit1.DateTime = DateTime.Now; this.ad_user_id = ad_user_id; this.ad_org_id = ad_org_id; this.dtProcess = dtProcess; dtCa = BUS_Ca.LoadCaShift(DateTime.Now.Date, ad_org_id); dtboPhan = BUS_BoPhan.LoadBoPhan(ad_org_id); utility.SearchProcess(this.Controls, dtProcess); #region Chart control 1 // Create an empty Bar series and add it to the chart. chartControl1.Series.Add(series1); series1.View.Color = Color.Green; chartControl1.Series.Add(series2); series2.View.Color = Color.DarkGoldenrod; chartControl1.Series.Add(series3); series3.View.Color = Color.Red; chartControl1.Series.Add(series4); series4.View.Color = Color.Red; //Show point view lable and customize it chartControl1.Series["Tổng số người"].LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; SideBySideBarSeriesLabel label1 = chartControl1.Series["Tổng số người"].Label as SideBySideBarSeriesLabel; if (label1 != null) { label1.Position = BarSeriesLabelPosition.Top; } chartControl1.Series["Số người vắng"].LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; SideBySideBarSeriesLabel label2 = chartControl1.Series["Số người vắng"].Label as SideBySideBarSeriesLabel; if (label2 != null) { label2.Position = BarSeriesLabelPosition.Top; } chartControl1.Series["Số người nghỉ việc"].LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; SideBySideBarSeriesLabel label3 = chartControl1.Series["Số người nghỉ việc"].Label as SideBySideBarSeriesLabel; if (label3 != null) { label3.Position = BarSeriesLabelPosition.Top; } chartControl1.Series["Tỉ lệ người vắng(%)"].LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; SideBySideBarSeriesLabel label4 = chartControl1.Series["Tỉ lệ người vắng(%)"].Label as SideBySideBarSeriesLabel; if (label4 != null) { label4.Position = BarSeriesLabelPosition.Top; } // Cast Diagram to the XYDiagram type. XYDiagram diagram = chartControl1.Diagram as XYDiagram; diagram.AxisY.Title.Visibility = DevExpress.Utils.DefaultBoolean.True; diagram.AxisY.Title.Text = "Số lượng người"; diagram.AxisY.Title.Font = new Font("Times New Roman", 10, FontStyle.Regular); // Add a title to the chart (if necessary). chartTitle1.Text = "BIỂU ĐỒ NHÂN SỰ\n(" + "01" + DateTime.Now.ToString("/MM/yyyy") + " - " + DateTime.Now.ToString("dd/MM/yyyy") + ")"; chartTitle1.Font = new Font("Times New Roman", 15, FontStyle.Bold); chartControl1.Titles.Add(chartTitle1); // Control legend & position chartControl1.Legend.Visibility = DevExpress.Utils.DefaultBoolean.True; chartControl1.Legend.AlignmentHorizontal = LegendAlignmentHorizontal.Center; chartControl1.Legend.AlignmentVertical = LegendAlignmentVertical.BottomOutside; chartControl1.Legend.Direction = LegendDirection.LeftToRight; chartControl1.Legend.EquallySpacedItems = true; //Create secondary Y-Axis, and add them to the chart's diagram SecondaryAxisY myAxisY2 = new SecondaryAxisY("Y-Axis2"); ((XYDiagram)chartControl1.Diagram).SecondaryAxesY.Add(myAxisY2); //Assign series4 to the created axis ((LineSeriesView)series4.View).AxisY = myAxisY2; //Customize the apperance of the secondary axis myAxisY2.Title.Text = "Tỉ lệ người vắng(%)"; myAxisY2.Title.Visibility = DevExpress.Utils.DefaultBoolean.True; myAxisY2.Title.TextColor = Color.Red; myAxisY2.Title.Font = new Font("Times New Roman", 10, FontStyle.Regular); myAxisY2.Label.TextColor = Color.Red; myAxisY2.Color = Color.Red; #endregion #region Chart control 2 // Add a title to the chart (if necessary). chartControl2.Titles.Clear(); chartTitle2.Text = "BIỂU ĐỒ TỈ LỆ NGƯỜI VẮNG\n(" + "01" + DateTime.Now.ToString("/MM/yyyy") + " - " + DateTime.Now.ToString("dd/MM/yyyy") + ")"; chartTitle2.Font = new Font("Times New Roman", 15, FontStyle.Bold); chartControl2.Titles.Add(chartTitle2); #endregion dtChart1 = BUS_ChamCong.ChartDiemDanh(DateTime.Now.ToString("yyyy-MM-") + "01", DateTime.Now.ToString("yyyy-MM-dd"), ad_org_id, "0"); dtChart2 = Utility.CopyChart(dtChart1, "01", DateTime.Now.ToString("dd")); CreateChart(dtChart1, dtChart2); }