private void cmdUploadExcel_Execute(object obj) { try { string fileName = string.Empty; string safeFileName = string.Empty; // Initialize an OpenFileDialog OpenFileDialog openFileDialog = new OpenFileDialog(); // Set filter and RestoreDirectory openFileDialog.RestoreDirectory = true; openFileDialog.Filter = "Excel documents(*.xlsx)|*.xlsx"; bool?result = openFileDialog.ShowDialog(); if (result == true && openFileDialog.FileName.Length > 0) { fileName = openFileDialog.FileName; } if (string.IsNullOrEmpty(fileName) || !File.Exists(fileName)) { return; } safeFileName = openFileDialog.SafeFileName; TupleOfstringstringboolean objTuple = pxyInvoice.UploadPatchSheet(IMSLibrary.Class.Helper.ConvertToByte(fileName.ToString()), safeFileName, Global.UserID, Const.InvoiceDetailsSheetType); ErrorFolder = objTuple.m_Item1; ErrorFile = objTuple.m_Item2; if (objTuple.m_Item3) { UIHelper.ShowMessage("File uploaded successfully!"); btnUpload = false; btnErrorFile = true; return; } UIHelper.ShowMessage("File not uploaded!"); } catch (FaultException ex) { UIHelper.ShowErrorMessage(ex.Message); } }
private void cmdUpload_execute(object obj) { try { TupleOfstringstringboolean objTuple = pxy.UploadSheet(IMSLibrary.Class.Helper.ConvertToByte(fileName.ToString()), safeFileName, Global.UserID, sheetType); ErrorFolder = objTuple.m_Item1; ErrorFile = objTuple.m_Item2; if (objTuple.m_Item3) { UIHelper.ShowMessage("File uploaded successfully!"); btnUpload = btnBrowse = false; btnDownload = true; return; } UIHelper.ShowMessage("File not uploaded!"); } catch (FaultException ex) { UIHelper.ShowErrorMessage(ex.Message); } }