Wednesday 16 March 2016

Daily Task

//--- Pop To A Perticuller View Controller ---//

+(void)popToViewController:(Class)aClass FromNavigationController:(UINavigationController*)navigationController
{
    NSArray *arrayViewControllers = [navigationController viewControllers];
    
    
    for (UIViewController *controller in arrayViewControllers)
    {
        
        //Do not forget to import AnOldViewController.h
        if ([controller isKindOfClass:aClass])
        {
            
            [navigationController popToViewController:controller
                                             animated:YES];
            break;
        }
    }
    

}



//--- Image Save to Documents Directory ---//

+(void)saveImage:(UIImage*)image withImageName:(NSString*)imageName
{
    
    NSData *imageData = UIImageJPEGRepresentation(image,1.0); //convert image into .png format.
    NSFileManager *fileManager = [NSFileManager defaultManager];//create instance of NSFileManager
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); //create an array and store result of our search for the documents directory in it
    
    NSString *documentsDirectory = [paths objectAtIndex:0]; //create NSString object, that holds our exact path to the documents directory
    
    NSString *fullPath = [documentsDirectory stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.jpeg", imageName]]; //add our image to the path
    
    [fileManager createFileAtPath:fullPath contents:imageData attributes:nil]; //finally save the path (image)
    
    //NSLog(@"image saved");
    
}


//--- Load Saved Image From Documents Directory ---//

