Exemple #1
0
        private void dgvHoaDon_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            textBoxNSX.Visible      = true;
            textBoxLoaiSP.Visible   = true;
            textBoxDSP.Visible      = true;
            textBoxMauKieu.Visible  = true;
            textBoxMaKieuSP.Visible = true;
            textBoxSP.Visible       = true;

            int    r  = dgvHoaDon.CurrentCell.RowIndex;
            string id = dgvHoaDon.Rows[r].Cells[1].Value.ToString();
            USP_GETAllInfoSPNew_Result sp = ChiTietSPBUS.GetMaSPByMaKieuSP(id);

            textBoxNSX.Text      = sp.TenHSX;
            textBoxLoaiSP.Text   = sp.TenLSP;
            textBoxDSP.Text      = sp.TenDong;
            textboxGiaBan.Text   = dgvHoaDon.Rows[r].Cells[3].Value.ToString();
            textBoxSLTon.Text    = ChiTietSPBUS.GetChiTietSPOderByMaCHByIDKieuSP(textBoxMaCH.Text, id).SoluongSP.ToString();
            textBoxMaKieuSP.Text = sp.MaKieu;
            textBoxTenSP.Text    = sp.TenSP;
            textBoxSLMua.Text    = dgvHoaDon.Rows[r].Cells[2].Value.ToString();
            ChiTietSP ct = ChiTietSPBUS.Get1ChiTietSPByIDMaKieu(id);

            textBoxSP.Text      = ct.MaSP.ToString();
            textBoxMauKieu.Text = ct.MaMau.ToString();

            try
            {
                pictureBox.BackgroundImage = ConverBinaryToImage(ct.Anh);
            }
            catch
            { pictureBox.BackgroundImage = null; }
        }
Exemple #2
0
 void LoadSP()
 {
     try
     {
         Sp   = ChiTietSPBUS.GetMaSPByIDKieuSP(IDMaKieu);
         CtSp = ChiTietSPBUS.Get1ChiTietSPByIDMaKieu(IDMaKieu);
         DSp  = DongSanPhamBUS.Get1DongSPByMaSP(Sp.MaDSP);
     }
     catch { }
 }
Exemple #3
0
        private void cmBoxMaKieuSP_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                string id = cmBoxMaKieuSP.SelectedValue.ToString();
                //ChiTietSP sp = ChiTietSPBUS.Get1ChiTietSPByIDMaKieu(id);
                if (IDMode == "ts")
                {
                    ChiTietSP sp = ChiTietSPBUS.Get1ChiTietSPByIDMaKieu(id);
                    cmBoxMauSP.DataSource    = ChiTietSPBUS.GetAllMauSP();
                    cmBoxMauSP.ValueMember   = "MaMau";
                    cmBoxMauSP.DisplayMember = "Mau";
                    cmBoxMauSP.SelectedValue = sp.MaMau;
                    txtBoxGiaSP.Text         = sp.Gia.ToString();
                    txtboxSoLuongAll.Text    = sp.SoluongSP.ToString();
                    //picBoxKieuSP.Image = null;
                    picBoxKieuSP.BackgroundImage = null;
                    textBoxPathAnh.Text          = "";
                    //picBoxKieuSP.Image = ConverBinaryToImage(sp.Anh);
                    picBoxKieuSP.BackgroundImage = ConverBinaryToImage(sp.Anh);
                }
                else
                {
                    ChiTietSP sp = ChiTietSPBUS.GetChiTietSPOderByMaCHByIDKieuSP(IDMode, id);

                    cmBoxMauSP.SelectedValue = sp.MaMau;
                    txtBoxGiaSP.Text         = sp.Gia.ToString();
                    txtboxSoLuongAll.Text    = sp.SoluongSP.ToString();
                    //picBoxKieuSP.Image = null;
                    picBoxKieuSP.BackgroundImage = null;
                    textBoxPathAnh.Text          = "";
                    //picBoxKieuSP.Image = ConverBinaryToImage(sp.Anh);
                    picBoxKieuSP.BackgroundImage = ConverBinaryToImage(sp.Anh);
                }
                //cmBoxMauSP.SelectedValue = sp.MaMau;
                //txtBoxGiaSP.Text = sp.Gia.ToString();
                //txtboxSoLuongAll.Text = sp.SoluongSP.ToString();
                //picBoxKieuSP.Image = null;
                //textBoxPathAnh.Text = "";
                //picBoxKieuSP.Image = ConverBinaryToImage(sp.Anh);
            }
            catch { }
        }
