public static (TriggerClassType, TriggerBeforeAfterType?, IList <TriggerEventType>) Parse(ulong type)
    {
        var @class = ParseTriggerClassType(type);

        switch (@class)
        {
        case TriggerClassType.DML:
        {
            var(beforeAfter, @event) = DML.Parse(type);
            return(@class, beforeAfter, @event);
        }

        case TriggerClassType.DB:
        {
            return(@class, null, DB.Parse(type));
        }

        case TriggerClassType.DDL:
        {
            var(beforeAfter, @event) = DDL.Parse(type);
            return(@class, beforeAfter, @event);
        }
        }
        throw UnknownTriggerTypeException(type);
    }
Exemplo n.º 2
0
    static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
    {
        foreach (string asset in importedAssets)
        {
            if (!filePath.Equals(asset))
            {
                continue;
            }

            DML data = (DML)AssetDatabase.LoadAssetAtPath(assetFilePath, typeof(DML));
            if (data == null)
            {
                data               = ScriptableObject.CreateInstance <DML> ();
                data.sheetName     = filePath;
                data.worksheetName = sheetName;
                AssetDatabase.CreateAsset((ScriptableObject)data, assetFilePath);
                //data.hideFlags = HideFlags.NotEditable;
            }

            //data.dataArray = new ExcelQuery(filePath, sheetName).Deserialize<DMLData>().ToArray();

            //ScriptableObject obj = AssetDatabase.LoadAssetAtPath (assetFilePath, typeof(ScriptableObject)) as ScriptableObject;
            //EditorUtility.SetDirty (obj);

            ExcelQuery query = new ExcelQuery(filePath, sheetName);
            if (query != null && query.IsValid())
            {
                data.dataArray = query.Deserialize <DMLData>().ToArray();
                ScriptableObject obj = AssetDatabase.LoadAssetAtPath(assetFilePath, typeof(ScriptableObject)) as ScriptableObject;
                EditorUtility.SetDirty(obj);
            }
        }
    }
Exemplo n.º 3
0
 protected virtual void Upd()
 {
     if (CurrentItem != null)
     {
         _dmlCurrent = DML.Update;
         ExecuteRunDialog(Settings.Same().LocalisationHelper["DMLRes.Update"], CurrentItem.Name);
     }
 }
