private void buttonTaoMoi_Click(object sender, EventArgs e)
        {
            if (textBoxTenBanVe.Text.Equals(""))
            {
                MessageBox.Show("Chưa nhập tên hộ chiếu");
                return;
            }
            foreach (RadioButton value in radioButtonTemplate)
            {
                if (value.Checked)
                {
                    idTemplate   = value.Name;
                    pathTemplate = BS_Template.ChonTemplate(idTemplate).DuongDan;
                }
            }
            //tạo id hộ chiếu, gán cho biến toàn cục
            String idHoChieu = BS_HoChieu.TaoHoChieu(idTemplate, textBoxTenBanVe.Text);

            if (idHoChieu == null)
            {
                MessageBox.Show("Hộ chiếu đã có");
                return;
            }
            else
            {
                MyGetData(idHoChieu);
                this.Close();
            }
        }
Ejemplo n.º 2
0
 private void RefreshData()
 {
     labelValue_MaHoChieu.Text       = BS_HoChieu.HoChieu(idHoChieu).TenHoChieu;
     comboBox_MayKhoan.DataSource    = BS_MayKhoan.DanhSachMayKhoan();
     comboBox_MayKhoan.DisplayMember = "TenMayKhoan";
     comboBox_MayKhoan.SelectedItem  = null;
 }
        private void RefreshData(String _idLoKhoan)
        {
            LoKhoan loKhoan = BS_LoKhoan.ThongTinLoKhoan(idHoChieu, _idLoKhoan);

            //hiển thị thông tin
            labelValue_MaHoChieu.Text       = BS_HoChieu.HoChieu(loKhoan.MaHoChieu).TenHoChieu;
            labelValue_MaBanVe.Text         = loKhoan.MaBanVe;
            labelValue_MaMayKhoan.Text      = BS_MayKhoan.MayKhoan(loKhoan.MaMayKhoan).TenMayKhoan;
            labelValue_MaLK.Text            = loKhoan.MaLoKhoan;
            comboBox_MayKhoan.DataSource    = BS_MayKhoan.DanhSachMayKhoan();
            comboBox_MayKhoan.DisplayMember = "TenMayKhoan";
            comboBox_MayKhoan.Text          = BS_MayKhoan.MayKhoan(loKhoan.MaMayKhoan).TenMayKhoan;
            //hiển thị thông số
            labelValue_DuongKinh.Text  = (Math.Round(loKhoan.BanKinh * 2, 2)).ToString();
            textBox_DuongKinh.Text     = (Math.Round(loKhoan.BanKinh * 2, 2)).ToString();
            labelValue_ChieuSauLK.Text = (Math.Round(loKhoan.ChieuSau, 2)).ToString();
            textBox_ChieuSauLK.Text    = (Math.Round(loKhoan.ChieuSau, 2)).ToString();
            labelValue_HuongKhoan.Text = comboBox_HuongKhoan.Text = loKhoan.HuongKhoan;
            labelValue_ToaDoX.Text     = textBox_ToaDoX.Text = (Math.Round(loKhoan.ToaDoX, 2)).ToString();
            labelValue_ToaDoY.Text     = textBox_ToaDoY.Text = (Math.Round(loKhoan.ToaDoY, 2)).ToString();
            labelValue_Lt.Text         = textBox1.Text = loKhoan.Lt.ToString();
            labelValue_Lkk.Text        = textBox2.Text = loKhoan.Lkk.ToString();
            labelValue_L0.Text         = textBox3.Text = loKhoan.L0.ToString();
            labelValue_Lbua.Text       = textBox4.Text = loKhoan.Lbua.ToString();
        }
        private void buttonUpdate_Click(object sender, EventArgs e)
        {
            HoChieu updated = gridViewMain.GetFocusedRow() as HoChieu;

            if (textBoxTenHoChieu.Text != String.Empty)
            {
                updated.TenHoChieu = textBoxTenHoChieu.Text;
            }
            if (comboBox_CongTruong.Text != String.Empty)
            {
                updated.MaCongTruong = (comboBox_CongTruong.SelectedItem as CongTruong).MaCongTruong;
            }
            if (comboBox_DatDa.Text != String.Empty)
            {
                updated.MaDatDa = (comboBox_DatDa.SelectedItem as DatDa).MaDatDa;
            }
            if (comboBox_MayKhoan.Text != String.Empty)
            {
                updated.MaMayKhoan = (comboBox_MayKhoan.SelectedItem as MayKhoan).MaMayKhoan;
            }
            if (comboBox_KipNo.Text != String.Empty)
            {
                updated.MaKipNo = (comboBox_KipNo.SelectedItem as KipNo).MaKipNo;
            }
            if (comboBox_ThuocNo.Text != String.Empty)
            {
                updated.MaThuocNo = (comboBox_ThuocNo.SelectedItem as ThuocNo).MaThuocNo;
            }
            if (comboBox_PhuongPhapNo.Text != String.Empty)
            {
                updated.MaPPNo = (comboBox_PhuongPhapNo.SelectedItem as PhuongPhapNo).MaPPNo;
            }
            if (comboBox_PhuKien.Text != String.Empty)
            {
                updated.MaPhuKien = (comboBox_PhuKien.SelectedItem as PhuKienNo).MaPhuKien;
            }
            if (comboBox_CapDo.Text != String.Empty)
            {
                updated.MaCapDo = (comboBox_CapDo.SelectedItem as CapDoNo).MaCapDo;
            }
            updated.HeSoKC       = double.Parse(textBoxHeSoKC.Text);
            updated.ChieuCaoTang = double.Parse(textBoxChieuCaoTang.Text);
            updated.QuyMoDotNo   = double.Parse(textBoxQuyMoDotNo.Text);
            updated.KichThuoc_X  = double.Parse(textBoxKichThuoc_X.Text);
            updated.KichThuoc_Y  = double.Parse(textBoxKichThuoc_Y.Text);
            try
            {
                BS_HoChieu.CapNhatHoChieu(updated);
            }
            catch (Exception exc)
            {
                MessageBox.Show("Lỗi - " + exc.Message);
            }
            ShowPanel(1);
            HienThiDuLieu_HoChieu();
        }
        private void controlDanhSachBanVe_Click(object sender, EventArgs e)
        {
            List <HoChieu> danhSachHoChieu = BS_HoChieu.DanhSachHoChieu();
            LinkLabel      value           = sender as LinkLabel;

            foreach (HoChieu a in danhSachHoChieu)
            {
                if (a.TenHoChieu.Equals(value.Text))
                {
                    MyGetData(a.MaHoChieu);
                    this.Close();
                }
            }
        }
        private void FormThongTinBanVe_Load(object sender, EventArgs e)
        {
            if (idHoChieu == null)
            {
                MessageBox.Show("Thông tin hộ chiếu chưa được lưu trong CSDL");
                this.Close();
                return;
            }
            BanVe value = BS_BanVe.BanVe(BS_HoChieu.HoChieu(idHoChieu).MaBanVe);

            labelValue_TenBanVe.Text     = value.TenBanVe;
            labelValue_Template.Text     = BS_Template.ChonTemplate(value.Template).TenTemplate;
            labelValue_NgayChinhSua.Text = value.NgayChinhSua;
            labelValue_SoLoKhoan.Text    = BS_LoKhoan.DanhSachLoKhoan(idHoChieu).Count.ToString();
        }
