コード例 #1
0
        public static setting get_setting(core c, db_provider conn, string setting_name)
        {
            DataRow r = conn.first_row(c.parse_query("lib-base.get-setting", new string[, ] {
                { "setting-name", setting_name }
            }));

            return(r == null ? null : new setting((int)r["setting_id"], (string)r["setting_name"]
                                                  , db_provider.str_val(r["setting_var"]), db_provider.str_val(r["machine_name"])));
        }
コード例 #2
0
        private void tmr_cmds_Tick(object sender, EventArgs e)
        {
            if (_cmd)
            {
                return;
            }
            _cmd = true;
            db_provider conn = null;

            try {
                conn = Program.open_conn();
                DataRow r = conn.first_row(_c.parse_query("lib-base.client-cmd-to-elab", new string[, ] {
                    { "client_key", _client_key }
                }));
                if (r != null)
                {
                    int    id_cmd = db_provider.int_val(r["id_client_cmd"]);
                    string cmd    = db_provider.str_val(r["cmd"]);
                    log_txt($"elab command '{cmd}'");
                    conn.exec(_c.parse_query("lib-base.client-remove-cmd", new string[, ] {
                        { "id_cmd", id_cmd.ToString() }
                    }));

                    client_cmd cc = new client_cmd(cmd);
                    if (cc.function == "open_att")
                    {
                        open_att(cc.par_int("file_id"), cc.par_int("user_id"), cc.par("user_name"));
                    }
                }
            } catch (Exception ex) { log_err(ex.Message); } finally { if (conn != null)
                                                                      {
                                                                          conn.close_conn();
                                                                      }
            }
            _cmd = false;
        }