public static void ExecuteCommand(string parameter, EventHandler <DataPortalResult <TestCommandBase> > handler, object userState) { var dp = new DataPortal <TestCommandBase>(); dp.ExecuteCompleted += handler; dp.BeginExecute(new TestCommandBase(parameter), userState); }
private static void IsDuplicateName(AsyncValidationRuleContext context) { DuplicateCompanyCommand command = new DuplicateCompanyCommand(context.PropertyValues["CompanyName"].ToString(), (int)context.PropertyValues["CompanyId"]); DataPortal <DuplicateCompanyCommand> dp = new DataPortal <DuplicateCompanyCommand>(); dp.ExecuteCompleted += (o, e) => { if (e.Error != null) { context.OutArgs.Description = String.Format("Error checking for duplicate company name. {0}", e.Error); context.OutArgs.Severity = RuleSeverity.Error; context.OutArgs.Result = false; } else { if (e.Object.IsDuplicate) { context.OutArgs.Description = "Duplicate company name."; context.OutArgs.Severity = RuleSeverity.Error; context.OutArgs.Result = false; } else { context.OutArgs.Result = true; } } context.Complete(); }; dp.BeginExecute(command); }
/// <summary> /// Async lookup of customer name /// </summary> /// <param name="customerId"> /// The customer id. /// </param> /// <param name="callback"> /// The callback function to execute when async call is completed. /// </param> public static void BeginExecute(int customerId, EventHandler <DataPortalResult <LookupCustomerCommand> > callback) { var cmd = new LookupCustomerCommand(); cmd.CustomerId = customerId; DataPortal.BeginExecute <LookupCustomerCommand>(cmd, callback); }
/// <summary> /// Async Exist of customer name /// </summary> /// <param name="customerName"> /// The customer Name. /// </param> /// <param name="callback"> /// The callback function to execute when async call is completed. /// </param> public static void BeginExecute(string name, EventHandler <DataPortalResult <NameCustomerCommand> > callback) { var cmd = new NameCustomerCommand(); cmd.Name = name; DataPortal.BeginExecute <NameCustomerCommand>(cmd, callback); }
/// <summary> /// Async Exist of customer name /// </summary> /// <param name="customerName"> /// The customer Name. /// </param> /// <param name="callback"> /// The callback function to execute when async call is completed. /// </param> public static void BeginExecute(string name, int id, EventHandler <DataPortalResult <DuplicateNameCommand> > callback) { var cmd = new DuplicateNameCommand(); cmd.Name = name; cmd.Id = id; DataPortal.BeginExecute <DuplicateNameCommand>(cmd, callback); }
public static void CloseProject(int id, EventHandler <DataPortalResult <ProjectCloser> > callback) { ProjectCloser cmd = new ProjectCloser { ProjectId = id }; DataPortal.BeginExecute <ProjectCloser>(cmd, callback); }
public static void BeginExecuteCommand(EventHandler <DataPortalResult <AsyncPortalWithCulture> > handler) { var command = new AsyncPortalWithCulture(); var dp = new DataPortal <AsyncPortalWithCulture>(); dp.ExecuteCompleted += handler; dp.BeginExecute(command); }
public static void GetCompanyEdit(int companyID, EventHandler <DataPortalResult <CompanyEditUoW> > callback) { #pragma warning disable 0618 var command = new CompanyEditUoW(); command.LoadProperty(CompanyIDProperty, companyID); #pragma warning restore 0618 DataPortal.BeginExecute <CompanyEditUoW>(command, callback); }
public static void BeginExecute(int companyID, string companyName, EventHandler <DataPortalResult <DuplicateCompanyCommand> > callback) { var cmd = new DuplicateCompanyCommand(); cmd.CompanyID = companyID; cmd.CompanyName = companyName; DataPortal.BeginExecute <DuplicateCompanyCommand>(cmd, callback); }
public static void Exists(int id, Action<bool> result) { var cmd = new ProjectExistsCommand(id); DataPortal.BeginExecute<ProjectExistsCommand>(cmd, (o, e) => { if (e.Error != null) throw e.Error; else result(e.Object.ProjectExists); }); }
public static void Execute(string name, Action <bool> result) { var cmd = new NameRequiredCommand(name); DataPortal.BeginExecute(cmd, (o, e) => { if (e.Error != null) { throw e.Error; } else { result(e.Object.Required); } }); }
public static void NameExistsForBusinessRules(string name, Action <bool> result) { var cmd = new CustomerNameCommand(name); DataPortal.BeginExecute <CustomerNameCommand>(cmd, (o, e) => { if (e.Error != null) { throw e.Error; } else { result(e.Object.isExist); } }); }
public static void BeginCommand(Action <MyExpensiveCommand> callback) { var cmd = new MyExpensiveCommand(); DataPortal.BeginExecute <MyExpensiveCommand>(cmd, (o, e) => { if (e.Error != null) { cmd.ResultText = e.Error.Message; cmd.Result = false; } else { cmd = e.Object; } callback(cmd); }); }
public static void Execute(string address, Action <bool> result) { var cmd = new AddressExistsCommand(new Criteria() { Address = address }); DataPortal.BeginExecute(cmd, (o, e) => { if (e.Error != null) { throw e.Error; } else { result(e.Object.isExist); } }); }
public void BeginExecute(T command) { DataPortal.BeginExecute(command, ExecuteCompleted); }
public void BeginExecute(T command, object userState) { DataPortal.BeginExecute(command, ExecuteCompleted, userState); }