}   //  end onCancel

        private void onFinished(object sender, EventArgs e)
        {
            //  stuff each grid view into appropriate lists
            List <exportGrades> sortList  = new List <exportGrades>();
            List <exportGrades> gradeList = new List <exportGrades>();
            exportGrades        eg        = new exportGrades();

            for (int k = 0; k < logSortCodes.RowCount - 1; k++)
            {
                eg.exportSort = logSortCodes.Rows[k].Cells[0].Value.ToString();
                eg.exportCode = logSortCodes.Rows[k].Cells[1].Value.ToString();
                eg.exportName = logSortCodes.Rows[k].Cells[2].Value.ToString();
                eg.minDiam    = Convert.ToDouble(logSortCodes.Rows[k].Cells[3].Value.ToString());
                eg.minLength  = Convert.ToDouble(logSortCodes.Rows[k].Cells[4].Value.ToString());
                eg.minBDFT    = Convert.ToDouble(logSortCodes.Rows[k].Cells[5].Value.ToString());
                eg.maxDefect  = Convert.ToDouble(logSortCodes.Rows[k].Cells[6].Value.ToString());
                sortList.Add(eg);
            }   //  end for k loop

            for (int k = 0; k < logGradeCodes.RowCount - 1; k++)
            {
                eg.exportGrade = logGradeCodes.Rows[k].Cells[0].Value.ToString();
                eg.exportCode  = logGradeCodes.Rows[k].Cells[1].Value.ToString();
                eg.exportName  = logGradeCodes.Rows[k].Cells[2].Value.ToString();
                eg.minDiam     = Convert.ToDouble(logGradeCodes.Rows[k].Cells[3].Value.ToString());
                eg.minLength   = Convert.ToDouble(logGradeCodes.Rows[k].Cells[4].Value.ToString());
                eg.minBDFT     = Convert.ToDouble(logGradeCodes.Rows[k].Cells[5].Value.ToString());
                eg.maxDefect   = Convert.ToDouble(logGradeCodes.Rows[k].Cells[6].Value.ToString());
                gradeList.Add(eg);
            }   //  end for k loop

            //  Load these lists into database table
            //  this will need to change once export reports are tested -- Oct 2014
            //Global.BL.fileName = fileName;
            //Global.BL.SaveExportGrade(sortList, gradeList, tableExists);
            return;
        }   //  end onFinished
Example #2
0
        }         //  end createDefaultList

        public StringBuilder createInsertQuery(exportGrades eg, string sortOrGrade)
        {
            StringBuilder queryString = new StringBuilder();

            queryString.Append("INSERT INTO ExportValues ");
            queryString.Append("(exportSort,exportGrade,exportCode,exportName,minDiam,minLength,minBDFT,maxDefect)");

            //  enter the actual values for the record
            queryString.Append(" VALUES ('");
            if (sortOrGrade == "sort")
            {
                queryString.Append(eg.exportSort);
                queryString.Append("','','");          //  blank exportGrade
            }
            else if (sortOrGrade == "grade")
            {
                queryString.Append("','");        //  blank exportSort
                queryString.Append(eg.exportGrade);
                queryString.Append("','");
            }   //  endif sortOrGrade

            queryString.Append(eg.exportCode);
            queryString.Append("','");
            queryString.Append(eg.exportName);
            queryString.Append("','");
            queryString.Append(eg.minDiam);
            queryString.Append("','");
            queryString.Append(eg.minLength);
            queryString.Append("','");
            queryString.Append(eg.minBDFT);
            queryString.Append("','");
            queryString.Append(eg.maxDefect);
            queryString.Append("');");

            return(queryString);
        }   //  end createInsertQuery
