public ThPhCanGapForm(ThongTinBanDauThanhPham thongTinBanDau, MucThPhCanGap mucThPham)
        {
            InitializeComponent();

            this.ThongTinHoTro = thongTinBanDau.ThongDiepCanThiet;
            this.TinhTrangForm = thongTinBanDau.TinhTrangForm;
            this.Text          = thongTinBanDau.TieuDeForm;


            canGapPres = new ThPhCanGapPresenter(this, mucThPham);
            LoadThanhPham();
            //Bẩy
            lbxThanhPham.SelectedIndex = -1;
            lbxThanhPham.SelectedIndex = 0;
            //Xử lý ở đây vì trong present không thể
            if (this.TinhTrangForm == FormStateS.Edit)
            {
                this.IdThanhPhamChon = mucThPham.IdThanhPhamChon;
            }

            if (this.TinhTrangForm == FormStateS.New)
            {
                canGapPres.KhoiTaoBanDau();
            }
            //Envent
            txtSoLuong.TextChanged            += new EventHandler(TextBoxes_TextChanged);
            txtSoDuongCan.TextChanged         += new EventHandler(TextBoxes_TextChanged);
            lbxThanhPham.SelectedIndexChanged += new EventHandler(ListBoxes_SelectedIndex_Changed);

            txtSoLuong.KeyPress    += new KeyPressEventHandler(InputValidator);
            txtSoDuongCan.KeyPress += new KeyPressEventHandler(InputValidator);

            txtSoLuong.Leave    += new EventHandler(TextBoxes_Leave);
            txtSoDuongCan.Leave += new EventHandler(TextBoxes_Leave);
        }
        public ThPhCanGapPresenter(IViewGiaCanGap view, MucThPhCanGap mucThPham)
        {
            this.MucCanGap = mucThPham;

            View = view;


            View.ID              = this.MucCanGap.ID;
            View.IdBaiIn         = this.MucCanGap.IdBaiIn;
            View.IdHangKhachHang = this.MucCanGap.IdHangKhachHang;
            View.IdThanhPhamChon = this.MucCanGap.IdThanhPhamChon;
            View.LoaiThPh        = this.MucCanGap.LoaiThanhPham;
            View.SoLuong         = this.MucCanGap.SoLuong;
            View.DonViTinh       = "con";
            View.SoDuongCan      = this.MucCanGap.SoDuongCan;
        }
Exemple #3
0
        private void btnTinhThu_CanGap_Click(object sender, EventArgs e)
        {
            var idHangKH       = int.Parse(cboHangKH.SelectedValue.ToString());
            var thongTinBanDau = this.thongTinBanDauChoThPh(idHangKH, LoaiThanhPhamS.CanGap,
                                                            FormStateS.View, "Cấn gấp [Tính thử]", "con");
            //Mục thành phẩm cấn gấp
            var mucThPhCanGap = new MucThPhCanGap();

            mucThPhCanGap.IdBaiIn         = 1;
            mucThPhCanGap.IdHangKhachHang = this.IdHangKhachHang;
            mucThPhCanGap.LoaiThanhPham   = LoaiThanhPhamS.CanGap;
            mucThPhCanGap.SoLuong         = 10;
            mucThPhCanGap.DonViTinh       = "con";
            mucThPhCanGap.SoDuongCan      = 1;

            var frm = new ThPhCanGapForm(thongTinBanDau, mucThPhCanGap);

            frm.MinimizeBox   = false;
            frm.MaximizeBox   = false;
            frm.StartPosition = FormStartPosition.CenterParent;
            frm.ShowDialog();
        }