Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            int           k    = 0;
            List <DanhBa> DB   = DanhBa.GetNhom();
            string        path = Application.StartupPath + @"/TenNhom.txt";

            for (int i = 0; i < DB.Count; i++)
            {
                if (txtTenNhom.Text.Equals(DB[i].TenNhom))
                {
                    k = 1;
                }
            }
            if (k == 1)
            {
                MessageBox.Show("Tên Nhóm đã có trong cơ sở!");
            }
            else
            {
                String line = txtTenNhom.Text + System.Environment.NewLine;
                File.AppendAllText(path, line, Encoding.UTF8);
                MessageBox.Show("Thêm nhóm thành công!");
                this.Close();
            }
        }
Example #2
0
 private void toolStripButton4_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Bạn có thực sự muốn xóa", "Thông báo!", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.OK)
     {
         String   tengoi = (string)sqdTenNhom.CurrentRow.Cells[0].Value;
         string   path   = Application.StartupPath + @"/lienlac.txt";
         String[] lines  = File.ReadAllLines(path);
         File.WriteAllText(path, "");
         for (int i = 0; i < lines.Length; i++)
         {
             string[] vd = lines[i].Split(new char[] { '#' });
             if (vd[1].Equals(tengoi) == false)
             {
                 String line = vd[0] + "#" + vd[1] + "#" + vd[2] + "#" + vd[3] + Environment.NewLine;
                 File.AppendAllText(path, line, Encoding.UTF8);
             }
             else
             {
             }
         }
     }
     else
     {
     }
     sqdTenNhom.DataSource = DanhBa.getDanhBa((string)sqdNhom.CurrentCell.Value);
 }
Example #3
0
        private void toolStripButton3_Click(object sender, EventArgs e)
        {
            Themlienlac f = new Themlienlac();

            f.Show();
            sqdTenNhom.DataSource = DanhBa.getDanhBa((string)sqdNhom.CurrentCell.Value);
        }
        private void button1_Click(object sender, EventArgs e)
        {
            int           k       = 0;
            string        path    = Application.StartupPath + @"/lienlac.txt";
            List <DanhBa> tennhom = DanhBa.GetNhom();

            for (int i = 0; i < tennhom.Count; i++)
            {
                // MessageBox.Show(tennhom[i].TenNhom);
                if (txtNhom.Text.Equals(tennhom[i].TenNhom))
                {
                    k = 1;
                }
            }
            if (k == 0)
            {
                MessageBox.Show("Tên nhóm không có trong cơ sở!");
            }
            else
            {
                String line = txtNhom.Text + "#" + txtTenGoi.Text + "#" + txtEmail.Text + "#" + txtSdt.Text + System.Environment.NewLine;
                File.AppendAllText(path, line, Encoding.UTF8);
                MessageBox.Show("Đã thêm thành công!");
                this.Close();
            }
        }
Example #5
0
        private void toolStripButton5_Click(object sender, EventArgs e)
        {
            List <DanhBa> Nhom = DanhBa.GetNhom();

            sqdNhom.AutoGenerateColumns    = false;
            sqdNhom.DataSource             = Nhom;
            sqdTenNhom.AutoGenerateColumns = false;
            List <DanhBa> DB = DanhBa.getDanhBa((string)sqdNhom.CurrentCell.Value);

            sqdTenNhom.DataSource = DB;
        }
Example #6
0
        public Form1()
        {
            InitializeComponent();
            sqdNhom.AutoGenerateColumns = false;
            List <DanhBa> Nhom = DanhBa.GetNhom();

            sqdNhom.DataSource             = Nhom;
            sqdTenNhom.AutoGenerateColumns = false;
            List <DanhBa> DB = DanhBa.getDanhBa(Nhom[0].TenNhom);

            sqdTenNhom.DataSource = DB;
            label5.Text           = (string)DB[0].Email;
            label6.Text           = (string)DB[0].SoDt;
            label7.Text           = (string)DB[0].TenGoi;
        }
Example #7
0
 private void sqdNhom_MouseClick(object sender, MouseEventArgs e)
 {
     sqdTenNhom.AutoGenerateColumns = false;
     if (DanhBa.getDanhBa((string)sqdNhom.CurrentCell.Value) != null)
     {
         List <DanhBa> DB = DanhBa.getDanhBa((string)sqdNhom.CurrentCell.Value);
         sqdTenNhom.DataSource = DB;
         try {
             label5.Text = (string)sqdTenNhom.CurrentRow.Cells[1].Value;
             label6.Text = (string)sqdTenNhom.CurrentRow.Cells[2].Value;
             label7.Text = (string)sqdTenNhom.CurrentRow.Cells[0].Value;
         }
         catch (Exception) {
             label5.Text = "";
             label6.Text = "";
             label7.Text = "";
         }
     }
 }
Example #8
0
        private void toolStripTextBox1_TextChanged(object sender, EventArgs e)
        {
            String        tk  = txtTimkiem.Text;
            List <DanhBa> DB  = DanhBa.getDanhBa((string)sqdNhom.CurrentCell.Value);
            List <DanhBa> DB2 = new List <DanhBa>();

            //label6.Text = tk;
            //label7.Text = DB[0].TenGoi;
            for (int i = 0; i < DB.Count; i++)
            {
                if (DB[i].TenGoi.ToLower().Contains(tk.ToLower()) == true)
                {
                    DB2.Add(new DanhBa {
                        TenNhom = DB[i].TenNhom, TenGoi = DB[i].TenGoi, Email = DB[i].Email, SoDt = DB[i].SoDt
                    });
                }
            }
            sqdTenNhom.DataSource = DB2;
        }