Esempio n. 1
0
        private void timer_WriteLog_Tick(object sender, EventArgs e)
        {
            string Err = null;
            timer_WriteLog.Enabled = false;
            string sLine = null;
            DateTime LogTime = DateTime.Now;
            string LogType = null;
            string LogDescription = null;
            int iCount = 0;
            string sql = @"DECLARE @Ret_code_CopyRight_Logina_AuthorDamjanStrucl int
                           DECLARE @Par_LogWrite_Log_id int
                           DECLARE @Par_LogWrite_Res nvarchar(265)
                            ";
            string sLogFile_id = LogFile_id.ToString();
            ProcParams.Clear();
            object result = new object();
            while (iLog_Line < iLogfile_Lines)
            {
                iCount++;
                sLine = sLogLines[iLog_Line];
                if (ParseLogLine(sLine, ref LogTime, ref LogType, ref LogDescription))
                {
                    Log_SQL_Parameter Par_LogWrite_LogTime = new Log_SQL_Parameter();
                    Par_LogWrite_LogTime.dbType = System.Data.SqlDbType.DateTime;
                    Par_LogWrite_LogTime.Name = "@Par_LogWrite_LogTime_" + iLog_Line.ToString();
                    Par_LogWrite_LogTime.size = 8;
                    Par_LogWrite_LogTime.Value = LogTime;
                    Par_LogWrite_LogTime.IsOutputParameter = false;
                    ProcParams.Add(Par_LogWrite_LogTime);

                    Log_SQL_Parameter Par_LogWrite_LogDescription = new Log_SQL_Parameter();
                    Par_LogWrite_LogDescription.dbType = System.Data.SqlDbType.NVarChar;
                    Par_LogWrite_LogDescription.Name = "@Par_LogWrite_LogDescription_"+ iLog_Line.ToString();;
                    Par_LogWrite_LogDescription.size = 2000;
                    Par_LogWrite_LogDescription.Value = LogDescription;
                    Par_LogWrite_LogDescription.IsOutputParameter = false;
                    ProcParams.Add(Par_LogWrite_LogDescription);

                    //EXECUTE @Ret_code_CopyRight_Logina_AuthorDamjanStrucl =  dbo.LogWrite @LogFile_id = @Par_LogWrite_LogFile_id,@LogTime = @Par_LogWrite_LogTime,@LogType = @Par_LogWrite_LogType,@LogDescription = @Par_LogWrite_LogDescription,@Log_id = @Par_LogWrite_Log_id OUTPUT ,@Res = @Par_LogWrite_Res OUTPUT
                    sql += "\r\n EXECUTE @Ret_code_CopyRight_Logina_AuthorDamjanStrucl =  dbo.LogWrite @LogFile_id = "+sLogFile_id+",@LogTime = "+Par_LogWrite_LogTime.Name+",@LogType = '"+LogType+"',@LogDescription = "+Par_LogWrite_LogDescription.Name+",@Log_id = @Par_LogWrite_Log_id OUTPUT ,@Res = @Par_LogWrite_Res OUTPUT ";

                    //m_LogFile_DataSet_Procedures.LogWrite(LogFile_id, LogTime, LogType, LogDescription, ref Log_id, ref Res, ref Err);
                    //if (Res.Equals("OK"))
                    //{
                    //    iLog_Line++;
                    //}
                    //else
                    //{
                    //    Error.Show("ERROR:LogWrite:Res=" + Res);
                    //    return;
                    //}
                }
                //else
                //{
                //    Error.Show("ERROR:ParseLogLine!");
                //    return;
                //}
                iLog_Line++;
                if (iCount >= 1000)
                {
                    if (m_LogDB_con.ExecuteNonQuerySQL(sql, ProcParams, ref result, ref Err))
                    {
                        this.progressBar.Minimum = 0;
                        this.progressBar.Maximum = iLogfile_Lines;
                        this.progressBar.Value = iLog_Line;
                        this.lbl_Progress.Text = "Imported: " + iLog_Line.ToString() + "/" + iLogfile_Lines.ToString();
                        timer_WriteLog.Enabled = true;
                        return;
                    }
                    else
                    {
                        Error.Show("ERROR:WriteLog to DB: Err = " + Err);
                        return;
                    }
                }
            }
            if (m_LogDB_con.ExecuteNonQuerySQL(sql,ProcParams,ref result,ref Err))
            {
                this.progressBar.Minimum = 0;
                this.progressBar.Maximum = iLogfile_Lines;
                this.progressBar.Value = iLog_Line;
                this.lbl_Progress.Text = "Imported: " + iLog_Line.ToString() + "/" + iLogfile_Lines.ToString();
                timer_WriteLog.Enabled = true;
            }
            else
            {
                    Error.Show("ERROR:WriteLog to DB: Err = "+ Err);
            }

            try
            {
                File.Delete(Log_PathFile);
            }
            catch (Exception ex)
            {
                Error.Show("ERROR:WriteLog Can not delete:" + Log_PathFile + " Err = " + Err + " ;" + ex.Message );
            }
            finally
            {
                this.Close();
                DialogResult = DialogResult.OK;
            }
        }
