private async void updateAddress(object obj) { Singleton.getDialogueBox().showSearch(ConfigurationManager.AppSettings["update_message"]); var infosList = InfoGeneral.getInfoData(_addressDetails[0].ContactDictionary);// _addressDetails[0].extractInfosListFromContactDictionary(); var infosToUpdateList = infosList.Where(x => x.ID != 0).ToList(); var infosToCreateList = infosList.Where(x => x.ID == 0).ToList(); var infosUpdatedList = await Bl.BlReferential.UpdateInfoAsync(infosToUpdateList); var infosCreatedList = await Bl.BlReferential.InsertInfoAsync(infosToCreateList); if (infosUpdatedList.Count > 0 || infosCreatedList.Count > 0) { await Singleton.getDialogueBox().showAsync("Address Detail saved Successfully!"); List <Info> savedInfosList = new List <Info>(infosUpdatedList); savedInfosList = new List <Info>(savedInfosList.Concat(infosCreatedList)); AddressList = new List <InfoContact> { new InfoContact(savedInfosList) }; } else { await Singleton.getDialogueBox().showAsync("Error occured while updating the address Details!"); } Singleton.getDialogueBox().IsDialogOpen = false; }
private async void getFileFromLocal(object obj) { string newFileFullPath = InfoGeneral.ExecuteOpenFileDialog("Select an image file", new List <string> { "png", "jpeg", "jpg" }); if (!string.IsNullOrEmpty(newFileFullPath) && File.Exists(newFileFullPath)) { var ftpCredentials = Bl.BlReferential.searchInfo(new Info { Name = "ftp_" }, ESearchOption.AND); if (!string.IsNullOrEmpty(SelectedAgentModel.TxtPicture)) { WPFHelper.deleteFileFromFtpServer(ConfigurationManager.AppSettings["ftp_profile_image_folder"], SelectedAgentModel.TxtPicture, ftpCredentials); } if (SelectedAgentModel.Image != null) { SelectedAgentModel.Image.closeImageSource(); WPFHelper.deleteFileFromFtpServer(ConfigurationManager.AppSettings["ftp_profile_image_folder"], SelectedAgentModel.TxtPicture, ftpCredentials); } else { SelectedAgentModel.Image = await Task.Factory.StartNew(() => { return(SelectedAgentModel.Image.downloadPicture(ConfigurationManager.AppSettings["ftp_profile_image_folder"], ConfigurationManager.AppSettings["local_profile_image_folder"], SelectedAgentModel.TxtPicture, SelectedAgentModel.TxtProfileImageFileNameBase + "_" + Bl.BlSecurity.GetAuthenticatedUser().ID, ftpCredentials)); }); } // opening the file explorer to choose and resize an image file SelectedAgentModel.Image.TxtChosenFile = newFileFullPath.resizeImage(); SelectedAgentModel.TxtPicture = SelectedAgentModel.Image.TxtFileName; Singleton.getDialogueBox().showSearch(ConfigurationManager.AppSettings["update_message"]); // upload the image file to the FTP server SelectedAgentModel.Image.uploadImage(); // update item image var savedAgentList = await Bl.BlAgent.UpdateAgentAsync(new List <Agent> { SelectedAgentModel.Agent }); if (savedAgentList.Count > 0) { await Singleton.getDialogueBox().showAsync("The picture has been saved successfully!"); } else { string errorMessage = "Error occured while updating the agent [" + SelectedAgentModel.TxtLastName + "] picture"; Log.error(errorMessage, EErrorFrom.ITEM); await Singleton.getDialogueBox().showAsync(errorMessage); } Singleton.getDialogueBox().IsDialogOpen = false; } }
//----------------------------[ Action Commands ]------------------ /// <summary> /// load and save file information into database /// </summary> /// <param name="obj">object which the file is associated with</param> public async void getFileFromLocal(InfoDisplay obj) { await Task.Factory.StartNew(() => { // opening the file explorer for image file choosing string imageFile = InfoGeneral.ExecuteOpenFileDialog("Select an image file", new List <string> { "png", "jpeg", "jpg" }); if (!string.IsNullOrEmpty(imageFile)) { string msg = ConfigurationManager.AppSettings["wait_message"]; Singleton.getDialogueBox().showSearch(ConfigurationManager.AppSettings["wait_message"]); obj.TxtChosenFile = imageFile; // upload the image file to the server FTP obj.uploadImage(); Singleton.getDialogueBox().IsDialogOpen = false; } }); }
private async void getFileFromLocal(object obj) { string newFileFullPath = InfoGeneral.ExecuteOpenFileDialog("Select an image file", new List <string> { "png", "jpeg", "jpg" }); if (!string.IsNullOrEmpty(newFileFullPath) && File.Exists(newFileFullPath)) { Singleton.getDialogueBox().showSearch(ConfigurationManager.AppSettings["wait_message"]); var ftpCredentials = Bl.BlReferential.searchInfo(new Info { Name = "ftp_" }, ESearchOption.AND); // closing the image file if opened in the order detail if (_main.OrderViewModel != null && _main.OrderViewModel.OrderDetailViewModel != null && _main.OrderViewModel.OrderDetailViewModel.Order_ItemModelList != null) { var imageFound = _main.OrderViewModel.OrderDetailViewModel.Order_ItemModelList.Where(x => x.TxtItem_ref == SelectedItemModel.TxtRef).Select(x => x.ItemModel.Image).SingleOrDefault(); if (imageFound != null) { imageFound.closeImageSource(); } } if (SelectedItemModel.Image != null) { SelectedItemModel.Image.closeImageSource(); WPFHelper.deleteFileFromFtpServer(ConfigurationManager.AppSettings["ftp_catalogue_image_folder"], SelectedItemModel.TxtPicture, ftpCredentials); } else { SelectedItemModel.Image = await Task.Factory.StartNew(() => { return(SelectedItemModel.Image.downloadPicture(ConfigurationManager.AppSettings["ftp_catalogue_image_folder"], ConfigurationManager.AppSettings["local_catalogue_image_folder"], SelectedItemModel.TxtPicture, SelectedItemModel.TxtRef.Replace(' ', '_').Replace(':', '_'), ftpCredentials)); }); } // opening the file explorer for image file choosing and resizing SelectedItemModel.Image.TxtChosenFile = newFileFullPath.resizeImage(); SelectedItemModel.TxtPicture = SelectedItemModel.Image.TxtFileName; // upload the image file to the FTP server SelectedItemModel.Image.uploadImage(); // update item image var savedItemList = await Bl.BlItem.UpdateItemAsync(new List <Item> { SelectedItemModel.Item }); if (savedItemList.Count > 0) { await Singleton.getDialogueBox().showAsync("The picture has been saved successfully!"); } else { string errorMessage = "Error occured while updating the item [" + SelectedItemModel.TxtRef + "] picture"; Log.error(errorMessage, EErrorFrom.ITEM); await Singleton.getDialogueBox().showAsync(errorMessage); } Singleton.getDialogueBox().IsDialogOpen = false; } }
public void TestInfoGeneral() { InfoGeneral info = Credito.Instancia.GetInfoGeneral(); Assert.AreEqual(info.Cbu, "01100181 - 30001809148651", "Info general inválida."); }