Esempio n. 1
0
        public CauHinhSPForm(ThongTinBanDauChoCauHinhSP thongTinBanDau, CauHinhSanPham cauHinhSP)
        {
            InitializeComponent();

            this.TinhTrangForm = thongTinBanDau.TinhTrangForm;
            this.SoLuong       = thongTinBanDau.SoLuongSanPham;
            this.DonViTinh     = thongTinBanDau.DonViTinh;
            this.ThongTinBaiIn = thongTinBanDau.YeuCauBaiIn;

            cauHinhSanPhamPres = new CauHinhSanPhamPresenter(this, cauHinhSP);

            if (this.PhuongPhapIn != PhuongPhapInS.KhongIn)
            {
                LoadDanhSachToChay();
                if (this.TinhTrangForm == FormStateS.Edit)
                {
                    //Phải chọn tờ in lúc này
                    this.IdToInChon = cauHinhSP.IdMayIn;
                }
            }
            //Nếu là sửa


            //Các events
            rdbToner.CheckedChanged   += new EventHandler(RadioButtons_CheckedChanged);
            rdbKhongIn.CheckedChanged += new EventHandler(RadioButtons_CheckedChanged);

            txtKhoCatRong.TextChanged  += new EventHandler(TextBoxes_TextChanged);
            txtKhoCatCao.TextChanged   += new EventHandler(TextBoxes_TextChanged);
            txtLeTren.TextChanged      += new EventHandler(TextBoxes_TextChanged);
            txtLeDuoi.TextChanged      += new EventHandler(TextBoxes_TextChanged);
            txtLeTrong.TextChanged     += new EventHandler(TextBoxes_TextChanged);
            txtLeNgoai.TextChanged     += new EventHandler(TextBoxes_TextChanged);
            txtTranLeTren.TextChanged  += new EventHandler(TextBoxes_TextChanged);
            txtTranLeDuoi.TextChanged  += new EventHandler(TextBoxes_TextChanged);
            txtTranLeTrong.TextChanged += new EventHandler(TextBoxes_TextChanged);
            txtTranLeNgoai.TextChanged += new EventHandler(TextBoxes_TextChanged);

            txtKhoCatRong.KeyPress  += new KeyPressEventHandler(InputValidator);
            txtKhoCatCao.KeyPress   += new KeyPressEventHandler(InputValidator);
            txtLeTren.KeyPress      += new KeyPressEventHandler(InputValidator);
            txtLeDuoi.KeyPress      += new KeyPressEventHandler(InputValidator);
            txtLeTrong.KeyPress     += new KeyPressEventHandler(InputValidator);
            txtLeNgoai.KeyPress     += new KeyPressEventHandler(InputValidator);
            txtTranLeTren.KeyPress  += new KeyPressEventHandler(InputValidator);
            txtTranLeDuoi.KeyPress  += new KeyPressEventHandler(InputValidator);
            txtTranLeTrong.KeyPress += new KeyPressEventHandler(InputValidator);
            txtTranLeNgoai.KeyPress += new KeyPressEventHandler(InputValidator);
        }
        private void XuLyNutOKTrenFormTrienKhaiSP_Click(TrienKhaiSanPhamForm frm)
        {
            switch (frm.formState)
            {
            case (int)Ennums.FormState.New:
                //Add
                tinhGiaPres.ThemCauHinhSanPham(new CauHinhSanPham(new KhoSanPham
                {
                    KhoCatRong = frm.KhoCatRong,
                    KhoCatCao  = frm.KhoCatCao
                },
                                                                  frm.TranLeTren,
                                                                  frm.TranLeDuoi,
                                                                  frm.TranLeTrong,
                                                                  frm.TranLeNgoai,
                                                                  frm.LeTren,
                                                                  frm.LeDuoi,
                                                                  frm.LeTrong,
                                                                  frm.LeNgoai,
                                                                  frm.IdBaiIn));
                break;

            case (int)Ennums.FormState.Edit:
                //Tạo SP mới
                var tmpCauHinhSP = new CauHinhSanPham(new KhoSanPham
                {
                    KhoCatRong = frm.KhoCatRong,
                    KhoCatCao  = frm.KhoCatCao
                },
                                                      frm.TranLeTren,
                                                      frm.TranLeDuoi,
                                                      frm.TranLeTrong,
                                                      frm.TranLeNgoai,
                                                      frm.LeTren,
                                                      frm.LeDuoi,
                                                      frm.LeTrong,
                                                      frm.LeNgoai,
                                                      frm.IdBaiIn);
                //Đổi ID vì thêm mới là có id mới
                tmpCauHinhSP.IDCauHinh = frm.IdCauHinhSP;
                //Cập nhật lại
                tinhGiaPres.CapNhatCauHinhSanPham(tmpCauHinhSP);
                break;
            }
        }
        public void CapNhatCHSPVoBaiIn(CauHinhSanPham cauHinhSP)
        {
            var item = this.DocBaiInTheoId(View.IdBaiInChon).CauHinhSP;

            if (item != null)
            {
                item.IDCauHinh        = cauHinhSP.IDCauHinh;
                item.KhoSP.KhoCatRong = cauHinhSP.KhoSP.KhoCatRong;
                item.KhoSP.KhoCatCao  = cauHinhSP.KhoSP.KhoCatCao;
                item.TranLeTren       = cauHinhSP.TranLeTren;
                item.TranLeDuoi       = cauHinhSP.TranLeDuoi;
                item.TranLeTrong      = cauHinhSP.TranLeTrong;
                item.TranLeNgoai      = cauHinhSP.TranLeNgoai;
                item.LeTren           = cauHinhSP.LeTren;
                item.LeDuoi           = cauHinhSP.LeDuoi;
                item.LeTrong          = cauHinhSP.LeTrong;
                item.LeNgoai          = cauHinhSP.LeNgoai;
                item.IdBaiIn          = cauHinhSP.IdBaiIn;
            }
        }
        public void CapNhatCauHinhSanPham(CauHinhSanPham cauHinhSP)
        {
            var item = View.CauHinhSanPhamS.Find(x => x.IDCauHinh == cauHinhSP.IDCauHinh);

            if (item != null)
            {
                item.IDCauHinh        = cauHinhSP.IDCauHinh;
                item.KhoSP.KhoCatRong = cauHinhSP.KhoSP.KhoCatRong;
                item.KhoSP.KhoCatCao  = cauHinhSP.KhoSP.KhoCatCao;
                item.TranLeTren       = cauHinhSP.TranLeTren;
                item.TranLeDuoi       = cauHinhSP.TranLeDuoi;
                item.TranLeTrong      = cauHinhSP.TranLeTrong;
                item.TranLeNgoai      = cauHinhSP.TranLeNgoai;
                item.LeTren           = cauHinhSP.LeTren;
                item.LeDuoi           = cauHinhSP.LeDuoi;
                item.LeTrong          = cauHinhSP.LeTrong;
                item.LeNgoai          = cauHinhSP.LeNgoai;
                item.IdBaiIn          = cauHinhSP.IdBaiIn;
            }
        }
        private void XuLyNutOKTrenFormChuanBiGiay_Click(ChuanBiGiayForm frm)
        {
            switch (frm.FormState)
            {
            case (int)Ennums.FormState.New:
                //Add
                var gDeInE = new GiayDeIn(frm.GiayChon);
                gDeInE.TenGiayIn             = frm.TenGiayIn;
                gDeInE.IdBaiIn               = frm.IdBaiIn;
                gDeInE.KhoToChay             = frm.KhoToChay;
                gDeInE.SoLuongToChayLyThuyet = frm.SoLuongToChayLyThuyet;
                gDeInE.SoLuongToChayBuHao    = frm.SoLuongToChayBuHao;
                gDeInE.SoLuongToLonCan       = frm.SoToGiayLon;



                break;

            case (int)Ennums.FormState.Edit:
                //Tạo
                var gDeInE = new CauHinhSanPham(new KhoSanPham
                {
                    KhoCatRong = frm.KhoCatRong,
                    KhoCatCao  = frm.KhoCatCao
                },
                                                frm.TranLeTren,
                                                frm.TranLeDuoi,
                                                frm.TranLeTrong,
                                                frm.TranLeNgoai,
                                                frm.LeTren,
                                                frm.LeDuoi,
                                                frm.LeTrong,
                                                frm.LeNgoai,
                                                frm.IdBaiIn);
                //Đổi ID vì thêm mới là có id mới
                tmpCauHinhSP.IDCauHinh = frm.IdCauHinhSP;
                //Cập nhật lại
                tinhGiaPres.CapNhatCauHinhSanPham(tmpCauHinhSP);
                break;
            }
        }