Esempio n. 2
0
 public void diagram_id_AddParameter(Log_SQL_Parameter par)
 {
     m_sysdiagrams.o_diagram_id.Where.AddParameter(par);
 }
Esempio n. 3
0
 public void principal_id_AddParameter(Log_SQL_Parameter par)
 {
     m_sysdiagrams.o_principal_id.Where.AddParameter(par);
 }
Esempio n. 4
0
 public void Log_Type_id_AddParameter(Log_SQL_Parameter par)
 {
     m_Log_VIEW.o_Log_Type_id.Where.AddParameter(par);
 }
Esempio n. 5
0
 public void UserName_AddParameter(Log_SQL_Parameter par)
 {
     m_Log_VIEW.o_UserName.Where.AddParameter(par);
 }
Esempio n. 6
0
 public void TypeName_AddParameter(Log_SQL_Parameter par)
 {
     m_Log_Type.o_TypeName.Where.AddParameter(par);
 }
Esempio n. 7
0
 public void Log_Description_id_AddParameter(Log_SQL_Parameter par)
 {
     m_Log_VIEW.o_Log_Description_id.Where.AddParameter(par);
 }
Esempio n. 8
0
        public int LogFile_Import(string LogComputer,string LogProgram,string LogUserName,string LogPathFile,string Description, ref int LogFile_id, ref string Res, ref string Err)
        {
            ProcParams.Clear();
                    Log_SQL_Parameter Ret_code_CopyRight_Logina_AuthorDamjanStrucl = new Log_SQL_Parameter();
                    Ret_code_CopyRight_Logina_AuthorDamjanStrucl.dbType = System.Data.SqlDbType.Int;
                    Ret_code_CopyRight_Logina_AuthorDamjanStrucl.Name = "@Ret_code_CopyRight_Logina_AuthorDamjanStrucl";
                    Ret_code_CopyRight_Logina_AuthorDamjanStrucl.size = 4;
                    Ret_code_CopyRight_Logina_AuthorDamjanStrucl.IsOutputParameter = true;
                    ProcParams.Add(Ret_code_CopyRight_Logina_AuthorDamjanStrucl);

                    Log_SQL_Parameter Par_LogFile_Import_LogComputer = new Log_SQL_Parameter();
                    Par_LogFile_Import_LogComputer.dbType = System.Data.SqlDbType.NVarChar;
                    Par_LogFile_Import_LogComputer.Name = "@Par_LogFile_Import_LogComputer";
                    Par_LogFile_Import_LogComputer.size = 264;
                    Par_LogFile_Import_LogComputer.Value = LogComputer;
                    Par_LogFile_Import_LogComputer.IsOutputParameter = false;
                    ProcParams.Add(Par_LogFile_Import_LogComputer);

                    Log_SQL_Parameter Par_LogFile_Import_LogProgram = new Log_SQL_Parameter();
                    Par_LogFile_Import_LogProgram.dbType = System.Data.SqlDbType.NVarChar;
                    Par_LogFile_Import_LogProgram.Name = "@Par_LogFile_Import_LogProgram";
                    Par_LogFile_Import_LogProgram.size = 264;
                    Par_LogFile_Import_LogProgram.Value = LogProgram;
                    Par_LogFile_Import_LogProgram.IsOutputParameter = false;
                    ProcParams.Add(Par_LogFile_Import_LogProgram);

                    Log_SQL_Parameter Par_LogFile_Import_LogUserName = new Log_SQL_Parameter();
                    Par_LogFile_Import_LogUserName.dbType = System.Data.SqlDbType.NVarChar;
                    Par_LogFile_Import_LogUserName.Name = "@Par_LogFile_Import_LogUserName";
                    Par_LogFile_Import_LogUserName.size = 264;
                    Par_LogFile_Import_LogUserName.Value = LogUserName;
                    Par_LogFile_Import_LogUserName.IsOutputParameter = false;
                    ProcParams.Add(Par_LogFile_Import_LogUserName);

                    Log_SQL_Parameter Par_LogFile_Import_LogPathFile = new Log_SQL_Parameter();
                    Par_LogFile_Import_LogPathFile.dbType = System.Data.SqlDbType.NVarChar;
                    Par_LogFile_Import_LogPathFile.Name = "@Par_LogFile_Import_LogPathFile";
                    Par_LogFile_Import_LogPathFile.size = 1000;
                    Par_LogFile_Import_LogPathFile.Value = LogPathFile;
                    Par_LogFile_Import_LogPathFile.IsOutputParameter = false;
                    ProcParams.Add(Par_LogFile_Import_LogPathFile);

                    Log_SQL_Parameter Par_LogFile_Import_Description = new Log_SQL_Parameter();
                    Par_LogFile_Import_Description.dbType = System.Data.SqlDbType.NVarChar;
                    Par_LogFile_Import_Description.Name = "@Par_LogFile_Import_Description";
                    Par_LogFile_Import_Description.size = 2000;
                    Par_LogFile_Import_Description.Value = Description;
                    Par_LogFile_Import_Description.IsOutputParameter = false;
                    ProcParams.Add(Par_LogFile_Import_Description);

                    Log_SQL_Parameter Par_LogFile_Import_LogFile_id = new Log_SQL_Parameter();
                    Par_LogFile_Import_LogFile_id.dbType = System.Data.SqlDbType.Int;
                    Par_LogFile_Import_LogFile_id.Name = "@Par_LogFile_Import_LogFile_id";
                    Par_LogFile_Import_LogFile_id.size = 4;
                    Par_LogFile_Import_LogFile_id.IsOutputParameter = true;
                    ProcParams.Add(Par_LogFile_Import_LogFile_id);

                    Log_SQL_Parameter Par_LogFile_Import_Res = new Log_SQL_Parameter();
                    Par_LogFile_Import_Res.dbType = System.Data.SqlDbType.NVarChar;
                    Par_LogFile_Import_Res.Name = "@Par_LogFile_Import_Res";
                    Par_LogFile_Import_Res.size = 265;
                    Par_LogFile_Import_Res.IsOutputParameter = true;
                    ProcParams.Add(Par_LogFile_Import_Res);

                      object Result = exec("LogFile_Import",new string[] {"@LogComputer","@LogProgram","@LogUserName","@LogPathFile","@Description","@LogFile_id","@Res"},ref Err);

            object obj = null;

            obj = ProcParamValue("@Par_LogFile_Import_LogFile_id");
            if (obj!=null)
              if (obj.GetType() == typeof(int))
             LogFile_id = (int) obj;

            obj = ProcParamValue("@Par_LogFile_Import_Res");
            if (obj!=null)
              if (obj.GetType() == typeof(string))
             Res = (string) obj;

                      if (Result==null)
                      {
                         return 0;
                      }
                      else if (Result.GetType()==typeof(int))
                      {
                        return (int) Result;
                      }
                      else
                      {
                        return -1;
                      }
        }