Ejemplo n.º 7
0
        private void LuuHoChieu(String idHoChieu)
        {
            List <LoKhoan> danhSachLoKhoan = new List <LoKhoan>();

            GetCirlcesFromAutocadFile();
            List <Circle> danhSachCircle = mgCircles.GetListCircles();

            foreach (Circle value in danhSachCircle)
            {
                danhSachLoKhoan.Add(new LoKhoan(idHoChieu, value));
            }
            BS_HoChieu.LuuBanVe(danhSachLoKhoan, idHoChieu);
            //BS_BanVe.CapNhatDelta(BS_HoChieu.HoChieu(idHoChieu).MaBanVe, this.banVeChinh.DeltaX, this.banVeChinh.DeltaY);
            BS_BanVe.CapNhatBanVe(banVeChinh);
            BS_LiteCAD.ShowNotifyAutoHide(elementHost1, BS_HoChieu.HoChieu(idHoChieu).TenHoChieu + " - đã lưu");
        }
        private void buttonDelete_Click(object sender, EventArgs e)
        {
            List <HoChieu> dsXoa = new List <HoChieu>();

            foreach (int value in gridViewMain.GetSelectedRows())
            {
                dsXoa.Add(gridViewMain.GetRow(value) as HoChieu);
            }
            try
            {
                BS_HoChieu.XoaHoChieu(dsXoa);
            }
            catch (Exception exc)
            {
                MessageBox.Show("Lỗi - " + exc.Message);
            }
            HienThiDuLieu_HoChieu();
        }
