public GiayDeBoiForm(ThongTinBanDauChoGiayIn thongTinBanDau, GiayDeBoi giayDeBoi) { InitializeComponent(); this.TinhTrangForm = thongTinBanDau.TinhTrangForm; this.ThongTinBaiIn_CauHinh = thongTinBanDau.ThongTinCanThiet; this.IdHangKH = thongTinBanDau.IdHangKhachHang; if (thongTinBanDau.LaInDanhThiep) //bắt nút tính số con { btnTinhSoConTrenToChay.Enabled = false; } else { btnTinhSoConTrenToChay.Enabled = true; } giayDeBoiPres = new GiayDeBoiPresenter(this, giayDeBoi); //cập nhật khổ in đỡ //event txtSoToBoiBuHao.KeyPress += new KeyPressEventHandler(InputValidator); txtSoToBoiTrenToLon.KeyPress += new KeyPressEventHandler(InputValidator); txtSoToBoiLyThuyet.KeyPress += new KeyPressEventHandler(InputValidator); txtToBoiRong.KeyPress += new KeyPressEventHandler(InputValidator); txtToBoiCao.KeyPress += new KeyPressEventHandler(InputValidator); txtSoToBoiBuHao.TextChanged += new EventHandler(TextBoxes_TextChanged); txtSoToBoiTrenToLon.TextChanged += new EventHandler(TextBoxes_TextChanged); txtSoToBoiLyThuyet.TextChanged += new EventHandler(TextBoxes_TextChanged); txtSoToGiayLon.TextChanged += new EventHandler(TextBoxes_TextChanged); txtTenGiayBoi.TextChanged += new EventHandler(TextBoxes_TextChanged); lblSoToInTong.TextChanged += new EventHandler(TextBoxes_TextChanged); txtToBoiRong.TextChanged += new EventHandler(TextBoxes_TextChanged); txtToBoiCao.TextChanged += new EventHandler(TextBoxes_TextChanged); txtSoToBoiBuHao.Leave += new EventHandler(TextBoxes_Leave); txtSoToBoiTrenToLon.Leave += new EventHandler(TextBoxes_Leave); }
public GiayDeBoiPresenter(IViewGiayDeBoi view, GiayDeBoi giayDeBoi) { View = view; MucGiayDeBoi = giayDeBoi; View.ID = MucGiayDeBoi.ID; View.IdBaiIn = MucGiayDeBoi.IdBaiIn; View.ToBoiRong = MucGiayDeBoi.ToBoiRong; View.ToBoiCao = MucGiayDeBoi.ToBoiDai; View.SoLuongToBoiLyThuyet = MucGiayDeBoi.SoToBoiLyThuyet; View.SoLuongToBoiBuHao = MucGiayDeBoi.SoToBoiBuHao; View.TenGiayBoi = MucGiayDeBoi.TenGiayIn; View.SoToChayTrenToLon = MucGiayDeBoi.SoToBoiTrenToLon; View.IdGiay = MucGiayDeBoi.IdGiay; }
private void ChoKhongChoNutNhan() { ///các đk cho: nếu só lợp >0 thì giấy bồi phải có ///số lượng >0 /// bool kq = true; if (this.SoLopLotGiua > 0) { if (this.GiayDeBoiChon == null) { MessageBox.Show("Bạn chưa giấy bồi!"); kq = false; } else { kq = true; } } else if (this.GiayDeBoiChon != null) { this.GiayDeBoiChon = null; //lớp giữã sẽ không có } if (this.SoLuong <= 0 || this.ToBoiCao <= 0 || this.ToBoiRong <= 0) { kq = false; } //Bồi thêm phải có 1 lớp if (this.KieuBoi == KieuBoiNhieuLop.BoiDap) { if (this.SoLopLotGiua <= 0) { MessageBox.Show("Kiểu bồi này bạn cần ít nhất 1 tờ lót"); txtSoLopLot.Focus(); kq = false; } } btnNhan.Enabled = kq; }
private void XuLyNutOKTrenFormChuanBiGiay_Click(GiayDeBoiForm frm) { switch (frm.TinhTrangForm) { case FormStateS.New: this.GiayDeBoiChon = frm.DocGiayDeIn(); txtThongTinGiayLot.Lines = this.GiayDeBoiChon.ThongTinGiayBoi().ToArray(); txtSoLuong.Enabled = false; //Lock lại //Cập nhật tính toán //TinhToanToanBo(); break; case FormStateS.Edit: //Đổi ID vì thêm mới là có id mới this.GiayDeBoiChon = frm.DocGiayDeIn(); txtThongTinGiayLot.Lines = this.GiayDeBoiChon.ThongTinGiayBoi().ToArray(); txtSoLuong.Enabled = false;//Lock lại //Cập nhật tính toán //TinhToanToanBo(); break; } }
private void btnLayGiay_Click(object sender, EventArgs e) { //Thong tin ban đầu if (this.SoLopLotGiua <= 0) { MessageBox.Show("Bạn cần lớp số lớp lót"); txtSoLopLot.Focus(); return; } var thongTinBanDau = new ThongTinBanDauChoGiayIn(); var strThongTin = string.Format(" Tờ bồi: {0} x {1}cm" + '\r' + '\n', this.ToBoiRong, this.ToBoiCao); strThongTin += string.Format("Tờ lót giữa: {0} tờ", thPhBoiNhieuLopPres.SoToLotGiua()); ///Nếu mới chưa có giấy bồi là mới còn có giáy bồi là edit if (this.GiayDeBoiChon == null) { thongTinBanDau.TinhTrangForm = FormStateS.New; thongTinBanDau.ThongTinCanThiet = "[Mới] Chọn giấy bồi" + '\r' + '\n'; thongTinBanDau.ThongTinCanThiet += strThongTin; } else { thongTinBanDau.TinhTrangForm = FormStateS.Edit; thongTinBanDau.ThongTinCanThiet = "[Sửa] Giấy để bồi"; thongTinBanDau.ThongTinCanThiet += strThongTin; } //Tao giay de bồi var soLuongToBoi = thPhBoiNhieuLopPres.SoToLotGiua(); var soToBuHao = 0; var idGiay = 0; var tenGiayIn = ""; var soToBoiTrenToLon = 0; var soToLonTong = 0; if (this.GiayDeBoiChon != null) { soToBuHao = this.GiayDeBoiChon.SoToBoiBuHao; soLuongToBoi = this.GiayDeBoiChon.SoToBoiLyThuyet; idGiay = this.GiayDeBoiChon.IdGiay; tenGiayIn = this.GiayDeBoiChon.TenGiayIn; soToBoiTrenToLon = this.GiayDeBoiChon.SoToBoiTrenToLon; soToLonTong = this.GiayDeBoiChon.SoToLonTong; } var mucGiayDeBoi = new GiayDeBoi(this.ToBoiRong, this.ToBoiCao, soToBuHao, soLuongToBoi, idGiay, tenGiayIn, 0, soToBoiTrenToLon, soToLonTong, 0);// //Tiến hành gắn var frm = new GiayDeBoiForm(thongTinBanDau, mucGiayDeBoi); if (this.GiayDeBoiChon == null) { frm.Text = "[Mới] BỒI NHIỀU LỚP"; } else { frm.Text = "[Sửa] BỒI NHIỀU LỚ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()); } }