diff --git a/Swift.DAL/Remittance/OFACManagement/OFACDao.cs b/Swift.DAL/Remittance/OFACManagement/OFACDao.cs index 3f73f78..3bff0a5 100644 --- a/Swift.DAL/Remittance/OFACManagement/OFACDao.cs +++ b/Swift.DAL/Remittance/OFACManagement/OFACDao.cs @@ -63,9 +63,17 @@ namespace Swift.DAL.BL.Remit.OFACManagement return ParseDbResultV2(sql); } + public DataRow UploadXMLData(string xml, string user) + { + var sql = "EXEC proc_ofacOtherDataManagement @flag = 'other'"; + sql += " ,@user=" + FilterString(user); + sql += " ,@xml='" + xml + "'"; + return ExecuteDataRow(sql); + } + public DbResult UpdateAQList(string user, string xmlFile,string xmlFileName, string source) { - var sql = "EXEC Proc_unscrManagement @flag = 'unscr'"; + var sql = "EXEC Proc_UKListManagement @flag = 'ofac-list'"; sql += ", @user = " + FilterString(user); sql += ", @xmlFile = " + FilterString(xmlFile); sql += ", @xmlFileName = " + FilterString(xmlFileName); diff --git a/Swift.web/Remit/OFACManagement/Import.aspx b/Swift.web/Remit/OFACManagement/Import.aspx index 3d8abcd..0709461 100644 --- a/Swift.web/Remit/OFACManagement/Import.aspx +++ b/Swift.web/Remit/OFACManagement/Import.aspx @@ -18,76 +18,91 @@
- +
progress Processing...
+
- - -
-
-
-
- + + <%-- + --%> + +
+ +
+
+
+
+

Import OFAC List

+
+
-
-
-
-
-
-

Import OFAC List

-
- -
+
+
+
+ + +
+
+
+ + +
+
+
+ +
+
+
+ <%--
--%> +
+ + <%----%> + + <%----%> +
+
+
+
+
+
+
+
+

+

+

+

+
-
-
-
- - -
-
-
- - -
-
-
- -
-
-
-
-
-
-
-
-

-

-

-

-
-
-
-
-
+
- - +
+
+ <%-- + --%> diff --git a/Swift.web/Remit/OFACManagement/Import.aspx.cs b/Swift.web/Remit/OFACManagement/Import.aspx.cs index 336fe7b..5902531 100644 --- a/Swift.web/Remit/OFACManagement/Import.aspx.cs +++ b/Swift.web/Remit/OFACManagement/Import.aspx.cs @@ -1,10 +1,13 @@ using System; using System.Data; +using System.Drawing; using System.IO; using System.Linq; using System.Net; +using System.Web; using System.Xml; using Swift.DAL.BL.Remit.OFACManagement; +using Swift.DAL.BL.System.Utility; using Swift.DAL.SwiftDAL; using Swift.web.Library; using static Swift.web.Library.CustomConfigHelper; @@ -30,6 +33,11 @@ namespace Swift.web.Remit.OFACManagement Authenticate(); LoadLogGrid(); LoadSourceWiseData(); + + if (!IsPostBack) + { + LoadLogGrid(); + } } private void Authenticate() { @@ -224,8 +232,9 @@ namespace Swift.web.Remit.OFACManagement private string GetUNSCRData(string fileName) { - - var aqFilePath = GetStatic.GetAppRoot() + "doc\\OFAC\\"+ fileName + ".xml"; + + //var aqFilePath = GetStatic.GetAppRoot() + "doc\\OFAC\\"+ fileName + ".xml"; + var aqFilePath = GetStatic.GetAppRoot() + fileName; FileWebRequest myRequest = (FileWebRequest)WebRequest.Create(aqFilePath); myRequest.Method = "GET"; WebResponse myResponse = myRequest.GetResponse(); @@ -304,5 +313,42 @@ namespace Swift.web.Remit.OFACManagement ManageMessage(dbResult); DivMessage.InnerHtml = dbResult.Msg; } + + protected void btnFileUpload_Click(object sender, EventArgs e) + { + //string xmlContent = GetUNSCRData("sample"); + //var dbResult = obj.UpdateAQList(GetStatic.GetUser(), xmlContent, "sample.xml", "UNSCR"); + //ManageMessage(dbResult); + //DivMessage.InnerHtml = dbResult.Msg; + + //LoadAQLogGrid(); + + try + { + + if (fileUpload.FileContent.Length > 0) + { + if (fileUpload.FileName.ToLower().Contains(".xml")) + { + string fileName = fileUpload.FileName; + string xmlContent = GetUNSCRData(fileName); + var dbResult = obj.UpdateAQList(GetStatic.GetUser(), xmlContent, fileName, "UNSCR"); + ManageMessage(dbResult); + DivMessage.InnerHtml = dbResult.Msg; + + LoadAQLogGrid(); + } + else + { + + GetStatic.AlertMessage(this, "Invalid file format uploaded"); + } + } + } + catch (Exception ex) + { + GetStatic.AlertMessage(this, $"Technical Error: { GetStatic.LogError(ex).Id}"); + } + } } } \ No newline at end of file diff --git a/Swift.web/Remit/OFACManagement/Import.aspx.designer.cs b/Swift.web/Remit/OFACManagement/Import.aspx.designer.cs index dcb327d..b5b0583 100644 --- a/Swift.web/Remit/OFACManagement/Import.aspx.designer.cs +++ b/Swift.web/Remit/OFACManagement/Import.aspx.designer.cs @@ -7,11 +7,13 @@ // //------------------------------------------------------------------------------ -namespace Swift.web.Remit.OFACManagement { - - - public partial class Import { - +namespace Swift.web.Remit.OFACManagement +{ + + + public partial class Import + { + /// /// Head1 control. /// @@ -20,7 +22,7 @@ namespace Swift.web.Remit.OFACManagement { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlHead Head1; - + /// /// form1 control. /// @@ -29,7 +31,7 @@ namespace Swift.web.Remit.OFACManagement { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlForm form1; - + /// /// ScriptManger1 control. /// @@ -38,7 +40,7 @@ namespace Swift.web.Remit.OFACManagement { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.ScriptManager ScriptManger1; - + /// /// updProgress control. /// @@ -47,16 +49,7 @@ namespace Swift.web.Remit.OFACManagement { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.UpdateProgress updProgress; - - /// - /// upd1 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.UpdatePanel upd1; - + /// /// btnImport control. /// @@ -65,7 +58,7 @@ namespace Swift.web.Remit.OFACManagement { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Button btnImport; - + /// /// btnLoadOfac control. /// @@ -74,7 +67,7 @@ namespace Swift.web.Remit.OFACManagement { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Button btnLoadOfac; - + /// /// BtnImpAQList control. /// @@ -83,7 +76,7 @@ namespace Swift.web.Remit.OFACManagement { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Button BtnImpAQList; - + /// /// btnUpload control. /// @@ -92,7 +85,7 @@ namespace Swift.web.Remit.OFACManagement { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Button btnUpload; - + /// /// Button1 control. /// @@ -101,7 +94,43 @@ namespace Swift.web.Remit.OFACManagement { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Button Button1; - + + /// + /// uploadDiv control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlGenericControl uploadDiv; + + /// + /// fileUpload control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.FileUpload fileUpload; + + /// + /// FileUploadValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator FileUploadValidator; + + /// + /// btnFileUpload control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnFileUpload; + /// /// SourceWiseData control. /// @@ -110,7 +139,7 @@ namespace Swift.web.Remit.OFACManagement { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlGenericControl SourceWiseData; - + /// /// DivMessage control. /// @@ -119,7 +148,7 @@ namespace Swift.web.Remit.OFACManagement { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlGenericControl DivMessage; - + /// /// rpt_grid control. /// @@ -128,7 +157,7 @@ namespace Swift.web.Remit.OFACManagement { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlGenericControl rpt_grid; - + /// /// rpt_AQgrid control. ///