Пример #1
0
        static void MoveMail(object source, System.Timers.ElapsedEventArgs e)
        {
            NotesUtils pNotesUtils = null;

            Console.WriteLine("Notes Move!");
            System.Timers.Timer pp = (System.Timers.Timer)source;
            pp.Enabled = false;

            try
            {
                //pNotesUtils = new NotesUtils(pNotesSession, "mail9you/runstar", "mail\\费亚平.nsf");
                pNotesUtils = new NotesUtils(pNotesSession, "mail9you/runstar", "mail\\netadmin.nsf");

                if (pNotesUtils.OpenDataBase("netadmin", "12341234"))
                {
                    if (pNotesUtils.MoveMailInfo())
                    {
                    }
                    else
                    {
                        Console.ForegroundColor = ConsoleColor.Yellow;
                        Console.WriteLine("Notes Move Exception : " + pNotesUtils.Message);
                        Console.ForegroundColor = ConsoleColor.Gray;
                        Console.WriteLine("");
                    }
                }
                else
                {
                    Console.ForegroundColor = ConsoleColor.Yellow;
                    Console.WriteLine("Notes Connect Exception : " + pNotesUtils.Message);
                    Console.ForegroundColor = ConsoleColor.Gray;
                    Console.WriteLine("");
                }
            }
            catch (Exception ex)
            {
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.WriteLine("Notes Save Exception : " + ex.Message);
                Console.ForegroundColor = ConsoleColor.Gray;
                Console.WriteLine("");
            }
            finally
            {
                if (pNotesUtils != null)
                {
                    pNotesUtils.Dispose();
                }
            }

            pp.Enabled = true;
        }
Пример #2
0
        static void SendAuLog(object source, System.Timers.ElapsedEventArgs e)
        {
            NotesUtils pNotesUtils = null;

            try
            {
                string       str_sql  = "SELECT * FROM Au_Log";
                MSSQLOperate pSendLog = new MSSQLOperate(strAnalyse);
                pSendLog.Connect(false);
                pSendLog.ExecuteQuery(str_sql);
                pSendLog.GetResult(RecordStyle.DATASET);
                DataSet pSet = (DataSet)pSendLog.RecordData;

                string _str = null;

                if (pSendLog.AffectRow > 0)
                {
                    for (int i = 0; i < pSendLog.AffectRow; i++)
                    {
                        for (int j = 0; j < pSet.Tables[0].Columns.Count; j++)
                        {
                            _str += pSet.Tables[0].Rows[i][j].ToString();
                            _str += "\a\t\a\t";
                        }
                        _str += "\r\n";
                    }


                    //pNotesUtils = new NotesUtils(pNotesSession, "mail9you/runstar", "mail\\费亚平.nsf");
                    pNotesUtils = new NotesUtils(pNotesSession, "mail9you/runstar", "mail\\netadmin.nsf");

                    if (pNotesUtils.OpenDataBase("黄恒泰", "12341234"))
                    {
                        pNotesUtils.SendMailInfo("", "", "Au日志", _str);
                    }
                }
            }
            catch
            { }
            finally
            {
                if (pNotesUtils != null)
                {
                    pNotesUtils.Dispose();
                }
            }
        }
