示例#1
0
 private void btnImport_Click(object sender, EventArgs e)
 {
     if (dt.Rows.Count > 0)
     {
         Waiting.ShowWaitForm();
         Class.NW_Dhcp_Customer cls = new Class.NW_Dhcp_Customer();
         string fail = "";
         for (int i = 0; i < dt.Rows.Count; i++)
         {
             Application.DoEvents();
             Waiting.SetWaitFormDescription("Đang lưu ...(" + (i + 1).ToString() + ")");
             cls.IpAddress       = dt.Rows[i]["IpAddress"].ToString();
             cls.MacAddress      = dt.Rows[i]["MacAddress"].ToString();
             cls.MacAddress_CMTS = dt.Rows[i]["MacAddress_CMTS"].ToString();
             cls.CustomerCode    = dt.Rows[i]["CustomerCode"].ToString();
             cls.CustomerName    = dt.Rows[i]["CustomerName"].ToString();
             cls.CustomerAddress = dt.Rows[i]["CustomerAddress"].ToString();
             cls.PoolIp          = dt.Rows[i]["PoolIp"].ToString();
             cls.Bootfile        = dt.Rows[i]["Bootfile"].ToString();
             cls.IpPublic        = dt.Rows[i]["IpPublic"].ToString();
             cls.MacPc           = dt.Rows[i]["MacPc"].ToString();
             cls.PoolPublic      = dt.Rows[i]["PoolPublic"].ToString();
             cls.Location        = dt.Rows[i]["Location"].ToString();
             cls.Note            = dt.Rows[i]["Note"].ToString();
             //if (cls.IpAddress == "192.168.11.63")
             //{
             //    string degug = "";
             //}
             if (!cls.InsertMySQL()) // thay the import vao dl binh thuong thi impoort vao Mysql server co DHCP SV
             {
                 fail += "\r\n" + dt.Rows[i]["IpAddress"].ToString();
             }
         }
         Waiting.CloseWaitForm();
         //MessageBox.Show("Hoàn thành Insert !");
         //MessageBox.Show(fail);
     }
 }
示例#2
0
        private void btnImport_Click(object sender, EventArgs e)
        {
            if (dt.Rows.Count > 0)
            {
                Waiting.ShowWaitForm();
                Class.NW_Dhcp_Customer cls = new Class.NW_Dhcp_Customer();
                string fail = "";
                for(int i=0;i<dt.Rows.Count;i++)
                {
                    Application.DoEvents();
                    Waiting.SetWaitFormDescription("Đang lưu ...("+(i+1).ToString()+")");
                    cls.IpAddress = dt.Rows[i]["IpAddress"].ToString();
                    cls.MacAddress = dt.Rows[i]["MacAddress"].ToString();
                    cls.MacAddress_CMTS = dt.Rows[i]["MacAddress_CMTS"].ToString();
                    cls.CustomerCode = dt.Rows[i]["CustomerCode"].ToString();
                    cls.CustomerName = dt.Rows[i]["CustomerName"].ToString();
                    cls.CustomerAddress = dt.Rows[i]["CustomerAddress"].ToString();
                    cls.PoolIp = dt.Rows[i]["PoolIp"].ToString();
                    cls.Bootfile = dt.Rows[i]["Bootfile"].ToString();
                    cls.IpPublic = dt.Rows[i]["IpPublic"].ToString();
                    cls.MacPc = dt.Rows[i]["MacPc"].ToString();
                    cls.PoolPublic = dt.Rows[i]["PoolPublic"].ToString();
                    cls.Location = dt.Rows[i]["Location"].ToString();
                    cls.Note = dt.Rows[i]["Note"].ToString();
                    //if (cls.IpAddress == "192.168.11.63")
                    //{
                    //    string degug = "";
                    //}
                    if (!cls.InsertMySQL()) // thay the import vao dl binh thuong thi impoort vao Mysql server co DHCP SV
                    {
                        fail += "\r\n" + dt.Rows[i]["IpAddress"].ToString();
                    }

                }
                Waiting.CloseWaitForm();
                //MessageBox.Show("Hoàn thành Insert !");
                //MessageBox.Show(fail);
            }
        }
