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()); } }