Esempio n. 1
0
        private void btnTinhThu_DongCuonMoPhang_Click(object sender, EventArgs e)
        {
            var idHangKH         = int.Parse(cboHangKH.SelectedValue.ToString());
            var thongTinBanDauMP = new ThongTinBanDauDongCuon();

            thongTinBanDauMP.MoTextSoLuongCuon = true;
            thongTinBanDauMP.TinhTrangForm     = FormStateS.View;
            thongTinBanDauMP.TieuDeForm        = "Đóng cuốn Mở phẳng [Tính thử]";
            //Tạo mục đóng cuốn
            var mucDongCuonMP = new MucDongCuonMoPhang();

            mucDongCuonMP.IdBaiIn         = 1;
            mucDongCuonMP.IdHangKhachHang = this.IdHangKhachHang;
            mucDongCuonMP.SoLuong         = 1; //Vì số lượng có thể không trùng
            mucDongCuonMP.DonViTinh       = "cuốn";
            mucDongCuonMP.SoToDoi         = 10;
            mucDongCuonMP.LoaiThanhPham   = LoaiThanhPhamS.DongCuon;
            mucDongCuonMP.KieuDongCuon    = KieuDongCuonS.MoPhang;
            var frm = new ThPhDongCuonMoPhangForm(thongTinBanDauMP, mucDongCuonMP);

            frm.MinimizeBox   = false;
            frm.MaximizeBox   = false;
            frm.StartPosition = FormStartPosition.CenterParent;
            //Data gởi qua form
            frm.ShowDialog();
        }
 public ThPhDongCuonMoPhangPresenter(IViewThPhDongCuonMoPhang view, MucDongCuonMoPhang mucThPham)
 {
     View             = view;
     View             = view;
     this.MucDongCuon = mucThPham;
     //Cập nhật form
     View.ID              = mucThPham.ID;
     View.IdBaiIn         = mucThPham.IdBaiIn;
     View.IdHangKhachHang = mucThPham.IdHangKhachHang;
     View.IdThanhPhamChon = mucThPham.IdThanhPhamChon;
     View.LoaiThPh        = mucThPham.LoaiThanhPham;
     View.KieuDongCuon    = mucThPham.KieuDongCuon;
     View.SoLuong         = mucThPham.SoLuong;
     View.DonViTinh       = mucThPham.DonViTinh;
     View.IdToLotChon     = mucThPham.IdToLotChon;
     View.SoToDoi         = mucThPham.SoToDoi;
 }
        public ThPhDongCuonMoPhangForm(ThongTinBanDauDongCuon thongTinBanDau, MucDongCuonMoPhang mucThPhamDongCuon)
        {
            InitializeComponent();

            this.ThongTinHoTro = thongTinBanDau.ThongDiepCanThiet;

            this.TinhTrangForm = thongTinBanDau.TinhTrangForm;
            this.Text          = thongTinBanDau.TieuDeForm;
            txtSoLuong.Enabled = thongTinBanDau.MoTextSoLuongCuon;


            thPhMoPhangPres = new ThPhDongCuonMoPhangPresenter(this, mucThPhamDongCuon);
            LoadDongCuon();
            cboMayDong.SelectedIndex = -1;
            cboMayDong.SelectedIndex = 0;
            //Load Nhu ep
            LoadToLot();

            //Load

            //Mục này phải làm ở đây
            if (this.TinhTrangForm == FormStateS.Edit ||
                this.IdThanhPhamChon > 0)
            {
                this.IdThanhPhamChon = mucThPhamDongCuon.IdThanhPhamChon;

                this.IdToLotChon = mucThPhamDongCuon.IdToLotChon;
            }
            //Envent

            txtSoLuong.TextChanged += new EventHandler(TextBoxes_TextChanged);
            txtSoToDoi.TextChanged += new EventHandler(TextBoxes_TextChanged);

            txtSoLuong.Leave += new EventHandler(TextBoxes_Leave);
            txtSoToDoi.Leave += new EventHandler(TextBoxes_Leave);

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


            lstToLot.SelectedItemChanged += new EventHandler(ListView_SelectedItemChanged);

            cboMayDong.SelectedIndexChanged += new Telerik.WinControls.UI.Data.PositionChangedEventHandler(DropDownList_SelectedIndexChanged);
        }
