private void frmHocKy_Load(object sender, EventArgs e) { //Khoi tao doi tuong m_Controller if (this.Controller == null) { this.Controller = new HocKyController(); } this.Controller.HienThiDS(dgvDS, bnDS); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cmbHocKy_SelectedIndexChanged(object sender, EventArgs e) { if ((this.cmbHocKy.SelectedIndex != -1) && (this.lvDSLopHoc.SelectedItems.Count > 0)) { PhanLopInfo phanLop = new PhanLopController().LayTuMa(((DataRow)((object[])this.lvDSLopHoc.SelectedItems[0].Tag)[1])["MaHocSinhLop"].ToString()); MonHocInfo monHoc = new MonHocController().LayTuMa(((DataRowView)this.cmbMonHoc.SelectedItem).Row.ItemArray[2].ToString()); HocKyInfo hocKy = new HocKyController().LayTuMa(((DataRowView)this.cmbHocKy.SelectedItem).Row.ItemArray[0].ToString()); this.DiemController.HienThiDS(this.dgvDSDiem, this.bnDSDiem, phanLop, monHoc, hocKy); } else { this.DiemController.Data.DataService.Clear(); } }
/// <summary> /// /// </summary> /// <returns></returns> public string PhatSinhMa() { string lastID = new HocKyController().LayMaCuoi(); int numOfLastID; //khi chua co record nao trong csdl this lastID se la "", khi co ta bat dau tu 1 if (lastID == "") { numOfLastID = 1; } else { numOfLastID = int.Parse(lastID.Substring(2, 1)); numOfLastID++; } return("HK" + numOfLastID.ToString()); }