Exemple #4
0
 private void comboBoxMaKieu_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         textBoxSLTonKieu.Text           = "";
         pictureBox.BackgroundImage      = null;
         khoHangBindingSource.DataSource = null;
         textBoxMaKieu.Text = "";
         string id = comboBoxMaKieu.SelectedValue.ToString();
         CtSp = ChiTietSPBUS.Get1ChiTietSPByIDMaKieu(id);
         textBoxMaKieu.Text    = CtSp.MaKieu;
         textBoxSLTonKieu.Text = CtSp.SoluongSP.ToString();
         try
         {
             pictureBox.BackgroundImage = ConverBinaryToImage(CtSp.Anh);
         }
         catch { pictureBox.BackgroundImage = null; }
         khoHangBindingSource.DataSource = KhoHangBUS.GetAllKhoHangByMaKieu(CtSp.MaKieu);
     }
     catch { }
 }
Exemple #5
0
        public void LoadChiTietSP()
        {
            //try
            //{
            LoadSP();
            //}
            //catch
            //{

            //}
            comboBoxCHNhan.DataSource    = CuaHangBUS.GetAllCuaHang();
            comboBoxCHNhan.DisplayMember = "TenCuaHang";
            comboBoxCHNhan.ValueMember   = "MaCuaHang";
            comboBoxCHPP.DataSource      = CuaHangBUS.GetAllCuaHang();
            comboBoxCHPP.DisplayMember   = "TenCuaHang";
            comboBoxCHPP.ValueMember     = "MaCuaHang";
            comboBoxNXS.DataSource       = HSXBUS.GetAllHSX();
            comboBoxNXS.DisplayMember    = "TenHSX";
            comboBoxNXS.ValueMember      = "MaHSX";
            comboBoxNXS.SelectedValue    = DSp.MaHSX;
            comboBoxDSP.DataSource       = DongSanPhamBUS.GetAllDongSPByMaHSX(DSp.MaHSX);
            comboBoxDSP.DisplayMember    = "TenDong";
            comboBoxDSP.ValueMember      = "MaDSP";
            comboBoxDSP.SelectedValue    = DSp.MaDSP;
            comboBoxSP.DataSource        = SanPhamBUS.GetSanPhamByMaDSP(DSp.MaDSP);
            comboBoxSP.DisplayMember     = "TenSP";
            comboBoxSP.ValueMember       = "MaSP";
            comboBoxSP.SelectedValue     = Sp.MaSP;
            comboBoxMaKieu.DataSource    = ChiTietSPBUS.GetChiTietSPByIDSP(Sp.MaSP);
            comboBoxMaKieu.DisplayMember = "MaKieu";
            comboBoxMaKieu.ValueMember   = "MaKieu";
            CtSp = ChiTietSPBUS.Get1ChiTietSPByIDMaKieu(IDMaKieu);
            comboBoxMaKieu.SelectedValue    = CtSp.MaKieu;
            textBoxSLTonKieu.Text           = CtSp.SoluongSP.ToString();
            pictureBox.BackgroundImage      = ConverBinaryToImage(CtSp.Anh);
            khoHangBindingSource.DataSource = KhoHangBUS.GetAllKhoHangByMaKieu(CtSp.MaKieu);
        }
        private void cmBoxKieuSP_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                string id = cmBoxKieuSP.SelectedValue.ToString();

                ChiTietSP ct = ChiTietSPBUS.Get1ChiTietSPByIDMaKieu(id);
                if (ct != null)
                {
                    txtBoxSLTon.Text  = ct.SoluongSP.ToString();
                    txtboxGiaBan.Text = ct.Gia.ToString();
                }
                else
                {
                    txtBoxSLTon.Text  = "";
                    txtboxGiaBan.Text = "";
                }
            }
            catch
            {
                txtBoxSLTon.Text  = "";
                txtboxGiaBan.Text = "";
            }
        }