Exemple #1
0
        public async Task <Domain.Entities.Edital> Execute(
            int id,
            string numEdital,
            int clienteId,
            int estadoId,
            int modalidadeId,
            int etapaId,
            string dataDeAbertura,
            string horaDeAbertura,
            string uasg,
            int categoriaId,
            string consorcio,
            decimal valorEstimado,
            string agendarVistoria,
            string dataVistoria,
            string objetosDescricao,
            string objetosResumo,
            string observacoes,
            int regiaoId,
            int gerenteId,
            int diretorId,
            int portalId,
            bool ativo,
            int idAnexo,
            string nomeAnexo,
            string tipoAnexo,
            byte[] base64Anexo,
            int responsavelRequestId)
        {
            using var context = new ApiContext();

            return(await update.Execute(
                       id,
                       numEdital,
                       clienteId,
                       estadoId,
                       modalidadeId,
                       etapaId,
                       dataDeAbertura,
                       horaDeAbertura,
                       uasg,
                       categoriaId,
                       consorcio,
                       valorEstimado,
                       agendarVistoria,
                       dataVistoria,
                       objetosDescricao,
                       objetosResumo,
                       observacoes,
                       regiaoId,
                       gerenteId,
                       diretorId,
                       portalId,
                       ativo,
                       idAnexo,
                       nomeAnexo,
                       tipoAnexo,
                       base64Anexo,
                       responsavelRequestId));
        }
Exemple #2
0
        public void Flush()
        {
            lock (_lock)
            {
                if (_newvalues.Count == 0)
                {
                    return;
                }

                IDictionary result = new Hashtable(_values);
                IUpdate     batch  = CreateNewUpdate();

                foreach (DictionaryEntry newvalue in _newvalues)
                {
                    ProfilePath path  = (ProfilePath)newvalue.Key;
                    string      value = (string)newvalue.Value;

                    if (value == null)
                    {
                        if (_values.Contains(path))
                        {
                            batch.DeleteValue(path);
                            result.Remove(path);
                        }
                    }
                    else
                    {
                        if (_values.Contains(path))
                        {
                            batch.SaveValue(path, value);
                            result[path] = value;
                        }
                        else
                        {
                            batch.AddValue(path, value);
                            result.Add(path, value);
                        }
                    }
                }

                try
                {
                    batch.Execute();

                    _values = result;
                    _newvalues.Clear();

                    batch.AcceptChanges();
                }
                catch
#if DEBUG
                (Exception)
#endif
                {
                    batch.DiscardChanges();
                    throw;
                }
            }
        }
Exemple #3
0
        // To protect from overposting attacks, enable the specific properties you want to bind to, for
        // more details, see https://aka.ms/RazorPagesCRUD.
        public virtual async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            var result = _mapper.Map <TModel>(ViewModel);
            await _updateAction.Execute(result);

            return(RedirectToPage("./Index"));
        }
Exemple #4
0
        public void Update(IUpdate update)
        {
            var result = update.Execute(_databaseconnection);

            if (result == (int)DbResponse.success)
            {
                EventSendResponse(this, new ResponseCodeEventArgs {
                    Result = result, Code = (int)CodeDataLayer.Update, Message = "Success"
                });
            }
            else
            {
                EventSendResponse(this, new ResponseCodeEventArgs {
                    Result = result, Code = (int)CodeDataLayer.Update, Message = "Fail"
                });
            }
        }
        public ActionResult ExecuteUpdate()
        {
            if (User.Identity.IsAuthenticated && User.HasAccess("ADMIN"))
            {
                // Execute all incremental updates in a transaction.
                using (IDbTransaction tx = Database.OpenTransaction()) {
                    for (int n = Data.Database.InstalledVersion + 1; n <= Data.Database.CurrentVersion; n++)
                    {
                        // Read embedded create script
                        Stream str = Assembly.GetExecutingAssembly().GetManifestResourceStream(Database.ScriptRoot + ".Updates." +
                                                                                               n.ToString() + ".sql");
                        String sql = new StreamReader(str).ReadToEnd();
                        str.Close();

                        // Split statements and execute
                        string[] stmts = sql.Split(new char[] { ';' });
                        foreach (string stmt in stmts)
                        {
                            if (!String.IsNullOrEmpty(stmt.Trim()))
                            {
                                SysUser.Execute(stmt.Trim(), tx);
                            }
                        }

                        // Check for update class
                        var utype = Type.GetType("Piranha.Data.Updates.Update" + n.ToString());
                        if (utype != null)
                        {
                            IUpdate update = (IUpdate)Activator.CreateInstance(utype);
                            update.Execute(tx);
                        }
                    }
                    // Now lets update the database version.
                    SysUser.Execute("UPDATE sysparam SET sysparam_value = @0 WHERE sysparam_name = 'SITE_VERSION'",
                                    tx, Data.Database.CurrentVersion);
                    SysParam.InvalidateParam("SITE_VERSION");
                    tx.Commit();
                }
                return(RedirectToAction("index", "account"));
            }
            else
            {
                return(RedirectToAction("update"));
            }
        }
        /// <summary>
        /// Updates an existing coordinate system in the database
        /// </summary>
        /// <param name="cs"></param>
        /// <param name="oldName"></param>
        /// <returns></returns>
        public bool UpdateProjection(CoordinateSystemDefinition cs, string oldName)
        {
            using (var conn = CreateSqliteConnection())
            {
                conn.Open();
                using (IUpdate update = (IUpdate)conn.CreateCommand(OSGeo.FDO.Commands.CommandType.CommandType_Update))
                {
                    update.SetFeatureClassName("Projections");
                    update.PropertyValues.Add(new OSGeo.FDO.Commands.PropertyValue("Name", new StringValue(cs.Name)));
                    update.PropertyValues.Add(new OSGeo.FDO.Commands.PropertyValue("Description", new StringValue(cs.Description)));
                    update.PropertyValues.Add(new OSGeo.FDO.Commands.PropertyValue("WKT", new StringValue(cs.Wkt)));

                    update.SetFilter("Name = '" + oldName + "'");

                    if (update.Execute() == 1)
                    {
                        LoggingService.InfoFormatted("Coordinate System {0} updated in database", oldName);
                        return(true);
                    }
                }
                conn.Close();
            }
            return(false);
        }
Exemple #7
0
 TReturn IUpdateContext <TState> .PerformUpdate <TReturn>(IUpdate <TState, TReturn> update)
 {
     return(update.Execute(this));
 }