Exemplo n.º 1
0
        public void edit(String name, String description, String moc, String linerMOC, String heightLength, String diameter, String norminalThickness, String ca, String designPressure, String designTemp, String noEq, String comTyle, String olderName, String olderNo)
        {
            MySqlConnection conn = DBUtils.getDBConnection();

            conn.Open();
            String sql = "UPDATE tbl_component SET "
                         + "componentName = '" + name + "',"
                         + "componentDescription = '" + description + "',"
                         + "MOC = '" + moc + "',"
                         + "LinearMOC = '" + linerMOC + "',"
                         + "HeightLength = '" + heightLength + "',"
                         + "Diameter = '" + diameter + "',"
                         + "NorminalThickness = '" + norminalThickness + "',"
                         + "CA = '" + ca + "',"
                         + "DesignPressure = '" + designPressure + "',"
                         + "DesignTemp = '" + designTemp + "',"
                         + "NoEquidment = '" + noEq + "',"
                         + "ComponentType = '" + comTyle + "'"
                         + " WHERE componentName = '" + olderName + "' AND NoEquidment ='" + olderNo + "'";

            try
            {
                MySqlCommand cmd = new MySqlCommand();
                cmd.Connection  = conn;
                cmd.CommandText = sql;
                cmd.ExecuteNonQuery();
            }
            catch
            {
                MessageBox.Show("Edit data failed", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                conn.Close();
                conn.Dispose();
            }
        }
Exemplo n.º 2
0
        public void delete(int count)
        {
            MySqlConnection conn = DBUtils.getDBConnection();

            conn.Open();
            String sql = "DELETE FROM tbl_equipmenttemp WHERE STT = '" + count + "'";

            try
            {
                MySqlCommand cmd = new MySqlCommand();
                cmd.Connection  = conn;
                cmd.CommandText = sql;
                cmd.ExecuteNonQuery();
            }
            catch
            {
                MessageBox.Show("Delete data failed", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                conn.Close();
                conn.Dispose();
            }
        }
Exemplo n.º 3
0
        public void edit(String unitCode, String unitName, String processSystem, String olderUnitCode)
        {
            MySqlConnection conn = DBUtils.getDBConnection();

            conn.Open();
            String sql = "UPDATE tbl_equipmentforrbi SET UnitCode = '" + unitCode + "' , UnitName = '" + unitName + "', ProcessSystem = '" + processSystem + "' WHERE UnitCode = '" + olderUnitCode + "'";

            try
            {
                MySqlCommand cmd = new MySqlCommand();
                cmd.Connection  = conn;
                cmd.CommandText = sql;
                cmd.ExecuteNonQuery();
            }
            catch
            {
                MessageBox.Show("Edit data failed", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                conn.Close();
                conn.Dispose();
            }
        }
Exemplo n.º 4
0
        public List <String> getUnitCode()
        {
            List <String>   arr  = new List <string>();
            MySqlConnection conn = DBUtils.getDBConnection();

            conn.Open();
            String sql = "SELECT UnitCode FROM tbl_equipmentforrbi";

            try
            {
                MySqlCommand cmd = new MySqlCommand();
                cmd.Connection  = conn;
                cmd.CommandText = sql;
                using (DbDataReader reader = cmd.ExecuteReader())
                {
                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            String data = reader.GetString(0);
                            arr.Add(data);
                        }
                    }
                }
            }
            catch
            {
                MessageBox.Show("Load data failed", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                conn.Close();
                conn.Dispose();
            }
            return(arr);
        }
Exemplo n.º 5
0
        public void add(String unitCode, String unitName, String processSystem)
        {
            MySqlConnection conn = DBUtils.getDBConnection();

            conn.Open();
            String sql = "INSERT INTO tbl_equipmentforrbi VALUES('" + unitCode + "','" + unitName + "','" + processSystem + "')";

            try
            {
                MySqlCommand cmd = new MySqlCommand();
                cmd.Connection  = conn;
                cmd.CommandText = sql;
                cmd.ExecuteNonQuery();
            }
            catch (Exception e)
            {
                MessageBox.Show("Add data failed" + e.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                conn.Close();
                conn.Dispose();
            }
        }
Exemplo n.º 6
0
        public void delete(String name, String noEq)
        {
            MySqlConnection conn = DBUtils.getDBConnection();

            conn.Open();
            String sql = "DELETE FROM tbl_component WHERE componentName = '" + name + "' AND NoEquidment ='" + noEq + "'";

            try
            {
                MySqlCommand cmd = new MySqlCommand();
                cmd.Connection  = conn;
                cmd.CommandText = sql;
                cmd.ExecuteNonQuery();
            }
            catch
            {
                MessageBox.Show("Delete data failed", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                conn.Close();
                conn.Dispose();
            }
        }
Exemplo n.º 7
0
        public void add(String name, String description, String moc, String linerMOC, String heightLength, String diameter, String norminalThickness, String ca, String designPressure, String designTemp, String noEquid, String comType)
        {
            MySqlConnection conn = DBUtils.getDBConnection();

            conn.Open();
            String sql = "INSERT INTO tbl_component VALUES "
                         + "('" + name + "',"
                         + "'" + description + "',"
                         + "'" + moc + "',"
                         + "'" + linerMOC + "',"
                         + "'" + heightLength + "',"
                         + "'" + diameter + "',"
                         + "'" + norminalThickness + "',"
                         + "'" + ca + "',"
                         + "'" + designPressure + "',"
                         + "'" + designTemp + "',"
                         + "'" + noEquid + "',"
                         + "'" + comType + "')";

            try
            {
                MySqlCommand cmd = new MySqlCommand();
                cmd.Connection  = conn;
                cmd.CommandText = sql;
                cmd.ExecuteNonQuery();
            }
            catch (Exception e)
            {
                MessageBox.Show("Add data failed" + e.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                conn.Close();
                conn.Dispose();
            }
        }
Exemplo n.º 8
0
        public void delete(String damageMechanism, String method, String itemNo)
        {
            MySqlConnection conn = DBUtils.getDBConnection();

            conn.Open();
            String sql = "DELETE FROM tbl_inspectionplan WHERE  DamageMechanism = '" + damageMechanism + "' AND Method = '" + method + "' AND tbl_equipmentlist_ItemNo = '" + itemNo + "' ";

            try
            {
                MySqlCommand cmd = new MySqlCommand();
                cmd.Connection  = conn;
                cmd.CommandText = sql;
                cmd.ExecuteNonQuery();
            }
            catch
            {
                MessageBox.Show("Delete data failed", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                conn.Close();
                conn.Dispose();
            }
        }
Exemplo n.º 9
0
        public List <EquipmentTemp> loads()
        {
            List <EquipmentTemp> listEq = new List <EquipmentTemp>();
            MySqlConnection      conn   = DBUtils.getDBConnection();

            conn.Open();
            String sql = "SELECT * FROM tbl_equipmenttemp";

            try
            {
                MySqlCommand cmd = new MySqlCommand();
                cmd.Connection  = conn;
                cmd.CommandText = sql;
                using (DbDataReader reader = cmd.ExecuteReader())
                {
                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            eqTemp                            = new EquipmentTemp();
                            eqTemp.Count                      = int.Parse(reader.GetString(0));
                            eqTemp.Plant                      = reader.GetString(1);
                            eqTemp.OperingPressInlet          = reader.GetString(2);
                            eqTemp.OperTempInlet              = reader.GetString(3);
                            eqTemp.OperingPressOutlet         = reader.GetString(4);
                            eqTemp.OperTempOutlet             = reader.GetString(5);
                            eqTemp.TestPress                  = reader.GetString(6);
                            eqTemp.MDMT                       = reader.GetString(7);
                            eqTemp.InService                  = reader.GetString(8);
                            eqTemp.ServiceDate                = reader.GetString(9);
                            eqTemp.LastInternalInspectionDate = reader.GetString(10);
                            eqTemp.LDTBXHCovered              = reader.GetString(11);
                            eqTemp.Insulated                  = reader.GetString(12);
                            eqTemp.PWHT                       = reader.GetString(13);
                            eqTemp.InsulatedType              = reader.GetString(14);
                            eqTemp.OperatingState             = reader.GetString(15);
                            eqTemp.InventoryLiquip            = reader.GetString(16);
                            eqTemp.InventoryVapor             = reader.GetString(17);
                            eqTemp.InventoryTotal             = reader.GetString(18);
                            eqTemp.ConfidentInStreamAnalysis  = reader.GetString(19);
                            eqTemp.VaporDensityAir            = reader.GetString(20);
                            eqTemp.CorrosionInhibitor         = reader.GetString(21);
                            eqTemp.FrequentFeedChanged        = reader.GetString(22);
                            eqTemp.MajorChemicals             = reader.GetString(23);
                            eqTemp.Contaminants               = reader.GetString(24);
                            eqTemp.OnLineMonitoring           = reader.GetString(25);
                            eqTemp.CathodicProtection         = reader.GetString(26);
                            eqTemp.CorrosionMonitoring        = reader.GetString(27);
                            eqTemp.OHCalibUptodate            = reader.GetString(28);
                            eqTemp.DistFromFacility           = reader.GetString(29);
                            eqTemp.EquipCount                 = reader.GetString(30);
                            eqTemp.HAZOPRating                = reader.GetString(31);
                            eqTemp.PersonalDensity            = reader.GetString(32);
                            eqTemp.MitigationEquip            = reader.GetString(33);
                            eqTemp.EnvRating                  = reader.GetString(34);
                            eqTemp.InspTechUsed               = reader.GetString(35);
                            eqTemp.EquipModification          = reader.GetString(36);
                            eqTemp.InspectionFinding          = reader.GetString(37);
                            eqTemp.VaporDensity               = reader.GetString(38);
                            eqTemp.LiquipDensity              = reader.GetString(39);
                            eqTemp.Vapor                      = reader.GetString(40);
                            eqTemp.Liquip                     = reader.GetString(41);
                            eqTemp.HMBPFDNum                  = reader.GetString(42);
                            eqTemp.PIDNum                     = reader.GetString(43);
                            eqTemp.Service                    = reader.GetString(44);
                            eqTemp.HMBStream                  = reader.GetString(45);
                            eqTemp.ItemNo                     = reader.GetString(46);
                            eqTemp.ComName                    = reader.GetString(47);

                            listEq.Add(eqTemp);
                        }
                    }
                }
            }
            catch
            {
                MessageBox.Show("Load data failed", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                conn.Close();
                conn.Dispose();
            }
            return(listEq);
        }
Exemplo n.º 10
0
        public void add(String itemNo,
                        String comName,
                        String plant,
                        String operingPressInlet,
                        String operTempInlet,
                        String operingPressOutlet,
                        String operTempOutlet,
                        String testPress,
                        String mdmt,
                        String inService,
                        String serviceDate,
                        String lastInternalInspectionDate,
                        String ldtbxhCovered,
                        String insulated,
                        String pwht,
                        String insulatedType,
                        String operatingState,
                        String inventoryLiquip,
                        String inventoryVapor,
                        String inventoryTotal,
                        String confidentInStreamAnalysis,
                        String vaporDensityAir,
                        String corrosionInhibitor,
                        String frequentFeedChanged,
                        String majorChemicals,
                        String contaminants,
                        String onLineMonitoring,
                        String cathodicProtection,
                        String corrosionMonitoring,
                        String ohCalibUptodate,
                        String distFromFacility,
                        String equipCount,
                        String hazopRating,
                        String personalDensity,
                        String mitigationEquip,
                        String envRating,
                        String inspTechUsed,
                        String equipModification,
                        String inspectionFinding,
                        String vaporDensity,
                        String liquipDensity,
                        String vapor,
                        String liquip,
                        String hmbpfdNum,
                        String pidNum,
                        String service,
                        String hmbStream,
                        int count)
        {
            MySqlConnection conn = DBUtils.getDBConnection();

            conn.Open();
            String sql = "INSERT INTO tbl_equipmenttemp VALUES " +
                         "('" + count + "'," +
                         "'" + plant + "'," +
                         "'" + operingPressInlet + "'," +
                         "'" + operTempInlet + "'," +
                         "'" + operingPressOutlet + "'," +
                         "'" + operTempOutlet + "'," +
                         "'" + testPress + "'," +
                         "'" + mdmt + "'," +
                         "'" + inService + "'," +
                         "'" + serviceDate + "'," +
                         "'" + lastInternalInspectionDate + "'," +
                         "'" + ldtbxhCovered + "'," +
                         "'" + insulated + "'," +
                         "'" + pwht + "'," +
                         "'" + insulatedType + "'," +
                         "'" + operatingState + "'," +
                         "'" + inventoryLiquip + "'," +
                         "'" + inventoryVapor + "'," +
                         "'" + inventoryTotal + "'," +
                         "'" + confidentInStreamAnalysis + "'," +
                         "'" + vaporDensityAir + "'," +
                         "'" + corrosionInhibitor + "'," +
                         "'" + frequentFeedChanged + "'," +
                         "'" + majorChemicals + "'," +
                         "'" + contaminants + "'," +
                         "'" + onLineMonitoring + "'," +
                         "'" + cathodicProtection + "'," +
                         "'" + corrosionMonitoring + "'," +
                         "'" + ohCalibUptodate + "'," +
                         "'" + distFromFacility + "'," +
                         "'" + equipCount + "'," +
                         "'" + hazopRating + "'," +
                         "'" + personalDensity + "'," +
                         "'" + mitigationEquip + "'," +
                         "'" + envRating + "'," +
                         "'" + inspTechUsed + "'," +
                         "'" + equipModification + "'," +
                         "'" + inspectionFinding + "'," +
                         "'" + vaporDensity + "'," +
                         "'" + liquipDensity + "'," +
                         "'" + vapor + "'," +
                         "'" + liquip + "'," +
                         "'" + hmbpfdNum + "'," +
                         "'" + pidNum + "'," +
                         "'" + service + "'," +
                         "'" + hmbStream + "'," +
                         "'" + itemNo + "'," +
                         "'" + comName + "'); ";

            try
            {
                MySqlCommand cmd = new MySqlCommand();
                cmd.Connection  = conn;
                cmd.CommandText = sql;
                cmd.ExecuteNonQuery();
            }
            catch (Exception e)
            {
                MessageBox.Show("Add data failed" + e.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                conn.Close();
                conn.Dispose();
            }
        }
Exemplo n.º 11
0
        public void edit(String itemNo,
                         String comName,
                         String plant,
                         String operingPressInlet,
                         String operTempInlet,
                         String operingPressOutlet,
                         String operTempOutlet,
                         String testPress,
                         String mdmt,
                         String inService,
                         String serviceDate,
                         String lastInternalInspectionDate,
                         String ldtbxhCovered,
                         String insulated,
                         String pwht,
                         String insulatedType,
                         String operatingState,
                         String inventoryLiquip,
                         String inventoryVapor,
                         String inventoryTotal,
                         String confidentInStreamAnalysis,
                         String vaporDensityAir,
                         String corrosionInhibitor,
                         String frequentFeedChanged,
                         String majorChemicals,
                         String contaminants,
                         String onLineMonitoring,
                         String cathodicProtection,
                         String corrosionMonitoring,
                         String ohCalibUptodate,
                         String distFromFacility,
                         String equipCount,
                         String hazopRating,
                         String personalDensity,
                         String mitigationEquip,
                         String envRating,
                         String inspTechUsed,
                         String equipModification,
                         String inspectionFinding,
                         String vaporDensity,
                         String liquipDensity,
                         String vapor,
                         String liquip,
                         String hmbpfdNum,
                         String pidNum,
                         String service,
                         String hmbStream,
                         int count)
        {
            MySqlConnection conn = DBUtils.getDBConnection();

            conn.Open();
            String sql = "UPDATE tbl_equipmenttemp SET "
                         + "Plant = '" + plant + "',"
                         + "OperingPressInlet = '" + operingPressInlet + "',"
                         + "OperTempInlet = '" + operTempInlet + "',"
                         + "OperingPressOutlet = '" + operingPressOutlet + "=,"
                         + "OperTempOutlet = '" + operTempOutlet + "',"
                         + "TestPress = '" + testPress + "',"
                         + "MDMT = '" + mdmt + "',"
                         + "InService = '" + inService + "',"
                         + "ServiceDate = '" + serviceDate + "',"
                         + "LastInternalInspectionDate = '" + lastInternalInspectionDate + "',"
                         + "LDTBXHCovered = '" + ldtbxhCovered + "',"
                         + "Insulated = '" + insulated + "',"
                         + "PWHT = '" + pwht + "',"
                         + "InsulatedType = '" + insulatedType + "',"
                         + "OperatingState = '" + operatingState + "',"
                         + "InventoryLiquip = '" + inventoryLiquip + "',"
                         + "InventoryVapor = '" + inventoryVapor + "',"
                         + "InventoryTotal = '" + inventoryTotal + "',"
                         + "ConfidentInStreamAnalysis = '" + confidentInStreamAnalysis + "',"
                         + "VaporDensityAir = '" + vaporDensityAir + "',"
                         + "CorrosionInhibitor = '" + corrosionInhibitor + "',"
                         + "FrequentFeedChanged = '" + frequentFeedChanged + "',"
                         + "MajorChemicals = '" + majorChemicals + "',"
                         + "Contaminants = '" + contaminants + "',"
                         + "OnLineMonitoring = '" + onLineMonitoring + "',"
                         + "CathodicProtection = '" + cathodicProtection + "',"
                         + "CorrosionMonitoring = '" + corrosionMonitoring + "',"
                         + "OHCalibUptodate = '" + ohCalibUptodate + "',"
                         + "DistFromFacility = '" + distFromFacility + "',"
                         + "EquipCount = '" + equipCount + "',"
                         + "HAZOPRating = '" + hazopRating + "',"
                         + "PersonalDensity = '" + personalDensity + "',"
                         + "MitigationEquip = '" + mitigationEquip + "',"
                         + "EnvRating = '" + envRating + "',"
                         + "InspTechUsed = '" + inspTechUsed + "',"
                         + "EquipModification = '" + equipModification + "',"
                         + "InspectionFinding = '" + inspectionFinding + "',"
                         + "VaporDensity = '" + vaporDensity + "',"
                         + "LiquipDensity = '" + liquipDensity + "',"
                         + "Vapor = '" + vapor + "',"
                         + "Liquip = '" + liquip + "',"
                         + "HMBPFDNum = '" + hmbpfdNum + "',"
                         + "PIDNum = '" + pidNum + "',"
                         + "Service = '" + service + "',"
                         + "HMBStream = '" + hmbStream + "',"
                         + "tbl_equipmentlist_ItemNo = '" + itemNo + "',"
                         + "tbl_component_componentName = '" + comName + "'"
                         + " WHERE STT = '" + count + "' ";

            try
            {
                MySqlCommand cmd = new MySqlCommand();
                cmd.Connection  = conn;
                cmd.CommandText = sql;
                cmd.ExecuteNonQuery();
            }
            catch
            {
                MessageBox.Show("Edit data failed", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                conn.Close();
                conn.Dispose();
            }
        }