+(UIImage*)loadImageWithImageName:(NSString*)imageName
{
    
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    
    NSString *documentsDirectory = [paths objectAtIndex:0];
    
    NSString *fullPath = [documentsDirectory stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.jpeg", imageName]];
    
    return [UIImage imageWithContentsOfFile:fullPath];
    
}


//--- Get Main Window Height & Width ---//

+ (CGFloat)getWindowHeight
{
    return [UIScreen mainScreen].applicationFrame.size.height;
}

+ (CGFloat)getWindowWidth
{
    return [UIScreen mainScreen].applicationFrame.size.width;
}


//--- Calculate Height of String ---//

+(CGFloat)calculateHeightForString:(NSString*)string withFont:(UIFont*)font withWidth:(CGFloat)width
{
    CGSize size;
    
    NSString *cellText = string;
    
    CGSize constraintSize = CGSizeMake(width, MAXFLOAT);
    
    NSDictionary *attributesDictionary = [NSDictionary dictionaryWithObjectsAndKeys:
                                          font, NSFontAttributeName,
                                          nil];
    
    CGRect frame = [cellText boundingRectWithSize:constraintSize
                                          options:(NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading)
                                       attributes:attributesDictionary
                                          context:nil];
    
    size = frame.size;
    
    return size.height;
}


//--- Add Separator line on Table Cell ---//


+(void)addSeparatorLineOnTableCell:(UITableViewCell*)cell withPhoneY:(float)iPhoneY andPadY:(float)iPadY
{
    UIView* separatorLineView;
    
    NSString *size = [NSString stringWithFormat:@"%0.1f",[[UIScreen mainScreen] bounds].size.width];
    
    
    if(ISIphone)
        separatorLineView = [[UIView alloc] initWithFrame:CGRectMake(0, iPhoneY, size.intValue, 1)];
    else
        separatorLineView = [[UIView alloc] initWithFrame:CGRectMake(0, iPadY, size.intValue, 1)];
    
    separatorLineView.backgroundColor = [UIColor grayColor];// you can also put image here
    [cell.contentView addSubview:separatorLineView];
}


//--- Validate Nil & NULL from String ---//

+(NSString *)validateNilString:(NSString *)strValue
{
    
    NSString *returnString = @"";
    
    @try {
        if (!strValue)
            return returnString;
        
        if ([strValue isKindOfClass:[NSNull class]])
            return returnString;
        
        if ([strValue isEqualToString:@"<nil>"])
            return returnString;
        
        if ([strValue isEqualToString:@"<null>"])
            return returnString;
        
        if ([strValue isEqualToString:@"NULL"])
            return returnString;
        
        if ([strValue isEqualToString:@"nil"])
            return returnString;
        
        if ([strValue isEqualToString:@"(null)"])
            return returnString;
        
        return strValue;
    }
    @catch (NSException *exception)
    {
        NSLog(@"Exception :%@",exception);
        return returnString;
    }
}


//--- Trim String ---//

+(NSString*)trimString:(NSString*)str
{
    NSString *trimmedString = [str stringByTrimmingCharactersInSet:
                               [NSCharacterSet whitespaceAndNewlineCharacterSet]];
    
    
    return trimmedString;
}



//--- Add Left Nav Bar Item ---//

-(void)createLeftNavBarItem
{
    self.navigationItem.leftBarButtonItem = nil;
    self.navigationItem.hidesBackButton = YES;
    
    
    UIButton *btnLogo = [UIButton buttonWithType:UIButtonTypeCustom];
    btnLogo.frame = CGRectMake(0, 7, 30, 30);
    [btnLogo setImage:[UIImage imageNamed:@"logo_nav.png"] forState:UIControlStateNormal];
    [btnLogo setImage:[UIImage imageNamed:@"logo_nav.png"] forState:UIControlStateHighlighted];
    //[btnLogo addTarget:self action:@selector(buttonLogoPressed) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem *leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:btnLogo];
    
    
    if(ISIOS7OrGreater)
    {
        //--- reduce left margin from left in ios 7 ---//
        UIBarButtonItem *negativeSpacer = [[UIBarButtonItem alloc]
                                           initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace
                                           target:nil action:nil];
        
        negativeSpacer.width = -10;     // it was -6 in iOS 6
        
        
        
        
        [self.navigationItem setLeftBarButtonItems:[NSArray arrayWithObjects:negativeSpacer,leftBarButtonItem, nil] animated:NO];
        
    }
    else
    {
        self.navigationItem.leftBarButtonItem = leftBarButtonItem;
    }

}


-(void)buttonLogoPressed
{
    
}


//--- Set Right Nav Bar Item ---//

-(void)createRightNavBarItem
{
    UIButton *btnLogout = [UIButton buttonWithType:UIButtonTypeCustom];
    btnLogout.frame = CGRectMake(0, 0, 40, 40);
    [btnLogout setImage:[UIImage imageNamed:@"back_normal.png"] forState:UIControlStateNormal];
    [btnLogout setImage:[UIImage imageNamed:@"back_selected.png"] forState:UIControlStateSelected];
    
    [btnLogout addTarget:self action:@selector(rightButtobClick) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem *rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:btnLogout];
    
    
    
    if(ISIOS7OrGreater)
    {
        //reduce left margin from left in ios 7
        UIBarButtonItem *negativeSpacer = [[UIBarButtonItem alloc]
                                           initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace
                                           target:nil action:nil];
        negativeSpacer.width = -16;// it was -6 in iOS 6
        
        
        
        
        [self.navigationItem setRightBarButtonItems:[NSArray arrayWithObjects:negativeSpacer,rightBarButtonItem, nil] animated:NO];
        
    }
    else
    {
        self.navigationItem.rightBarButtonItem = rightBarButtonItem;
    }

}



-(void)rightButtobClick
{
    [self.navigationController popViewControllerAnimated:YES];
}



//--- Add Title View On Nav Bar ---//

-(void)addTitle:(NSString*)title
{
    //--- here to create a UILabel ---//
    UILabel *labelTitle = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 44)];
    labelTitle.backgroundColor = [UIColor clearColor];
    labelTitle.textColor = [UIColor blackColor];
    //labelTitle.shadowColor = [UIColor colorWithWhite:0.0 alpha:0.5];
    labelTitle.font = [UIFont systemFontOfSize:12.0];
    labelTitle.textAlignment = NSTextAlignmentLeft;
    labelTitle.numberOfLines = 0;
    labelTitle.text = NSLocalizedString(title,@"");
    self.navigationItem.titleView = labelTitle;

}













//--- Custom PopUp ---//

    AppDelegate *appDelegate  = ((AppDelegate *)[[UIApplication sharedApplication] delegate]);
    CustomPopup *viewCustomPopup = [[CustomPopup alloc] initWithFrame:appDelegate.window.bounds];
    viewCustomPopup.callBack = self;
    [viewCustomPopup showPopupForMultipleProcessedRequestResponse:arrayResponse1];
    [appDelegate.window addSubview:viewCustomPopup];






