-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCustomer.swift
55 lines (46 loc) · 1.45 KB
/
Customer.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//
// Customer.swift
// Prototype2
//
// Created by Andrew Magdy on 258//15.
// Copyright © 2015 Andrew Magdy. All rights reserved.
//
import Foundation
import CoreData
class Customer: NSManagedObject {
class func createInManagedObjectContext(moc: NSManagedObjectContext, companyName: String,
id: String,
customerName: String,
mobileno: String,
salary: NSNumber,
customerType: String,
canHaveCheckBook: NSNumber,
canHaveUnlimitedCredit: NSNumber,
hasCheckBook: NSNumber,
hasUnlimitedCredit: NSNumber,
loanLimit: NSNumber,
creditLimit: NSNumber,
maxCreditLimit: NSNumber,
maxLoanLimit: NSNumber,
supportingDocument: NSData,
employeeCompany: Company) -> Customer {
let newItem = NSEntityDescription.insertNewObjectForEntityForName("Customer", inManagedObjectContext: moc) as! Customer
newItem.companyName = companyName
newItem.id = id
newItem.customerName = customerName
newItem.mobileno = mobileno
newItem.salary = salary
newItem.customerType = customerType
newItem.canHaveCheckBook = canHaveCheckBook
newItem.canHaveUnlimitedCredit = canHaveUnlimitedCredit
newItem.hasCheckBook = hasCheckBook
newItem.hasUnlimitedCredit = hasUnlimitedCredit
newItem.loanLimit = loanLimit
newItem.creditLimit = creditLimit
newItem.maxCreditLimit = maxCreditLimit
newItem.maxLoanLimit = maxLoanLimit
newItem.supportingDocument = supportingDocument
newItem.employeeCompany = employeeCompany
return newItem
}
}