//
//  InformationTableViewCell.m
//  Lighting
//
//  Created by 曹云霄 on 16/4/29.
//  Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//

#import "InformationTableViewCell.h"

@implementation InformationTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}


#pragma mark -赋值
- (void)setModel:(MyclientEntityModel *)model
{
    _model = model;
    [self.personHeader sd_setImageWithURL:[NSURL URLWithString:_model.picture] placeholderImage:ReplaceImage];
    self.personName.text = _model.createName;
    self.personPhoneNumber.text = _model.mobile;
    self.recentTime.text = [self stringFromDate:_model.lastVisitedTime];
    self.Guideservices.text = _model.name;
    self.personLocation.text = _model.address;
    self.setCurrentCustomer.selected = _model.selectedState;
}



#pragma mark -NSDate转NSStirng
- (NSString *)stringFromDate:(NSDate *)date{
    
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
   [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *destDateString = [dateFormatter stringFromDate:date];
    return destDateString;
}



#pragma mark -设为当前用户
- (IBAction)SelectedButtonClick:(UIButton *)sender {
    
    if (self.blockSeletced) {
        
        self.blockSeletced(_indexNumber);
    }
    sender.selected = YES;
}



- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
