Exemple #1
0
        private IList<ImportInsData> GetDataRow(DataSet ds)
        {
            int rowno = 0;
            IList<ImportInsData> rdlist = new List<ImportInsData>();
            int maxThroughput, dailyTest, perTestCtrl, weeklyTest, monthlyTest, quarterlyTest;

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                rowno++;
                if (!DatarowValueToInt(dr[2], out maxThroughput))
                    maxThroughput = 1;
                if (!DatarowValueToInt(dr[3], out perTestCtrl))
                    perTestCtrl = 0;
                if (!DatarowValueToInt(dr[4], out dailyTest))
                    dailyTest = 0;
                if (!DatarowValueToInt(dr[5], out weeklyTest))
                    weeklyTest = 0;
                if (!DatarowValueToInt(dr[6], out monthlyTest))
                    monthlyTest = 0;
                if (!DatarowValueToInt(dr[7], out quarterlyTest))
                    quarterlyTest = 0;

                ImportInsData rd = new ImportInsData(Convert.ToString(dr[1]).Trim(), Convert.ToString(dr[0]).Trim(), maxThroughput, dailyTest, weeklyTest, monthlyTest, quarterlyTest, perTestCtrl, rowno);
                if (!string.IsNullOrEmpty(Convert.ToString(dr[0])))
                    AddImportedTestingArea(new ImportedTestingArea(Convert.ToString(dr[0]).Trim()));

                rdlist.Add(rd);
            }

            FrmAssignTestingArea frm = new FrmAssignTestingArea(_listOfImportedTA);
            frm.ShowDialog();

            foreach (ImportInsData rd in rdlist)
            {
                if (!string.IsNullOrEmpty(rd.AreaName))
                {
                    ImportedTestingArea ita = _listOfImportedTA[rd.AreaName.Trim()];
                    rd.TestingArea = ita.TestingArea;

                    if (!string.IsNullOrEmpty(rd.InsName))
                    {
                        rd.IsExist = DataRepository.GetInstrumentByNameAndTestingArea(rd.InsName.Trim(), rd.TestingArea.Id) != null;
                    }
                    else
                        rd.HasError = true;
                }
                else
                    rd.HasError = true;
            }

            return rdlist;
        }
Exemple #2
0
        private IList <ImportInsData> GetDataRow(DataSet ds)
        {
            int rowno = 0;
            IList <ImportInsData> rdlist = new List <ImportInsData>();
            int maxThroughput, dailyTest, perTestCtrl, weeklyTest, monthlyTest, quarterlyTest;

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                rowno++;
                if (!DatarowValueToInt(dr[2], out maxThroughput))
                {
                    maxThroughput = 1;
                }
                if (!DatarowValueToInt(dr[3], out perTestCtrl))
                {
                    perTestCtrl = 0;
                }
                if (!DatarowValueToInt(dr[4], out dailyTest))
                {
                    dailyTest = 0;
                }
                if (!DatarowValueToInt(dr[5], out weeklyTest))
                {
                    weeklyTest = 0;
                }
                if (!DatarowValueToInt(dr[6], out monthlyTest))
                {
                    monthlyTest = 0;
                }
                if (!DatarowValueToInt(dr[7], out quarterlyTest))
                {
                    quarterlyTest = 0;
                }

                ImportInsData rd = new ImportInsData(Convert.ToString(dr[1]).Trim(), Convert.ToString(dr[0]).Trim(), maxThroughput, dailyTest, weeklyTest, monthlyTest, quarterlyTest, perTestCtrl, rowno);
                if (!string.IsNullOrEmpty(Convert.ToString(dr[0])))
                {
                    AddImportedTestingArea(new ImportedTestingArea(Convert.ToString(dr[0]).Trim()));
                }

                rdlist.Add(rd);
            }

            FrmAssignTestingArea frm = new FrmAssignTestingArea(_listOfImportedTA);

            frm.ShowDialog();

            foreach (ImportInsData rd in rdlist)
            {
                if (!string.IsNullOrEmpty(rd.AreaName))
                {
                    ImportedTestingArea ita = _listOfImportedTA[rd.AreaName.Trim()];
                    rd.TestingArea = ita.TestingArea;

                    if (!string.IsNullOrEmpty(rd.InsName))
                    {
                        rd.IsExist = DataRepository.GetInstrumentByNameAndTestingArea(rd.InsName.Trim(), rd.TestingArea.Id) != null;
                    }
                    else
                    {
                        rd.HasError = true;
                    }
                }
                else
                {
                    rd.HasError = true;
                }
            }

            return(rdlist);
        }