Пример #1
0
        private void txtSoTo_ValueChanged(object sender, EventArgs e)
        {
            try
            {
                int       idSanPhamCha = (int)cbbLoaiSanPham.SelectedValue;
                String    size         = cbbSize.Text;
                String    loaiBia      = cbbLoaiBia.Text;
                String    loaiGiay     = cbbLoaiGiay.Text;
                DataTable dt           = SanPhamDao.getChiTietSanPham(idSanPhamCha, size, loaiBia, loaiGiay);
                if (dt.Rows.Count == 1)
                {
                    DataRow row            = dt.Rows[0];
                    int     numPageDefault = int.Parse(row["NUM_PAGE_DEFAULT"].ToString());
                    double  donGiaDefault  = double.Parse(row["DON_GIA"].ToString());
                    int     soTo           = (int)txtSoTo.Value;
                    double  costPageAdd    = double.Parse(row["ADDITIONAL_PAGES_COST"].ToString());
                    double  donGia         = AppUtils.cashProduct(numPageDefault, donGiaDefault, soTo, costPageAdd);

                    txtDonGia.Text    = donGia.ToString();
                    txtThanhTien.Text = (donGia * (double)txtSoLuong.Value).ToString();
                }
            }
            catch (Exception ex) {
                //MessageBox.Show(ex.Message, "ERROR");
            }
        }
Пример #2
0
        private void updateDataChanged()
        {
            try
            {
                if (this.initData == false)
                {
                    return;
                }

                txtSoTo.Value      = 10;
                txtDonGia.Text     = "";
                txtSoLuong.Value   = txtSoLuong.Minimum;
                txtChietKhau.Value = txtChietKhau.Minimum;
                txtThanhTien.Text  = "";

                int       idSanPhamCha = (int)cbbLoaiSanPham.SelectedValue;
                String    size         = cbbSize.Text;
                String    loaiBia      = cbbLoaiBia.Text;
                String    loaiGiay     = cbbLoaiGiay.Text;
                DataTable dt           = SanPhamDao.getChiTietSanPham(idSanPhamCha, size, loaiBia, loaiGiay);
                if (dt.Rows.Count == 1)
                {
                    DataRow row            = dt.Rows[0];
                    int     numPageDefault = int.Parse(row["NUM_PAGE_DEFAULT"].ToString());
                    double  donGiaDefault  = double.Parse(row["DON_GIA"].ToString());
                    int     soTo           = (int)txtSoTo.Value;
                    double  costPageAdd    = double.Parse(row["ADDITIONAL_PAGES_COST"].ToString());
                    double  donGia         = AppUtils.cashProduct(numPageDefault, donGiaDefault, soTo, costPageAdd);

                    txtDonGia.Text    = donGia.ToString();
                    txtThanhTien.Text = (donGia * (double)txtSoLuong.Value).ToString("#,###");
                }
            }
            catch (Exception) { }
        }