コード例 #1
0
ファイル: frmkhachhang.cs プロジェクト: ngochien1999/TTCM
 private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         makh           = dataGridView1.CurrentRow.Cells[0].Value.ToString();
         txtten.Text    = dataGridView1.CurrentRow.Cells[1].Value.ToString();
         txttuoi.Text   = dataGridView1.CurrentRow.Cells[2].Value.ToString();
         txtsdt.Text    = dataGridView1.CurrentRow.Cells[3].Value.ToString();
         txtdiachi.Text = dataGridView1.CurrentRow.Cells[4].Value.ToString();
         txtcmnd.Text   = dataGridView1.CurrentRow.Cells[5].Value.ToString();
         txtemail.Text  = dataGridView1.CurrentRow.Cells[6].Value.ToString();
         btnsua.Enabled = true;
     }
     catch
     {
         btnsua.Enabled = false;
     }
     if (e.ColumnIndex == 7)
     {
         if (MessageBox.Show("Bạn có muốn xóa nhà khách hàng không ?", "xóa", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             using (QLBCMBEntities3 quanli = new QLBCMBEntities3())
             {
                 quanli.deletekh(makh);
                 MessageBox.Show("đã xóa", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                 Form8_Load(sender, e);
             }
         }
     }
 }
コード例 #2
0
        private void Form2_Load(object sender, EventArgs e)
        {
            //bmp = new Bitmap(width + 1, height + 1);
            //cx = width / 2;
            //cy = height / 2;
            //this.BackColor = Color.White;
            //t.Interval = 1000;
            //t.Tick += new EventHandler(this.t_Tick);
            //t.Start();


            using (QLBCMBEntities3 quanli = new QLBCMBEntities3())
            {
                Nhanvien nv = quanli.Nhanviens.FirstOrDefault(p => p.MaNV == manv);
                if (nv != null)
                {
                    if (nv.Chucvu.ToString().Equals("Nhanvien"))
                    {
                        btnchuyenbay.Enabled = false;
                        GunaButton4.Enabled  = false;
                        btnnhanvien.Enabled  = false;
                        btnsanbay.Enabled    = false;
                        btnthongke.Enabled   = false;
                    }
                }
            }
            loadform(new Form13());
            timer5.Start();
        }
コード例 #3
0
ファイル: frmmaybay.cs プロジェクト: ngochien1999/TTCM
        private void dtmaybay_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                mamb = dtmaybay.CurrentRow.Cells[0].Value.ToString();

                txtten.Text    = dtmaybay.CurrentRow.Cells[1].Value.ToString();
                cbGT.Text      = dtmaybay.CurrentRow.Cells[2].Value.ToString();
                txtI.Text      = dtmaybay.CurrentRow.Cells[3].Value.ToString();
                txtII.Text     = dtmaybay.CurrentRow.Cells[4].Value.ToString();
                btnsua.Enabled = true;
            }
            catch
            {
                btnsua.Enabled = false;
            }



            if (e.ColumnIndex == 5)
            {
                if (MessageBox.Show("Bạn có muốn xóa nhà khách hàng không ?", "xóa", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    using (QLBCMBEntities3 quanli = new QLBCMBEntities3())
                    {
                        quanli.deletemb(mamb);
                        quanli.SaveChanges();
                        MessageBox.Show("đã xóa", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                        Form10_Load(sender, e);
                    }
                }
            }
        }
コード例 #4
0
ファイル: frmchuyenbay.cs プロジェクト: ngochien1999/TTCM
        //public void Loadchuyenbay()
        //{
        //    string query = " select * from Tuyenbay";
        //    DataTable data = Connect.Instace.excutequery(query);
        //   dtchuyenbay.DataSource = data;

        //}
        //public void LoadCombox()
        //  {
        //      string query = "select * from Tuyenbay";
        //      DataTable data = Connect.Instace.excutequery(query);
        //      cbdi.DataSource = data;
        //      cbdi.ValueMember = "MaTB";
        //      cbdi.DisplayMember = "SBdi";
        //  }
        private void Form5_Load(object sender, EventArgs e)
        {
            using (QLBCMBEntities3 quanli = new QLBCMBEntities3())
            {
                dataGridView1.DataSource = quanli.them();
            }
            DSBItems();

            //DataTable table = new DataTable();
            ////table.Columns.Add("MaCB");
            ////table.Columns.Add("MaMB");
            ////table.Columns.Add("NgayBay");
            ////table.Columns.Add("ThoiGianBay");
            ////table.Columns.Add("GheLoai1");
            ////table.Columns.Add("GheLoai2");
            //using (QLBCMBEntities3 quanli = new QLBCMBEntities3())
            //{

            //    List<Chuyenbay> ds_cb = quanli.Chuyenbays.ToList();
            //    foreach (var item in ds_cb)
            //    {
            //        Maybay mb = quanli.Maybays.FirstOrDefault(p => p.MaMB == item.MaMB);
            //        table.Rows.Add(item.MaCB, item.MaMB, item.Ngaybay, item.Thoigianbay, mb.Gheloai1, mb.Gheloai2);
            //    }
            //}
            //gunaDataGridView1.AutoGenerateColumns = false;
            //gunaDataGridView1.DataSource = table;
        }
コード例 #5
0
ファイル: frmkhachhang.cs プロジェクト: ngochien1999/TTCM
 private void gunaButton4_Click(object sender, EventArgs e)
 {
     using (QLBCMBEntities3 quanli = new QLBCMBEntities3())
     {
         dataGridView1.DataSource = quanli.Khachhangs.Where(p => p.Makh.Contains(txttimkiem.Text.Trim())).ToList();
         MessageBox.Show("Tìm kiếm thành công", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
     }
 }
コード例 #6
0
 //void control()
 //{
 //    using (QLBCMBEntities3 db = new QLBCMBEntities3())
 //    {
 //        chartControl1.DataSource = db.dthu().ToList();
 //        chartControl1.X= "thoigian";
 //        chartControl1.Series["VND"] = "tongtien";
 //    }
 //}
 void loadchart()
 {
     using (QLBCMBEntities3 db = new QLBCMBEntities3())
     {
         chart1.DataSource = db.tongdthu().ToList();
         chart1.Series["VND"].YValueMembers = "tongtien";
     }
 }
コード例 #7
0
ファイル: frmkhachhang.cs プロジェクト: ngochien1999/TTCM
 private void gunaButton3_Click(object sender, EventArgs e)
 {
     using (QLBCMBEntities3 quanli = new QLBCMBEntities3())
     {
         quanli.deletekh(makh);
         quanli.SaveChanges();
         MessageBox.Show("đã xóa", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
         Form8_Load(sender, e);
     }
 }
コード例 #8
0
ファイル: frmve.cs プロジェクト: ngochien1999/TTCM
        private void gunaButton1_Click(object sender, EventArgs e)
        {
            string a = "";

            using (QLBCMBEntities3 quanli = new QLBCMBEntities3())
            {
                a = quanli.Hoadons.Max(p => p.MaHD);
            }
            frminhoadon f = new frminhoadon(a);

            this.Hide();
            f.ShowDialog();
            this.Show();
        }
コード例 #9
0
ファイル: frmmaybay.cs プロジェクト: ngochien1999/TTCM
 private void gunaButton3_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Bạn có muốn xóa hóa đơn này không?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
     {
         using (QLBCMBEntities3 quanli = new QLBCMBEntities3())
         {
             Maybay hd = quanli.Maybays.FirstOrDefault(p => p.MaMB == mamb);
             if (hd != null)
             {
                 quanli.Maybays.Remove(hd);
                 quanli.SaveChanges();
                 MessageBox.Show("Đã xóa!");
                 Form10_Load(sender, e);
             }
         }
     }
 }
コード例 #10
0
        private void GunaButton1_Click(object sender, EventArgs e)
        {
            //(tk.dem == "0" || tk.dem == "1" || tk.dem == "2" || tk.dem == "3" || tk.dem == "4"
            //        || tk.dem == "5" || tk.dem == "6" || tk.dem == "7" || tk.dem == "8" || tk.dem == "9")
            using (QLBCMBEntities3 quanli = new QLBCMBEntities3())
            {
                TK tk = quanli.TKs.FirstOrDefault(p => p.TenTK.Trim() == txttk.Text.Trim() && p.Pass.Trim() == txtmk.Text.Trim());
                if (tk != null && (tk.dem <= 10 && tk.keykh == null))

                {
                    if (tk.dem <= 10)
                    {
                        quanli.updatekey((tk.dem + 1).ToString(), txttk.Text.Trim());
                        frmmain f = new frmmain();
                        this.Hide();
                        this.Show();
                        f.manv = tk.TenTK;
                        f.ShowDialog();
                    }
                }
                else if (tk != null && (tk.dem > 10 && tk.keykh == null))
                {
                    tentkchuan = tk.TenTK;
                    DialogResult dr = MessageBox.Show("Bạn Có Muốn Kích Hoạt Key Không?", "Thông báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                    if (dr == DialogResult.OK)
                    {
                        FormKichHoat f = new FormKichHoat();
                        f.ShowDialog();
                    }
                }
                else if (tk != null && tk.dem > 10 && tk.keykh != null)
                {
                    ttnv.manv = tk.TenTK;
                    frmmain f = new frmmain();
                    this.Hide();
                    f.manv = tk.TenTK;
                    f.ShowDialog();
                }
                else if (tk == null)
                {
                    MessageBox.Show("BẠN NHẬP SAI TK HOẶC MK", "Thông báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                }
            }
        }
コード例 #11
0
ファイル: frmve.cs プロジェクト: ngochien1999/TTCM
        private void txtII_TextChanged(object sender, EventArgs e)
        {
            QLBCMBEntities3 dt = new QLBCMBEntities3();

            giave2 = 0;
            int       giaveloai2, tongtien;
            Chuyenbay chuyenbay = dt.Chuyenbays.Where(s => s.MaCB == label3.Text).FirstOrDefault();

            if (chuyenbay != null)
            {
                string a   = chuyenbay.MaCB.ToString();
                Ve     ve1 = dt.Ves.Where(s => s.MaCB == a.ToString()).FirstOrDefault();

                giave2 = int.Parse(ve1.Giave);
                if (txtII.Text == "")
                {
                    if (txtI.Text != "")
                    {
                        giaveloai2      = giave1 * int.Parse(txtI.Text.Trim());
                        tongtien        = giaveloai2;
                        lbTongTien.Text = tongtien.ToString();
                    }
                    else
                    {
                        lbTongTien.Text = "0";
                    }
                    return;
                }
                giaveloai2      = (giave2 * int.Parse(txtII.Text.Trim())) * 80 / 100;
                tongtien        = int.Parse(lbTongTien.Text);
                tongtien       += giaveloai2;
                lbTongTien.Text = tongtien.ToString();
                // hoadon.Tongtien = tongtien;
                //hoadon.MaNV = txtmahd.Text;
                dt.SaveChanges();
                Form3_Load(sender, e);
            }
        }
コード例 #12
0
ファイル: frmkhachhang.cs プロジェクト: ngochien1999/TTCM
        private void btnLuu_Click(object sender, EventArgs e)
        {
            if (temp)
            {
                if (!kiemtra())
                {
                    return;
                }
                {
                    using (QLBCMBEntities3 quanli = new QLBCMBEntities3())
                    {
                        string makh       = quanli.Khachhangs.Max(p => p.Makh);
                        string ma         = makh.Substring(2, makh.Length - 2);
                        int    manhanvien = int.Parse(ma) + 1;
                        if (manhanvien <= 9)
                        {
                            makh = "KH0" + manhanvien;
                        }
                        else
                        {
                            makh = "KH" + manhanvien;
                        }
                        Khachhang kh = new Khachhang();
                        kh.Makh  = makh;
                        kh.Tenkh = txtten.Text;
                        kh.Tuoi  = int.Parse(txttuoi.Text);
                        kh.SDTkh = txtsdt.Text;
                        kh.ĐCkh  = txtdiachi.Text;
                        kh.CMND  = int.Parse(txtcmnd.Text);
                        kh.Email = txtemail.Text;
                        quanli.Khachhangs.Add(kh);
                        quanli.SaveChanges();
                        Form8_Load(sender, e);
                        btnthem.Enabled = true;

                        clearData();
                        dataGridView1.Enabled = true;
                    }
                }
            }
            {
                if (makh == "")
                {
                    MessageBox.Show("Hãy chọn khách hàng cần sửa!");
                    return;
                }
                using (QLBCMBEntities3 quanli = new QLBCMBEntities3())
                {
                    Khachhang kh = quanli.Khachhangs.FirstOrDefault(p => p.Makh == makh);

                    kh.Makh  = makh;
                    kh.Tenkh = txtten.Text;
                    kh.Tuoi  = int.Parse(txttuoi.Text);
                    kh.SDTkh = txtsdt.Text;
                    kh.ĐCkh  = txtdiachi.Text;
                    kh.CMND  = int.Parse(txtcmnd.Text);
                    kh.Email = txtemail.Text;
                    quanli.SaveChanges();
                    MessageBox.Show("Sua thanh cong!");
                    Form8_Load(sender, e);
                }
            }
        }
コード例 #13
0
ファイル: frmmaybay.cs プロジェクト: ngochien1999/TTCM
        private void btnLuu_Click(object sender, EventArgs e)
        {
            {
                if (temp)
                {
                    if (!kiemtra())
                    {
                        return;
                    }

                    using (QLBCMBEntities3 quanli = new QLBCMBEntities3())
                    {
                        string mamb       = quanli.Maybays.Max(p => p.MaMB);
                        string ma         = mamb.Substring(2, mamb.Length - 2);
                        int    manhanvien = int.Parse(ma) + 1;
                        if (manhanvien <= 9)
                        {
                            mamb = "MB0" + manhanvien;
                        }
                        else
                        {
                            mamb = "MB" + manhanvien;
                        }
                        Maybay nv = new Maybay();
                        nv.MaMB     = mamb;
                        nv.TenMB    = txtten.Text;
                        nv.Hang     = cbGT.Text;
                        nv.Gheloai1 = txtI.Text;
                        nv.Gheloai2 = txtII.Text;

                        quanli.Maybays.Add(nv);
                        quanli.SaveChanges();

                        Form10_Load(sender, e);
                        clearData();
                        btnthem.Enabled  = true;
                        dtmaybay.Enabled = true;
                    }
                }



                else
                {
                    if (mamb == "")
                    {
                        MessageBox.Show("Hãy chọn máy bay cần sửa!");
                        return;
                    }
                    {
                        using (QLBCMBEntities3 quanli = new QLBCMBEntities3())
                        {
                            if (mamb == "")
                            {
                                MessageBox.Show("Hãy chọn sân bay cần sửa!");
                                return;
                            }

                            using (QLBCMBEntities3 quanli1 = new QLBCMBEntities3())
                            {
                                Maybay nv = quanli1.Maybays.FirstOrDefault(p => p.MaMB == mamb);

                                nv.TenMB    = txtten.Text;
                                nv.Hang     = cbGT.Text;
                                nv.Gheloai1 = txtI.Text;
                                nv.Gheloai2 = txtII.Text;

                                quanli1.SaveChanges();
                                DialogResult dr = MessageBox.Show("Sửa thành công!", "Thông báo",
                                                                  MessageBoxButtons.OK, MessageBoxIcon.Information);
                                Form10_Load(sender, e);
                                clearData();
                                btnthem.Enabled  = true;
                                dtmaybay.Enabled = true;
                            }
                        }
                    }
                }
            }
        }
コード例 #14
0
        private void btnluu_Click(object sender, EventArgs e)
        {
            if (temp)
            {
                {
                    if (!kiemtra())
                    {
                        return;
                    }
                    using (QLBCMBEntities3 quanli = new QLBCMBEntities3())
                    {
                        string manv       = quanli.Nhanviens.Max(p => p.MaNV);
                        string ma         = manv.Substring(2, manv.Length - 2);
                        int    manhanvien = int.Parse(ma) + 1;
                        if (manhanvien <= 9)
                        {
                            manv = "NV0" + manhanvien;
                        }
                        else
                        {
                            manv = "NV" + manhanvien;
                        }
                        Nhanvien nv = new Nhanvien();
                        nv.MaNV   = manv;
                        nv.Hoten  = txtten.Text;
                        nv.SĐT    = txtsdt.Text;
                        nv.Diachi = txtdiachi.Text;
                        nv.CMND   = int.Parse(txtcmnd.Text);
                        quanli.Nhanviens.Add(nv);
                        quanli.SaveChanges();

                        Form9_Load(sender, e);
                        btnthem.Enabled    = true;
                        dtnhanvien.Enabled = true;
                        clearData();
                    }
                }
            }
            {
                if (manv == "")
                {
                    MessageBox.Show("Hãy chọn nhân viên cần sửa!");
                    return;
                }
                using (QLBCMBEntities3 quanli = new QLBCMBEntities3())
                {
                    Nhanvien nv = quanli.Nhanviens.FirstOrDefault(p => p.MaNV == manv);

                    nv.Hoten  = txtten.Text;
                    nv.SĐT    = txtsdt.Text;
                    nv.Diachi = txtdiachi.Text;
                    nv.CMND   = int.Parse(txtcmnd.Text);
                    nv.Chucvu = txtchucvu.Text;
                    quanli.SaveChanges();
                    MessageBox.Show("Sua thanh cong!");
                    Form9_Load(sender, e);
                    btnthem.Enabled    = true;
                    dtnhanvien.Enabled = true;
                    clearData();
                }
            }
        }
コード例 #15
0
ファイル: frmve.cs プロジェクト: ngochien1999/TTCM
        private void btnDatVe_Click(object sender, EventArgs e)
        {
            using (QLBCMBEntities3 quanli = new QLBCMBEntities3())
            {
                //    Hoadon hd = new Hoadon();
                //    hd.MaHD = txtmahd.Text;
                //    hd.Nlap = DateTime.Now;
                //    hd.MaNV = cbnv.SelectedValue.ToString();
                //    hd.Makh = cbkh.SelectedValue.ToString();
                //    hd.MaCB = label3.Text;
                //hd.Tongtien = int.Parse(lbTongTien.Text);
                //quanli.Hoadons.Add(hd);
                //quanli.SaveChanges();
                // quanli.mahoadon(cbnv.SelectedValue, Convert.ToDateTime(dtngay.Text), lbTongTien.Text, cbkh.SelectedValue);
                quanli.themHoaDon(cbnv.SelectedValue.ToString()
                                  , int.Parse(lbTongTien.Text), cbkh.SelectedValue.ToString(), DateTime.Now, textBox1.Text);
                CTVe ct = new CTVe();
                ct.MaHD = quanli.Hoadons.Max(p => p.MaHD);
                ct.Mave = textBox1.Text;
                quanli.CTVes.Add(ct);
                int n = int.Parse(txtI.Text) + int.Parse(txtII.Text);

                ct.Soluongban = n;

                quanli.SaveChanges();

                //if (String.IsNullOrEmpty(txtI.Text))
                //{
                //    CTVe cT = new CTVe();
                //    cT.MaHD = txtmahd.Text;
                //    cT.Mave = "V01";
                //    cT.Soluongban = int.Parse(txtI.Text);
                //    quanli.CTVes.Add(cT);
                //    quanli.SaveChanges();
                //}
                //if (String.IsNullOrEmpty(txtII.Text))
                //{
                //    CTVe cT = new CTVe();
                //    cT.MaHD = txtmahd.Text;
                //    cT.Mave = "V02";
                //    cT.Soluongban = int.Parse(txtI.Text);
                //    quanli.CTVes.Add(cT);
                //    quanli.SaveChanges();
                //}
                MessageBox.Show("Thêm thành công");
            }
            int giaveloai1, giaveloai2;

            if (txtI.Text != "" && txtII.Text != "")
            {
                giaveloai1 = int.Parse(txtI.Text) * giave1;
                giaveloai2 = int.Parse(txtII.Text) * giave2;
                int tong = giaveloai1 + giaveloai2;
                lbTongTien.Text = tong.ToString();
            }



            //    //dt.themhd(cbnv.SelectedValue.ToString(), Convert.ToDateTime(dtngaylap.Text), int.Parse(lbTongTien.Text), comboBox3.SelectedValue.ToString(), int.Parse(textBox1.Text), textBox2.Text, cbcb.SelectedValue.ToString(), cbmakh.SelectedValue.ToString());

            //}
            //Chuyenbay chuyenbay = dt.Chuyenbays.Where(s => s.MaCB == label3.Text.Trim()).FirstOrDefault();
            //Hoadon hoadon = dt.Hoadons.Where(s => s.MaCB == chuyenbay.MaCB.ToString()).FirstOrDefault();
            //CTVe cTVe = dt.CTVes.Where(s => s.MaHD == hoadon.MaHD.ToString()).FirstOrDefault();
            //Ve ve = dt.Ves.Where(s => s.Mave == cTVe.Mave.ToString()).FirstOrDefault();
            //giave = int.Parse(ve.Giave);
            //lbTongTien.Text = giave.ToString();
            //giave = Convert.ToDouble(ve.Giave);
            //lbTongtien.Text = giave.ToString();
        }