Esempio n. 1
0
        public static IEnumerable<DeviceInfoResult> GetInfoList(DateTime? lastModifyDate = null)
        {
            SqlParameter pLastModifyDate = new SqlParameter() { ParameterName = "last_modify_date", SqlValue = lastModifyDate, SqlDbType = SqlDbType.Date };
            var dt = Db.UnitProg.ExecuteQueryStoredProcedure("get_device_info", pLastModifyDate);
            var list = new List<DeviceInfoResult>();
            if (dt.Rows.Count > 0)
            {
                foreach (DataRow row in dt.Rows)
                {
                    var info = new DeviceInfoResult();
                    info.DeviceId = Db.DbHelper.GetValueIntOrNull(row, "id_device");
                    info.DeviceSerialNum = Db.DbHelper.GetValueString(row, "serial_num");
                    info.ContractorStr = Db.DbHelper.GetValueString(row, "contractor_name");
                    info.ContractStr = Db.DbHelper.GetValueString(row, "contract_number");
                    info.AddressStr = Db.DbHelper.GetValueString(row, "device_address");
                    info.DeviceStr = Db.DbHelper.GetValueString(row, "device_name");
                    info.DescrStr = Db.DbHelper.GetValueString(row, "descr");

                    list.Add(info);
                }

            }
            return list;
        }
Esempio n. 2
0
 public static DeviceInfoResult GetInfo(string serialNum)
 {
     SqlParameter pSerialNum = new SqlParameter() { ParameterName = "serial_num", SqlValue = serialNum, SqlDbType = SqlDbType.NVarChar };
     var dt = Db.UnitProg.ExecuteQueryStoredProcedure("get_device_info", pSerialNum);
     var result= new DeviceInfoResult();
     if (dt.Rows.Count > 0)
     {
         var row = dt.Rows[0];
         result.DeviceId = Db.DbHelper.GetValueIntOrNull(row, "id_device");
         result.DeviceSerialNum = Db.DbHelper.GetValueString(row, "serial_num");
         result.ContractorStr = Db.DbHelper.GetValueString(row, "contractor_name");
         result.ContractStr = Db.DbHelper.GetValueString(row, "contract_number");
         result.AddressStr = Db.DbHelper.GetValueString(row, "device_address");
         result.DeviceStr = Db.DbHelper.GetValueString(row, "device_name");
         result.DescrStr = Db.DbHelper.GetValueString(row, "descr");
     }
     return result;
 }