string customerName = customerEntity.FirstName + " " + customerEntity.LastName;
ICustomerDataAccess dataaccess = new CustomerDataAccess();
/// reading the existing customer details before updating
AxdCustomer customer = dataaccess.GetCustomerDetailsById(PrepareQueryCriteria(customerEntity.TargetCustomerId));
AxdEntity_CustTable custTable = customer.CustTable[0];
AxdType_DateTime dateTime = new AxdType_DateTime();
dateTime.localDateTime = DateTime.Now.ToUniversalTime();
dateTime.timezone = AxdEnum_Timezone.GMTMINUS0500INDIANA;
dateTime.Value = dateTime.localDateTime;
customer.ValidAsOfDateTime = dateTime;
customer.ValidTimeStateType = AxdEnum_AxdValidTimeStateType.Range;
customer.ValidTimeStateTypeSpecified = true;
customer.ValidToDateTime = dateTime;
customer.ValidFromDateTime = dateTime;
custTable.AccountNum = customerEntity.TargetCustomerId;
custTable.Currency = “USD”; // We need to map this one also
custTable.CustGroup = customerEntity.CustomerGroupEntity.CustomerGroup;
if (customerEntity.IsGuestCustomer)
{
custTable.OneTimeCustomer = customerEntity.IsGuestCustomer ? AxdExtType_OneTimeCustomer.Yes : AxdExtType_OneTimeCustomer.No;
custTable.OneTimeCustomerSpecified = true;
}
custTable.action = AxdEnum_AxdEntityAction.update;
custTable.actionSpecified = true;
if (custTable.DirParty[0].DirPartyContactInfoView != null)
{
custTable.DirParty[0].DirPartyContactInfoView[0].action = AxdEnum_AxdEntityAction.update;
custTable.DirParty[0].DirPartyContactInfoView[0].actionSpecified = true;
}
if (custTable.DirParty[0].DirPartyPostalAddressView != null)
{
IList<AxdEntity_DirPartyPostalAddressView> dirpostalAddress = custTable.DirParty[0].DirPartyPostalAddressView;
foreach (AxdEntity_DirPartyPostalAddressView address in dirpostalAddress)
{
address.action = AxdEnum_AxdEntityAction.update;
address.actionSpecified = true;
}
}
if (custTable.DirParty != null)
{
custTable.DirParty[0].action = AxdEnum_AxdEntityAction.update;
custTable.DirParty[0].actionSpecified = true;
}
customer.CustTable = new AxdEntity_CustTable[1] { custTable };
Update the customer through this
CustomerServiceClient proxy = new CustomerServiceClient();
proxy.update(callContext, entityKeyList, axCustomerObject);
Thanks,
Srinivasulun.