public Termbook(Termbook x) : base((Saving)x) { KyHan = x.KyHan; }
private void btnAdd_Click(object sender, EventArgs e) { if (FormInvalid() == true) { bool check = true; HoTen = FormatName(txtName.Text); CMND = FormatCMND(txtCMND.Text); //Kiem Tra du lieu Input Sai Name va cmnd if (Bank.InvalidFailsData(HoTen, CMND) == true) { if (rdbCokyhan.Checked) { try { Termbook Cokyhan = new Termbook("", CMND, HoTen, double.Parse(txtDepoist.Text), day / 30, Laisuat, kyhan ); Bank.SetListTerm(Cokyhan); STT += 1; //set lai Maso Cokyhan.maso = "MS" + STT; }catch { check = false; MessageBox.Show("Kieu Du lieu Khong Hop Le!"); } } else { try { NonTerm Khongkyhan = new NonTerm("", CMND, HoTen, double.Parse(txtDepoist.Text), day / 30, Laisuat); Bank.SetNonTerm(Khongkyhan); STT += 1; //set lai Maso Khongkyhan.maso = "MS" + STT; } catch { check = false; MessageBox.Show("Kieu Du lieu Khong Hop Le!"); } } if (check == true) { //Them vao list view string[] arr = new string[9]; arr[0] = "MS" + STT.ToString(); arr[1] = HoTen; arr[2] = CMND; arr[3] = txtDepoist.Text + " VND"; if (rdbCokyhan.Checked) { arr[4] = "Term Book"; arr[6] = kyhan.ToString() + " Thang"; arr[8] = Bank.GetListTerm()[IndexTerm++].TinhTien().ToString() + " VND"; } else { arr[4] = "Non-Term Book"; arr[6] = "không xác định"; arr[8] = Bank.GetNonTerm()[IndexNonTerm++].TinhTien().ToString() + " VND"; } arr[5] = (day / 30).ToString() + " Thang "; arr[7] = Laisuat.ToString() + " % "; //Item ListViewItem Item = new ListViewItem(arr); lsvShow.Items.Add(Item); } } else { MessageBox.Show("Xin Kiem Tra Lai Name Hoac CMND cua Ban..."); } //Procsecc } }
public static void SetListTerm(Termbook x) { DanhsachTerm.Add(x); }