コード例 #1
0
ファイル: TinhThuForm.cs プロジェクト: DzungHg/TinhGiaDigi2
        private void btnGiaGiayIn_Click(object sender, EventArgs e)
        {
            if (frmGiayDeIn == null)
            {
                //Thông tin ban đầu
                var kichThuocSP = new KichThuocPhang
                {
                    Rong = 32,
                    Dai  = 22
                };
                var thongTinBanDau = new ThongTinBanDauChoGiayIn();
                thongTinBanDau.IdHangKhachHang  = this.IdHangKhachHang;
                thongTinBanDau.TinhTrangForm    = FormStateS.TinhThu;
                thongTinBanDau.KichThuocSanPham = kichThuocSP;
                thongTinBanDau.DonViTinhSanPham = "Tờ";
                thongTinBanDau.SoLuongSanPham   = 10;
                thongTinBanDau.ThongTinCanThiet = string.Format("Khổ SP A4: {0} x {1}cm",
                                                                kichThuocSP.Rong, kichThuocSP.Dai);

                //Giây de in
                GiayDeIn giayDeIn = new GiayDeIn(32, 47, 2, 1, 0, 0, false,
                                                 0, "", 1, 5, 1, 0);
                frmGiayDeIn               = new GiayDeInForm(thongTinBanDau, giayDeIn);
                frmGiayDeIn.FormClosed   += new FormClosedEventHandler(ByByWindows);
                frmGiayDeIn.Text          = "Tính thử " + cboHangKH.Text;
                frmGiayDeIn.MinimizeBox   = false;
                frmGiayDeIn.MaximizeBox   = false;
                frmGiayDeIn.StartPosition = FormStartPosition.CenterParent;
                frmGiayDeIn.Show();
            }
            else
            {
                frmGiayDeIn.Focus();
            }
        }
コード例 #2
0
        private void lvwGiay_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (lvwGiay.SelectedItems.Count <= 0)
            {
                _giayChon           = null;
                lblChonGiay.Text    = "";
                lblTriGia.Text      = "";
                lblGiaBanChoKH.Text = "";
                txtKhoToChay.Text   = "";
                return;
            }
            int _tmpIdGiay = 0;

            int.TryParse(lvwGiay.SelectedItems[0].Text, out _tmpIdGiay);
            _giayChon           = Giay.LayGiayTheoId(_tmpIdGiay);
            lblChonGiay.Text    = this.GiayChon.TenGiay;
            lblGiaMua.Text      = string.Format("{0}đ/tờ", this.GiayChon.GiaMua);
            txtTenDienGiai.Text = lblChonGiay.Text;
            txtKhoToChay.Text   = _giayChon.KhoGiay;
            var giayDeIn = new GiayDeIn(_giayChon, 1);//Chú ý phải đổi markup theo KH

            lblGiaBanChoKH.Text = string.Format("{0}đ/tờ", giayDeIn.GiaBan);
            //this.ThanhTien = giayDeIn.ThanhTien;
            lblTriGia.Text = string.Format("{0}đ/tờ", giayDeIn.ThanhTien);
        }
コード例 #3
0
        private void XuLyNutOKTrenFormChuanBiGiay_Click(GiayDeInForm frm)
        {
            var gDeIn = new GiayDeIn();

            gDeIn.GiayChon              = frm.GiayChon;
            gDeIn.TenGiayIn             = frm.TenGiayIn;
            gDeIn.GiayKhachDua          = frm.GiayKhachDua;
            gDeIn.IdBaiIn               = frm.IdBaiIn;
            gDeIn.KhoToChay             = frm.KhoToChay;
            gDeIn.SoConTrenToChay       = frm.SoConTrenToChay;
            gDeIn.SoLuongToChayLyThuyet = frm.SoLuongToChayLyThuyet;
            gDeIn.SoLuongToChayBuHao    = frm.SoLuongToChayBuHao;
            gDeIn.SoToChayTong          = frm.SoLuongToChayTong;
            gDeIn.SoLuongToLonCan       = frm.SoToGiayLon;
            gDeIn.GiaBan    = frm.GiaBan;
            gDeIn.ThanhTien = frm.ThanhTien;
            switch (frm.FormState)
            {
            case (int)Enumss.FormState.New:
                //Add
                tinhGiaPres.GanGiayDeIn(gDeIn);
                this.TomTatGiayDeIn = tinhGiaPres.TomTatGiayDeIn();
                break;

            case (int)Enumss.FormState.Edit:
                //Đổi ID vì thêm mới là có id mới
                gDeIn.ID = frm.ID;
                //Cập nhật lại
                tinhGiaPres.CapNhatGiayDeIn(gDeIn);
                this.TomTatGiayDeIn = tinhGiaPres.TomTatGiayDeIn();
                break;
            }
        }
