Example #1
0
        public static long WriteSettingsToDb(SySal.OperaDb.OperaDbConnection conn, string desc, string exe, int driverlevel, int marks, string settings)
        {
            SySal.OperaDb.OperaDbCredentials cred = SySal.OperaDb.OperaDbCredentials.CreateFromRecord();
            long authorid = SySal.OperaDb.Convert.ToInt64(new SySal.OperaDb.OperaDbCommand("SELECT ID FROM VW_USERS WHERE UPPER(USERNAME) = UPPER('" + cred.OPERAUserName + "') ", conn, null).ExecuteScalar());

            SySal.OperaDb.OperaDbCommand cmd = new SySal.OperaDb.OperaDbCommand("CALL PC_ADD_PROGRAMSETTINGS(:description, :exe, :authorid, :driverlevel, :marks, :settings, :newid)", conn);
            cmd.Parameters.Add("description", SySal.OperaDb.OperaDbType.String, System.Data.ParameterDirection.Input).Value = desc;
            cmd.Parameters.Add("exe", SySal.OperaDb.OperaDbType.String, System.Data.ParameterDirection.Input).Value         = exe;
            cmd.Parameters.Add("authorid", SySal.OperaDb.OperaDbType.Long, System.Data.ParameterDirection.Input).Value      = authorid;
            cmd.Parameters.Add("driverlevel", SySal.OperaDb.OperaDbType.Int, System.Data.ParameterDirection.Input).Value    = driverlevel;
            cmd.Parameters.Add("marks", SySal.OperaDb.OperaDbType.Int, System.Data.ParameterDirection.Input).Value          = marks;
            cmd.Parameters.Add("settings", SySal.OperaDb.OperaDbType.CLOB, System.Data.ParameterDirection.Input).Value      = settings;
            cmd.Parameters.Add("newid", SySal.OperaDb.OperaDbType.Long, System.Data.ParameterDirection.Output);
            try
            {
                cmd.ExecuteNonQuery();
                return((long)cmd.Parameters["newid"].Value);
                //	return 1;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return(0);
            }
        }
Example #2
0
        public static string LookupItem(long id, SySal.OperaDb.OperaDbConnection conn)
        {
            SySal.OperaDb.OperaDbCommand cmd = new OperaDbCommand("SELECT DESCRIPTION FROM TB_PROGRAMSETTINGS WHERE ID=" + id, conn);
            object o = cmd.ExecuteScalar();
            string name;

            if (o == null)
            {
                name = id.ToString() + " <description not found>";
            }
            else
            {
                name = id.ToString() + " (" + o.ToString() + ")";
            }
            return(name);
        }