コード例 #1
0
ファイル: TinhThuForm.cs プロジェクト: DzungHg/TinhGiaDigi2
        private void btnTinhThu_CanPhu_Click(object sender, EventArgs e)
        {
            var idHangKH       = int.Parse(cboHangKH.SelectedValue.ToString());
            var thongTinBanDau = this.thongTinBanDauChoThPh(idHangKH, LoaiThanhPhamS.CanPhu,
                                                            FormStateS.View, "Cán Phủ [Tính thử]", "Mặt");

            thongTinBanDau.MoTextSoLuong = true;
            //Mục thành phẩm cán phủ
            var mucThPhCanPhu = new MucThPhCanPhu();

            mucThPhCanPhu.IdBaiIn         = 1;
            mucThPhCanPhu.IdHangKhachHang = this.IdHangKhachHang;
            mucThPhCanPhu.LoaiThanhPham   = LoaiThanhPhamS.CanPhu;
            mucThPhCanPhu.ToChayDai       = 21; //cm
            mucThPhCanPhu.ToChayRong      = 32; //cm
            mucThPhCanPhu.SoLuong         = 50;
            mucThPhCanPhu.DonViTinh       = "mặt";
            mucThPhCanPhu.SoMatCan        = 1;
            //Cập nhật lại thông ti ban đầu
            thongTinBanDau.ThongDiepCanThiet += string.Format(" Khổ: {0} x {1}cm",
                                                              mucThPhCanPhu.ToChayRong, mucThPhCanPhu.ToChayDai);

            var frm = new ThPhCanPhuForm(thongTinBanDau, mucThPhCanPhu);

            frm.MinimizeBox   = false;
            frm.MaximizeBox   = false;
            frm.StartPosition = FormStartPosition.CenterParent;
            frm.ShowDialog();
        }
コード例 #2
0
 public ThPhCanPhuPresenter(IViewThPhCanPhu view, MucThPhCanPhu mucThPham)
 {
     View           = view;
     this.MucCanPhu = mucThPham;
     //Cập nhật form
     View.ID              = this.MucCanPhu.ID;
     View.IdBaiIn         = this.MucCanPhu.IdBaiIn;
     View.IdHangKhachHang = this.MucCanPhu.IdHangKhachHang;
     View.IdThanhPhamChon = this.MucCanPhu.IdThanhPhamChon;
     View.LoaiThPh        = this.MucCanPhu.LoaiThanhPham;
     View.ToChayRong      = this.MucCanPhu.ToChayRong;
     View.ToChayDai       = this.MucCanPhu.ToChayDai;
     View.SoLuong         = this.MucCanPhu.SoLuong;
     View.DonViTinh       = this.MucCanPhu.DonViTinh;
     View.SoMatCan        = this.MucCanPhu.SoMatCan;
 }
コード例 #3
0
        public ThPhCanPhuForm(ThongTinBanDauThanhPham thongTinBanDau, MucThPhCanPhu mucThPhCanPhu)
        {
            InitializeComponent();

            this.ThongTinHoTro = thongTinBanDau.ThongDiepCanThiet;
            this.TinhTrangForm = thongTinBanDau.TinhTrangForm;
            this.Text          = thongTinBanDau.TieuDeForm;
            txtSoLuong.Enabled = thongTinBanDau.MoTextSoLuong;//Bật hay tắt số lượng
            //Tiép
            canPhuPres = new ThPhCanPhuPresenter(this, mucThPhCanPhu);
            LoadThanhPham();
            lbxCanPhu.SelectedIndex = -1;
            lbxCanPhu.SelectedIndex = 0;
            //Phải xử lý mục chọn tại đây
            if (this.TinhTrangForm == FormStateS.Edit)
            {
                this.IdThanhPhamChon = mucThPhCanPhu.IdThanhPhamChon;
            }

            if (this.TinhTrangForm == FormStateS.New)//Chỉ khi mới
            {
                canPhuPres.KhoiTaoBanDau();
            }

            //Envent
            txtSoLuong.TextChanged += new EventHandler(TextBoxes_TextChanged);

            rdbHaiMat.CheckedChanged += new EventHandler(TextBoxes_TextChanged);
            rdbMotMat.CheckedChanged += new EventHandler(TextBoxes_TextChanged);

            txtSoLuong.Leave += new EventHandler(TextBoxes_Leave);

            txtSoLuong.KeyPress += new KeyPressEventHandler(InputValidator);

            lbxCanPhu.SelectedIndexChanged += new EventHandler(ListBoxes_SelectedIndex_Changed);
        }