本文整理汇总了C#中ResponseBool类的典型用法代码示例。如果您正苦于以下问题:C# ResponseBool类的具体用法?C# ResponseBool怎么用?C# ResponseBool使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ResponseBool类属于命名空间,在下文中一共展示了ResponseBool类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetInvalidateCache
public HttpResponseMessage GetInvalidateCache()
{
var response = new ResponseBool();
_masterDataCachingInvalidator.InvalidateMasterDataCaching();
response.Success = true;
return Request.CreateResponse(HttpStatusCode.OK, response);
}
示例2: SaveContacts
protected async Task<bool> SaveContacts(MasterEntity entity)
{
using (var c = NestedContainer)
{
if(!ContactsList.Any(n => n.IsDirty)) return true;
_proxy = Using<IDistributorServiceProxy>(c);
ResponseBool response = new ResponseBool { Success = false };
var itemsToSave = new List<ContactItem>();
foreach (var item in ContactsList.Where(n => n.IsDirty))
{
var contactItem = new ContactItem
{
MasterId = item.Contact.Id,
DateOfBirth = item.Contact.DateOfBirth,
MaritalStatusMasterId = (int)item.Contact.MStatus,
BusinessPhone = item.Contact.BusinessPhone,
ChildrenNames = item.Contact.ChildrenNames,
City = item.Contact.City,
Company = item.Contact.Company,
ContactClassification = (int)item.Contact.ContactClassification,
ContactOwnerType = item.Contact.ContactOwnerType,
ContactOwnerMasterId = entity.Id,
DateCreated = item.Contact._DateCreated,
Email = item.Contact.Email,
Fax = item.Contact.Fax,
Firstname = item.Contact.Firstname,
HomePhone = item.Contact.HomePhone,
HomeTown = item.Contact.HomeTown,
JobTitle = item.Contact.JobTitle,
Lastname = item.Contact.Lastname,
MobilePhone = item.Contact.MobilePhone,
PhysicalAddress = item.Contact.PhysicalAddress,
PostalAddress = item.Contact.PostalAddress,
SpouseName = item.Contact.SpouseName,
WorkExtPhone = item.Contact.WorkExtPhone,
DateLastUpdated = DateTime.Now,
StatusId = (int)EntityStatus.Active,
IsNew = item.IsNew
};
if (item.Contact.ContactType != null) contactItem.ContactTypeMasterId = item.Contact.ContactType.Id;
itemsToSave.Add(contactItem);
}
if (itemsToSave.Count > 0)
{
response = await _proxy.ContactsAddAsync(itemsToSave.ToList());
MessageBox.Show(response.ErrorInfo, "Agrimanagr: Manage contacts", MessageBoxButton.OK,
MessageBoxImage.Information);
}
else response.Success = true;
return response.Success;
}
}
示例3: GetIsAlive
public HttpResponseMessage GetIsAlive()
{
var result = new ResponseBool();
try
{
// _onRequestRepository.RetireCommands(Guid.NewGuid() );
_costCentreRepository.GetById(Guid.Empty);
result.Success = true;
}catch(Exception exception)
{
result.ErrorInfo = exception.Message;
result.Success = false;
}
return Request.CreateResponse(HttpStatusCode.OK, result);
}
示例4: OutletUpdateAsync
public async Task<ResponseBool> OutletUpdateAsync(OutletItem outletItem)
{
ResponseBool _response = new ResponseBool { Success = false, ErrorInfo = "" };
string url = string.Format("api/distributorservices/outletupdate");
var httpClient = setupHttpClient();
httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
try
{
var response = await httpClient.PostAsJsonAsync(url, outletItem);
_response = await response.Content.ReadAsAsync<ResponseBool>();
}
catch (Exception ex)
{
_response.ErrorInfo = "Error: An error occurred when updating the outlet.\nCause: " + ex.Message;
_log.Error("Failed to update outlet", ex);
}
return _response;
}
示例5: MarkOrderAsExported
public HttpResponseMessage MarkOrderAsExported(string userName, string password,string orderExternalRef)
{
var transactionResponse = new ResponseBool();
try
{
_log.InfoFormat("Login attempt for {0} - GetNextOrder", userName);
CostCentreLoginResponse response = _costCentreApplicationService.CostCentreLogin(userName, password, "HQAdmin");
AuditCCHit(response.CostCentreId, "Login", "Login attempt for ", response.ErrorInfo);
if (response.CostCentreId == Guid.Empty)
{
transactionResponse.ErrorInfo = "Invalid user credentials";
transactionResponse.Success = false;
}
else
{
var data = _orderExportDocumentRepository.MarkAsExported(orderExternalRef);
if (data )
{
transactionResponse.Success = true;
}
else
{
transactionResponse.ErrorInfo = "Failed to mark as exported";
transactionResponse.Success = false;
}
}
}
catch (Exception ex)
{
transactionResponse.Success = false;
transactionResponse.ErrorInfo = "Error: An error occurred executing the task.Result details=>" + ex.Message + "Inner Exception:" + (ex.InnerException != null ? ex.InnerException.Message : "");
//_log.Error(string.Format("Error: An error occurred when exporting transactions for {0}\n"), ex);
}
return Request.CreateResponse(HttpStatusCode.OK, transactionResponse);
}
示例6: PurchasingCerkAddAsync
public async Task<ResponseBool> PurchasingCerkAddAsync(PurchasingClerkItem purchasingClerkItem)
{
ResponseBool _response = new ResponseBool { Success = false, ErrorInfo = "" };
string url = string.Format("api/distributorservices/purchasingclerkadd");
var httpClient = setupHttpClient();
httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
try
{
var response = await httpClient.PostAsJsonAsync(url, purchasingClerkItem);
_response = await response.Content.ReadAsAsync<ResponseBool>();
}
catch (Exception ex)
{
_response.ErrorInfo = "Error: An error occurred when adding purchasing clerk.\n" + ex.Message;
_log.Error("Error: An error occurred when adding purchasing clerk.", ex);
}
return _response;
}
示例7: SupplierMappingSaveAsync
public async Task<ResponseBool> SupplierMappingSaveAsync(CostCentreMapping mapping)
{
ResponseBool _response = new ResponseBool { Success = false, ErrorInfo = "" };
string url = string.Format("api/distributorservices/commoditysuppliermapping");
var httpClient = setupHttpClient();
httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
try
{
var response = await httpClient.PostAsJsonAsync(url, mapping);
_response = await response.Content.ReadAsAsync<ResponseBool>();
}
catch (Exception ex)
{
_response.ErrorInfo = "Failed to save supplier outlet Mapping.\n" + ex.Message;
_log.Error("Failed tosave supplier outlet Mapping", ex);
}
return _response;
}
示例8: VehicleAddAsync
public async Task<ResponseBool> VehicleAddAsync(Vehicle vehicle)
{
ResponseBool _response = new ResponseBool { Success = false, ErrorInfo = "" };
string url = string.Format("api/distributorservices/vehicleadd");
var httpClient = setupHttpClient();
httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
try
{
var response = await httpClient.PostAsJsonAsync(url, vehicle);
_response = await response.Content.ReadAsAsync<ResponseBool>();
}
catch (Exception ex)
{
_log.Error("Failed to update store.\nCause:", ex);
}
return _response;
}
示例9: ShiftDeleteAsync
public async Task<ResponseBool> ShiftDeleteAsync(Guid id)
{
ResponseBool _response = new ResponseBool { Success = false, ErrorInfo = "" };
string url = string.Format("api/pushmasterdata/shift/delete/{0}", id);
var httpClient = setupHttpClient();
try
{
var response = await httpClient.GetAsync(url);
_response = await response.Content.ReadAsAsync<ResponseBool>();
}
catch (Exception ex)
{
_response.ErrorInfo = "Error: An error occurred when deleting the shift.\nCause: " + ex.Message;
_log.Error("Failed to delete shift.", ex);
}
return _response;
}
示例10: BankUpdateAsync
public async Task<ResponseBool> BankUpdateAsync(BankItem bankItem)
{
ResponseBool _response = new ResponseBool { Success = false, ErrorInfo = "" };
bool success = false;
string url = string.Format("api/distributorservices/bankupdate");
var httpClient = setupHttpClient();
httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
try
{
var response = await httpClient.PostAsJsonAsync(url, bankItem);
_response = await response.Content.ReadAsAsync<ResponseBool>();
if (response.IsSuccessStatusCode)
success = true;
}
catch (Exception ex)
{
_log.Error("Failed to update bank", ex);
}
return _response;
}
示例11: DeleteSelected
protected override async void DeleteSelected()
{
if (
MessageBox.Show("Are you sure you want to delete this weighing scale?",
"Agrimanagr: Delete Weighing Scale", MessageBoxButton.OKCancel) ==
MessageBoxResult.Cancel) return;
using (var c = NestedContainer)
{
ResponseBool response = new ResponseBool() { Success = false };
if (SelectedWeighingScale == null) return;
_proxy = Using<IDistributorServiceProxy>(c);
response = await _proxy.EquipmentDeleteAsync(SelectedWeighingScale.WeighingScale.Id);
if(response.Success)
{
Using<IEquipmentRepository>(c).SetAsDeleted(SelectedWeighingScale.WeighingScale);
if (DeleteDeviceLocalSettings(SelectedWeighingScale.WeighingScale))
MessageBox.Show("A problem occurred while deleting the device local configuration settings.",
"Device Local Configuration Settings Manager", MessageBoxButton.OK,
MessageBoxImage.Exclamation);
}
MessageBox.Show(response.ErrorInfo, "Agrimangr: Manage Weighing Scales", MessageBoxButton.OK,
MessageBoxImage.Information);
}
}
示例12: OutletVisitAddAsync
public async Task<ResponseBool> OutletVisitAddAsync(List<OutletVisitDayItem> visitDays)
{
ResponseBool _response = new ResponseBool { Success = false, ErrorInfo = "" };
string url = string.Format("api/distributorservices/outletvisitdayadd");
var httpClient = setupHttpClient();
httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
try
{
var response = await httpClient.PostAsJsonAsync(url, visitDays);
_response = await response.Content.ReadAsAsync<ResponseBool>();
}
catch (Exception ex)
{
_log.Error("Failed to add outletvisit", ex);
_response.ErrorInfo = "Failed to add outletvisit \n" + ex.Message;
}
return _response;
}
示例13: ContactsAddAsync
public async Task<ResponseBool> ContactsAddAsync(List<ContactItem> contactItems)
{
ResponseBool _response = new ResponseBool { Success = false, ErrorInfo = "" };
string url = string.Format("api/distributorservices/contactsadd");
var httpClient = setupHttpClient();
httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
try
{
var response = await httpClient.PostAsJsonAsync(url, contactItems);
_response = await response.Content.ReadAsAsync<ResponseBool>();
}
catch (Exception ex)
{
_log.Error("Error: An error occurred when saving the contact.", ex);
_response.ErrorInfo = "Error: An error occurred when saving the contact.\n" +
ex.Message;
}
return _response;
}
示例14: MasterDataAllocationDeleteAsync
public async Task<ResponseBool> MasterDataAllocationDeleteAsync(List<Guid> ids)
{
ResponseBool _response = new ResponseBool { Success = false, ErrorInfo = "" };
string url = string.Format("api/distributorservices/masterdataallocationdelete/{0}", ids);
var httpClient = setupHttpClient();
try
{
var response = await httpClient.PostAsJsonAsync(url, ids);
_response = await response.Content.ReadAsAsync<ResponseBool>();
}
catch (Exception ex)
{
_response.ErrorInfo = "Error: An error occurred when deleting the allocation.\nCause: " + ex.Message;
_log.Error("Failed to delete allocation.", ex);
}
return _response;
}
示例15: OutletPriorityDeactivateAsync
public async Task<ResponseBool> OutletPriorityDeactivateAsync(Guid outletId)
{
ResponseBool _response = new ResponseBool { Success = false, ErrorInfo = "" };
string url = string.Format("api/distributorservices/outletprioritydeactivate/{0}", outletId);
var httpClient = setupHttpClient();
httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
try
{
var response = await httpClient.GetAsync(url);
_response = await response.Content.ReadAsAsync<ResponseBool>();
}
catch (Exception ex)
{
_log.Error("Failed to deactivate priority", ex);
_response.ErrorInfo = "Failed to deactivate priority\n" + ex.Message;
}
return _response;
}