Beispiel #1
0
        public IList <AlarmTemporaryInfo> GetAlarmTemporarys()
        {
            DataTable tb = getAlarmTemporarys();

            List <AlarmTemporaryInfo> lst = new List <AlarmTemporaryInfo>();

            if (tb != null && tb.Rows.Count > 0)
            {
                foreach (DataRow row in tb.Rows)
                {
                    AlarmTemporaryInfo info = new AlarmTemporaryInfo();
                    info.AlarmTemporaryDID = int.Parse(row[0].ToString());
                    info.RuleDID           = row[1].ToString();
                    info.FacilityDID       = int.Parse(row[2].ToString());
                    info.AlarmTime         = DateTime.Parse(row[3].ToString());
                    if (row[4].ToString() != "")
                    {
                        info.DisposeState = int.Parse(row[4].ToString());
                    }
                    if (row[5].ToString() != "")
                    {
                        info.DisposeTime = DateTime.Parse(row[5].ToString());
                    }
                    info.Handler = row[6].ToString();
                    if (row[7].ToString() != "")
                    {
                        info.Duration = int.Parse(row[7].ToString());
                    }
                    info.Address = row[8].ToString();
                    info.Remark  = row[9].ToString();

                    ProductionDB p = new ProductionDB();
                    FacilityInfo f = p.GetFacilityByID(info.FacilityDID);
                    info.Facility = f;

                    lst.Add(info);
                }
            }
            return(lst);
        }
Beispiel #2
0
        public AlarmTemporaryInfo GetAlarmTemporaryByID(int alarmTemporaryDID)
        {
            DataTable tb = getAlarmTemporaryByID(alarmTemporaryDID);

            if (tb != null && tb.Rows.Count > 0)
            {
                AlarmTemporaryInfo info = new AlarmTemporaryInfo();
                info.AlarmTemporaryDID = int.Parse(tb.Rows[0][0].ToString());
                info.RuleDID           = tb.Rows[0][1].ToString();
                info.FacilityDID       = int.Parse(tb.Rows[0][2].ToString());
                info.AlarmTime         = DateTime.Parse(tb.Rows[0][3].ToString());
                if (tb.Rows[0][4].ToString() != "")
                {
                    info.DisposeState = int.Parse(tb.Rows[0][4].ToString());
                }
                if (tb.Rows[0][5].ToString() != "")
                {
                    info.DisposeTime = DateTime.Parse(tb.Rows[0][5].ToString());
                }
                info.Handler = tb.Rows[0][6].ToString();
                if (tb.Rows[0][7].ToString() != "")
                {
                    info.Duration = int.Parse(tb.Rows[0][7].ToString());
                }
                info.Address = tb.Rows[0][8].ToString();
                info.Remark  = tb.Rows[0][9].ToString();

                ProductionDB p = new ProductionDB();
                FacilityInfo f = p.GetFacilityByID(info.FacilityDID);
                info.Facility = f;

                return(info);
            }
            else
            {
                throw new Exception("执行 getAlarmTemporaryByID 查询到空值");
            }
        }