コード例 #4
0
        private void XuLyNutOKTrenFormChuanBiGiay_Click(ChuanBiGiayForm frm)
        {
            switch (frm.FormState)
            {
            case (int)Ennums.FormState.New:
                //Add
                var gDeIn = new GiayDeIn(frm.GiayChon, 0);
                gDeIn.TenGiayIn             = frm.TenGiayIn;
                gDeIn.IdBaiIn               = frm.IdBaiIn;
                gDeIn.KhoToChay             = frm.KhoToChay;
                gDeIn.SoLuongToChayLyThuyet = frm.SoLuongToChayLyThuyet;
                gDeIn.SoLuongToChayBuHao    = frm.SoLuongToChayBuHao;
                gDeIn.SoLuongToLonCan       = frm.SoToGiayLon;
                tinhGiaPres.ThemGiayIn(gDeIn);


                break;

            case (int)Ennums.FormState.Edit:
                //Tạo
                var gDeInE = new GiayDeIn(frm.GiayChon, 0);

                gDeInE.TenGiayIn             = frm.TenGiayIn;
                gDeInE.IdBaiIn               = frm.IdBaiIn;
                gDeInE.KhoToChay             = frm.KhoToChay;
                gDeInE.SoLuongToChayLyThuyet = frm.SoLuongToChayLyThuyet;
                gDeInE.SoLuongToChayBuHao    = frm.SoLuongToChayBuHao;
                gDeInE.SoLuongToLonCan       = frm.SoToGiayLon;
                //Đổi ID vì thêm mới là có id mới
                gDeInE.ID = frm.ID;
                //Cập nhật lại
                tinhGiaPres.CapNhatGiayDeIn(gDeInE);
                break;
            }
        }
コード例 #5
0
        public void ThemGiayIn(GiayDeIn giayDeIn)
        {
            var tmpCauHinh = View.GiayDeInS.Where(x => x.ID == giayDeIn.ID).SingleOrDefault();

            if (tmpCauHinh == null)
            {
                View.GiayDeInS.Add(giayDeIn);
                //Trỏ tham chiếu đến
                View.BaiInS.Find(x => x.ID == giayDeIn.IdBaiIn).GiayDeInIn = giayDeIn;
            }
        }