Esempio n. 6
0
        public void CapNhatCHSPVoBaiIn(CauHinhSanPham cauHinhSP)
        {
            var item = baiIn.CauHinhSP;

            if (item != null)
            {
                item.IDCauHinh        = cauHinhSP.IDCauHinh;
                item.KhoSP.KhoCatRong = cauHinhSP.KhoSP.KhoCatRong;
                item.KhoSP.KhoCatCao  = cauHinhSP.KhoSP.KhoCatCao;
                item.TranLeTren       = cauHinhSP.TranLeTren;
                item.TranLeDuoi       = cauHinhSP.TranLeDuoi;
                item.TranLeTrong      = cauHinhSP.TranLeTrong;
                item.TranLeNgoai      = cauHinhSP.TranLeNgoai;
                item.LeTren           = cauHinhSP.LeTren;
                item.LeDuoi           = cauHinhSP.LeDuoi;
                item.LeTrong          = cauHinhSP.LeTrong;
                item.LeNgoai          = cauHinhSP.LeNgoai;
                item.IdBaiIn          = cauHinhSP.IdBaiIn;
                item.IdMayIn          = cauHinhSP.IdMayIn;
                item.PhuongPhapIn     = cauHinhSP.PhuongPhapIn;
            }
        }
        public CauHinhSanPhamPresenter(IViewCauHinhSanPham view, CauHinhSanPham cauHinhSP)
        {
            View         = view;
            this.CauHinh = cauHinhSP;

            View.IdCauHinhSP  = this.CauHinh.IDCauHinh;
            View.IdBaiIn      = this.CauHinh.IdBaiIn;
            View.KhoCatRong   = this.CauHinh.KhoCatRong;
            View.KhoCatCao    = this.CauHinh.KhoCatCao;
            View.TranLeTren   = this.CauHinh.TranLeTren;
            View.TranLeDuoi   = this.CauHinh.TranLeDuoi;
            View.TranLeTrong  = this.CauHinh.TranLeTrong;
            View.TranLeNgoai  = this.CauHinh.TranLeNgoai;
            View.LeTren       = this.CauHinh.LeTren;
            View.LeDuoi       = this.CauHinh.LeDuoi;
            View.LeTrong      = this.CauHinh.LeTrong;
            View.LeNgoai      = this.CauHinh.LeNgoai;
            View.PhuongPhapIn = this.CauHinh.PhuongPhapIn;
            View.IdToInChon   = this.CauHinh.IdMayIn;

            //this.SoLuong = cauHinhSP.SoLuong;
        }
Esempio n. 8
0
 public void GanCHSPVoBaiIn(CauHinhSanPham cauHinhSP)
 {
     baiIn.CauHinhSP = cauHinhSP;
 }
 public void GanCHSPVoBaiIn(CauHinhSanPham cauHinhSP)
 {
     tinhGiaIn.DocBaiInTheoID(View.IdBaiInChon).CauHinhSP = cauHinhSP;
 }