Exemplo n.º 1
0
		public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath)
		{
			// in a Storyboard, Dequeue will ALWAYS return a cell, 
			if (!isHeader) {
				DiemThiCell cell = tableView.DequeueReusableCell (cellIdentifier) as DiemThiCell;

				if (cell == null) {
					cell = new DiemThiCell (cellIdentifier);
				}
				var monhoc = BMonHoc.GetMH (SQLite_iOS.GetConnection (), tableItems [indexPath.Row].MaMH);
				cell.UpdateCell (monhoc.TenMH, monhoc.TiLeThi.ToString(), tableItems [indexPath.Row].DiemKT,
					tableItems [indexPath.Row].DiemThi,tableItems [indexPath.Row].DiemTK10,tableItems [indexPath.Row].DiemChu);
				if (indexPath.Row % 2 != 0) {
					cell.BackgroundColor = UIColor.FromRGBA((float)0.8, (float)0.8, (float)0.8, (float)1);
				}
				else {
					cell.BackgroundColor = UIColor.White;
				}
				return cell;
				// now set the properties as normal
			} else {
				DiemThiCell cell = tableView.DequeueReusableCell (cellIdentifier) as DiemThiCell;
				if (cell == null) {
					cell = new  DiemThiCell (cellIdentifier,true);
				}
				return cell;
			}


		}
Exemplo n.º 2
0
		public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath)
		{
			int type = GetItemViewType (indexPath.Row);
			DiemThi dt;
			switch (type) {
			case HEADER_TYPE: 
				DTHeader hcell = tableView.DequeueReusableCell (cellIdentifier) as DTHeader;
				if (hcell == null) {
					hcell = new DTHeader (cellIdentifier);
				}
				dt = BDiemThi.GetDT (SQLite_iOS.GetConnection (), tableItems [indexPath.Row].Hocky, tableItems [indexPath.Row].NamHoc);
				hcell.UpdateCell (dt.Hocky, dt.NamHoc);
				return hcell;
			case BODY_TYPE:
				DiemThiCell cell = tableView.DequeueReusableCell (cellIdentifier) as DiemThiCell;
				if (cell == null) {
					cell = new DiemThiCell (cellIdentifier);

				}
				MonHoc mh = BMonHoc.GetMH (SQLite_iOS.GetConnection (), tableItems [indexPath.Row].MaMH);
				cell.UpdateCell (mh.TenMH, mh.TiLeThi.ToString (), tableItems [indexPath.Row].DiemKT,
					tableItems [indexPath.Row].DiemThi, tableItems [indexPath.Row].DiemTK10, tableItems [indexPath.Row].DiemChu);
				if (indexPath.Row % 2 != 0) {
					cell.BackgroundColor = UIColor.FromRGBA((float)0.8, (float)0.8, (float)0.8, (float)1);
				}
				else {
					cell.BackgroundColor = UIColor.White;
				}
				return cell;


			case FOOTER_TYPE:
				DiemThiFooter icell = tableView.DequeueReusableCell (cellIdentifier) as DiemThiFooter;
				if (icell == null) {
					icell = new DiemThiFooter (cellIdentifier);
				}

				 dt = BDiemThi.GetDT (SQLite_iOS.GetConnection (), tableItems [indexPath.Row].Hocky, tableItems [indexPath.Row].NamHoc);
				icell.UpdateCell (dt);
				return icell;

			}
			return null;
		}