コード例 #6
0
        public GiayInDanhThiepForm(ThongTinBanDauChoGiayInDanhThiep thongTinBanDau, GiayDeIn giayDeIn)
        {
            InitializeComponent();
            this.TinhTrangForm         = thongTinBanDau.TinhTrangForm;
            this.ThongTinBaiIn_CauHinh = thongTinBanDau.ThongTinCanThiet;
            this.SoLuongHop            = thongTinBanDau.SoLuongSanPham;
            this.SoDanhThiepTrenHop    = thongTinBanDau.SoDanhThiepTrenHop;
            this.IdHangKH           = thongTinBanDau.IdHangKhachHang;
            this.PhuongPhapIn       = thongTinBanDau.PhuongPhapIn;
            this.KichThuocDanhThiep = thongTinBanDau.KichThuocSanPham;

            /*if (thongTinBanDau.LaInDanhThiep) //bắt nút tính số con
             *  btnTinhSoConTrenToChay.Enabled = false;
             * else
             *  btnTinhSoConTrenToChay.Enabled = true;
             */

            giayDeInPres = new GiayInDanhThiepPresenter(this, giayDeIn);

            //cập nhật khổ in đỡ


            //event
            txtSoToChayBuHao.KeyPress     += new KeyPressEventHandler(InputValidator);
            txtSoToChayTrenToLon.KeyPress += new KeyPressEventHandler(InputValidator);
            txtSoToChayLyThuyet.KeyPress  += new KeyPressEventHandler(InputValidator);
            txtSoConTrenToIn.KeyPress     += new KeyPressEventHandler(InputValidator);
            txtToChayRong.KeyPress        += new KeyPressEventHandler(InputValidator);
            txtToChayDai.KeyPress         += new KeyPressEventHandler(InputValidator);
            txtDThiepRongGomLe.KeyPress   += new KeyPressEventHandler(InputValidator);
            txtDThiepCaoGomLe.KeyPress    += new KeyPressEventHandler(InputValidator);
            txtSoDThiepTrenHop.KeyPress   += new KeyPressEventHandler(InputValidator);

            txtSoToChayBuHao.TextChanged     += new EventHandler(TextBoxes_TextChanged);
            txtSoToChayTrenToLon.TextChanged += new EventHandler(TextBoxes_TextChanged);
            txtSoToChayLyThuyet.TextChanged  += new EventHandler(TextBoxes_TextChanged);
            txtSoConTrenToIn.TextChanged     += new EventHandler(TextBoxes_TextChanged);
            txtSoToGiayLon.TextChanged       += new EventHandler(TextBoxes_TextChanged);
            txtTenGiayIn.TextChanged         += new EventHandler(TextBoxes_TextChanged);

            chkGiayKhach.CheckedChanged += new EventHandler(TextBoxes_TextChanged);

            lblSoToInTong.TextChanged += new EventHandler(TextBoxes_TextChanged);
            txtToChayRong.TextChanged += new EventHandler(TextBoxes_TextChanged);
            txtToChayDai.TextChanged  += new EventHandler(TextBoxes_TextChanged);

            txtSoConTrenToIn.Leave     += new EventHandler(TextBoxes_Leave);
            txtSoToChayBuHao.Leave     += new EventHandler(TextBoxes_Leave);
            txtSoToChayTrenToLon.Leave += new EventHandler(TextBoxes_Leave);
        }
コード例 #7
0
        public void CapNhatGiayDeIn(GiayDeIn giayDeIn)
        {
            var item = View.GiayDeInS.Find(x => x.ID == giayDeIn.ID);

            if (item != null)
            {
                item.ID                    = giayDeIn.ID;
                item.GiayChon              = giayDeIn.GiayChon;
                item.KhoToChay             = giayDeIn.KhoToChay;
                item.SoLuongToChayLyThuyet = giayDeIn.SoLuongToChayLyThuyet;
                item.SoLuongToChayBuHao    = giayDeIn.SoLuongToChayBuHao;
                item.SoLuongToLonCan       = giayDeIn.SoLuongToLonCan;
                item.TenGiayIn             = giayDeIn.TenGiayIn;
                item.IdBaiIn               = giayDeIn.IdBaiIn;
            }
        }
コード例 #8
0
        private void TextBoxes_TextChanged(object sender, EventArgs e)
        {
            TextBox t;

            if (sender is TextBox)
            {
                t = (TextBox)sender;
                if (t == txtSoToChayBuHao || t == txtSoToChayLyThuyet || t == txtSoToGiayLon)
                {
                    if (this.GiayChon != null)
                    {
                        var giayDeIn = new GiayDeIn(this.GiayChon, 1);//Chú ý đổi markup
                        lblGiaBanChoKH.Text = string.Format("{0}đ/tờ", giayDeIn.GiaBan);
                        lblTriGia.Text      = string.Format("{0}đ/tờ", giayDeIn.ThanhTien);
                    }
                }
            }
        }
