Beispiel #1
0
 public void edit(RW_POINTS obj)
 {
     DAL.edit(obj.ID, obj.PointID, obj.GaugePoint, obj.PointLocation, obj.PIDNo, obj.FittingDesc, obj.Specification, obj.PointName, obj.Size, obj.MinReqThickness, obj.ThicknessReading, obj.ThicknessDate, obj.NominalThickness, obj.EstimatedCorrosionRate, obj.CalculatedCorrosionRate, obj.CalculatedRemainingLife, obj.k);
 }
Beispiel #2
0
 public void delete(RW_POINTS obj)
 {
     DAL.delete(obj.PointID);
 }
        // dung file get data
        // dung file get list( data source)
        public List <RW_POINTS> getDataSource()
        {
            List <RW_POINTS> list = new List <RW_POINTS>();
            RW_POINTS        obj  = null;
            SqlConnection    conn = MSSQLDBUtils.GetDBConnection();

            conn.Open();
            String sql = "USE [rbi]" +
                         "SELECT [ID]" +
                         ",[PointID]" +
                         ",[PointName]" +
                         ",[GaugePoint]" +
                         ",[PointLocation]" +
                         ",[PIDNo]" +
                         ",[FittingDesc]" +
                         ",[Specification]" +
                         ",[Size]" +
                         ",[MinReqThickness]" +
                         ",[ThicknessReading]" +
                         ",[ThicknessDate]" +
                         ",[NominalThickness]" +
                         ",[EstimatedCorrosionRate]" +
                         ",[CalculatedCorrosionRate]" +
                         ",[CalculatedRemainingLife]" +
                         ",[k]" +
                         "  FROM [rbi].[dbo].[RW_POINTS]";

            try
            {
                SqlCommand cmd = new SqlCommand();
                cmd.Connection  = conn;
                cmd.CommandText = sql;
                using (DbDataReader reader = cmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        if (reader.HasRows)
                        {
                            obj         = new RW_POINTS();
                            obj.ID      = reader.GetInt32(0);
                            obj.PointID = reader.GetInt32(1);
                            if (!reader.IsDBNull(2))
                            {
                                obj.PointName = reader.GetString(2);
                            }
                            if (!reader.IsDBNull(3))
                            {
                                obj.GaugePoint = reader.GetString(3);
                            }
                            if (!reader.IsDBNull(4))
                            {
                                obj.PointLocation = reader.GetString(4);
                            }
                            if (!reader.IsDBNull(5))
                            {
                                obj.PIDNo = reader.GetString(5);
                            }
                            if (!reader.IsDBNull(6))
                            {
                                obj.FittingDesc = reader.GetString(6);
                            }
                            if (!reader.IsDBNull(7))
                            {
                                obj.Specification = reader.GetString(7);
                            }
                            if (!reader.IsDBNull(8))
                            {
                                obj.Size = reader.GetString(8);
                            }
                            if (!reader.IsDBNull(9))
                            {
                                obj.MinReqThickness = reader.GetFloat(9);
                            }
                            if (!reader.IsDBNull(10))
                            {
                                obj.ThicknessReading = reader.GetFloat(10);
                            }
                            if (!reader.IsDBNull(11))
                            {
                                obj.ThicknessDate = reader.GetDateTime(11);
                            }
                            if (!reader.IsDBNull(12))
                            {
                                obj.NominalThickness = reader.GetFloat(12);
                            }
                            if (!reader.IsDBNull(13))
                            {
                                obj.EstimatedCorrosionRate = reader.GetFloat(13);
                            }
                            if (!reader.IsDBNull(14))
                            {
                                obj.CalculatedCorrosionRate = reader.GetFloat(14);
                            }
                            if (!reader.IsDBNull(15))
                            {
                                obj.CalculatedRemainingLife = reader.GetFloat(15);
                            }
                            if (!reader.IsDBNull(16))
                            {
                                obj.k = reader.GetFloat(16);
                            }
                            list.Add(obj);
                        }
                    }
                }
            }
            catch
            {
                MessageBox.Show("GET DATA SOURCE FAIL!");
            }
            finally
            {
                conn.Close();
                conn.Dispose();
            }
            return(list);
        }