コード例 #1
0
        private void cbVeThang_SelectedIndexChanged(object sender, EventArgs e)
        {
            DateTime now    = DateTime.Now;
            string   months = blKhachHang.GetDetailOfTicket(cbVeThang.GetItemText(cbVeThang.SelectedItem)).Tables[0].Rows[0][8].ToString();            ////
            float    price  = float.Parse(blKhachHang.GetDetailOfTicket(cbVeThang.GetItemText(cbVeThang.SelectedItem)).Tables[0].Rows[0][2].ToString());
            int      uudai  = int.Parse(blKhachHang.GetDetailOfTicket(cbVeThang.GetItemText(cbVeThang.SelectedItem)).Tables[0].Rows[0][6].ToString()); //LỖI

            SHAREVAR.PriceOfRegister = price - price * uudai / 100;

            //txtNgayHetHan.Text = now.AddMonths(Int32.Parse(months)).ToString();
            if (Giahan == false)
            {
                dateTimePickerHetHan.Text = now.AddMonths(Int32.Parse(months)).ToString();
            }
            else
            {
                int r = dgvQLKhachHang.CurrentCell.RowIndex;
                dateTimePickerHetHan.Text = dgvQLKhachHang.Rows[r].Cells[7].Value.ToString();
                dateTimePickerHetHan.Text = Convert.ToDateTime(dateTimePickerHetHan.Text).AddMonths(Int32.Parse(months)).ToString();
            }
        }