@interface CustomPopup : UIView
{
    
}

@property (nonatomic,weak) id callBack;

-(void)showPopupForTicketDetails:(NSMutableArray*)arrayTicketDetails andTicektId:(NSString*)ticketId;
-(void)showPopupForMultipleProcessedRequestResponse:(NSMutableArray*)arrayResponse;

@end



- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
    }
    return self;
}


-(void)showPopupForTicketDetails:(NSMutableArray*)arrayTicketDetails andTicektId:(NSString*)ticketId
{
    int windowHeight = [CommonUtilityController getWindowHeight];
    int windowWidth = [CommonUtilityController getWindowWidth];
    
    
    
    NSDictionary *dicTicketDetails = [arrayTicketDetails objectAtIndex:0];
    NSArray *arrayKeys1 = [dicTicketDetails allKeys];
    //NSArray *arrayValues = [dicTicketDetails allValues];

    
    NSSortDescriptor *sortOrder = [NSSortDescriptor sortDescriptorWithKey:@"self" ascending:YES];
    NSArray *arrayKeys = [arrayKeys1 sortedArrayUsingDescriptors: [NSArray arrayWithObject:sortOrder]];
    
    
    CGFloat xPos = 10;
    CGFloat yPos = 80;
    CGFloat width = windowWidth-20;
    CGFloat height = windowHeight-57-70;
    CGFloat diff = 0;
    //xPos = (windowWidth - width)/2;

    
    //--- Create UIView for Service Request ---//
    UIView *viewContent = [[UIView alloc] initWithFrame:CGRectMake(xPos, yPos, width, height)];
    [viewContent setBackgroundColor: [UIColor whiteColor]];
    [viewContent.layer setCornerRadius:10.0];
    [viewContent.layer setBorderWidth:0.5];
    [viewContent.layer setBorderColor:[CommonUtilityController colorWithHexString:kColorCodeTheam].CGColor];
    [self addSubview:viewContent];

    
    
    UILabel *labelHeader = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, width, 40)];
    [labelHeader setText:[NSString stringWithFormat:@"TICKETID-%@",ticketId]];
    [labelHeader setClipsToBounds:YES];
    [labelHeader setBackgroundColor:[CommonUtilityController colorWithHexString:kColorCodeTheam]];
    [labelHeader setTextColor:[UIColor whiteColor]];
    [labelHeader setTextAlignment:NSTextAlignmentCenter];
    [labelHeader setFont:[UIFont boldSystemFontOfSize:12]];
    [labelHeader setNumberOfLines:1];
    [labelHeader setBaselineAdjustment:UIBaselineAdjustmentAlignCenters];
    [labelHeader setAdjustsFontSizeToFitWidth:NO];
    [viewContent addSubview:labelHeader];
    
    CGRect bounds = labelHeader.bounds;
    UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:bounds
                                                   byRoundingCorners:(UIRectCornerTopLeft | UIRectCornerTopRight)
                                                         cornerRadii:CGSizeMake(10.0, 10.0)];
    CAShapeLayer *maskLayer = [CAShapeLayer layer];
    maskLayer.frame = bounds;
    maskLayer.path = maskPath.CGPath;
    labelHeader.layer.mask = maskLayer;
    
    
    
    UIScrollView *scrolBG = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 40, width, viewContent.bounds.size.height-80.0)];
    scrolBG.backgroundColor = [UIColor clearColor];
    [viewContent addSubview:scrolBG];

    
    
    
    
    
    CGFloat yPos1 = 0.0;
    
    for(int i=0; i<arrayKeys.count; i++)
    {
        NSString *strLeftHand = [arrayKeys objectAtIndex:i];
        
        NSString *strRightHand = [dicTicketDetails objectForKey:strLeftHand];
        
        CGFloat heightLabelRight = [CommonUtilityController calculateHeightForString:strRightHand withFont:[UIFont systemFontOfSize:12] withWidth:(width/2)-10]+20;
        
        
        UILabel *labelLeft = [[UILabel alloc] initWithFrame:CGRectMake(5, yPos1, (width/2)-10, heightLabelRight)];
        [labelLeft setText:[NSString stringWithFormat:@"%@:",strLeftHand]];
        [labelLeft setClipsToBounds:YES];
        [labelLeft setBackgroundColor:[UIColor clearColor]];
        [labelLeft setTextColor:[UIColor blackColor]];
        [labelLeft setTextAlignment:NSTextAlignmentCenter];
        [labelLeft setFont:[UIFont systemFontOfSize:12]];
        [labelLeft setNumberOfLines:0];
        [labelLeft setLineBreakMode:NSLineBreakByWordWrapping];
        [labelLeft setBaselineAdjustment:UIBaselineAdjustmentAlignCenters];
        [labelLeft setAdjustsFontSizeToFitWidth:NO];
        [scrolBG addSubview:labelLeft];
        
    
        UILabel *labelRight = [[UILabel alloc] initWithFrame:CGRectMake((width/2)+5, yPos1, (width/2)-10, heightLabelRight)];
        [labelRight setText:strRightHand];
        [labelRight setClipsToBounds:YES];
        [labelRight setBackgroundColor:[UIColor clearColor]];
        [labelRight setTextColor:[UIColor blackColor]];
        [labelRight setTextAlignment:NSTextAlignmentLeft];
        [labelRight setFont:[UIFont systemFontOfSize:12]];
        [labelRight setNumberOfLines:0];
        [labelRight setLineBreakMode:NSLineBreakByWordWrapping];
        [labelRight setBaselineAdjustment:UIBaselineAdjustmentAlignCenters];
        [labelRight setAdjustsFontSizeToFitWidth:NO];
        [scrolBG addSubview:labelRight];
        
        
        
        UIView *viewBottomLine = [[UIView alloc] initWithFrame:CGRectMake(0, yPos1+heightLabelRight-1, width, 0.5)];
        [viewBottomLine setBackgroundColor:[CommonUtilityController colorWithHexString:kColorCodeFieldBoundry]];
        [scrolBG addSubview:viewBottomLine];
        
        
        
        yPos1 = yPos1+heightLabelRight+diff;
    }
    
    [scrolBG setContentSize:CGSizeMake(width, yPos1)];
    
    
    
    
    UIButton *buttonSave = [UIButton buttonWithType:UIButtonTypeCustom];
    [buttonSave setFrame:CGRectMake((viewContent.frame.size.width-80)/2, viewContent.frame.size.height-35, 80, 30)];
    [buttonSave setEnabled:YES];
    [buttonSave.layer setCornerRadius:3.0];
    [buttonSave.layer setBorderWidth:1.0];
    [buttonSave.layer setBorderColor:[[CommonUtilityController colorWithHexString:kColorCodeBtnBoundry] CGColor]];
    [buttonSave setBackgroundColor:[CommonUtilityController colorWithHexString:kColorCodeBtnBg]];
    [buttonSave setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [buttonSave.titleLabel setFont:[UIFont systemFontOfSize:13]];
    [buttonSave setShowsTouchWhenHighlighted:YES];
    //[buttonSave setBackgroundImage:[UIImage imageNamed:@"save.png"] forState:UIControlStateNormal];
    [buttonSave setTitle:@"OK" forState:UIControlStateNormal];
    [buttonSave addTarget:self action:@selector(buttonOKClick) forControlEvents:UIControlEventTouchUpInside];
    [viewContent addSubview:buttonSave];

    
}


