Ejemplo n.º 1
0
        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();
                }
            }
        }
Ejemplo n.º 2
0
        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();
                }
            }
        }
Ejemplo n.º 3
0
        public void NW_Node_GetList()
        {
            Class.NW_Node cls = new Class.NW_Node();
            DataTable     dt  = cls.NW_Node_GetList();

            gridItem.DataSource = dt;
        }
Ejemplo n.º 4
0
        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();
        }
Ejemplo n.º 5
0
 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();
     }
 }
Ejemplo n.º 6
0
        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;
        }
Ejemplo n.º 7
0
        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;
        }
Ejemplo n.º 8
0
 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();
 }
Ejemplo n.º 9
0
 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();
 }
Ejemplo n.º 10
0
        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();
        }
Ejemplo n.º 11
0
 void NW_Node_GetList()
 {
     Class.NW_Node cls = new Class.NW_Node();
     DataTable dt = cls.NW_Node_GetList();
     gridItemNode.DataSource = dt;
 }
Ejemplo n.º 12
0
        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();
        }
Ejemplo n.º 13
0
 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();
     }
 }
Ejemplo n.º 14
0
 private string call_Code_New()
 {
     Class.NW_Node cls = new Class.NW_Node();
     return(cls.GetNewCode());
 }
Ejemplo n.º 15
0
 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();
 }
Ejemplo n.º 16
0
 private string call_Code_New()
 {
     Class.NW_Node cls = new Class.NW_Node();
     return cls.GetNewCode();
 }