コード例 #9
0
        public void CapNhatGiayDeIn(GiayDeIn giayDeIn)
        {
            var item = tinhGiaIn.DocBaiInTheoID(View.IdBaiInChon).GiayDeInIn;

            if (item != null)
            {
                item.ID                    = giayDeIn.ID;
                item.GiayChon              = giayDeIn.GiayChon;
                item.GiayKhachDua          = giayDeIn.GiayKhachDua;
                item.KhoToChay             = giayDeIn.KhoToChay;
                item.SoConTrenToChay       = giayDeIn.SoConTrenToChay;
                item.SoLuongToChayLyThuyet = giayDeIn.SoLuongToChayLyThuyet;
                item.SoLuongToChayBuHao    = giayDeIn.SoLuongToChayBuHao;
                item.SoLuongToLonCan       = giayDeIn.SoLuongToLonCan;
                item.TenGiayIn             = giayDeIn.TenGiayIn;
                item.IdBaiIn               = giayDeIn.IdBaiIn;
            }
        }
コード例 #10
0
        private void DoiGiayMoi()
        {
            //Tao giay de in
            var mucGiayDeIn = new GiayDeIn(32, 48.5f, 1, 0, 1,
                                           1, false, 0, "", 1, 1, 1, 0);//
            //Tiến hành gắn
            var frm = new GiayInDanhThiepForm(thongTinBanDauChoGiayIn(FormStateS.New), mucGiayDeIn);

            frm.Text          = "[Đổi] Giấy in Danh thiếp";
            frm.MinimizeBox   = false;
            frm.MaximizeBox   = false;
            frm.StartPosition = FormStartPosition.CenterParent;
            frm.ShowDialog();
            if (frm.DialogResult == System.Windows.Forms.DialogResult.OK)
            {
                XuLyNutOKTrenFormChuanBiGiay_Click(frm);
                //MessageBox.Show(this.CauHinhSanPhamS.Count().ToString());
            }
        }
コード例 #11
0
        public GiayInDanhThiepPresenter(IViewGiayInDanhThiep view, GiayDeIn giayDeIn)
        {
            View        = view;
            MucGiayDeIn = giayDeIn;

            View.ID      = MucGiayDeIn.ID;
            View.IdBaiIn = MucGiayDeIn.IdBaiIn;
            //Kích thước SP đã theo thông tin ban đầu
            View.ToChayRong         = MucGiayDeIn.ToChayRong;
            View.ToChayDai          = MucGiayDeIn.ToChayDai;
            View.SoConTrenToChay    = MucGiayDeIn.SoConTrenToChay;
            View.SoLuongToChayBuHao = MucGiayDeIn.SoToChayBuHao;
            View.GiayKhachDua       = MucGiayDeIn.GiayKhachDua;
            View.TenGiayIn          = MucGiayDeIn.TenGiayIn;


            View.SoToChayTrenToLon = MucGiayDeIn.SoToChayTrenToLon;

            View.IdGiay = MucGiayDeIn.IdGiay;
        }
コード例 #12
0
        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;
            }
        }
コード例 #13
0
        public GiayDeInPresenter(IViewGiayDeIn view, GiayDeIn giayDeIn)
        {
            View        = view;
            MucGiayDeIn = giayDeIn;

            View.ID                 = MucGiayDeIn.ID;
            View.IdBaiIn            = MucGiayDeIn.IdBaiIn;
            View.ToChayRong         = MucGiayDeIn.ToChayRong;
            View.ToChayDai          = MucGiayDeIn.ToChayDai;
            View.SoConTrenToChay    = MucGiayDeIn.SoConTrenToChay;
            View.SoLuongToChayBuHao = MucGiayDeIn.SoToChayBuHao;
            View.IdGiay             = MucGiayDeIn.IdGiay;
            View.TenGiayIn          = MucGiayDeIn.TenGiayIn;
            View.GiayLonRong        = MucGiayDeIn.GiayLonRong;
            View.GiayLonCao         = MucGiayDeIn.GiayLonCao;
            View.GiayKhachDua       = MucGiayDeIn.GiayKhachDua;



            View.SoToChayTrenToLon = MucGiayDeIn.SoToChayTrenToLon;
        }
コード例 #14
0
 public void GanGiayDeIn(GiayDeIn giayDeIn)
 {
     tinhGiaIn.DocBaiInTheoID(View.IdBaiInChon).GiayDeInIn = giayDeIn;
 }