Пример #3
0
        static void CheckMail(object source, System.Timers.ElapsedEventArgs e)
        {
            NotesUtils pNotesUtils = null;

            Console.WriteLine("Notes Check:");
            System.Timers.Timer pp = (System.Timers.Timer)source;
            pp.Enabled = false;

            try
            {
                //pNotesUtils = new NotesUtils(pNotesSession, "mail9you/runstar", "mail\\费亚平.nsf");
                pNotesUtils = new NotesUtils(pNotesSession, "mail9you/runstar", "mail\\netadmin.nsf");

                if (pNotesUtils.OpenDataBase("netadmin", "12341234"))
                {
                    if (pNotesUtils.GetMailInfo())
                    {
                        MSSQLOperate pSaveMail = new MSSQLOperate(strAnalyse);

                        CustomDataCollection pMailStruct = (CustomDataCollection)pNotesUtils.Records;
                        CustomData[,] pMailInfo = pMailStruct[-1];

                        for (int i = 0; i < pMailStruct.RowCount; i++)
                        {
                            pSaveMail.Connect(false);
                            string        strProcParams = "SP_PUT_NOTESCONTENT";
                            DbParameter[] paramCache    = DataUtilities.GetParameters(strProcParams);

                            #region
                            if (paramCache == null)
                            {
                                paramCache = new SqlParameter[] {
                                    new SqlParameter("@iFailure", SqlDbType.Int, 4),
                                    new SqlParameter("@iCategory", SqlDbType.Int, 4),
                                    new SqlParameter("@strUID", SqlDbType.VarChar, 100),
                                    new SqlParameter("@strPUID", SqlDbType.VarChar, 100),
                                    new SqlParameter("@strSubject", SqlDbType.VarChar, 100),
                                    new SqlParameter("@dtPost", SqlDbType.DateTime),
                                    new SqlParameter("@strSender", SqlDbType.VarChar, 50),
                                    new SqlParameter("@strRecive", SqlDbType.Text),
                                    new SqlParameter("@strContent", SqlDbType.Text),
                                    new SqlParameter("@strCount", SqlDbType.VarChar, 100),
                                    new SqlParameter("@iView", SqlDbType.Int, 4),
                                    new SqlParameter("@iGroup", SqlDbType.Int, 4)
                                };
                                DataUtilities.SetParameters(strProcParams, paramCache);
                            }

                            paramCache[0].Value  = 0;
                            paramCache[1].Value  = 0;
                            paramCache[2].Value  = pMailInfo[i, 0].Content;
                            paramCache[3].Value  = pMailInfo[i, 1].Content;
                            paramCache[4].Value  = pMailInfo[i, 2].Content;
                            paramCache[5].Value  = pMailInfo[i, 4].Content;
                            paramCache[6].Value  = pMailInfo[i, 3].Content;
                            paramCache[7].Value  = pMailInfo[i, 5].Content;
                            paramCache[8].Value  = pMailInfo[i, 6].Content;
                            paramCache[9].Value  = pMailInfo[i, 7].Content;
                            paramCache[10].Value = 0;
                            paramCache[11].Value = 2;
                            #endregion

                            pSaveMail.ExecuteQuery(false, strProcParams, paramCache);
                            pSaveMail.GetResult(RecordStyle.NONE);
                        }

                        #region
                        Console.ForegroundColor = ConsoleColor.Yellow;
                        Console.WriteLine("Notes Recive Count : " + pMailStruct.RowCount);
                        Console.ForegroundColor = ConsoleColor.Gray;
                        Console.WriteLine("");
                        #endregion
                    }
                    else
                    {
                        #region
                        Console.ForegroundColor = ConsoleColor.Yellow;
                        Console.WriteLine("Notes Recive Exception : " + pNotesUtils.Message);
                        Console.ForegroundColor = ConsoleColor.Gray;
                        Console.WriteLine("");
                        #endregion
                    }
                }
                else
                {
                    #region
                    Console.ForegroundColor = ConsoleColor.Yellow;
                    Console.WriteLine("Notes Connect Exception : " + pNotesUtils.Message);
                    Console.ForegroundColor = ConsoleColor.Gray;
                    Console.WriteLine("");
                    #endregion
                }
            }
            catch (Exception ex)
            {
                #region
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.WriteLine("Notes Save Exception : " + ex.Message);
                Console.ForegroundColor = ConsoleColor.Gray;
                Console.WriteLine("");
                #endregion
            }
            finally
            {
                if (pNotesUtils != null)
                {
                    pNotesUtils.Dispose();
                }
            }

            pp.Enabled = true;
        }