Ejemplo n.º 9
0
 public FormBaoCaoThongKe(HoChieu _HoChieu)
 {
     InitializeComponent();
     //add text control
     textLabel.Add(labelText);
     textLabel.Add(labelText3);
     textLabel.Add(label_GiaTri1);
     textLabel.Add(label_GiaTri2);
     textLabel.Add(label_GiaTri3);
     textLabel.Add(label_GiaTri4);
     textLabel.Add(label_GiaTri5);
     textLabel.Add(label_GiaTri6);
     textLabel.Add(label_GiaTri7);
     //add value control
     valueLabel.Add(labelValue_GiaTri1);
     valueLabel.Add(labelValue_GiaTri2);
     valueLabel.Add(labelValue_GiaTri3);
     valueLabel.Add(labelValue_GiaTri4);
     valueLabel.Add(labelValue_GiaTri5);
     valueLabel.Add(labelValue_GiaTri6);
     valueLabel.Add(labelValue_GiaTri7);
     //add combobox control
     valueComboBox.Add(comboBox_MaHoChieu);
     //add button control
     buttonGroup.Add(buttonTaoMoi);
     //UI
     this.BackColor   = Properties.Settings.Default.FormBackgroundColor;
     this.MinimizeBox = false;
     this.MaximizeBox = false;
     foreach (Button b in buttonGroup)
     {
         b.BackColor = Properties.Settings.Default.ButtonColor;
         b.FlatAppearance.BorderSize = 0;
     }
     foreach (Label l in textLabel)
     {
         l.ForeColor = Properties.Settings.Default.TextColor;
     }
     idHoChieu = _HoChieu.MaHoChieu;
     comboBox_MaHoChieu.DataSource    = BS_HoChieu.DanhSachHoChieu();
     comboBox_MaHoChieu.DisplayMember = "TenHoChieu";
     comboBox_MaHoChieu.Text          = _HoChieu.TenHoChieu;
 }