コード例 #15
0
 public void GanGiayDeIn(GiayDeIn giayDeIn)
 {
     MucBaiIn.GiayDeInIn = giayDeIn;
 }
コード例 #16
0
ファイル: GiayDeInForm.cs プロジェクト: DzungHg/TinhGiaDigi2
        public GiayDeInForm(ThongTinBanDauChoGiayIn thongTinBanDau, GiayDeIn giayDeIn)
        {
            InitializeComponent();
            this.TinhTrangForm         = thongTinBanDau.TinhTrangForm;
            this.ThongTinBaiIn_CauHinh = thongTinBanDau.ThongTinCanThiet;
            this.SoLuongSanPham        = thongTinBanDau.SoLuongSanPham;
            this.IdHangKH     = thongTinBanDau.IdHangKhachHang;
            this.PhuongPhapIn = thongTinBanDau.PhuongPhapIn;
            this.SanPhamRong  = thongTinBanDau.KichThuocSanPham.Rong;
            this.SanPhamCao   = thongTinBanDau.KichThuocSanPham.Dai;
            lblDonViTinh.Text = thongTinBanDau.DonViTinhSanPham;

            if (thongTinBanDau.LaInDanhThiep) //bắt nút tính số con
            {
                btnTinhSoConTrenToChay.Enabled = false;
            }
            else
            {
                btnTinhSoConTrenToChay.Enabled = true;
            }

            giayDeInPres = new GiayDeInPresenter(this, giayDeIn);

            //cập nhật khổ in đỡ


            //event
            txtSoToChayBuHao.KeyPress     += new KeyPressEventHandler(InputValidator);
            txtSoToChayTrenToLon.KeyPress += new KeyPressEventHandler(InputValidator);
            txtSoToChayLyThuyet.KeyPress  += new KeyPressEventHandler(InputValidator);
            txtSoConTrenToIn.KeyPress     += new KeyPressEventHandler(InputValidator);
            txtToChayRong.KeyPress        += new KeyPressEventHandler(InputValidator);
            txtToChayDai.KeyPress         += new KeyPressEventHandler(InputValidator);
            txtSoLuongSP.KeyPress         += new KeyPressEventHandler(InputValidator);
            txtSPRong.KeyPress            += new KeyPressEventHandler(InputValidator);
            txtSPCao.KeyPress             += new KeyPressEventHandler(InputValidator);

            txtSoToChayBuHao.TextChanged     += new EventHandler(TextBoxes_TextChanged);
            txtSoToChayTrenToLon.TextChanged += new EventHandler(TextBoxes_TextChanged);
            txtSoToChayLyThuyet.TextChanged  += new EventHandler(TextBoxes_TextChanged);
            txtSoConTrenToIn.TextChanged     += new EventHandler(TextBoxes_TextChanged);
            txtSoToGiayLon.TextChanged       += new EventHandler(TextBoxes_TextChanged);
            txtTenGiayIn.TextChanged         += new EventHandler(TextBoxes_TextChanged);
            txtSoLuongSP.TextChanged         += new EventHandler(TextBoxes_TextChanged);
            txtSPRong.TextChanged            += new EventHandler(TextBoxes_TextChanged);
            txtSPCao.TextChanged             += new EventHandler(TextBoxes_TextChanged);

            chkGiayKhach.CheckedChanged += new EventHandler(CheckBoxes_CheckChanged);

            lblSoToInTong.TextChanged += new EventHandler(TextBoxes_TextChanged);
            txtToChayRong.TextChanged += new EventHandler(TextBoxes_TextChanged);
            txtToChayDai.TextChanged  += new EventHandler(TextBoxes_TextChanged);



            txtSoConTrenToIn.Leave     += new EventHandler(TextBoxes_Leave);
            txtSoToChayBuHao.Leave     += new EventHandler(TextBoxes_Leave);
            txtSoToChayTrenToLon.Leave += new EventHandler(TextBoxes_Leave);
            txtSoLuongSP.Leave         += new EventHandler(TextBoxes_Leave);
            txtSPRong.Leave            += new EventHandler(TextBoxes_Leave);
            txtSPCao.Leave             += new EventHandler(TextBoxes_Leave);
        }