示例#3
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (cboPoolIp.EditValue == null)
            {
                Class.App.InputNotAccess();
                return;
            }
            if (txtMacAddress.Text.Length < 1)
            {
                Class.App.InputNotAccess();
                return;
            }

            if (txtIpAddress.Text.Length < 5)
            {
                MessageBox.Show("Địa chỉ IP Address chưa đúng định dạng, Vui lòng nhập lại.!", "Cảnh Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (txtMacAddress.Text.Length != 17)
            {
                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_Dhcp_Customer cls = new Class.NW_Dhcp_Customer();
            cls.MacAddress = txtMacAddress.Text;
            string mac = txtMacAddress.Text;

            mac = mac.Replace(":", "");
            mac = mac.Insert(4, ".");
            mac = mac.Insert(9, ".");
            cls.MacAddress_CMTS = mac;
            cls.IpAddress       = txtIpAddress.Text;
            cls.PoolIp          = cboPoolIp.EditValue.ToString();
            cls.CustomerCode    = txtCustomerCode.Text;
            cls.CustomerName    = txtCustomerName.Text;
            cls.CustomerAddress = txtCustomerAddress.Text;
            cls.Bootfile        = cboBootfile.EditValue.ToString();
            cls.Location        = txtLocation.Text;
            cls.Note            = txtNote.Text;

            cls.IpPublic   = "";
            cls.PoolPublic = "";
            cls.MacPc      = "";
            if (txtIpAddress.Enabled)
            {
                if (cls.InsertMySQL())
                {
                    Class.App.SaveSuccessfully();
                    add_edit = true;
                }
                else
                {
                    Class.App.SaveNotSuccessfully();
                }
            }
            else
            {
                if (cls.UpdateMySQL())
                {
                    Class.App.SaveSuccessfully();
                    add_edit = true;
                }
                else
                {
                    Class.App.SaveNotSuccessfully();
                }
            }
            this.Close();
        }
示例#4
0
        private void btnUpdateNew_Click(object sender, EventArgs e)
        {
            if (cboPoolIp.EditValue == null)
            {
                Class.App.InputNotAccess();
                return;
            }
            if (txtMacAddress.Text.Length < 1)
            {
                Class.App.InputNotAccess();
                return;
            }
            if (txtIpAddress.Text.Length < 5)
            {
                MessageBox.Show("Địa chỉ IP Address chưa đúng định dạng, Vui lòng nhập lại.!", "Cảnh Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (txtMacAddress.Text.Length != 17)
            {
                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_Dhcp_Customer cls = new Class.NW_Dhcp_Customer();
            cls.MacAddress = txtMacAddress.Text;
            string mac = txtMacAddress.Text;
            mac = mac.Replace(":", "");
            mac = mac.Insert(4, ".");
            mac = mac.Insert(9, ".");
            cls.MacAddress_CMTS = mac;
            cls.IpAddress = txtIpAddress.Text;
            cls.PoolIp = cboPoolIp.EditValue.ToString();
            cls.CustomerCode = txtCustomerCode.Text;
            cls.CustomerName = txtCustomerName.Text;
            cls.CustomerAddress = txtCustomerAddress.Text;
            cls.Bootfile = cboBootfile.EditValue.ToString();
            cls.Location = txtLocation.Text;
            cls.Note = txtNote.Text;

            cls.IpPublic = "";
            cls.PoolPublic = "";
            cls.MacPc = "";
            if (txtIpAddress.Enabled)
            {
                if (cls.InsertMySQL())
                {
                    Class.App.SaveSuccessfully();
                    add_edit = true;
                }
                else
                {
                    Class.App.SaveNotSuccessfully();
                }
            }
            else
            {
                if (cls.UpdateMySQL())
                {
                    Class.App.SaveSuccessfully();
                    add_edit = true;
                }
                else
                {
                    Class.App.SaveNotSuccessfully();
                }
            }

            txtIpAddress.Enabled = true;
            cboPoolIp.Enabled = true;
            call_Code_New();
            //NW_Dhcp_Ip_GetbyPoolModem();
            NW_Dhcp_Ip_GetbyPoolModem_MySQL();
        }