-(void)buttonOKClick
{
    if(self.callBack != nil && [self.callBack respondsToSelector:@selector(removePopup)])
    {
        [self.callBack performSelector:@selector(removePopup) withObject:nil afterDelay:0.0];
    }
    
    [self removeFromSuperview];
    
}

-(void)removePopup
{
    
}


@end





//--- Design Custom Cell ---//

-(void)designCellComponents:(NSString*)descriptionString;


- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self)
    {
        
        self.contentView.clipsToBounds = YES;
    }
    
    
    
    return self;
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}



-(void)designCellComponents:(NSString*)descriptionString
{
    int windowWidth = [CommonUtilityController getWindowWidth];
    
    
    UIFont *font = [UIFont systemFontOfSize:11.0];
    
    CGFloat cellHeight = [CommonUtilityController calculateHeightForString:descriptionString withFont:font withWidth:windowWidth-45]+33;
    CGFloat labelDescriptionHeight = [CommonUtilityController calculateHeightForString:descriptionString withFont:font withWidth:windowWidth-45];
    
    
    self.imgView = [[UIImageView alloc] initWithFrame:CGRectMake(5, (cellHeight-30)/2, 30, 30)];
    [self.imgView setBackgroundColor:[UIColor clearColor]];
    [self.contentView addSubview:self.imgView];
    
    /*
    UIView* viewLine = [[UIView alloc] initWithFrame:CGRectMake(40, 5, 0.5, cellHeight-10)];
    [viewLine setBackgroundColor:[CommonUtilityController colorWithHexString:kColorCodeLightGray]];
    [self.contentView addSubview:viewLine];
    */
    
    self.labelTicketId = [[UILabel alloc] initWithFrame:CGRectMake(45, 3, windowWidth-45-100, 21)];
    [self.labelTicketId setBackgroundColor:[UIColor clearColor]];
    [self.labelTicketId setNumberOfLines:1];
    [self.labelTicketId setTextAlignment:NSTextAlignmentLeft];
    [self.labelTicketId setFont:[UIFont systemFontOfSize:12]];
    [self.labelTicketId setTextColor:[CommonUtilityController colorWithHexString:kColorCodeTitle]];
    [self.labelTicketId setLineBreakMode:NSLineBreakByTruncatingTail];
    [self.labelTicketId setAdjustsFontSizeToFitWidth:NO];
    [self.labelTicketId setBaselineAdjustment:UIBaselineAdjustmentAlignBaselines];
    [self.contentView addSubview:self.labelTicketId];
    
    
    self.labelStaus = [[UILabel alloc] initWithFrame:CGRectMake((windowWidth-95), 3, 90, 21)];
    [self.labelStaus setBackgroundColor:[UIColor clearColor]];
    [self.labelStaus setNumberOfLines:1];
    [self.labelStaus setTextAlignment:NSTextAlignmentRight];
    [self.labelStaus setFont:[UIFont systemFontOfSize:12]];
    [self.labelStaus setTextColor:[CommonUtilityController colorWithHexString:kColorCodeTitle]];
    [self.labelStaus setLineBreakMode:NSLineBreakByTruncatingTail];
    [self.labelStaus setAdjustsFontSizeToFitWidth:NO];
    [self.labelStaus setBaselineAdjustment:UIBaselineAdjustmentAlignBaselines];
    [self.contentView addSubview:self.labelStaus];
    
    
    
    self.labelDescription = [[UILabel alloc] initWithFrame:CGRectMake(45, 22, windowWidth-50, labelDescriptionHeight+4)];
    [self.labelDescription setBackgroundColor:[UIColor clearColor]];
    [self.labelDescription setNumberOfLines:0];
    [self.labelDescription setTextAlignment:NSTextAlignmentLeft];
    [self.labelDescription setFont:[UIFont systemFontOfSize:11]];
    [self.labelDescription setTextColor:[CommonUtilityController colorWithHexString:kColorCodeDesc]];
    [self.labelDescription setLineBreakMode:NSLineBreakByCharWrapping];
    [self.labelDescription setAdjustsFontSizeToFitWidth:NO];
    [self.labelDescription setBaselineAdjustment:UIBaselineAdjustmentAlignBaselines];
    [self.contentView addSubview:self.labelDescription];
    
    
    
    CGFloat heightBottomLine = 0.0;
    
    if(ISIphone)
        heightBottomLine = 0.5;
    else
        heightBottomLine = 1.0;
    
    
    UIView *viewBottomLine = [[UIView alloc] initWithFrame:CGRectMake(0, cellHeight-heightBottomLine, windowWidth, heightBottomLine)];
    [viewBottomLine setBackgroundColor:[CommonUtilityController colorWithHexString:kColorCodeLightGray]];
    [self.contentView addSubview:viewBottomLine];
    
}



