示例#1
0
        private static void map(DAL.CustomersDataContext dc, Phone p, DAL.Phone dalPhone)
        {
            bool isNew = p.Id == 0;
            bool isModified = false;

            if (dalPhone.CountryCallingCode != p.CountryCallingCode)
            {
                dalPhone.CountryCallingCode = p.CountryCallingCode;
                isModified = true;
            }

            if (dalPhone.Number != p.Number)
            {
                dalPhone.Number = p.Number;
                isModified = true;
            }

            DAL.PhoneType pt = p.PhoneType.findPhoneType(dc);
            if ((dalPhone.PhoneType == null) || (dalPhone.PhoneType.Id != pt.Id))
            {
                dalPhone.PhoneType = pt;
                isModified = true;
            }

            if (dalPhone.CustomerId != p.CustomerId)
            {
                dalPhone.CustomerId = p.CustomerId;
                isModified = true;
            }

            if (isNew)
            {
                dalPhone.CreatedBy = p.LastChangedBy;
                dalPhone.CreatedDate = DateTime.Now;
            }

            if (isModified)
            {
                dalPhone.LastChangedBy = p.LastChangedBy;
                dalPhone.LastChangedDate = DateTime.Now;
            }
        }
示例#2
0
 private static void map(DAL.Phone dalPhone, Phone phone)
 {
     phone.CountryCallingCode = dalPhone.CountryCallingCode;
     phone.Number = dalPhone.Number;
     phone.PhoneType = (Type)Enum.Parse(typeof(Type), dalPhone.PhoneType.TypeName);
     phone.Id = dalPhone.Id;
     phone.CustomerId = dalPhone.CustomerId;
 }
示例#3
0
 internal static void Delete(DAL.CustomersDataContext dc, Phone item)
 {
     DAL.Phone dalPhone = dc.Phones.Where(p => p.Id == item.Id).Where(p => !p.Deleted).Single();
     dalPhone.Deleted = true;
     dc.SubmitChanges();
 }
示例#4
0
 public Phone(Phone.Type at)
 {
     this.PhoneType = at;
     this.LastChangedBy = 0; // TODO: get this from paymentStatusCodeId parameter
 }
 internal static Phone createRandomPhone()
 {
     Phone p = new Phone(Phone.Type.Home);
     p.CountryCallingCode = "1" + rnd.Next(10);
     p.Number = rnd.Next().ToString();
     return p;
 }