Esempio n. 1
0
        private void btnLichTrinhSanXuat_Click(object sender, EventArgs e)
        {
            var tong = 0;
            var db   = new MyDBContextDataContext();

            if (BoPhantxt.Text == "TEM VẢI")
            {
                var khonvl = db.tbKhoNLVs.ToList();
                foreach (var item in khonvl)
                {
                    if (item.MaPhieu != MaPhieutxt.Text)
                    {
                        continue;
                    }
                    var lst = db.DonSanXuat_KhoNVL_LichTrinh(MaPhieutxt.Text).ToList();
                    var rp  = new rpLichTrinhSanXuat(BoPhantxt.Text);
                    rp.DataSource = lst;
                    rp.databingding();
                    rp.ShowRibbonPreviewDialog();
                    tong = 1;
                    break;
                }
                var khonvl2 = db.tbKhoNLVs.ToList();
                foreach (var item in khonvl2)
                {
                    if (item.MaPhieu != MaPhieutxt.Text)
                    {
                        continue;
                    }
                    var lst = db.DonSanXuat_KhoNVL(MaPhieutxt.Text).ToList();
                    var rp  = new rpDanhSachLichTrinhSanXuat();
                    rp.DataSource = lst;
                    rp.databingding();
                    rp.ShowRibbonPreviewDialog();
                    tong = 1;
                    break;
                }
            }
            else
            {
                var khonvl = db.tbKhoNLVs.ToList();
                foreach (var item in khonvl)
                {
                    if (item.MaPhieu != MaPhieutxt.Text)
                    {
                        continue;
                    }
                    var lst = db.DonSanXuat_KhoNVL(MaPhieutxt.Text).ToList();
                    var rp  = new rpLichTrinhSanXuat(BoPhantxt.Text);
                    rp.DataSource = lst;
                    rp.databingding();
                    rp.ShowRibbonPreviewDialog();
                    tong = 1;
                    break;
                }
                if (tong == 0)
                {
                    MessageBox.Show("Vui lòng Lưu kho mã phiếu " + MaPhieutxt.Text + " này trước khi in");
                }
            }
        }