internal void Process()
        {
            this.dBProcesses = this.serializer.Deserialize();
            this.log.LogWrite("Service starts for " + this.dBProcesses.setting.Length + " operation", Log.LogType.Information);
            try
            {
                DBProcess[] setting2 = this.dBProcesses.setting;
                foreach (DBProcess setting in setting2)
                {
                    this.log.LogWrite("Proces started for " + setting.OperationName + " operation", Log.LogType.Information);
                    setting.Data = this.dao.FillChatHistory(setting);
                    if (setting.Data == null)
                    {
                        this.log.LogWrite("No data for " + setting.OperationName + " operation", Log.LogType.Information);
                    }
                    else if (setting.Data.Rows.Count == 0)
                    {
                        this.log.LogWrite("No data for " + setting.OperationName + " operation", Log.LogType.Information);
                    }
                    else
                    {
                        int maxValue    = Convert.ToInt32(setting.Data.Compute("MAX(TRANSCRIPT)", string.Empty));
                        int uniqueValue = maxValue;
                        this.log.LogWrite("Prepare data process starts.", Log.LogType.Information);
                        List <Chat> chatList = this.chatHistoryService.PrepareData(setting);
                        this.log.LogWrite("Data prepared, sending mail operation starts.", Log.LogType.Information);
                        //this.mailService.SendMail(chatList);
                        this.siebelService.WriteToDB(chatList);

                        this.log.LogWrite("Sending mail operation completed.", Log.LogType.Information);
                        setting.UniqueValue = uniqueValue;
                        setting.Data        = null;
                        this.log.LogWrite("New unique value set to :" + setting.UniqueValue, Log.LogType.Information);
                        this.serializer.Serialize(this.dBProcesses);
                    }
                    this.log.LogWrite("Proces completed for " + setting.OperationName, Log.LogType.Information);
                }
            }
            catch (Exception ex)
            {
                this.log.LogWrite("Unexpected error occured. Exception : " + ex.ToString(), Log.LogType.Information);
            }
        }
Example #2
0
 public DBProcesses Serialize(DBProcesses settings)
 {
     try
     {
         this.log.LogWrite("Serialize process started", Log.LogType.Information);
         string        path             = Assembly.GetExecutingAssembly().Location;
         FileInfo      fileInfo         = new FileInfo(path);
         string        dir              = fileInfo.DirectoryName;
         XmlSerializer SerializerObj    = new XmlSerializer(typeof(DBProcesses));
         TextWriter    writeFileStream2 = new StreamWriter(dir + "\\ExternalFiles\\Settings.xml");
         SerializerObj.Serialize(writeFileStream2, settings);
         writeFileStream2.Close();
         writeFileStream2 = null;
         this.log.LogWrite("Serialize operation ended successfully", Log.LogType.Information);
         return(settings);
     }
     catch (Exception ex)
     {
         this.log.LogWrite("Serialize operation error. " + ex.ToString(), Log.LogType.Error);
         return(null);
     }
 }
Example #3
0
 public DBProcesses Deserialize()
 {
     try
     {
         this.log.LogWrite("Deserialize process started", Log.LogType.Information);
         string        path       = Assembly.GetExecutingAssembly().Location;
         FileInfo      fileInfo   = new FileInfo(path);
         string        dir        = fileInfo.DirectoryName;
         DBProcesses   settings2  = null;
         XmlSerializer serializer = new XmlSerializer(typeof(DBProcesses));
         StreamReader  reader2    = new StreamReader(dir + "\\ExternalFiles\\Settings.xml");
         settings2 = (DBProcesses)serializer.Deserialize(reader2);
         reader2.Close();
         reader2 = null;
         this.log.LogWrite("Deserialize operation ended successfully", Log.LogType.Information);
         return(settings2);
     }
     catch (Exception ex)
     {
         this.log.LogWrite("Deserialize operation error. " + ex.ToString(), Log.LogType.Information);
         return(null);
     }
 }