@end













//--- Create Table View ---//
    
    
    self.tableViewItemsList = [[UITableView alloc]initWithFrame:CGRectMake(0, searchBarHeight, windowWidth, windowHeight-searchBarHeight-38-57) style:UITableViewStylePlain];
    [self.tableViewItemsList setBackgroundColor:[UIColor clearColor]];
    self.tableViewItemsList.rowHeight = 44;
    self.tableViewItemsList.sectionFooterHeight = 0;
    self.tableViewItemsList.sectionHeaderHeight = 0;
    self.tableViewItemsList.scrollEnabled = YES;
    self.tableViewItemsList.showsVerticalScrollIndicator = YES;
    self.tableViewItemsList.userInteractionEnabled = YES;
    self.tableViewItemsList.bounces = YES;
    [self.tableViewItemsList setSeparatorStyle:UITableViewCellSeparatorStyleSingleLine];
    
    self.tableViewItemsList.delegate = self;
    self.tableViewItemsList.dataSource = self;
    
    self.tableViewItemsList.tableFooterView = [[UIView alloc] init];
    
    
    [self.tableViewItemsList registerClass:[MyActivityCell class] forCellReuseIdentifier:@"ASSET"];
    [self.view addSubview:self.tableViewItemsList];
    
    
    [self.tableViewItemsList reloadData];




