Posts

Showing posts from August, 2021

Cryptography Utility

 using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.IO; using System.Text; using System.Security.Cryptography; /// <summary> //' <summary> //   ' This class uses a symmetric key algorithm (Rijndael/AES) to encrypt and  //   ' decrypt data. As long as encryption and decryption routines use the same  //   ' parameters to generate the keys, the keys are guaranteed to be the same. //   ' The class uses static functions with duplicate code to make it easier to  //   ' demonstrate encryption and decryption logic. In a real-life application,  //   ' this may not be the most efficient way of handling encryption, so - as  //   ' soon as you feel comfortable with it - you may want to redesign this class. /// </summary> namespace InsiderTrading.Infrastructure.Common {     public class Cryptography     {         public Cryptography()         {             //             // TODO: Add constructor logic h

LoadXmlFilesUtility

 /*----------------------------------------------------------------- File Name       :  LoadXML.cs Created By      :  Navin Kumar  Created on      :  Sep-2017 Revision History:   ------------------------------------------------------------------*/ using System; using System.Collections.Specialized; using System.Xml; namespace InsiderTrading.Infrastructure.Common {/// <summary> /// used to load xml file /// </summary>     public class LoadXML     {         /// <summary>         /// Loads the XML file.         /// </summary>         /// <param name="fileName">Name of the file.</param>         /// <returns></returns>         private static StringDictionary LoadXMLFile(string fileName)         {             StringDictionary dictionary = new StringDictionary();             XmlDocument xDoc = new XmlDocument();             XmlNode xRootNode ;             XmlNode xNode ;             String strID = "";             String strVa

UploadFilesUtility

 /************************************************************************************* CREATED BY          : Navin Kumar CREATED ON          : 16-Nov-2016 SUMMARY             : Created for upload files. MODIFIED HISTORY :  S.NO        MODIFIED ON         MODIFIED BY          TRACKER                SUMMARY 1           <DATE>              <NAME>               <MINDBS20160919>       <SUMMARY> *******************************************************************************************/ using System; using System.Web; using System.IO; using System.Data; using System.Data.SqlClient; using iGHS.Web.Sys.Infrastructure.Framework; using iGHS.Shared.Repositories.Helpers; using iGHS.Web.Sys.Utilities.ExcelHelper; using iGHS.Shared.GlobalSettings; using iGHS.Shared.Enums.GlobalSetting; namespace iGHS.Web.Sys.Infrastucture.Common {/// <summary> ///  /// </summary>     public class UploadFile     {         HttpPostedFileBase _file;         /// <summary>      

DataTabletojsonUtility

 /*----------------------------------------------------------------- File Name       :  Utility.cs Created By      :  Navin Kumar  Created on      :  Sep-2017 Revision History:   ------------------------------------------------------------------*/ using System; using System.Collections.Generic; using System.Data; using System.Security.Cryptography; using System.Text; using System.Web.Script.Serialization; namespace InsiderTrading.Infrastructure.Common {/// <summary> /// used to convert DataTable to Json. /// </summary>     public sealed class Utility     {/// <summary>     ///      /// </summary>     /// <param name="table"></param>     /// <returns></returns>         public static string DataTableToJsonWithStringBuilder(DataTable table)         {             var jsonString = new StringBuilder();             if (table.Rows.Count > 0)             {                 jsonString.Append("[");                 for (int i =

DataTabletoModelHelper

 using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Reflection; using System.Text; using System.Threading.Tasks; namespace InsiderTrading.Infrastructure.Helpers {     public static class ModelHelper     {         /// <summary>         ///Get DataTable From Model List         /// </summary>         /// <typeparam name="T"></typeparam>         /// <param name="items"></param>         /// <returns></returns>         public static DataTable GetDataTableFromList<T>(List<T> items)         {             DataTable dataTable = new DataTable(typeof(T).Name);             //Get all the properties by using reflection                PropertyInfo[] Props = typeof(T).GetProperties(BindingFlags.Public | BindingFlags.Instance);             foreach (PropertyInfo prop in Props)             {                 //Setting column names as Property names                   dataTable.Colu

EmailHelper

 using System; using System.Web; using System.Web.Mvc; using System.Collections; using System.Data; using System.Collections.Specialized; using InsiderTrading.Infrastructure.Common; using InsiderTrading.DataObject; using System.Data.SqlClient; using InsiderTrading.Infrastructure.Enums.Emails; using System.IO; using System.IO.Compression; using System.IO.Packaging; using System.Collections.Generic; using InsiderTrading.Models; namespace InsiderTrading.Infrastructure.Helpers {     public static class EmailHelper     {         #region  Variable         private static string _SMTPClient = string.Empty;         private static string _BCCEmail = string.Empty;         private static string _defaultMailFrom = string.Empty;         private static string _conString = CommonFunction.GetConnectionString();         private static string _uploadPath = CommonFunction.GetUploadPath();         #endregion         #region   Constructor          /// <summary>         /// Initializes a new instance o