Пример #1
0
        public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
        {
            var cell = tableView.DequeueReusableCell (RaffleListCell.Key) as RaffleListCell;
            if (cell == null)
                cell = new RaffleListCell (RaffleListScreenController.sellClick);

            if (RaffleListScreenController.selectedListView == SelectedListView.Confirmed)
            {
                cell.RaffleNameLabel.Text = haveContractEventlist [indexPath.Row].event_name;
                cell.RaffleImageView.Image = Global.eventImageList [(int)hashTable ["haveContractEventlist," + indexPath.Row]];
                try{
                    DateTime eventEndTime=DateTime.ParseExact (haveContractEventlist [indexPath.Row].event_end_time.Substring (0, 19),
                        "yyyy-MM-ddTHH:mm:ss", null);
                    double hoursleft=(eventEndTime-DateTime.Now).TotalHours;
                    int daysRemain=(int)(hoursleft/24.0);
                    int hoursRemain=(int)(hoursleft%24.0);
                    cell.TimeLeft.Text =String.Format("{0} Days, {1} Hours",daysRemain,hoursRemain);
                    if(daysRemain<1&&hoursRemain<1){
                        cell.TimeLeft.Text= GoalScreenData.lessThanAnHour;
                    }
                }
                catch{
                    cell.TimeLeft.Text = "N/A";
                }
                cell.jackPotLabel.Hidden = (haveContractEventlist [indexPath.Row].has_jackpot == "Y" ? false : true);
                cell.jackPotLabel.Text="$"+haveContractEventlist [indexPath.Row].jackpot_total+"("+haveContractEventlist [indexPath.Row].jackpot_description+")";
                cell.sellBtn.Hidden = false;
                cell.Row = indexPath.Row;

            }
            if (RaffleListScreenController.selectedListView == SelectedListView.Potential)
            {
                cell.RaffleNameLabel.Text = noContractEventlist [indexPath.Row].event_name;
                cell.RaffleImageView.Image = Global.eventImageList [(int)hashTable ["noContractEventlist," + indexPath.Row]];
                try{
                    DateTime eventEndTime=DateTime.ParseExact (noContractEventlist [indexPath.Row].event_end_time.Substring (0, 19),
                        "yyyy-MM-ddTHH:mm:ss", null);
                    double hoursleft=(eventEndTime-DateTime.Now).TotalHours;
                    int daysRemain=(int)(hoursleft/24.0);
                    int hoursRemain=(int)(hoursleft%24.0);
                    cell.TimeLeft.Text =String.Format("{0} Days, {1} Hours",daysRemain,hoursRemain);
                    if(daysRemain<1&&hoursRemain<1){
                        cell.TimeLeft.Text= GoalScreenData.lessThanAnHour;
                    }
                }
                catch{
                    cell.TimeLeft.Text = "N/A";
                }
                cell.jackPotLabel.Hidden = (noContractEventlist[indexPath.Row].has_jackpot == "Y" ? false : true);
                cell.jackPotLabel.Text="$"+noContractEventlist[indexPath.Row].jackpot_total+"("+noContractEventlist [indexPath.Row].jackpot_description+")";
                cell.sellBtn.Hidden = true;
            }

            return cell;
        }
Пример #2
0
        public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
        {
            var cell = tableView.DequeueReusableCell (RaffleListCell.Key) as RaffleListCell;
            if (cell == null)
                cell = new RaffleListCell ();

            if (indexPath.Section == 0)
            {
                cell.RaffleNameLabel.Text = haveContractEventlist [indexPath.Row].event_name;
                cell.RaffleImageView.Image = Global.eventImageList [(int)hashTable ["haveContractEventlist," + indexPath.Row]];
            }
            if (indexPath.Section == 1)
            {
                cell.RaffleNameLabel.Text = noContractEventlist [indexPath.Row].event_name;
                cell.RaffleImageView.Image = Global.eventImageList [(int)hashTable ["noContractEventlist," + indexPath.Row]];
            }

            return cell;
        }