コード例 #1
0
        }   //  end onCellClick

        private void onInsertClick(object sender, EventArgs e)
        {
            if (trackRow >= 0)
            {
                qualityEquationList.CurrentCell = qualityEquationList.Rows[trackRow].Cells[2];
                qualityEquationList.EditMode    = DataGridViewEditMode.EditOnEnter;
            }
            else if (trackRow == -1)
            {
                //  means user didn't click a cell which could be the first row is being edited
                //  so set trackRow to zero for first row
                trackRow = 0;
            }   //  endif trackRow

            if (trackRow < qaList.Count)
            {
                //  must be a change
                qaList[trackRow].QualityAdjEq = equationList.SelectedItem.ToString();
            }
            else if (trackRow >= qaList.Count)
            {
                //  it's a new record
                QualityAdjEquationDO qado = new QualityAdjEquationDO();
                qado.QualityAdjEq = equationList.SelectedItem.ToString();
                qaList.Add(qado);
            }   //  endif trackRow

            qualityAdjEquationDOBindingSource.ResetBindings(false);
            qualityEquationList.ClearSelection();
            qualityEquationList.CurrentCell = qualityEquationList.Rows[trackRow].Cells[3];

            equationList.Enabled = false;
        }   //  end onInsertClick
コード例 #2
0
        }         //  end CheckEquations

        public List <string> buildPrintArray(QualityAdjEquationDO qae)
        {
            string fieldFormat = "{0,8:F4}";
            string yearFormat  = "{0,0:F4}";
            var    qualArray   = new List <string>();

            qualArray.Add(" ");
            qualArray.Add(qae.Species.PadRight(6, ' '));
            qualArray.Add(qae.QualityAdjEq);
            qualArray.Add(String.Format(yearFormat, qae.Year));
            qualArray.Add(String.Format(fieldFormat, qae.Coefficient1));
            qualArray.Add(String.Format(fieldFormat, qae.Coefficient2));
            qualArray.Add(String.Format(fieldFormat, qae.Coefficient3));
            qualArray.Add(String.Format(fieldFormat, qae.Coefficient4));
            qualArray.Add(String.Format(fieldFormat, qae.Coefficient5));
            qualArray.Add(String.Format(fieldFormat, qae.Coefficient6));

            return(qualArray);
        }   //  end buildPrintArray
コード例 #3
0
        }         //  end CheckEquations

        public static ArrayList buildPrintArray(QualityAdjEquationDO qae)
        {
            string    fieldFormat = "{0,8:F4}";
            string    yearFormat  = "{0,0:F4}";
            ArrayList qualArray   = new ArrayList();

            qualArray.Add(" ");
            qualArray.Add(qae.Species.PadRight(6, ' '));
            qualArray.Add(qae.QualityAdjEq);
            qualArray.Add(Utilities.FormatField(qae.Year, yearFormat).ToString());
            qualArray.Add(Utilities.FormatField(qae.Coefficient1, fieldFormat).ToString());
            qualArray.Add(Utilities.FormatField(qae.Coefficient2, fieldFormat).ToString());
            qualArray.Add(Utilities.FormatField(qae.Coefficient3, fieldFormat).ToString());
            qualArray.Add(Utilities.FormatField(qae.Coefficient4, fieldFormat).ToString());
            qualArray.Add(Utilities.FormatField(qae.Coefficient5, fieldFormat).ToString());
            qualArray.Add(Utilities.FormatField(qae.Coefficient6, fieldFormat).ToString());

            return(qualArray);
        }   //  end buildPrintArray
