private void btnDel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { int SelectedRow = gridItemDetail.FocusedRowHandle; if (SelectedRow >= 0) { DataRow drow = gridItemDetail.GetDataRow(SelectedRow); string _value = drow["NodeCode"].ToString(); string _total = drow["Total"].ToString(); if (_total != "0" && _total != "") { MessageBox.Show("Node đang chứa nhiều thiết bị, Vui lòng xóa thiết bị trước.!", "Cảnh Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (Class.App.ConfirmDeletion() == DialogResult.No) { return; } Class.NW_Node cls = new Class.NW_Node(); cls.NodeCode = _value; if (cls.Delete()) { Class.App.DeleteSuccessfully(); NW_Node_GetList(); } else { Class.App.DeleteNotSuccessfully(); } } }
private void btnDel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { int SelectedRow = gridItemDetail.FocusedRowHandle; if (SelectedRow >= 0) { DataRow drow = gridItemDetail.GetDataRow(SelectedRow); string _value = drow["NodeCode"].ToString(); string _total = drow["Total"].ToString(); if (_total != "0" && _total != "") { MessageBox.Show("Node đang chứa nhiều thiết bị, Vui lòng xóa thiết bị trước.!", "Cảnh Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (Class.App.ConfirmDeletion() == DialogResult.No) return; Class.NW_Node cls = new Class.NW_Node(); cls.NodeCode = _value; if (cls.Delete()) { Class.App.DeleteSuccessfully(); NW_Node_GetList(); } else { Class.App.DeleteNotSuccessfully(); } } }
public void NW_Node_GetList() { Class.NW_Node cls = new Class.NW_Node(); DataTable dt = cls.NW_Node_GetList(); gridItem.DataSource = dt; }
private void call_info(string Form_name, string code) { Class.NW_Node cls = new Class.NW_Node(); cls.NodeCode = code; DataTable dt = cls.NW_Node_Get(); txtCode.Text = dt.Rows[0]["NodeCode"].ToString(); txtName.Text = dt.Rows[0]["NodeName"].ToString(); txtGroup.Text = dt.Rows[0]["NodeGroup"].ToString(); txtDescription.Text = dt.Rows[0]["Description"].ToString(); }
private void btnUpdate_Click(object sender, EventArgs e) { Class.NW_Node cls = new Class.NW_Node(); cls.NodeCode = txtCode.Text; cls.Path = txtPath.Text; if (cls.UpdateByPath()) { Class.App.SaveSuccessfully(); } else { Class.App.SaveNotSuccessfully(); } }
public frmNodeList_UpdateByPath(string node, string firstLocarion) { InitializeComponent(); txtCode.Text = node; txtCode.Enabled = false; Class.NW_Node cls = new Class.NW_Node(); cls.NodeCode = node; DataTable dt = cls.NW_Node_Get(); if(dt.Rows.Count==1){ txtPath.Text = dt.Rows[0]["Path"].ToString(); } if (txtPath.Text.Length < 1) { txtPath.Text = firstLocarion; } location = firstLocarion; }
public frmNodeList_UpdateByPath(string node, string firstLocarion) { InitializeComponent(); txtCode.Text = node; txtCode.Enabled = false; Class.NW_Node cls = new Class.NW_Node(); cls.NodeCode = node; DataTable dt = cls.NW_Node_Get(); if (dt.Rows.Count == 1) { txtPath.Text = dt.Rows[0]["Path"].ToString(); } if (txtPath.Text.Length < 1) { txtPath.Text = firstLocarion; } location = firstLocarion; }
private void btnUpdateNew_Click(object sender, EventArgs e) { if (txtCode.Text.Length < 1) { Class.App.InputNotAccess(); return; } Class.NW_Node cls = new Class.NW_Node(); cls.NodeCode = txtCode.Text; cls.NodeName = txtName.Text; cls.NodeGroup = txtGroup.Text; cls.Description = txtDescription.Text; if (txtCode.Enabled == true) { if (cls.Insert()) { Class.App.SaveSuccessfully(); } else { Class.App.SaveNotSuccessfully(); } } else { if (cls.Update()) { Class.App.SaveSuccessfully(); } else { Class.App.SaveNotSuccessfully(); } } (this.Owner as frmNodeList).NW_Node_GetList(); txtCode.Enabled = true; txtName.Text = ""; txtDescription.Text = ""; this.Text = "Thêm Node"; txtCode.Text = call_Code_New(); }
void LoadBieuDoNode() { Class.NW_Node clsN = new Class.NW_Node(); Class.NW_Device clsDe = new Class.NW_Device(); DataTable dtDevice = new DataTable(); DataTable dtNode = clsN.NW_Node_GetList(); dtNode.Columns.Add("TotalOn"); dtNode.Columns.Add("TotalOff"); int on = 0; int off = 0; for (int i = 0; i < dtNode.Rows.Count; i++) { on = 0; off = 0; clsDe.NodeCode = dtNode.Rows[i]["NodeCode"].ToString(); dtDevice = clsDe.NW_Device_GetByNodeCode(); for (int j = 0; j < dtDevice.Rows.Count; j++) { if (dtDevice.Rows[j]["Status"].ToString() == "online") { on++; } else { off++; } } dtNode.Rows[i]["TotalOn"] = on; dtNode.Rows[i]["TotalOff"] = off; } // load bieu do frmSignalChartDetail frm = new frmSignalChartDetail(dtNode); frm.ShowDialog(); }
void NW_Node_GetList() { Class.NW_Node cls = new Class.NW_Node(); DataTable dt = cls.NW_Node_GetList(); gridItemNode.DataSource = dt; }
void LoadBieuDoNode() { Class.NW_Node clsN= new Class.NW_Node(); Class.NW_Device clsDe= new Class.NW_Device(); DataTable dtDevice = new DataTable(); DataTable dtNode = clsN.NW_Node_GetList(); dtNode.Columns.Add("TotalOn"); dtNode.Columns.Add("TotalOff"); int on = 0; int off = 0; for (int i = 0; i < dtNode.Rows.Count; i++) { on = 0; off = 0; clsDe.NodeCode=dtNode.Rows[i]["NodeCode"].ToString(); dtDevice = clsDe.NW_Device_GetByNodeCode(); for (int j = 0; j < dtDevice.Rows.Count; j++) { if (dtDevice.Rows[j]["Status"].ToString() == "online") on++; else off++; } dtNode.Rows[i]["TotalOn"] = on; dtNode.Rows[i]["TotalOff"] = off; } // load bieu do frmSignalChartDetail frm = new frmSignalChartDetail(dtNode); frm.ShowDialog(); }
private string call_Code_New() { Class.NW_Node cls = new Class.NW_Node(); return(cls.GetNewCode()); }
private string call_Code_New() { Class.NW_Node cls = new Class.NW_Node(); return cls.GetNewCode(); }