Exemplo n.º 4
0
        private void btnCadastrar_Click(object sender, EventArgs e)
        {
            DML dml = new DML();

            try
            {
                if (txtCodigo.Text != "" && txtNome.Text != "" & txtValor.Text != "")
                {
                    Produto produto = new Produto();
                    produto.Codigo = Convert.ToInt32(txtCodigo.Text);
                    produto.Valor  = Convert.ToDouble(txtValor.Text);
                    produto.Nome   = txtNome.Text;

                    if (edicao)
                    {
                        MessageBox.Show(dml.ProdutoAlterar(produto, numeroAntigo), "Alterado com Sucesso!", MessageBoxButtons.OK, MessageBoxIcon.Information);

                        btnAlterar.Enabled = true;
                        btnExcluir.Enabled = true;
                        edicao             = false;

                        numeroAntigo = 0;
                    }
                    else
                    {
                        if (dml.ProdutoInserir(produto) != "1")
                        {
                            MessageBox.Show("Erro ao fazer a inserção!", "Não cadastrado", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }

                    dgvProduto.DataSource = null;
                    CarregaGrid();
                }
                else
                {
                    if (txtCodigo.Text.Trim() == "")
                    {
                        epError.SetError(txtCodigo, "Preencha com o Código do Produto.");
                        txtCodigo.Focus();
                    }
                    else if (txtValor.Text.Trim() == "")
                    {
                        epError.SetError(txtValor, "Preencha com o Valor do Produto.");
                        txtValor.Focus();
                    }
                    else
                    {
                        epError.SetError(txtNome, "Preencha com o Nome do Produto.");
                        txtNome.Focus();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Verifique os valores cadastrados!\n" + ex.Message, "Não Registrado!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 5
0
        private void btnConfirmar_Click(object sender, EventArgs e)
        {
            DML dml = new DML();

            try
            {
                if (txtNumero.Text != "" && txtValorDiaria.Text != "" & txtLocalidade.Text != "")
                {
                    Quarto quarto = new Quarto();
                    quarto.Numero      = Convert.ToInt32(txtNumero.Text);
                    quarto.ValorDiaria = Convert.ToDouble(txtValorDiaria.Text);
                    quarto.Localidade  = txtLocalidade.Text;

                    if (edicao)
                    {
                        MessageBox.Show(dml.QuartoAlterar(quarto, numeroAntigo), "Alterado com Sucesso!", MessageBoxButtons.OK, MessageBoxIcon.Information);

                        btnAlterar.Enabled = true;
                        btnExcluir.Enabled = true;
                        edicao             = false;

                        numeroAntigo = 0;
                    }
                    else
                    {
                        if (dml.QuartoInserir(quarto) != "1")
                        {
                            MessageBox.Show("Erro ao fazer a inserção!", "Não cadastrado", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }

                    dgvQuarto.DataSource = null;
                    CarregaGrid();
                }
                else
                {
                    if (txtNumero.Text.Trim() == "")
                    {
                        epNumero.SetError(txtNumero, "Preencha com o número do quarto.");
                        txtNumero.Focus();
                    }
                    else if (txtValorDiaria.Text.Trim() == "")
                    {
                        epNumero.SetError(txtValorDiaria, "Preencha com o Valor da Diária.");
                        txtValorDiaria.Focus();
                    }
                    else
                    {
                        epNumero.SetError(txtLocalidade, "Preencha com a Localidade do quarto.");
                        txtLocalidade.Focus();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Verifique os valores cadastrados!\n" + ex.Message, "Não Registrado!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 6
0
        protected SqlQuery BuildAnQuery <T>(DML command, object args)
        {
            this.QueryString = new StringBuilder("{command} {table} SET {set} {Where}")
                               .Replace("{command}", command.ToString())
                               .Replace("{table}", this.GetType().Name)
                               .Replace("{set}", BuildSetArgs <T>(args))
                               .Replace("{Where}", BuildWhereArgs(true))
                               .ToString();

            return(this);
        }
Exemplo n.º 7
0
 public void SynchronizationFolder(string folder, DML originalOperation, Action <string> insert, Action <string> update)
 {
     _folder                                      = folder;
     _originalOperation                           = originalOperation;
     _insert                                      = insert;
     _update                                      = update;
     _countAddFolders                             = 0;
     _countAddFiles                               = 0;
     _countCheckFiles                             = 0;
     _countDelRegisteresFiles                     = 0;
     _countEmptyFolders                           = 0;
     _workerSyncFolder                            = new BackgroundWorker();
     _workerSyncFolder.DoWork                    += new DoWorkEventHandler(Worker_DoWorkSync);
     _workerSyncFolder.RunWorkerCompleted        += new RunWorkerCompletedEventHandler(Worker_RunWorkerSyncCompleted);
     _workerSyncFolder.ProgressChanged           += new ProgressChangedEventHandler(Worker_ProgressSyncChanged);
     _workerSyncFolder.WorkerReportsProgress      = true;
     _workerSyncFolder.WorkerSupportsCancellation = true;
     _workerSyncFolder.RunWorkerAsync();
 }
Exemplo n.º 8
0
        private void btnExcluir_Click(object sender, EventArgs e)
        {
            DML     dml     = new DML();
            Produto produto = new Produto();

            produto.Codigo = Convert.ToInt32(dgvProduto.Rows[dgvProduto.CurrentRow.Index].Cells[0].Value);


            if (MessageBox.Show("Deseja realmente excluir o registro selecionado?", "Exclusão", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                try
                {
                    dml.ProdutoExcluir(produto);
                    MessageBox.Show("Produto Excluído com Sucesso!");
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Não foi possível fazer a exclusão!\n" + ex.Message, "Cancelado!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                dgvProduto.DataSource = null;
                CarregaGrid();
            }
        }
Exemplo n.º 9
0
        /// <summary>
        /// DML
        /// </summary>
        /// <returns></returns>
        public DML DML(Data.IDataSeries input)
        {
            if (cacheDML != null)
                for (int idx = 0; idx < cacheDML.Length; idx++)
                    if (cacheDML[idx].EqualsInput(input))
                        return cacheDML[idx];

            lock (checkDML)
            {
                if (cacheDML != null)
                    for (int idx = 0; idx < cacheDML.Length; idx++)
                        if (cacheDML[idx].EqualsInput(input))
                            return cacheDML[idx];

                DML indicator = new DML();
                indicator.BarsRequired = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
            #if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack = MaximumBarsLookBack;
            #endif
                indicator.Input = input;
                Indicators.Add(indicator);
                indicator.SetUp();

                DML[] tmp = new DML[cacheDML == null ? 1 : cacheDML.Length + 1];
                if (cacheDML != null)
                    cacheDML.CopyTo(tmp, 0);
                tmp[tmp.Length - 1] = indicator;
                cacheDML = tmp;
                return indicator;
            }
        }
Exemplo n.º 10
0
 protected virtual void Add()
 {
     _dmlCurrent = DML.Insert;
     ExecuteRunDialog(Settings.Same().LocalisationHelper["DMLRes.Insert"], string.Empty);
 }
Exemplo n.º 11
0
 public RQueryResponse <T> RQueryExecute <T>(DML command, object arg = null) where T : new() =>
 ExecuteQuery <T>(BuildAnQuery <T>(command, arg)).Result;
Exemplo n.º 12
0
 private void Upd()
 {
     _dmlCurrent = DML.Update;
     ExecuteUpdDialog(Settings.Same().LocalisationHelper["DMLRes.Update"], SelectedItem.SNode);
 }
Exemplo n.º 13
0
 private void Add()
 {
     _dmlCurrent = DML.Insert;
     ExecuteChoiceDialog(Settings.Same().LocalisationHelper["DMLRes.Insert"], string.Empty, DataGridSelectionMode.Extended);
 }
Exemplo n.º 14
0
 private void Del()
 {
     _dmlCurrent = DML.Delete;
     Delete();
 }
Exemplo n.º 15
0
 private void Replace()
 {
     _dmlCurrent = DML.Replace;
     ExecuteChoiceDialog(Settings.Same().LocalisationHelper["DMLRes.Replace"], SelectedItem.SNode, DataGridSelectionMode.Single);
 }