Beispiel #1
0
        public ActionResult SourceDB(int id)
        {
            HashSet <int> docIndexes = Session["Doc" + id] as HashSet <int>;

            ViewBag.Text    = TextManager.ComposeHtmlText(TextManager.WordsFromText(SQLLoader.GetDoc(id)).ToArray(), docIndexes);
            ViewBag.Message = "AntiP Main page.";

            return(View());
        }
Beispiel #2
0
        public LocalData()
        {
            string server   = "35.180.63.12";
            string database = "Kate";
            string uid      = "Admin";
            string password = "******";

            connectionString =
                "SERVER=" + server +
                "; PORT = 3306 ;" +
                "DATABASE=" + database + ";" +
                "UID=" + uid + ";" +
                "PASSWORD="******";";

            _loader    = new SQLLoader(connectionString);
            _publisher = new Publisher(connectionString);
        }
Beispiel #3
0
        /// <summary>ReadDownloadedSpecFile method does the following:
        /// <list type="bullet">
        /// <item><description>Retrieve specs from the spec file (already downloaded)</description></item>
        /// <item><description>For each spec, try to process the spec via the ARINVT rules</description></item>
        /// <item><description>Insert parsed spec line into staging table using SQLLoader</description></item>
        /// <item><description>try insert staging (tempARINVT_for_GSPPS) values into ARINVT</description></item>
        /// </list>
        /// </summary>
        private static void ParseSpecFile(string GSPPSSourceFolder,
                                          string sourceFile, string SpecsFolder)
        {
            Console.WriteLine("\n Parsing... ");

            #region READ LINE BY LINE
            //*
            FileInfo fStream    = new FileInfo(GSPPSSourceFolder + sourceFile);
            long     fileLength = fStream.Length;

            string rawLine = String.Empty;
            string currentServicePartNumber = "";
            string packedServicePart        = "";

            SPECIFICATION     pkgSpec           = null;
            List <DETAILS>    currentDetails    = new List <DETAILS>();
            List <REMARKCODE> currentRemarkCode = new List <REMARKCODE>();
            List <BOM>        currentBOM        = new List <BOM>();
            REMARK            rmk     = null;
            string            rawSpec = "";
            int index = 0; //keep track of current spec
                           //int lineCounter = 0; //keep track of current line in file

            int rawLineLength = 0;
            using (StreamReader sr = new StreamReader(GSPPSSourceFolder + sourceFile))
            {
                while (sr.EndOfStream == false)
                {
                    rawLine        = sr.ReadLine();
                    rawLineLength += rawLine.Length;
                    //calculate progress
                    //keep track of current stream position
                    double percent = Math.Round((rawLineLength) * 100f / fileLength, 2);

                    #region DATA
                    if (rawLine.StartsWith("HDR")) //HEADER: Reset the current Service Part Number
                    {
                        pkgSpec = null;
                        rmk     = null;
                        currentDetails.Clear(); currentRemarkCode.Clear(); currentBOM.Clear();
                        currentServicePartNumber = "";
                        packedServicePart        = "";
                        rawSpec = "";
                    }
                    else if (rawLine.StartsWith("TRL")) //TRAILER: Reset the current Service Part Number
                    {
                        if (pkgSpec != null)
                        {
                            index = index + 1;

                            processSpec(SpecsFolder, pkgSpec, percent, currentDetails,
                                        currentBOM, currentRemarkCode, rmk, rawSpec);

                            arinvtTable.InsertIntoDataFile(true);

                            ShowProgress(pkgSpec, percent);
                        }
                        pkgSpec = null;
                        rmk     = null;
                        currentDetails.Clear(); currentRemarkCode.Clear(); currentBOM.Clear();
                        currentServicePartNumber = "";
                        packedServicePart        = "";
                        rawSpec = "";
                    }
                    else if (rawLine.StartsWith("DET1")) ///HEADER SPECIFICATION
                    {
                        if (pkgSpec != null)
                        {
                            index = index + 1;

                            processSpec(SpecsFolder, pkgSpec, percent, currentDetails,
                                        currentBOM, currentRemarkCode, rmk, rawSpec);

                            arinvtTable.InsertIntoDataFile(false);

                            ShowProgress(pkgSpec, percent);
                        }
                        currentDetails.Clear(); currentRemarkCode.Clear(); currentBOM.Clear();
                        currentServicePartNumber = "";
                        packedServicePart        = "";
                        rawSpec = "";

                        pkgSpec  = new SPECIFICATION(rawLine);
                        rawSpec += (rawLine + System.Environment.NewLine);

                        currentServicePartNumber = pkgSpec.ServicePartNo;
                        packedServicePart        = pkgSpec.PackedServicePart;
                    }
                    else if (rawLine.StartsWith("DET2") && currentServicePartNumber != "") //DETAIL/LEVEL
                    {
                        DETAILS pkgLevel = new DETAILS(rawLine, currentServicePartNumber, pkgSpec);
                        rawSpec += (rawLine + System.Environment.NewLine);
                        currentDetails.Add(pkgLevel);
                    }
                    #endregion

                    #region Others

                    /*
                     * else if (rawLine.StartsWith("DET3") && currentServicePartNumber != "") //REMARK CODE
                     * {
                     *  REMARKCODE rmkCode = new REMARKCODE(rawLine, currentServicePartNumber);
                     *  rawSpec += (rawLine + System.Environment.NewLine);
                     *  currentRemarkCode.Add(rmkCode);
                     * }
                     * else if (rawLine.StartsWith("DET4") && currentServicePartNumber != "") //REMARK
                     * {
                     *  rmk = new REMARK(rawLine, currentServicePartNumber);
                     *  rawSpec += (rawLine + System.Environment.NewLine);
                     *
                     * }
                     * else if (rawLine.StartsWith("DET5") && currentServicePartNumber != "") //BOM
                     * {
                     *  BOM bom = new BOM(rawLine, currentServicePartNumber);
                     *  rawSpec += (rawLine + System.Environment.NewLine);
                     *
                     *  currentBOM.Add(bom);
                     * }
                     * //*/
                    #endregion
                }
            }
            //*/
            #endregion

            //in case there are data items not inserted into the sql loader data file
            arinvtTable.InsertIntoDataFile(true);

            //SQLLoader.RunControlFile(arinvtTable);
            SQLLoader.RunControlFile(arinvtTable.GetControlFilePath(),
                                     arinvtTable.GetSqlLoaderTableName(), arinvtTable.TotalItems());

            arinvtTable.StageIntoRealTable();
        }
Beispiel #4
0
 public RequestParser(RequestOpen request)
 {
     _loader = new SQLLoader(request);
 }