Esempio n. 9
0
        public int LogWrite(int LogFile_id,DateTime LogTime,string LogType,string LogDescription, ref int Log_id, ref string Res, ref string Err)
        {
            ProcParams.Clear();
                    Log_SQL_Parameter Ret_code_CopyRight_Logina_AuthorDamjanStrucl = new Log_SQL_Parameter();
                    Ret_code_CopyRight_Logina_AuthorDamjanStrucl.dbType = System.Data.SqlDbType.Int;
                    Ret_code_CopyRight_Logina_AuthorDamjanStrucl.Name = "@Ret_code_CopyRight_Logina_AuthorDamjanStrucl";
                    Ret_code_CopyRight_Logina_AuthorDamjanStrucl.size = 4;
                    Ret_code_CopyRight_Logina_AuthorDamjanStrucl.IsOutputParameter = true;
                    ProcParams.Add(Ret_code_CopyRight_Logina_AuthorDamjanStrucl);

                    Log_SQL_Parameter Par_LogWrite_LogFile_id = new Log_SQL_Parameter();
                    Par_LogWrite_LogFile_id.dbType = System.Data.SqlDbType.Int;
                    Par_LogWrite_LogFile_id.Name = "@Par_LogWrite_LogFile_id";
                    Par_LogWrite_LogFile_id.size = 4;
                    Par_LogWrite_LogFile_id.Value = LogFile_id;
                    Par_LogWrite_LogFile_id.IsOutputParameter = false;
                    ProcParams.Add(Par_LogWrite_LogFile_id);

                    Log_SQL_Parameter Par_LogWrite_LogTime = new Log_SQL_Parameter();
                    Par_LogWrite_LogTime.dbType = System.Data.SqlDbType.DateTime;
                    Par_LogWrite_LogTime.Name = "@Par_LogWrite_LogTime";
                    Par_LogWrite_LogTime.size = 8;
                    Par_LogWrite_LogTime.Value = LogTime;
                    Par_LogWrite_LogTime.IsOutputParameter = false;
                    ProcParams.Add(Par_LogWrite_LogTime);

                    Log_SQL_Parameter Par_LogWrite_LogType = new Log_SQL_Parameter();
                    Par_LogWrite_LogType.dbType = System.Data.SqlDbType.NVarChar;
                    Par_LogWrite_LogType.Name = "@Par_LogWrite_LogType";
                    Par_LogWrite_LogType.size = 10;
                    Par_LogWrite_LogType.Value = LogType;
                    Par_LogWrite_LogType.IsOutputParameter = false;
                    ProcParams.Add(Par_LogWrite_LogType);

                    Log_SQL_Parameter Par_LogWrite_LogDescription = new Log_SQL_Parameter();
                    Par_LogWrite_LogDescription.dbType = System.Data.SqlDbType.NVarChar;
                    Par_LogWrite_LogDescription.Name = "@Par_LogWrite_LogDescription";
                    Par_LogWrite_LogDescription.size = 2000;
                    Par_LogWrite_LogDescription.Value = LogDescription;
                    Par_LogWrite_LogDescription.IsOutputParameter = false;
                    ProcParams.Add(Par_LogWrite_LogDescription);

                    Log_SQL_Parameter Par_LogWrite_Log_id = new Log_SQL_Parameter();
                    Par_LogWrite_Log_id.dbType = System.Data.SqlDbType.Int;
                    Par_LogWrite_Log_id.Name = "@Par_LogWrite_Log_id";
                    Par_LogWrite_Log_id.size = 4;
                    Par_LogWrite_Log_id.IsOutputParameter = true;
                    ProcParams.Add(Par_LogWrite_Log_id);

                    Log_SQL_Parameter Par_LogWrite_Res = new Log_SQL_Parameter();
                    Par_LogWrite_Res.dbType = System.Data.SqlDbType.NVarChar;
                    Par_LogWrite_Res.Name = "@Par_LogWrite_Res";
                    Par_LogWrite_Res.size = 265;
                    Par_LogWrite_Res.IsOutputParameter = true;
                    ProcParams.Add(Par_LogWrite_Res);

                      object Result = exec("LogWrite",new string[] {"@LogFile_id","@LogTime","@LogType","@LogDescription","@Log_id","@Res"},ref Err);

            object obj = null;

            obj = ProcParamValue("@Par_LogWrite_Log_id");
            if (obj!=null)
              if (obj.GetType() == typeof(int))
             Log_id = (int) obj;

            obj = ProcParamValue("@Par_LogWrite_Res");
            if (obj!=null)
              if (obj.GetType() == typeof(string))
             Res = (string) obj;

                      if (Result==null)
                      {
                         return 0;
                      }
                      else if (Result.GetType()==typeof(int))
                      {
                        return (int) Result;
                      }
                      else
                      {
                        return -1;
                      }
        }
