예제 #1
0
        public void dt_DataSource(Name_product <Product> ip_us_result)
        {
            m_dg_banggia.DataSource = ip_us_result.product;

            for (int j = 0; j < 9; j++)
            {
                if (m_dg_banggia.Rows[1].Cells[j].Value == null)
                {
                    m_dg_banggia.Columns[j].Visible = false;
                }
            }
        }
        private void check_Click(object sender, EventArgs e)
        {
            m_img_label.Visible = false;
            m_lbl_notice1.Text  = null;
            Double   v_db_tong_tien = 0;
            f005_hdt us_hdt         = new f005_hdt();

            JsonSerializer         serializer = new JsonSerializer();
            Name_product <Product> us_product = JsonConvert.DeserializeObject <Name_product <Product> >(File.ReadAllText(m_str_json_product));

            us_hdt.dt_DataSource(us_product);
            foreach (var tien in us_product.product)
            {
                if (m_cbo_menhgia.SelectedItem.ToString() == "VND")
                {
                    v_db_tong_tien += float.Parse(tien.VND);
                }
                else if (m_cbo_menhgia.SelectedItem.ToString() == "USD")
                {
                    v_db_tong_tien += float.Parse(tien.USD);
                }
                else if (m_cbo_menhgia.SelectedItem.ToString() == "EURO")
                {
                    v_db_tong_tien += float.Parse(tien.EURO);
                }
                else if (m_cbo_menhgia.SelectedItem.ToString() == "RMB")
                {
                    v_db_tong_tien += float.Parse(tien.RMB);
                }
                else if (m_cbo_menhgia.SelectedItem.ToString() == "WON")
                {
                    v_db_tong_tien += float.Parse(tien.WON);
                }
            }
            us_hdt.display(m_txt_tenkh.Text, m_txt_tendc.Text, m_txt_sotk.Text, m_cbo_thanhtoan.SelectedItem.ToString(), v_db_tong_tien, m_cbo_menhgia.SelectedItem.ToString());
            us_hdt.Show();
        }