Ejemplo n.º 10
0
        private void loadFile_FormMoBanVeDatabase(String idHoChieu)
        {
            this.hoChieuChinh = BS_HoChieu.HoChieu(idHoChieu);
            this.banVeChinh   = BS_BanVe.BanVe(this.hoChieuChinh.MaBanVe);
            List <LoKhoan> danhSachLoKhoan = BS_LoKhoan.DanhSachLoKhoan(idHoChieu);
            List <Circle>  danhSachCircle  = new List <Circle>();

            mgCircles = new ManageCircle();
            //dựng bản vẽ mới
            //this.banVeChinh.HienKhoangCach = false;
            this.Text = "Bản vẽ: [" + this.banVeChinh.TenBanVe + "]";
            Lcad.DrwLoad(hDrw, BS_Template.ChonTemplate(this.banVeChinh.Template).DuongDan, this.Handle, hWnd);
            layerLoMin         = Lcad.DrwAddLayer(hDrw, "LoMin", "cyan", 0, Lcad.LC_LWEIGHT_DEFAULT);
            layerLuoiKichThuoc = Lcad.DrwAddLayer(hDrw, "LuoiKichThuoc", "foreground", 0, Lcad.LC_LWEIGHT_DEFAULT);
            int hBlockModel = Lcad.PropGetHandle(hDrw, Lcad.LC_PROP_DRW_BLOCK_MODEL);

            foreach (LoKhoan value in danhSachLoKhoan)
            {
                int hEntCircle = Lcad.BlockAddCircle(hBlockModel, value.ToaDoX, value.ToaDoY, value.BanKinh, false);
                Lcad.PropPutInt(hEntCircle, Lcad.LC_PROP_ENT_ID, int.Parse(value.MaLoKhoan));
                Lcad.PropPutInt(hEntCircle, Lcad.LC_PROP_ENT_KEY, keyCircle);
                Lcad.PropPutStr(hEntCircle, Lcad.LC_PROP_ENT_LAYER, "LoMin");
                danhSachCircle.Add(new Circle(hEntCircle));
            }
            mgCircles.AddListCircle(danhSachCircle);
            if (banVeChinh.HienKhoangCach)
            {
                Lcad.LayerClear(layerLuoiKichThuoc, hBlockModel);
                DungLuoiKichThuoc();
            }
            //vẽ lại hình
            Lcad.DrwRegenViews(hDrw, 0);
            Lcad.WndExeCommand(hWnd, Lcad.LC_CMD_ZOOM_EXT, 0);
            BS_LiteCAD.ShowNotifyAutoHide(elementHost1, this.banVeChinh.TenBanVe + " - đã mở");
            //mở form dựng lưới lỗ khoan
            if (mgCircles.GetListCircles().Count == 0)
            {
                FormXayDungLoKhoan fm = new FormXayDungLoKhoan();
                fm.MyGetData = new FormXayDungLoKhoan.GetData(loadFile_FormXayDungLoKhoan);
                fm.Show();
            }
        }
        private void FormMoBanVeDatabase_Load(object sender, EventArgs e)
        {
            t.Start();
            List <HoChieu> danhSachHoChieu = BS_HoChieu.DanhSachHoChieu();
            int            y = 0, i = 1;

            foreach (HoChieu value in danhSachHoChieu)
            {
                UserControl_BanVe controlBanVe = new UserControl_BanVe(value.TenHoChieu, BS_BanVe.BanVe(value.MaBanVe).NgayChinhSua, i);
                controlBanVe.Width    = panelMain.Width;
                controlBanVe.Location = new Point(0, y);
                controlDanhSachBanVe.Add(controlBanVe);
                panelMain.Controls.Add(controlBanVe);
                y += 30; i++;
            }
            foreach (UserControl_BanVe value in controlDanhSachBanVe)
            {
                value.LinkLabelBanVe.Click += new System.EventHandler(controlDanhSachBanVe_Click);
            }
        }
        private void buttonTaoMoi_Click(object sender, EventArgs e)
        {
            if (textBoxTenBanVe.Text.Equals(""))
            {
                MessageBox.Show("Chưa nhập tên hộ chiếu");
                return;
            }
            String idHoChieu = BS_HoChieu.TaoHoChieu(textBoxTenBanVe.Text);

            if (idHoChieu == null)
            {
                MessageBox.Show("Hộ chiếu đã có");
                return;
            }
            else
            {
                MyGetData(idHoChieu);
                this.Close();
            }
        }