#pragma mark- UITableView Delegate Methods ::


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.arrayItemsList.count;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"ASSET";
    
    MyActivityCell *cell = (MyActivityCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
    
    if (!cell)
    {
        cell = [[MyActivityCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
    }
    
    [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
    [cell setAccessoryType:UITableViewCellAccessoryNone];
    
    [cell.contentView.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];
    [cell designCellComponents:[[self.arrayItemsList objectAtIndex:indexPath.row] objectForKey:@"DESCRIPTION"]];
    
    
    [cell.imgView setImage:[UIImage imageNamed:kImageTicketAssets]];
    [cell.labelTicketId setText:[NSString stringWithFormat:@"ASSETNUM-%@",[[self.arrayItemsList objectAtIndex:indexPath.row] objectForKey:@"ASSETNUM"]]];
    [cell.labelStaus setText:[[self.arrayItemsList objectAtIndex:indexPath.row] objectForKey:@"STATUS"]];
    [cell.labelDescription setText:[[self.arrayItemsList objectAtIndex:indexPath.row] objectForKey:@"DESCRIPTION"]];
    
    return cell;
}


- (void)tableView:(UITableView *)theTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    AssetDetailViewController *objAssetDetailViewController = [[AssetDetailViewController alloc] init];
    [objAssetDetailViewController setDicItemDetail:[self.arrayItemsList objectAtIndex:indexPath.row]];
    [self.navigationController pushViewController:objAssetDetailViewController animated:YES];
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSString *locationString = [[self.arrayItemsList objectAtIndex:indexPath.row] objectForKey:@"DESCRIPTION"];
    
    UIFont *font = [UIFont systemFontOfSize:11.0];
    int windowWidth = [CommonUtilityController getWindowWidth];
    
    CGFloat cellHeight = [CommonUtilityController calculateHeightForString:locationString withFont:font withWidth:windowWidth-45];
    
    return cellHeight+33;
}










//--- Add Done Button On Number Pad ---//


-(void)addDoneButton:(UITextView*)textView
{
    int windowWidth = [CommonUtilityController getWindowWidth];
    
    UIToolbar* doneToolbar = [[UIToolbar alloc]initWithFrame:CGRectMake(0, 0, windowWidth, 50)];
    doneToolbar.barStyle = UIBarStyleBlackTranslucent;
    doneToolbar.items = [NSArray arrayWithObjects:
                         [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil],
                         [[UIBarButtonItem alloc]initWithTitle:@"Done" style:UIBarButtonItemStyleDone target:self action:@selector(doneButtonAction)],
                         nil];
    [doneToolbar sizeToFit];
    
    
    textView.inputAccessoryView = doneToolbar;
    
}

-(void)doneButtonAction
{
    [self.textViewMemo resignFirstResponder];
}