Esempio n. 10
0
 public void Attachment_type_AddParameter(Log_SQL_Parameter par)
 {
     m_LogFile_Attachment_VIEW.o_Attachment_type.Where.AddParameter(par);
 }
Esempio n. 11
0
 public void LogFile_id_AddParameter(Log_SQL_Parameter par)
 {
     m_LogFile_Attachment_VIEW.o_LogFile_id.Where.AddParameter(par);
 }
Esempio n. 12
0
 public void id_AddParameter(Log_SQL_Parameter par)
 {
     m_LogFile_Attachment_Type.o_id.Where.AddParameter(par);
 }
Esempio n. 13
0
 public void Description_AddParameter(Log_SQL_Parameter par)
 {
     m_LogFile_Attachment.o_Description.Where.AddParameter(par);
 }
Esempio n. 14
0
        //Upload image to database
        public bool InsertAttachment2LogFile(byte[] data, int LogFile_id, string sAttachmentType, string sDescription, ref string Err)
        {
            object result = new object();
            List<Log_SQL_Parameter> sql_params = new List<Log_SQL_Parameter>();
            Log_SQL_Parameter parAttachment = new Log_SQL_Parameter();
            parAttachment.dbType = System.Data.SqlDbType.Image;
            parAttachment.size = data.Length;
            parAttachment.Name = "@parAttachment";
            parAttachment.IsOutputParameter = false;
            parAttachment.Value = data;
            sql_params.Add(parAttachment);

            Log_SQL_Parameter parDescription = new Log_SQL_Parameter();
            parDescription.dbType = System.Data.SqlDbType.NVarChar;
            parDescription.size = 2000;
            parDescription.Name = "@parDescription";
            parDescription.IsOutputParameter = false;
            parDescription.Value = sDescription;
            sql_params.Add(parDescription);

            string sql = @"DECLARE @AttachmentType_id int
                           set @AttachmentType_id = null
                           select @AttachmentType_id = lgfat.id from dbo.LogFile_Attachment_Type lgfat where lgfat.Attachment_type ='"+sAttachmentType+@"'
                           if (@AttachmentType_id is null)
                           begin
                                insert into dbo.LogFile_Attachment_Type
                                (
                                    Attachment_type
                                )
                                values
                                (
                                   '"+sAttachmentType+@"'
                                )
                                set @AttachmentType_id =  IDENT_CURRENT('LogFile_Attachment_Type')
                           end
                           insert into dbo.LogFile_Attachment
                           (
                            LogFile_id,
                            LogFile_Attachment_Type_id,
                            Attachment,
                            Description
                            )
                            values
                            (
                            " + LogFile_id.ToString() +@",
                            @AttachmentType_id,
                            @parAttachment,
                            @parDescription
                            )
                            ";
            if (LogFile.m_LogDB_con.ExecuteNonQuerySQL(sql, sql_params, ref result, ref Err))
            {
                return true;
            }
            else
            {
                return false;
            }
        }
