Esempio n. 1
0
        public void DeleteRec_Accessories(string Proj_In, clsDB DB_In)
        //============================================================
        {
            string pSQL = "DELETE FROM tblProject_Accessories WHERE fldProjectNo = '" + Proj_In + "'";

            DB_In.ExecuteCommand(pSQL);
        }
Esempio n. 2
0
        //=====================

        #region "DATABASE RELATED ROUTINE"

        public int AddRec_Accessories(string Proj_In, clsDB DB_In)
        //====================================================
        {
            int pCountRec = 0;

            try
            {
                string pFIELDS = "(fldProjectNo,fldTempSensor_Supplied,fldTempSensor_Name,fldTempSensor_Count," +
                                 "fldTempSensor_Type,fldWireClip_Supplied,fldWireClip_Count,fldWireClip_Size)";                                      //SB 10APR09

                string pINSERT = "INSERT INTO tblProject_Accessories";

                byte pTempSensor_Supplied = 0;
                if (mTempSensor.Supplied)
                {
                    pTempSensor_Supplied = 1;
                }
                else
                {
                    pTempSensor_Supplied = 0;
                }

                byte pWireClip_Supplied = 0;
                if (mWireClip.Supplied)
                {
                    pWireClip_Supplied = 1;
                }
                else
                {
                    pWireClip_Supplied = 0;
                }


                string pVALUES = "VALUES ('" + Proj_In + "',"
                                 + pTempSensor_Supplied + ",'"
                                 + mTempSensor.Name + "',"
                                 + mTempSensor.Count + ",'"
                                 + mTempSensor.Type.ToString() + "',"
                                 + pWireClip_Supplied + ","
                                 + mWireClip.Count + ",'"
                                 + mWireClip.Size.ToString() + "')";

                string pSQL = pINSERT + pFIELDS + pVALUES;

                pCountRec = DB_In.ExecuteCommand(pSQL);
            }
            catch (Exception pEXP)
            {
                MessageBox.Show("Add Record Error.\n" + pEXP.Message);
            }

            return(pCountRec);
        }
Esempio n. 3
0
        public int UpdateRec_Accessories(string ProjNo_In, clsDB DB_In)
        //=============================================================
        {
            //....UPDATE Records.
            String pSET, pWHERE, pSQL;
            int    pCountRec = 0;

            try
            {
                byte pTempSensor_Supplied = 0;
                if (mTempSensor.Supplied)
                {
                    pTempSensor_Supplied = 1;
                }
                else
                {
                    pTempSensor_Supplied = 0;
                }

                byte pWireClip_Supplied = 0;
                if (mWireClip.Supplied)
                {
                    pWireClip_Supplied = 1;
                }
                else
                {
                    pWireClip_Supplied = 0;
                }


                pSET = " SET fldTempSensor_Supplied = " + pTempSensor_Supplied +
                       ", fldTempSensor_Name = '" + mTempSensor.Name +
                       "', fldTempSensor_Count = " + mTempSensor.Count +
                       ", fldTempSensor_Type = '" + mTempSensor.Type.ToString() +
                       "', fldWireClip_Supplied = " + pWireClip_Supplied +
                       ", fldWireClip_Count = " + mWireClip.Count +
                       ", fldWireClip_Size = '" + mWireClip.Size.ToString() + "'";

                pWHERE    = " WHERE fldProjectNo = '" + ProjNo_In + "'";
                pSQL      = "UPDATE tblProject_Accessories" + pSET + pWHERE;
                pCountRec = DB_In.ExecuteCommand(pSQL);
            }
            catch (Exception pEXP)
            {
                MessageBox.Show("Add Record Error.\n" + pEXP.Message);
            }

            return(pCountRec);
        }