Beispiel #1
0
        /// <summary>
        /// This method is used to update contact person of supplier in database. - JJ
        /// </summary>
        /// <param name="contactPerson">object of ContactPersonAC </param>
        /// <returns>object of SupplierContactPerson </returns>
        public SupplierContactPerson UpdateContact(ContactPersonAC contactPerson)
        {
            try
            {
                var updateContact = _supplierContactPersonContext.GetById(contactPerson.ContactId);

                updateContact.SupplierId       = contactPerson.SupplierId;
                updateContact.ContactNameEn    = contactPerson.ContactNameEn;
                updateContact.ContactNameSl    = contactPerson.ContactNameSl;
                updateContact.ContactAddressEn = contactPerson.ContactAddressEn;
                updateContact.ContactAddressSl = contactPerson.ContactAddressSl;
                updateContact.ContactPhone     = contactPerson.ContactPhone;
                updateContact.ContactFax       = contactPerson.ContactFax;
                updateContact.ContactEmail     = contactPerson.ContactEmail;
                updateContact.PhoneExtension   = contactPerson.PhoneExtension;
                updateContact.JobTitleEn       = contactPerson.JobTitleEn;
                updateContact.JobTitleSl       = contactPerson.JobTitleSl;
                updateContact.ContactIsDeleted = contactPerson.ContactIsDeleted;
                updateContact.ModifiedDateTime = DateTime.UtcNow;
                _supplierContactPersonContext.Update(updateContact);
                _supplierContactPersonContext.SaveChanges();
                return(updateContact);
            }
            catch (Exception ex)
            {
                _errorLog.LogException(ex);
                throw;
            }
        }
Beispiel #2
0
 /// <summary>
 /// This method is used for insert new contact person of supplier in database. - JJ
 /// </summary>
 /// <param name="contactPerson">object of SupplierProfileAC </param>
 /// <returns>object of SupplierContactPerson </returns>
 public SupplierContactPerson SaveContactPerson(ContactPersonAC contactPerson)
 {
     try
     {
         var contactPersons = new SupplierContactPerson
         {
             SupplierId       = contactPerson.SupplierId,
             ContactNameEn    = contactPerson.ContactNameEn,
             ContactNameSl    = contactPerson.ContactNameSl,
             JobTitleEn       = contactPerson.JobTitleEn,
             JobTitleSl       = contactPerson.JobTitleSl,
             ContactAddressEn = contactPerson.ContactAddressEn,
             ContactAddressSl = contactPerson.ContactAddressSl,
             ContactPhone     = contactPerson.ContactPhone,
             PhoneExtension   = contactPerson.PhoneExtension,
             ContactFax       = contactPerson.ContactFax,
             ContactEmail     = contactPerson.ContactEmail,
             ContactIsDeleted = contactPerson.ContactIsDeleted,
             CreatedDateTime  = DateTime.UtcNow
         };
         _supplierContactPersonContext.Add(contactPersons);
         _supplierContactPersonContext.SaveChanges();
         contactPerson.ContactId = contactPersons.Id;
         return(contactPersons);
     }
     catch (Exception ex)
     {
         _errorLog.LogException(ex);
         throw;
     }
 }
 public IHttpActionResult GetContactPersonList(int id)
 {
     try
     {
         if (HttpContext.Current.User.Identity.IsAuthenticated)
         {
             var contactPersonList       = _supplierProfileContext.GetContactPersonList(id);
             var contactPersonCollection = new List <ContactPersonAC>();
             var contactAC = new ContactPersonAC();
             foreach (var contact in contactPersonList)
             {
                 contactAC           = ApplicationClassHelper.ConvertType <SupplierContactPerson, ContactPersonAC>(contact);
                 contactAC.ContactId = contact.Id;
                 contactPersonCollection.Add(contactAC);
             }
             return(Ok(contactPersonCollection));
         }
         else
         {
             return(BadRequest());
         }
     }
     catch (Exception ex)
     {
         _errorLog.LogException(ex);
         throw;
     }
 }
 public IHttpActionResult UpdateContactPerson(ContactPersonAC contact)
 {
     try
     {
         if (HttpContext.Current.User.Identity.IsAuthenticated)
         {
             var contactPerson = _supplierProfileContext.UpdateContact(contact);
             return(Ok(contactPerson));
         }
         else
         {
             return(BadRequest());
         }
     }
     catch (Exception ex)
     {
         _errorLog.LogException(ex);
         throw;
     }
 }