示例#1
0
        //=============================================================================================
        /// <summary>
        /// This process starts with defined inputs parameters another ones functions of Shell Archiving process...
        /// The valid parameters are bellow...
        /// </summary>
        /// <param name="args"></param>
        //=============================================================================================
        static void Main(string[] args)
        {
            string dthrmmss = _dthrmmss.ToString("yyyyMMddHHmmss");
            string path     = System.IO.Directory.GetCurrentDirectory();

            //
            Console.WriteLine("\n|----------------------------------------------------===================|");
            Console.WriteLine("|Info| Shell_AutoArch_cmd - Starting Process - | " + _dthrmmss.ToString("dd/MM/yyyy HH:mm:ss"));
            Console.WriteLine("|Info| (" + path + ") Using: ");
            Console.WriteLine("|------------------------------------------------------");
            Console.WriteLine("|Info| (Config DB ) Shell_AutoArch_cmd  <1>  <UniqueID> <FileREQ>");
            Console.WriteLine("|Info| (Create CSV) Shell_AutoArch_cmd  <2>  <UniqueID> <FileREQ>");
            Console.WriteLine("|Info| (Mail PSTxt) Shell_AutoArch_cmd  <3>  <Path\\File_PST.pst>");
            Console.WriteLine("|Info| (Create CVR) Shell_AutoArch_cmd  <9>  <UniqueID> <FileREQ>");
            Console.WriteLine("\n|----------------------------------------------------===================|");
            Console.WriteLine("|Info| _PathServer - " + PathServer);
            Console.WriteLine("|Info| _PathCSV_AO - " + PathCSV);
            Console.WriteLine("|Info| _PathSQL_AO - " + PathSQL);
            Console.WriteLine("|Info| _PathCVR_AO - " + PathCVR);
            Console.WriteLine("|Info| _PathPST_AO - " + PathPST);
            Console.WriteLine("|Info| Parameters  : ");
            int cont = 1;

            foreach (string s in args)
            {
                Console.WriteLine(String.Format("|Info| param [{0, 2}]  = {1}", cont, s));
                cont++;
            }
            Console.WriteLine("|----------------------------------------------------===================|");
            //
            if ((args == null) || (args.Length == 0))
            {
                ErrMsg("Invalid arguments!", "Try again with correct values.");
            }
            else
            {
                if (args.Length >= 3)
                {
                    string unique_id = args[1];

                    //Search and get all configuration values in tables...
                    cfg_plan = new MPSfwk.Model.Configs();
                    cfg_lapi = new MPSfwk.Model.Configs();
                    cfg_plan = SqlServer.SQLUtil.ReadPlanning(unique_id);
                    cfg_lapi = SqlServer.SQLUtil.ReadLAPI(cfg_plan.INSTANCEID);
                    sysid    = SqlServer.SQLUtil.ReadSYSID(cfg_plan.INSTANCEID);
                    FileSQL  = PathSQL + unique_id + "_conf.sql";
                    FileREQ  = PathServer + args[2];

                    //Change "-" to "_"
                    unique_id = args[1].Replace("-", "_");
                    string db_name = cfg_plan.INSTANCEID + "_" + unique_id; //Rev. INSTANCEID - 12/5/2015

                    // Select wich functionality was choice...
                    if (args[0] == "1")
                    {
                        dthrmmss = DateTime.Now.ToString("yyyyMMddHHmmss");
                        //Write SQL file to run on Shell Server...
                        fileSQL = new StreamWriter(FileSQL, false); //false = not append, create new (31/3)
                        //
                        fileSQL.WriteLine("/*** ==== " + "|Info| Shell_AutoArch_cmd - Database Initialization - | " + _dthrmmss.ToString("dd/MM/yyyy HH:mm:ss") + " ==== ***/");
                        //
                        //Generate Insert Orders...
                        Console.WriteLine("|Info| Starting Archive Orders objects... " + ReadWriteCSV(unique_id));
                        //
                        fileSQL.Close();
                    }
                    else if (args[0] == "2")
                    {
                        Console.WriteLine("|Info| Starting Archive Orders objects... " + ReadWriteCSV(unique_id));
                    }
                    else if (args[0] == "9")
                    {
                        //Write SQL file to run on Shell Server...
                        fileSQL = new StreamWriter(FileSQL, false); //false = not append, create new (31/3)
                        //
                        Console.WriteLine("|Info| Starting Archive Orders objects... " + ReadWriteCSV(unique_id));
                        Console.WriteLine("|Info| Starting Document CVR objects... " + fillWordCVR(unique_id));
                    }
                    //
                    else if (args[0] == "0")
                    {
                        Console.WriteLine("|Info| Starting Test MPS updAOVolume objects... " + updAOVolume(unique_id, args[2], args[3]));
                    }
                    //
                    else
                    {
                        ErrMsg("Invalid arguments!", "Try again with correct values.");
                    }
                }
                else if (args.Length == 2)
                {
                    string path_pstfile = args[1];
                    if (args[0] == "3")
                    {
                        if (path_pstfile.IndexOf("\\") >= 0)
                        {
                            Console.WriteLine("|Info| Starting MailPST Text exporting... " + MPSfwk.MSWord.WritePSText((PathPST + "Today.txt"), path_pstfile));
                        }
                        else
                        {
                            Console.WriteLine("|Info| Starting MailPST Text exporting... " + MPSfwk.MSWord.WritePSText((PathPST + "Today.txt"), (PathPST + path_pstfile)));
                        }
                    }
                }
            }
        }
