예제 #1
0
        public bool updateData_unit(ClsUnitData unit)
        {
            bool   isOK   = false;
            string querry = string.Empty;

            try
            {
                querry += "UPDATE tbl_units SET ";
                querry += "description = '" + unit._description + "', ";
                querry += "symbol = '" + unit._symbol + "' ";
                querry += "WHERE unitId = '" + unit._unitId + "';";

                isOK = CONN.update(querry);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(isOK);
        }
예제 #2
0
        public bool insertData_unit(ClsUnitData unit)
        {
            bool   isOK   = false;
            string querry = string.Empty;

            try
            {
                querry += @"INSERT INTO tbl_units 
                             (unitId, description, symbol) VALUES (";
                querry += "'" + unit._unitId + "',";
                querry += "'" + unit._description + "',";
                querry += "'" + unit._symbol + "'";
                querry += ");";

                isOK = CONN.update(querry);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(isOK);
        }
예제 #3
0
        public ClsUnitData getSingleUnitData(int unitId)
        {
            ClsUnitData unit = new ClsUnitData();
            DataTable   dt   = new DataTable();

            try
            {
                string querry = "SELECT * FROM tbl_units WHERE unitId = '" + unitId + "';";
                dt = CONN.getDataTable(querry);

                if (dt.Rows.Count > 0)
                {
                    unit._unitId      = Convert.ToInt32(dt.Rows[0]["unitId"]);
                    unit._description = dt.Rows[0]["description"].ToString();
                    unit._symbol      = dt.Rows[0]["symbol"].ToString();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(unit);
        }