public static void Main(string[] args) { LogFileHelper log = new LogFileHelper(); string message = "Program Initiated"; log.WriteToFile(message); EnterChoice(); message = "Program end"; log.WriteToFile(message); }
public void InitiateHCR(DateTime myRunDate) { string msg = "Starting to execute, RunDate : " + myRunDate.ToString(); Console.WriteLine(Environment.NewLine); Console.WriteLine(msg + myRunDate.ToString()); Console.WriteLine(Environment.NewLine); _log.WriteToFile(Environment.NewLine, Convert.ToString(ConfigurationManager.AppSettings["LogFilePath"])); _log.WriteToFile(msg, Convert.ToString(ConfigurationManager.AppSettings["LogFilePath"])); List <int> incHospitals = new List <int>(); List <int> excHospitals = new List <int>(); DataTable dt = _hcrDao.GetTargetedHospitals(incHospitals, excHospitals, true, myRunDate); }
public DataTable GenericExecution_Source(string sql) { DataTable dt = new DataTable(); try { string message = "SOURCE DB EXECUTION : SQL statement - " + sql; _logger.WriteToFile(message); if (sourceConnServer.State == ConnectionState.Closed) { sourceConnServer.Open(); } NpgsqlCommand command = sourceConnServer.CreateCommand(); command.CommandText = sql; NpgsqlDataAdapter da = new NpgsqlDataAdapter(sql, sourceConnServer); da.Fill(dt); sourceConnServer.Close(); message = "SOURCE DB EXECUTION : SQL statement done"; _logger.WriteToFile(message); } catch (Exception ex) { _logger.WriteToFile("SOURCE DB EXECUTION Exception : SQL statement - " + ex.Message); } return(dt); }
public void CreateFunctionfromFile(string fileName, string fileContent) { try { _logger.WriteToFile("BEGIN - Executing file :" + fileName); _logger.WriteToFile("BEGIN"); DataAccessLayer obj = new DataAccessLayer(); DataTable dt = obj.GenericExecution_Destination(fileContent); _logger.WriteToFile("END - Executing file :" + fileName); } catch (Exception ex) { _logger.WriteToFile("Exception - Executing file :" + fileName + ", Exception: " + ex.Message); } }
public static void LoadTables() { LogFileHelper logger = new LogFileHelper(); BusinessLogicLayer objBusiness = new BusinessLogicLayer(); try { string hid = "1074,2882"; string[] tableswithoutHID = { "country_lookup", "campaign.campaign_program", "campaign.campaign_segment", "campaign.campaign_sequence", "campaign.campaign_versions", "campaign.emailtracking_status_lookup", "locale", "localization", "pms", "timezone", "vi_breed_lookup", "vi_client_patient_code_lookup", "vi_gender_lookup", "vi_li_lookup", "vi_species_lookup" }; string[] tableswithHID = { "campaign.campaign_email_contact_tracking", "campaign.campaign_postal_contact_tracking", "campaign.crecap_email_tracking", "campaign.crecap_partner_vs_mapping", "campaign.dental_compliance_hids", "public.appointment", "public.client", "hospital_load_history", "lineitem", "patient", "pms_breed_lookup", "pms_client_code_lookup", "pms_gender_lookup", "pms_patient_code_lookup", "pms_provider_lookup", "pms_species_lookup", "working.campaign_contact_targets" }; #region INSERT TABLES WITHOUT HOSPITAL ID for (var i = 0; i < tableswithoutHID.Length; i++) { logger.WriteToFile("Getting data for the table : " + tableswithoutHID[i]); objBusiness.GetDatafromQueryandInsert("select * from " + tableswithoutHID[i] + ";", tableswithoutHID[i]); } #endregion #region INSERT HOSPITAL TABLE logger.WriteToFile("Getting data for the table : hospital"); objBusiness.GetDatafromQueryandInsert("select * from public.hospital where id IN (" + hid + ")", "public.hospital"); #endregion #region INSERT TABLES WITH HOSPITAL ID for (var i = 0; i < tableswithHID.Length; i++) { logger.WriteToFile("Getting data for the table : " + tableswithHID[i]); objBusiness.GetDatafromQueryandInsert("select * from " + tableswithHID[i] + " where hid IN (" + hid + ")", tableswithHID[i]); } #endregion } catch (Exception ex) { logger.WriteToFile("LoadTables method exception : " + ex.Message); } }
public static void LoadScripts() { BusinessLogicLayer objBusiness = new BusinessLogicLayer(); LogFileHelper logger = new LogFileHelper(); try { Console.WriteLine("Enter the file Path"); //string path = @"D:\AccionLabs\Help\LocalDB\Functions"; var path = Console.ReadLine(); foreach (string fileName in Directory.GetFiles(path)) { //CHECK FOR EXTENSION - .SQL string ext = Path.GetExtension(fileName); //GET EACH FILE if (ext.ToUpper() == (".sql").ToUpper()) { var fileStream = new FileStream(fileName, FileMode.Open, FileAccess.Read); using (var streamReader = new StreamReader(fileStream, Encoding.UTF8)) { string functionContent = streamReader.ReadToEnd(); if (!string.IsNullOrEmpty(functionContent)) { //SEND FILENAME AND FILECONTENT FOR EACH FILE objBusiness.CreateFunctionfromFile(fileName, functionContent); } } } } EnterChoice(); } catch (Exception ex) { logger.WriteToFile("LoadScripts method exception : " + ex.Message); } }