示例#2
0
        //=============================================================================================
        /// <summary>
        /// This process starts with defined inputs parameters another ones functions of Shell Archiving process...
        /// The valid parameters are bellow...
        /// </summary>
        /// <param name="args"></param>
        //=============================================================================================
        static void Main(string[] args)
        {
            string dthrmmss = _dthrmmss.ToString("yyyyMMddHHmmss");
            string path = System.IO.Directory.GetCurrentDirectory();
            //
            Console.WriteLine("\n|----------------------------------------------------===================|");
            Console.WriteLine("|Info| Shell_AutoArch_cmd - Starting Process - | " + _dthrmmss.ToString("dd/MM/yyyy HH:mm:ss"));
            Console.WriteLine("|Info| (" + path + ") Using: ");
            Console.WriteLine("|------------------------------------------------------");
            Console.WriteLine("|Info| (Config DB ) Shell_AutoArch_cmd  <1>  <UniqueID> <FileREQ>");
            Console.WriteLine("|Info| (Create CSV) Shell_AutoArch_cmd  <2>  <UniqueID> <FileREQ>");
            Console.WriteLine("|Info| (Mail PSTxt) Shell_AutoArch_cmd  <3>  <Path\\File_PST.pst>");
            Console.WriteLine("|Info| (Create CVR) Shell_AutoArch_cmd  <9>  <UniqueID> <FileREQ>");
            Console.WriteLine("\n|----------------------------------------------------===================|");
            Console.WriteLine("|Info| _PathServer - " + PathServer);
            Console.WriteLine("|Info| _PathCSV_AO - " + PathCSV);
            Console.WriteLine("|Info| _PathSQL_AO - " + PathSQL);
            Console.WriteLine("|Info| _PathCVR_AO - " + PathCVR);
            Console.WriteLine("|Info| _PathPST_AO - " + PathPST);
            Console.WriteLine("|Info| Parameters  : ");
            int cont = 1;
            foreach (string s in args)
            {
                Console.WriteLine(String.Format("|Info| param [{0, 2}]  = {1}", cont, s));
                cont++;
            }
            Console.WriteLine("|----------------------------------------------------===================|");
            //
            if ((args == null) || (args.Length == 0)) { ErrMsg("Invalid arguments!", "Try again with correct values."); }
            else
            {
                if (args.Length >= 3)
                {
                    string unique_id = args[1];

                    //Search and get all configuration values in tables...
                    cfg_plan = new MPSfwk.Model.Configs();
                    cfg_lapi = new MPSfwk.Model.Configs();
                    cfg_plan = SqlServer.SQLUtil.ReadPlanning(unique_id);
                    cfg_lapi = SqlServer.SQLUtil.ReadLAPI(cfg_plan.INSTANCEID);
                    sysid = SqlServer.SQLUtil.ReadSYSID(cfg_plan.INSTANCEID);
                    FileSQL = PathSQL + unique_id + "_conf.sql";
                    FileREQ = PathServer + args[2];

                    //Change "-" to "_"
                    unique_id = args[1].Replace("-", "_");
                    string db_name = cfg_plan.INSTANCEID + "_" + unique_id; //Rev. INSTANCEID - 12/5/2015

                    // Select wich functionality was choice...
                    if (args[0] == "1")
                    {
                        dthrmmss = DateTime.Now.ToString("yyyyMMddHHmmss");
                        //Write SQL file to run on Shell Server...
                        fileSQL = new StreamWriter(FileSQL, false); //false = not append, create new (31/3)
                        //
                        fileSQL.WriteLine("/*** ==== " + "|Info| Shell_AutoArch_cmd - Database Initialization - | " + _dthrmmss.ToString("dd/MM/yyyy HH:mm:ss") + " ==== ***/");
                        //
                        //Generate Insert Orders...
                        Console.WriteLine("|Info| Starting Archive Orders objects... " + ReadWriteCSV(unique_id));
                        //
                        fileSQL.Close();
                    }
                    else if (args[0] == "2") { Console.WriteLine("|Info| Starting Archive Orders objects... " + ReadWriteCSV(unique_id)); }
                    else if (args[0] == "9")
                    {
                        //Write SQL file to run on Shell Server...
                        fileSQL = new StreamWriter(FileSQL, false); //false = not append, create new (31/3)
                        //
                        Console.WriteLine("|Info| Starting Archive Orders objects... " + ReadWriteCSV(unique_id));
                        Console.WriteLine("|Info| Starting Document CVR objects... " + fillWordCVR(unique_id));
                    }
                    //
                    else if (args[0] == "0") { Console.WriteLine("|Info| Starting Test MPS updAOVolume objects... " + updAOVolume(unique_id,args[2],args[3])); }
                    //
                    else { ErrMsg("Invalid arguments!", "Try again with correct values."); }
                }
                else if (args.Length == 2)
                {
                    string path_pstfile = args[1];
                    if (args[0] == "3")
                    {
                        if (path_pstfile.IndexOf("\\") >= 0)
                            Console.WriteLine("|Info| Starting MailPST Text exporting... " + MPSfwk.MSWord.WritePSText((PathPST + "Today.txt"), path_pstfile));
                        else
                            Console.WriteLine("|Info| Starting MailPST Text exporting... " + MPSfwk.MSWord.WritePSText((PathPST + "Today.txt"), (PathPST + path_pstfile)));
                    }
                }
            }
        }