Esempio n. 1
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     if (gridItemDetailNode.SelectedRowsCount > 0)
     {
         if (gridItemDetailNode.FocusedRowHandle > -1)
         {
             string Node = gridItemDetailNode.GetFocusedRowCellValue(colNodeCode).ToString();
             Class.NW_Device cls = new Class.NW_Device();
             for (int i = 0; i < Data.Rows.Count; i++)
             {
                 if (Data.Rows[i]["Checked"] != DBNull.Value)
                 {
                     if ((bool)Data.Rows[i]["Checked"])
                     {
                         cls.MacAddress = Data.Rows[i]["MacAddress"].ToString();
                         cls.NodeCode = Node;
                         cls.Description = "";
                         if (!cls.Insert())
                         {
                             MessageBox.Show("Không thêm được mac : " + cls.MacAddress);
                         }
                     }
                 }
             }
             MessageBox.Show(" Hoàn thành quá trình thực hiện thêm .!");
             this.Close();
         }
     }
 }
Esempio n. 2
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     if (gridItemDetailNode.SelectedRowsCount > 0)
     {
         if (gridItemDetailNode.FocusedRowHandle > -1)
         {
             string          Node = gridItemDetailNode.GetFocusedRowCellValue(colNodeCode).ToString();
             Class.NW_Device cls  = new Class.NW_Device();
             for (int i = 0; i < Data.Rows.Count; i++)
             {
                 if (Data.Rows[i]["Checked"] != DBNull.Value)
                 {
                     if ((bool)Data.Rows[i]["Checked"])
                     {
                         cls.MacAddress  = Data.Rows[i]["MacAddress"].ToString();
                         cls.NodeCode    = Node;
                         cls.Description = "";
                         if (!cls.Insert())
                         {
                             MessageBox.Show("Không thêm được mac : " + cls.MacAddress);
                         }
                     }
                 }
             }
             MessageBox.Show(" Hoàn thành quá trình thực hiện thêm .!");
             this.Close();
         }
     }
 }
Esempio n. 3
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (txtCode.Text.Length < 1)
            {
                Class.App.InputNotAccess();
                return;
            }

            if (txtCode.Text.Length != 14)
            {
                MessageBox.Show("Địa chỉ Mac Address chưa đúng định dạng, Vui lòng nhập lại.!", "Cảnh Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            string[] kt = txtCode.Text.Split('.');
            if (kt.Length != 3)
            {
                MessageBox.Show("Địa chỉ Mac Address chưa đúng định dạng, Vui lòng nhập lại.!", "Cảnh Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            Class.NW_Device cls = new Class.NW_Device();
            cls.MacAddress  = txtCode.Text;
            cls.NodeCode    = _NodeCode;
            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 frmDeviceList).NW_Device_GetByNodeCode();
            this.Close();
        }
Esempio n. 4
0
 private void btnUpdateNew_Click(object sender, EventArgs e)
 {
     if (txtCode.Text.Length < 1)
     {
         Class.App.InputNotAccess();
         return;
     }
     if (txtCode.Text.Length != 14)
     {
         MessageBox.Show("Địa chỉ Mac Address chưa đúng định dạng, Vui lòng nhập lại.!", "Cảnh Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         return;
     }
     string[] kt = txtCode.Text.Split('.');
     if (kt.Length != 3)
     {
         MessageBox.Show("Địa chỉ Mac Address chưa đúng định dạng, Vui lòng nhập lại.!", "Cảnh Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         return;
     }
     Class.NW_Device cls = new Class.NW_Device();
     cls.MacAddress = txtCode.Text;
     cls.NodeCode = _NodeCode;
     cls.Description = txtDescription.Text;
     if (txtCode.Enabled == true)
     {
         if (cls.Insert())
         {
             Class.App.SaveSuccessfully();
         }
         else
         {
             Class.App.SaveNotSuccessfully();
         }
     }
     (this.Owner as frmDeviceList).NW_Device_GetByNodeCode();
     txtCode.Text = "";
     txtDescription.Text = "";
 }