protected void btnInsert_Click(object sender, EventArgs e)
        {
            var pizza = new Pizza()
            {
                Descricao = txtDesc.Text, Valor = decimal.Parse(txtValor.Text)
            };
            var logDB = new LogDB();

            if (new PizzaDB().Insert(pizza))
            {
                logDB.Insert("Inserido com sucesso");
                lblMSG.Text = "Top";
            }
            else
            {
                logDB.Insert("Elemento não inserido");
            }
            PopulaTabelaPizza();
            PopulaTabelaLog();
        }
示例#2
0
        public long Build_Init(EngineState s, string name)
        {
            if (s.DisableLogger)
            {
                return(0);
            }

            // Build Id
            DB_BuildInfo dbBuild = new DB_BuildInfo()
            {
                StartTime = DateTime.UtcNow,
                Name      = name,
            };

            DB.Insert(dbBuild);
            buildDict[dbBuild.Id] = dbBuild;
            s.BuildId             = dbBuild.Id;

            // Fire Event
            BuildInfoUpdated?.Invoke(this, new BuildInfoUpdateEventArgs(dbBuild));

            // Variables - Fixed, Global, Local
            List <DB_Variable> varLogs = new List <DB_Variable>();

            foreach (VarsType type in Enum.GetValues(typeof(VarsType)))
            {
                Dictionary <string, string> dict = s.Variables.GetVarDict(type);
                foreach (var kv in dict)
                {
                    DB_Variable dbVar = new DB_Variable()
                    {
                        BuildId = dbBuild.Id,
                        Type    = type,
                        Key     = kv.Key,
                        Value   = kv.Value,
                    };
                    varLogs.Add(dbVar);

                    // Fire Event
                    VariableUpdated?.Invoke(this, new VariableUpdateEventArgs(dbVar));
                }
            }
            DB.InsertAll(varLogs);

            System_Write(new LogInfo(LogState.Info, $"Build [{name}] started"));

            return(dbBuild.Id);
        }
示例#3
0
 public void SaveLog(string msg)
 {
     _logDB.Insert(msg);
 }
示例#4
0
 public static Log Insert(Log myItem)
 {
     return(LogDB.Insert(myItem));
 }