Esempio n. 15
0
 public void id_AddParameter(Log_SQL_Parameter par)
 {
     m_Log_Program.o_id.Where.AddParameter(par);
 }
Esempio n. 16
0
 public void id_AddParameter(Log_SQL_Parameter par)
 {
     m_LogFile_Description.o_id.Where.AddParameter(par);
 }
Esempio n. 17
0
 public void LogFile_id_AddParameter(Log_SQL_Parameter par)
 {
     m_Log.o_LogFile_id.Where.AddParameter(par);
 }
Esempio n. 18
0
 public void LogFileImportTime_AddParameter(Log_SQL_Parameter par)
 {
     m_LogFile_VIEW.o_LogFileImportTime.Where.AddParameter(par);
 }
Esempio n. 19
0
 public void id_AddParameter(Log_SQL_Parameter par)
 {
     m_Log_UserName.o_id.Where.AddParameter(par);
 }
Esempio n. 20
0
 public void Log_Program_id_AddParameter(Log_SQL_Parameter par)
 {
     m_LogFile_VIEW.o_Log_Program_id.Where.AddParameter(par);
 }
Esempio n. 21
0
 public void Log_Time_AddParameter(Log_SQL_Parameter par)
 {
     m_Log_VIEW.o_Log_Time.Where.AddParameter(par);
 }
Esempio n. 22
0
 public void ComputerName_AddParameter(Log_SQL_Parameter par)
 {
     m_Log_Computer.o_ComputerName.Where.AddParameter(par);
 }
Esempio n. 23
0
 public void Program_AddParameter(Log_SQL_Parameter par)
 {
     m_Log_VIEW.o_Program.Where.AddParameter(par);
 }
Esempio n. 24
0
 public void id_AddParameter(Log_SQL_Parameter par)
 {
     m_Log_Computer.o_id.Where.AddParameter(par);
 }
Esempio n. 25
0
 public void definition_AddParameter(Log_SQL_Parameter par)
 {
     m_sysdiagrams.o_definition.Where.AddParameter(par);
 }
Esempio n. 26
0
 public void Description_AddParameter(Log_SQL_Parameter par)
 {
     m_Log_Description.o_Description.Where.AddParameter(par);
 }
Esempio n. 27
0
 public void name_AddParameter(Log_SQL_Parameter par)
 {
     m_sysdiagrams.o_name.Where.AddParameter(par);
 }
Esempio n. 28
0
 public void PathFile_AddParameter(Log_SQL_Parameter par)
 {
     m_Log_PathFile.o_PathFile.Where.AddParameter(par);
 }
Esempio n. 29
0
 public void version_AddParameter(Log_SQL_Parameter par)
 {
     m_sysdiagrams.o_version.Where.AddParameter(par);
 }
Esempio n. 30
0
 private string ConevrtToString_MySQLdbTypeValue(Log_SQL_Parameter sqlpar)
 {
     return "";
 }