Esempio n. 4
0
        private void ThemDongCuon()
        {///Hiện tại Id chọn các dịch vụ đóng cuốn là Id của MonDongCuon
         ///Lấy được món đóng cuốn

            var monDongCuon = inSachPres.DocMonDongCuonTheoID();

            switch (monDongCuon.KieuDongCuon) //Thiết lập chỉ 2 loại keo và lò xo
            {
            case KieuDongCuonS.KimKeoNep:
                //Điều chỉnh thông tin ban đầu
                var thongTinBanDauCuonKeo = ThongTinBanDauCuonKeo();
                thongTinBanDauCuonKeo.TinhTrangForm = FormStateS.New;
                thongTinBanDauCuonKeo.TieuDeForm    = "[Mới] Đóng cuốn";

                //tạo mục thành phẩm đóng cuốn
                var mucThPhamDongCuon = new MucDongCuon();
                mucThPhamDongCuon.IdBaiIn         = this.ID;
                mucThPhamDongCuon.IdHangKhachHang = this.IdHangKhachHang;
                mucThPhamDongCuon.IdThanhPhamChon = inSachPres.DocMonDongCuonTheoID().IdGoc;
                mucThPhamDongCuon.LoaiThanhPham   = LoaiThanhPhamS.DongCuon;
                mucThPhamDongCuon.KieuDongCuon    = KieuDongCuonS.KimKeoNep;
                mucThPhamDongCuon.SoLuong         = this.SoCuon;
                mucThPhamDongCuon.DonViTinh       = "cuốn";

                var frm1 = new ThPhDongCuonForm(thongTinBanDauCuonKeo, mucThPhamDongCuon);

                frm1.MinimizeBox   = false;
                frm1.MaximizeBox   = false;
                frm1.StartPosition = FormStartPosition.CenterParent;
                //Data gởi qua ỏm

                frm1.ShowDialog();
                if (frm1.DialogResult == System.Windows.Forms.DialogResult.OK)
                {
                    XuLyNutOKClick_FormDongCuon(frm1);
                    //MessageBox.Show(this.CauHinhSanPhamS.Count().ToString());

                    //Cap nhat noi dung đóng cuốn
                    CapNhatChiTietDongCuon();
                }
                break;

            case KieuDongCuonS.LoXo:

                var mucDongCuon = new MucDongCuonLoXo();
                mucDongCuon.IdBaiIn         = this.ID;
                mucDongCuon.IdHangKhachHang = this.IdHangKhachHang;
                mucDongCuon.SoLuong         = this.SoCuon; //Vì số lượng có thể không trùng
                mucDongCuon.DonViTinh       = "cuốn";
                mucDongCuon.GayCao          = this.SachCao;
                mucDongCuon.GayDay          = this.GayDay;
                mucDongCuon.LoaiThanhPham   = LoaiThanhPhamS.DongCuon;
                //Tiếp tục thông tin ban đầu
                var thongTinBanDauCuonLoXo = this.ThongTinBanDauCuonLoXo();
                thongTinBanDauCuonLoXo.TieuDeForm    = "[Mới] Cuốn Lò xo";
                thongTinBanDauCuonLoXo.TinhTrangForm = FormStateS.New;
                //điều chỉnh mục thành phẩm
                mucDongCuon.KieuDongCuon = KieuDongCuonS.LoXo;
                var frm2 = new ThPhDongCuonLoXoForm(thongTinBanDauCuonLoXo, mucDongCuon);

                frm2.MinimizeBox   = false;
                frm2.MaximizeBox   = false;
                frm2.StartPosition = FormStartPosition.CenterParent;
                frm2.ShowDialog();
                if (frm2.DialogResult == System.Windows.Forms.DialogResult.OK)
                {
                    XuLyNutOKClick_FormDongCuonLoXo(frm2);
                    //MessageBox.Show(this.CauHinhSanPhamS.Count().ToString());
                    CapNhatChiTietDongCuon();
                }
                break;

            case KieuDongCuonS.MoPhang:

                var mucDongCuonMP = new MucDongCuonMoPhang();
                mucDongCuonMP.IdBaiIn         = this.ID;
                mucDongCuonMP.IdHangKhachHang = this.IdHangKhachHang;
                mucDongCuonMP.SoLuong         = this.SoCuon; //Vì số lượng có thể không trùng
                mucDongCuonMP.DonViTinh       = "cuốn";
                mucDongCuonMP.SoToDoi         = this.SoTrangRuot / 2;
                mucDongCuonMP.LoaiThanhPham   = LoaiThanhPhamS.DongCuon;
                //Tiếp tục thông tin ban đầu
                var thongTinBanDauCuonMP = this.ThongTinBanDauCuonMoPhang();
                thongTinBanDauCuonMP.TieuDeForm    = "[Mới] Cuốn Mở phẳng";
                thongTinBanDauCuonMP.TinhTrangForm = FormStateS.New;
                //điều chỉnh mục thành phẩm
                mucDongCuonMP.KieuDongCuon = KieuDongCuonS.MoPhang;
                var frm3 = new ThPhDongCuonMoPhangForm(thongTinBanDauCuonMP, mucDongCuonMP);

                frm3.MinimizeBox   = false;
                frm3.MaximizeBox   = false;
                frm3.StartPosition = FormStartPosition.CenterParent;
                frm3.ShowDialog();
                if (frm3.DialogResult == System.Windows.Forms.DialogResult.OK)
                {
                    XuLyNutOKClick_FormDongCuonMoPhang(frm3);
                    //MessageBox.Show(this.CauHinhSanPhamS.Count().ToString());
                    CapNhatChiTietDongCuon();
                }
                break;
            }
        }