private void GetClientDetails(int val) { var bll = new ProjectInfoBLL(); var ClientDetails = bll.GetClientDetails(val); if (ClientDetails != null) { TxtCompanyName = ClientDetails.CompanyName; TxtContactName = ClientDetails.ContactName; TxtStreetAddress = ClientDetails.StreetAddress; TxtSuburb = ClientDetails.Suburb; TxtTownCity = ClientDetails.TownCity; TxtCountry = ClientDetails.Country; TxtGpsPosition = ClientDetails.GpsPosition; TxtContactEmail = ClientDetails.ContactEmail; TxtIdNumber = ClientDetails.IdNumber; } }
private void OnNewClientClickedCommand() { try { if (ValidateViewModel() == true && ValidateEmailId() == true) { var bll = new ProjectInfoBLL(); var ClientDetails = bll.GetClientDetails(clientVal); if (ClientDetails != null) { Client objClient = new Client(); _projectInfoBll = new ProjectInfoBLL(); objClient.CompanyName = TxtCompanyName; objClient.ContactName = TxtContactName; objClient.StreetAddress = TxtStreetAddress; objClient.Suburb = TxtSuburb; objClient.TownCity = TxtTownCity; objClient.Country = TxtCountry; objClient.GpsPosition = TxtGpsPosition; objClient.Phone = TxtPhone; objClient.ContactEmail = TxtContactEmail; objClient.IdNumber = TxtIdNumber; objClient.Id = clientVal; var result = _projectInfoBll.UpdateClientInfo(objClient); if (result == 1) { _eventAggregator.GetEvent <AddCreatorPayLoad>().Publish(); JCHMessageBox.Show(Langauge.Current.GetMessage("UPDATE_SUCCESSFULLY"));//Update Successfully Application.Current.Properties["TxtContactName"] = objClient.ContactName; ResetValue(); _winService.Close(ViewKeys.Addnewclient); //objClientWindow.RequestClose(); } } else { Client objClient = new Client(); _projectInfoBll = new ProjectInfoBLL(); objClient.CompanyName = TxtCompanyName; objClient.ContactName = TxtContactName; objClient.StreetAddress = TxtStreetAddress; objClient.Suburb = TxtSuburb; objClient.TownCity = TxtTownCity; objClient.Country = TxtCountry; objClient.GpsPosition = TxtGpsPosition; objClient.Phone = TxtPhone; objClient.ContactEmail = TxtContactEmail; objClient.IdNumber = TxtIdNumber; var result = _projectInfoBll.InsertClientInfo(objClient); if (result == 1) { _eventAggregator.GetEvent <AddCreatorPayLoad>().Publish(); JCHMessageBox.Show(Langauge.Current.GetMessage("SAVE_SUCCESSFULLY"));//Save Successfully Application.Current.Properties["TxtContactName"] = objClient.ContactName; ResetValue(); _winService.Close(ViewKeys.Addnewclient); // objClientWindow.RequestClose(); } } } } catch (Exception ex) { Logger.LogProjectError(null, ex); } }