コード例 #4
0
        }   //  end LogError6

        public static StringBuilder GetIdentifier(string tableName, long CNtoFind)
        {
            StringBuilder ident = new StringBuilder();

            switch (tableName)
            {
            case "Sale":
                SaleDO sale = Global.BL.getSale().FirstOrDefault(sd => sd.Sale_CN == CNtoFind);
                if (sale != null)
                {
                    ident.Append("Sale number = ");
                    ident.Append(sale.SaleNumber);
                }
                else
                {
                    ident.Append("Sale number not found");
                }
                break;

            case "Stratum":
                StratumDO strat = Global.BL.getStratum().FirstOrDefault(sdo => sdo.Stratum_CN == CNtoFind);
                if (strat != null)
                {
                    ident.Append(strat.Code);
                }
                else
                {
                    ident.Append("Stratum code not found");
                }
                break;

            case "Cutting Unit":
                CuttingUnitDO cudo = Global.BL.getCuttingUnits().FirstOrDefault(cu => cu.CuttingUnit_CN == CNtoFind);
                if (cudo != null)
                {
                    ident.Append("   ");
                    ident.Append(cudo.Code.PadLeft(3, ' '));
                }
                else
                {
                    ident.Append("Cutting unit not found");
                }
                break;

            case "Tree":
                TreeDO tdo = Global.BL.getTrees().FirstOrDefault(td => td.Tree_CN == CNtoFind);
                if (tdo != null)
                {
                    ident.Append(tdo.Stratum.Code.PadRight(3, ' '));
                    ident.Append(tdo.CuttingUnit.Code.PadLeft(3, ' '));
                    if (tdo.Plot == null)
                    {
                        ident.Append("     ");
                    }
                    else if (tdo.Plot_CN == 0)
                    {
                        ident.Append("     ");
                    }
                    else
                    {
                        ident.Append(tdo.Plot.PlotNumber.ToString().PadLeft(5, ' '));
                    }
                    ident.Append(tdo.TreeNumber.ToString().PadLeft(5, ' '));
                    ident.Append(" --- ");
                    if (tdo.Species == null)
                    {
                        ident.Append("       ");
                    }
                    else
                    {
                        ident.Append(tdo.Species.PadRight(7, ' '));
                    }
                    if (tdo.SampleGroup == null)
                    {
                        ident.Append("   ");
                    }
                    else
                    {
                        if (tdo.SampleGroup.Code == "" || tdo.SampleGroup.Code == " " ||
                            tdo.SampleGroup.Code == "<Blank>" || tdo.SampleGroup.Code == null)
                        {
                            ident.Append("   ");
                        }
                        else
                        {
                            ident.Append(tdo.SampleGroup.Code.PadRight(3, ' '));
                        }
                        ident.Append(tdo.SampleGroup.PrimaryProduct.PadRight(3, ' '));
                    }       //  endif
                }
                else
                {
                    ident.Append("Tree not found");
                }
                break;

            case "Log":
                LogDO log = Global.BL.getLogs().FirstOrDefault(ld => ld.Log_CN == CNtoFind);
                if (log != null)
                {
                    ident.Append(log.Tree.Stratum.Code.PadRight(3, ' '));
                    ident.Append(log.Tree.CuttingUnit.Code.PadLeft(3, ' '));
                    if (log.Tree.Plot == null)
                    {
                        ident.Append("     ");
                    }
                    else
                    {
                        ident.Append(log.Tree.Plot.PlotNumber.ToString().PadLeft(5, ' '));
                    }
                    ident.Append(log.Tree.TreeNumber.ToString().PadLeft(5, ' '));
                    ident.Append(log.LogNumber.PadLeft(3, ' '));
                }
                else
                {
                    ident.Append("Log not found");
                }
                break;

            case "Volume Equation":
                if (CNtoFind == 0)
                {
                    CNtoFind = 1;
                }
                //List<VolumeEquationDO> vList = Global.BL.getVolumeEquations();
                VolumeEquationDO ve = Global.BL.getVolumeEquations().ElementAt((int)CNtoFind - 1);
                ident.Append("-- --- ---- ---- --- ");
                ident.Append(ve.Species.PadRight(7, ' '));
                ident.Append("-- ");
                ident.Append(ve.PrimaryProduct.PadRight(3, ' '));
                ident.Append(ve.VolumeEquationNumber.PadRight(10, ' '));

                //ident.Append("-- --- ---- ---- --- ");
                //ident.Append(vList[(int)CNtoFind-1].Species.PadRight(7, ' '));
                //ident.Append("-- ");
                //ident.Append(vList[(int)CNtoFind-1].PrimaryProduct.PadRight(3, ' '));
                //ident.Append(vList[(int)CNtoFind-1].VolumeEquationNumber.PadRight(10,' '));
                break;

            case "Value Equation":
                if (CNtoFind == 0)
                {
                    CNtoFind = 1;
                }
                ValueEquationDO veq = Global.BL.getValueEquations().ElementAt((int)CNtoFind - 1);
                ident.Append("-- --- ---- ---- --- ");
                ident.Append(veq.Species.PadRight(7, ' '));
                ident.Append("-- ");
                ident.Append(veq.PrimaryProduct.PadRight(3, ' '));
                ident.Append(veq.ValueEquationNumber.PadRight(10, ' '));
                //List<ValueEquationDO> veList = Global.BL.getValueEquations();
                //ident.Append("-- --- ---- ---- --- ");
                //ident.Append(veList[(int)CNtoFind-1].Species.PadRight(7, ' '));
                //ident.Append("-- ");
                //ident.Append(veList[(int)CNtoFind-1].PrimaryProduct.PadRight(3,' '));
                //ident.Append(veList[(int)CNtoFind-1].ValueEquationNumber.PadRight(10,' '));
                break;

            case "Quality Adjustment":
                if (CNtoFind == 0)
                {
                    CNtoFind = 1;
                }
                QualityAdjEquationDO qe = Global.BL.getQualAdjEquations().ElementAt((int)CNtoFind - 1);
                ident.Append("-- --- ---- ---- --- ");
                ident.Append(qe.Species.PadRight(7, ' '));
                ident.Append("-- -- ");
                ident.Append(qe.QualityAdjEq.PadRight(10, ' '));
                //List<QualityAdjEquationDO> qList = Global.BL.getQualAdjEquations();
                //ident.Append("-- --- ---- ---- --- ");
                //ident.Append(qList[(int)CNtoFind-1].Species.PadRight(7, ' '));
                //ident.Append("-- -- ");
                //ident.Append(qList[(int)CNtoFind-1].QualityAdjEq.PadRight(10,' '));
                break;

            case "SampleGroup":
                SampleGroupDO sg = Global.BL.getSampleGroups().FirstOrDefault(sgd => sgd.SampleGroup_CN == CNtoFind);
                if (sg != null)
                {
                    ident.Append(sg.Stratum.Code.PadRight(3, ' '));
                    ident.Append("--- ---- ---- --- ------ ");
                    ident.Append(sg.Code.PadRight(3, ' '));
                    ident.Append(sg.PrimaryProduct.PadRight(3, ' '));
                }
                else
                {
                    ident.Append("Sample Group not found");
                }
                break;
            } //  end switch
            return(ident);
        }     //  end GetIdentifier