Ejemplo n.º 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;
        }
Ejemplo n.º 2
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;
        }