Example #3
0
        }     //  end CreateEX1

        private int CreateEX2(StreamWriter strWriteOut, ref int pageNumb, reportHeaders rh)
        {
            //  need export data for comparison and flags for the footer and errors
            bool   errorFound          = false;
            int    footFlag            = 0;
            double minDiam             = 0;
            double minBDFT             = 0;
            double minLength           = 0;
            double maxDefect           = 0;
            string currExSort          = "";
            string currExGrade         = "";
            List <exportGrades> exList = Global.BL.GetExportGrade().ToList();

            //  loop through log stock and compare values to defaults to find errors
            foreach (LogStockDO lsl in logStockList)
            {
                //   find export grade in the export defaults
                exportGrades eg = exList.FirstOrDefault(ex => ex.exportSort == lsl.ExportGrade);
                if (eg != null)
                {
                    currExSort = eg.exportSort;
                    //  find log grade in export defaults for comparison
                    exportGrades eg1 = exList.FirstOrDefault(ex => ex.exportGrade == lsl.Grade);
                    if (eg1 != null)
                    {
                        currExGrade = eg1.exportGrade;
                        //  compare values to get correct min or max
                        //  Small end diameter minimum
                        if (eg.minDiam < eg1.minDiam)
                        {
                            minDiam = eg1.minDiam;
                        }
                        else
                        {
                            minDiam = eg.minDiam;
                        }
                        //  BDFT volume minimum
                        if (eg.minBDFT < eg1.minBDFT)
                        {
                            minBDFT = eg1.minBDFT;
                        }
                        else
                        {
                            minBDFT = eg.minBDFT;
                        }
                        //  Length minimum
                        if (eg.minLength < eg1.minLength)
                        {
                            minLength = eg1.minLength;
                        }
                        else
                        {
                            minLength = eg.minLength;
                        }
                        //  Defect maximum
                        if (eg.maxDefect > eg1.maxDefect)
                        {
                            maxDefect = eg1.maxDefect;
                        }
                        else
                        {
                            maxDefect = eg.maxDefect;
                        }
                    }
                    else
                    {
                        currExGrade = "";
                    }
                }
                else
                {
                    currExSort = "";
                }

                //  is this log in error?
                //  check length
                if (lsl.Length < minLength)
                {
                    errorFound = true;
                }
                //  check diameter
                if (lsl.SmallEndDiameter < minDiam)
                {
                    errorFound = true;
                }
                //  check BDFT volume
                if (lsl.NetBoardFoot < minBDFT)
                {
                    errorFound = true;
                }
                //  check seen defect
                if (lsl.SeenDefect > maxDefect)
                {
                    errorFound = true;
                }
                //  check sort code for blank
                if (currExSort == "" || currExSort == " ")
                {
                    currExSort = "**";
                    footFlag   = 1;
                    errorFound = true;
                }   //  endif
                //  check grade for blank
                if (currExGrade == "" || currExGrade == " ")
                {
                    currExGrade = "**";
                    footFlag    = 1;
                    errorFound  = true;
                }   //  endif
                //  load record into output list
                loadExportOutputList(lsl, currExSort, currExGrade, errorFound);
                errorFound = false;
            }   //  end foreach loop

            //  Write list
            writeExportList(strWriteOut, ref pageNumb, rh, footFlag);
            if (errorFound)
            {
                return(-1);
            }
            else
            {
                return(1);
            }
        }   //  end CreateEX2
Example #4
0
        public List <exportGrades> createDefaultList(string currentRegion, string sortOrGrades)
        {
            List <exportGrades> egList = new List <exportGrades>();
            exportGrades        eg     = new exportGrades();

            //  if this is region 10, use those arrays to build the list
            if (currentRegion == "10")
            {
                if (sortOrGrades == "sort")
                {
                    for (int n = 0; n < 21; n++)
                    {
                        eg.exportSort = R10defaultLogSort[n, 0];
                        eg.exportCode = R10defaultLogSort[n, 1];
                        eg.exportName = R10defaultLogSort[n, 2];
                        eg.minDiam    = Convert.ToDouble(R10defaultLogSort[n, 3]);
                        eg.minLength  = Convert.ToDouble(R10defaultLogSort[n, 4]);
                        eg.minBDFT    = Convert.ToDouble(R10defaultLogSort[n, 5]);
                        eg.maxDefect  = Convert.ToDouble(R10defaultLogSort[n, 6]);
                        egList.Add(eg);
                    }   //  end for n loop
                }
                else if (sortOrGrades == "grade")
                {
                    for (int n = 0; n < 9; n++)
                    {
                        eg.exportGrade = R10defaultLogGrade[n, 0];
                        eg.exportCode  = R10defaultLogGrade[n, 1];
                        eg.exportName  = R10defaultLogGrade[n, 2];
                        eg.minDiam     = Convert.ToDouble(R10defaultLogGrade[n, 3]);
                        eg.minLength   = Convert.ToDouble(R10defaultLogGrade[n, 4]);
                        eg.minBDFT     = Convert.ToDouble(R10defaultLogGrade[n, 5]);
                        eg.maxDefect   = Convert.ToDouble(R10defaultLogGrade[n, 6]);
                        egList.Add(eg);
                    } //  end for n loop
                }     //  endif sortOrGrades
            }
            else
            {
                if (sortOrGrades == "sort")
                {
                    for (int n = 0; n < 21; n++)
                    {
                        eg.exportSort = defaultLogSort[n, 0];
                        eg.exportCode = defaultLogSort[n, 1];
                        eg.exportName = defaultLogSort[n, 2];
                        eg.minDiam    = Convert.ToDouble(defaultLogSort[n, 3]);
                        eg.minLength  = Convert.ToDouble(defaultLogSort[n, 4]);
                        eg.minBDFT    = Convert.ToDouble(defaultLogSort[n, 5]);
                        eg.maxDefect  = Convert.ToDouble(defaultLogSort[n, 6]);
                        egList.Add(eg);
                    }   //  end for n loop
                }
                else if (sortOrGrades == "grade")
                {
                    for (int n = 0; n < 18; n++)
                    {
                        eg.exportGrade = defaultLogGrade[n, 0];
                        eg.exportCode  = defaultLogGrade[n, 1];
                        eg.exportName  = defaultLogGrade[n, 2];
                        eg.minDiam     = Convert.ToDouble(defaultLogGrade[n, 3]);
                        eg.minLength   = Convert.ToDouble(defaultLogGrade[n, 4]);
                        eg.minBDFT     = Convert.ToDouble(defaultLogGrade[n, 5]);
                        eg.maxDefect   = Convert.ToDouble(defaultLogGrade[n, 6]);
                        egList.Add(eg);
                    }
                } //  endif sortOrGrades
            }     //  endif currentRegion
            return(egList);
        }         //  end createDefaultList