Ejemplo n.º 13
0
 private void loadFile_FormBanVeMoi(String idHoChieu)
 {
     this.hoChieuChinh = BS_HoChieu.HoChieu(idHoChieu);
     this.banVeChinh   = BS_BanVe.BanVe(this.hoChieuChinh.MaBanVe);
     mgCircles         = new ManageCircle();
     //dựng bản vẽ mới
     this.Text = "Hộ chiếu: [" + this.hoChieuChinh.TenHoChieu + "]";
     Lcad.DrwLoad(hDrw, BS_Template.ChonTemplate(this.banVeChinh.Template).DuongDan, this.Handle, hWnd);
     layerLoMin         = Lcad.DrwAddLayer(hDrw, "LoMin", "cyan", 0, Lcad.LC_LWEIGHT_DEFAULT);
     layerLuoiKichThuoc = Lcad.DrwAddLayer(hDrw, "LuoiKichThuoc", "foreground", 0, Lcad.LC_LWEIGHT_DEFAULT);
     //vẽ lại hình
     Lcad.DrwRegenViews(hDrw, 0);
     Lcad.WndExeCommand(hWnd, Lcad.LC_CMD_ZOOM_EXT, 0);
     //mở form dựng lưới lỗ khoan
     if (mgCircles.GetListCircles().Count == 0)
     {
         FormXayDungLoKhoan fm = new FormXayDungLoKhoan();
         fm.MyGetData = new FormXayDungLoKhoan.GetData(loadFile_FormXayDungLoKhoan);
         fm.Show();
     }
 }
        private void HienThiDuLieu_HoChieu()
        {
            List <HoChieu> dsHoChieu = BS_HoChieu.DanhSachHoChieu();

            gridControlMain.DataSource = dsHoChieu;
            //panel insert + update
            comboBox_CongTruong.DataSource      = comboBox_CongTruong2.DataSource = BS_CongTruong.DanhSachCongTruong();
            comboBox_CongTruong.DisplayMember   = comboBox_CongTruong2.DisplayMember = "TenCongTruong";
            comboBox_DatDa.DataSource           = comboBox_DatDa2.DataSource = BS_DatDa.DanhSachDatDa();
            comboBox_DatDa.DisplayMember        = comboBox_DatDa2.DisplayMember = "TenDatDa";
            comboBox_MayKhoan.DataSource        = comboBox_MayKhoan2.DataSource = BS_MayKhoan.DanhSachMayKhoan();
            comboBox_MayKhoan.DisplayMember     = comboBox_MayKhoan2.DisplayMember = "TenMayKhoan";
            comboBox_KipNo.DataSource           = comboBox_KipNo2.DataSource = BS_KipNo.DanhSachKipNo();
            comboBox_KipNo.DisplayMember        = comboBox_KipNo2.DisplayMember = "TenKipNo";
            comboBox_ThuocNo.DataSource         = comboBox_ThuocNo2.DataSource = BS_ThuocNo.DanhSachThuocNo();
            comboBox_ThuocNo.DisplayMember      = comboBox_ThuocNo2.DisplayMember = "TenThuocNo";
            comboBox_PhuongPhapNo.DataSource    = comboBox_PhuongPhapNo2.DataSource = BS_PhuongPhapNo.DanhSachPPNo();
            comboBox_PhuongPhapNo.DisplayMember = comboBox_PhuongPhapNo2.DisplayMember = "TenPPNo";
            comboBox_PhuKien.DataSource         = comboBox_PhuKien2.DataSource = BS_PhuKienNo.DanhSachPhuKienNo();
            comboBox_PhuKien.DisplayMember      = comboBox_PhuKien2.DisplayMember = "TenPhuKien";
            comboBox_CapDo.DataSource           = comboBox_CapDo2.DataSource = BS_CapDoNo.DanhSachCapDoNo();
            comboBox_CapDo.DisplayMember        = comboBox_CapDo2.DisplayMember = "TenCapDo";
            textBoxNgayLap2.Text = DateTime.Now.ToString();
        }
 private void buttonExport_Click(object sender, EventArgs e)
 {
     BS_Main.ExcelExport <HoChieu>(BS_HoChieu.DanhSachHoChieu());
 }
 private void buttonPrint_Click(object sender, EventArgs e)
 {
     BS_Main.PrintData <HoChieu>(BS_HoChieu.DanhSachHoChieu());
 }
        private void buttonInsert_Click(object sender, EventArgs e)
        {
            HoChieu inserted = new HoChieu();

            if (textBoxMaHoChieu2.Text != String.Empty)
            {
                inserted.MaHoChieu = textBoxMaHoChieu2.Text;
            }
            if (textBoxTenHoChieu2.Text != String.Empty)
            {
                inserted.TenHoChieu = textBoxTenHoChieu2.Text;
            }
            inserted.NgayLap = DateTime.Now.ToString();
            if (comboBox_CongTruong2.Text != String.Empty)
            {
                inserted.MaCongTruong = (comboBox_CongTruong2.SelectedItem as CongTruong).MaCongTruong;
            }
            if (comboBox_DatDa2.Text != String.Empty)
            {
                inserted.MaDatDa = (comboBox_DatDa2.SelectedItem as DatDa).MaDatDa;
            }
            if (comboBox_MayKhoan2.Text != String.Empty)
            {
                inserted.MaMayKhoan = (comboBox_MayKhoan2.SelectedItem as MayKhoan).MaMayKhoan;
            }
            if (comboBox_KipNo2.Text != String.Empty)
            {
                inserted.MaKipNo = (comboBox_KipNo2.SelectedItem as KipNo).MaKipNo;
            }
            if (comboBox_ThuocNo2.Text != String.Empty)
            {
                inserted.MaThuocNo = (comboBox_ThuocNo2.SelectedItem as ThuocNo).MaThuocNo;
            }
            if (comboBox_PhuongPhapNo2.Text != String.Empty)
            {
                inserted.MaPPNo = (comboBox_PhuongPhapNo2.SelectedItem as PhuongPhapNo).MaPPNo;
            }
            if (comboBox_PhuKien2.Text != String.Empty)
            {
                inserted.MaPhuKien = (comboBox_PhuKien2.SelectedItem as PhuKienNo).MaPhuKien;
            }
            if (comboBox_CapDo2.Text != String.Empty)
            {
                inserted.MaCapDo = (comboBox_CapDo2.SelectedItem as CapDoNo).MaCapDo;
            }
            inserted.HeSoKC       = double.Parse(textBoxHeSoKC2.Text);
            inserted.ChieuCaoTang = double.Parse(textBoxChieuCaoTang2.Text);
            inserted.QuyMoDotNo   = double.Parse(textBoxQuyMoDotNo2.Text);
            inserted.KichThuoc_X  = double.Parse(textBoxKichThuoc_X2.Text);
            inserted.KichThuoc_Y  = double.Parse(textBoxKichThuoc_Y2.Text);
            try
            {
                BS_HoChieu.ThemHoChieu(inserted);
            }
            catch (Exception exc)
            {
                MessageBox.Show("Lỗi - " + exc.Message);
            }
            ShowPanel(1);
            HienThiDuLieu_HoChieu();
        }
        private void FormStart_Load(object sender, EventArgs e)
        {
            List <Template> danhSachTemplate = BS_Template.DanhSachTemplate();
            int             i = 1, x = 10, y = 10;

            foreach (Template value in danhSachTemplate)
            {
                RadioButton rbt = new RadioButton();
                rbt.Name       = value.ID;
                rbt.Location   = new Point(x, y);
                rbt.Appearance = System.Windows.Forms.Appearance.Button;
                rbt.Size       = new Size(160, 90);
                rbt.FlatStyle  = FlatStyle.Flat;
                rbt.FlatAppearance.BorderSize = 3;
                rbt.BackgroundImageLayout     = ImageLayout.Stretch;
                rbt.Text      = value.TenTemplate;
                rbt.ForeColor = Properties.Settings.Default.FormBackgroundColor;
                rbt.TextAlign = ContentAlignment.TopLeft;
                rbt.Cursor    = Cursors.Hand;
                if (!value.AnhMau.Equals(""))
                {
                    rbt.BackgroundImage = Image.FromFile(value.AnhMau);
                }
                radioButtonTemplate.Add(rbt);
                panelMain.Controls.Add(rbt);
                if (i % 2 == 0)
                {
                    x = 10; y = y + 100;
                }
                else
                {
                    x = x + 170;
                }
                i++;
            }
            foreach (RadioButton rb in radioButtonTemplate)
            {
                rb.FlatAppearance.BorderSize = 2;
                rb.CheckedChanged           += new System.EventHandler(radioButtonTempGroups_CheckedChanged);
            }

            danhSachHoChieu = BS_HoChieu.DanhSachHoChieuGanNhat(5);
            i = 0;
            foreach (HyperlinkLabelControl value in duongDanHoChieu)
            {
                if (danhSachHoChieu.Count > i)
                {
                    value.Text   = danhSachHoChieu[i].TenHoChieu;
                    value.Click += new System.EventHandler(link_Click);
                    i++;
                }
            }
            i = 0;
            foreach (Label value in ngayBanVe)
            {
                if (danhSachHoChieu.Count > i)
                {
                    value.Text = BS_BanVe.BanVe(danhSachHoChieu[i].MaBanVe).NgayChinhSua;
                    i++;
                }
                this.Refresh();
            }
        }