/// <summary> /// Makes a call to the db to retrieve the data and populate here. /// </summary> public void Populate() { // This requires a label titled "label1" on the form... // Get the UI thread's context var context = TaskScheduler.FromCurrentSynchronizationContext(); ShowBusyCursor(true, "Fetching Caller Details"); // TODO: retrieve object and set the member properties. here var callerSearchRequest = new CallerSearchRequest { PhoneNumber = this.SearchPhoneNumber }; Caller caller = null; Task t = new Task(() => { caller = ManagerFactory.Create<CallerSearchRequest, Caller>().Execute(callerSearchRequest); }); t.ContinueWith(_ => { if (caller != null) { this._currentCaller = caller; FirstName = caller.FirstName; LastName = caller.LastName; PhoneNumber = caller.PhoneNumber; // AnnualIncome = caller.a if (!string.IsNullOrEmpty(caller.AlternatePhoneNumber)) { AltPhoneNumber = caller.AlternatePhoneNumber; } if (caller.Address != null) { //TODO: What about Address1 and Address2 Address1 = caller.Address.Address1; Area = caller.Address.Area; City = caller.Address.City; EmailID = caller.Address.EmailID; } if (caller.Profession != null) { //TODO: What about Address1 and Address2 Profession = caller.Profession.Name; } SetStatusbarMessage("Caller details retrieved successfully...", StatusMessageType.Info); } else { this.PhoneNumber = this.SearchPhoneNumber; SetStatusbarMessage("Caller not found.. Please capture details...", StatusMessageType.Warning); } ShowBusyCursor(false); }, context); t.Start(); }
public void ExeucteClearCallerDetails() { this._currentCaller = null; this.Address1 = string.Empty; this.Address2 = string.Empty; this.PhoneNumber = string.Empty; this.AltPhoneNumber = string.Empty; this.EmailID = string.Empty; this.Area = string.Empty; this.City = string.Empty; this.FirstName = string.Empty; this.LastName = string.Empty; this.AnnualIncome = null; this.Profession = string.Empty; }