public ActionResult Create(Metas metas) { if (Convert.ToString(Session["POAorPEDI"]) == "POA") { decimal idMeta = 0; idMeta = db.spMetasInsert(metas.IndicadorId, metas.Descripcion, metas.tipoCalificacionId, Convert.ToString(Session["POAorPEDI"])).FirstOrDefault().Value; if (idMeta != 0) { MetasDepartamento metaDepartamento = new MetasDepartamento(); metaDepartamento.MetasId = Convert.ToInt32(idMeta); metaDepartamento.DepartamentoID = Convert.ToInt32(Session["department"]); metaDepartamento.TipoDependenciaID = Convert.ToInt32(Session["tipodepartament"]); metaDepartamento.fecha = DateTime.Now; metaDepartamento.eliminado = false; db.MetasDepartamento.Add(metaDepartamento); db.SaveChanges(); return(Json(new { mensaje = "Registrado correctamente" })); } } else { decimal idMeta = 0; idMeta = db.spMetasInsert(metas.IndicadorId, metas.Descripcion, metas.tipoCalificacionId, Convert.ToString(Session["POAorPEDI"])).FirstOrDefault().Value; if (idMeta != 0) { return(Json(new { mensaje = "Registrado correctamente" })); } } return(Json(new { mensaje = "No se pudo ingresar la meta" })); }
private bool ExisteEnLaBaseDeDatos() { repositorio = new RepositorioBase <Metas>(); Metas metas = repositorio.Buscar((int)MetasIdNumericUpDown.Value); return(metas != null); }
//select public Metas Select(int id) { Metas obj = null; System.Data.IDbConnection objConexao; System.Data.IDbCommand objCommand; System.Data.IDataReader objDataReader; objConexao = Mapped.Connection(); objCommand = Mapped.Command("SELECT * FROM met_meta WHERE met_codigo = ?codigo", objConexao); objCommand.Parameters.Add(Mapped.Parameter("?codigo", id)); objDataReader = objCommand.ExecuteReader(); while (objDataReader.Read()) { obj = new Metas(); obj.Codigo = Convert.ToInt32(objDataReader["met_codigo"]); obj.Mes = Convert.ToString(objDataReader["met_mes"]); obj.Ano = Convert.ToString(objDataReader["met_ano"]); obj.Meta = Convert.ToInt32(objDataReader["met_meta"]); obj.Produto = Convert.ToString(objDataReader["met_produto"]); obj.Descricao = Convert.ToString(objDataReader["met_descricao"]); } objDataReader.Close(); objConexao.Close(); objCommand.Dispose(); objConexao.Dispose(); objDataReader.Dispose(); return(obj); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int Id = 0; LlenarDropDownList(); if (Request.QueryString["Id"] != null) { Id = Utilitarios.ToInt(Request.QueryString["Id"].ToString()); if (Id > 0) { Metas meta = new Metas(); if (!meta.Buscar(Id)) { ShowToast("error", "Error", "Registro no encontrado."); Limpiar(); } else { MetaIdTextBox.Text = Id.ToString(); LlenarMetas(meta); } } } } }
public void EliminarTest() { Metas meta = new Metas(); meta.MetaId = 3; Assert.IsTrue(meta.Eliminar()); }
protected void BuscarButton_Click1(object sender, EventArgs e) { int Id = 0; Metas meta = new Metas(); if (ConsultaTextBox.Text.Length > 0 && ConsultaDropDownList.Text == "MetaId") { bool result = Int32.TryParse(ConsultaTextBox.Text, out Id); if (Id > 0) { MetasGridView.DataSource = meta.Listado(" * ", " MetaId = " + Id, ""); MetasGridView.DataBind(); if (MetasGridView.Rows.Count <= 0) { ShowToast("error", "Error", "Id No Existe"); ConsultaTextBox.Text = ""; CargarGridView(); } } else { ShowToast("warning", "Incorrecto", "Id Incorrecto"); ConsultaTextBox.Text = ""; } } if (ConsultaDropDownList.Text == "Descripcion") { MetasGridView.DataSource = meta.Listado(" * ", "Descripcion like '" + ConsultaTextBox.Text + "%'", ""); MetasGridView.DataBind(); } }
protected void EliminarButton_Click(object sender, EventArgs e) { int Id = 0; Metas meta = new Metas(); int.TryParse(MetaIdTextBox.Text, out Id); if (Id > 0) { meta.MetaId = Id; if (meta.Buscar(meta.MetaId)) { if (meta.Eliminar()) { ShowToast("success", "Eliminado", "Eliminado Correctamente"); Limpiar(); } else { ShowToast("error", "Error", "Error al Eliminado"); } } else { ShowToast("warning", "Incorrecto", "Id No Existe"); } } else { ShowToast("warning", "Incorrecto", "Id Incorrecto"); } }
public void CargarGridView() { Metas meta = new Metas(); MetasGridView.DataSource = meta.Listado(" * ", " 1=1 ", ""); MetasGridView.DataBind(); }
public async Task <IActionResult> put(int MetaId, Metas model) { try { //verifica se existe meta a ser alterado var meta = await this.Repo.GetMetaById(MetaId); if (meta == null) { return(NotFound()); } this.Repo.Entry(meta); this.Repo.Update(model); if (await this.Repo.SaveChangesAsync()) { //pegar o aluno novamente, agora alterado para devolver pela rota abaixo //meta = await this.Repo.GetMetaByID(MetaId); //return Created($"/api/usuarios/{model.Id}", model); return(Ok()); } } catch { return(this.StatusCode(StatusCodes.Status500InternalServerError, "Falha no acesso ao banco de dados.")); } // retorna BadRequest se não conseguiu alterar return(BadRequest()); }
public void ActivarMetas(bool bModoNormal) { if (this.oMetas == null) { this.oMetas = new Metas() { Dock = DockStyle.Fill }; this.Controls.Add(this.oMetas); // this.oMetas.Preparar(0); } this.oMetas.SucursalID = GlobalClass.SucursalID; this.oMetas.UsuarioID = Util.Entero(this.cmbVendedor.SelectedValue); this.oMetas.Desde = this.dtpDe.Value; this.oMetas.Hasta = this.dtpA.Value; // this.oMetas.bVerAdicional = this.bVerAdicional; this.oMetas.Preparar(this.oMetas.UsuarioID); this.oMetas.BringToFront(); this.oMetas.Show(); if (bModoNormal) { this.oMetas.CargarDatos(); } else { this.oMetas.CargarDatosGeneral(); } }
/// <inheritdoc /> /// <summary> /// Init this storage /// </summary> protected override void OnInit() { Ensure.ReferenceNotNull(BasePath, "The FileStorage BasePath, is null."); Core.Log.InfoBasic("Initializing FileStorage..."); if (_handlers?.Any() == true) { Core.Log.InfoBasic("Disposing previous instances..."); _handlers.Each(fsto => fsto.Dispose()); _handlers = null; } if (!Directory.Exists(BasePath)) { Core.Log.InfoBasic("Creating base folder"); Directory.CreateDirectory(BasePath); } Core.Log.InfoBasic("Configuring {0} Subfolders", NumberOfSubFolders); _handlers = new FolderHandler[NumberOfSubFolders]; for (var i = 0; i < NumberOfSubFolders; i++) { var folder = Path.Combine(BasePath, i.ToString()); Core.Log.InfoBasic("Initializing Subfolder: {0} on {1}", i, folder); _handlers[i] = new FolderHandler(folder, this); } Core.Log.InfoBasic("Waiting the folder handlers to be loaded."); TaskHelper.SleepUntil(() => _handlers.All(s => s.Loaded)).WaitAsync(); Core.Log.InfoBasic("All folder handlers are loaded, Index Count: {0}", Metas.Count()); SetReady(true); }
public ActionResult Delete(int id) { Metas metas = db.Metas.Where(s => s.id == id).SingleOrDefault(); metas.eliminado = true; db.SaveChanges(); return(Json(new { mensaje = "Registrado eliminado correctamente" })); }
public void LlenarMetas(Metas meta) { DescripcionTextBox.Text = meta.Descripcion; foreach (var item in meta.metas) { MetasListBox.Items.Add(item.Monto.ToString()); } }
public ActionResult Update(int id, string descripcion, int idtipo) { Metas metas = db.Metas.Where(s => s.id == id).SingleOrDefault(); metas.Descripcion = descripcion; metas.tipoCalificacionId = idtipo; db.SaveChanges(); return(Json(new { mensaje = "Registrado actualizado correctamente" })); }
public async Task UpdateMetasByCidAsync(int cid, string[] name, int type) { var metas = new List <Metas>(); foreach (string n in name) { if (!string.IsNullOrEmpty(n)) { var meta = await _project3DB.Metas.Where(m => m.name == n && m.type == type).SingleOrDefaultAsync(); if (meta == null) { meta = new Metas(); meta.name = n; meta.type = type; meta.count = 1; meta = await _project3DB.AddAsync(meta); } metas.Add(meta); var relationship = await _project3DB.Relationships.Where(m => m.cid == cid && m.mid == meta.mid).SingleOrDefaultAsync(); if (relationship == null) { relationship = new Relationships(); relationship.cid = cid; relationship.mid = meta.mid; await _project3DB.AddAsync(relationship); //更新文章计数 meta.count++; meta = await _project3DB.UpdateAsync(meta); } } } //删除掉旧的分类/标签 var r = (from s in _project3DB.Relationships where s.cid == cid join m in _project3DB.Metas on s.mid equals m.mid where m.type == type select s); foreach (Relationships rs in r) { if (metas.Where(m => m.mid == rs.mid).Count() == 0) { //更新文章计数 var meta = await _project3DB.Metas.Where(m => m.mid == rs.mid).SingleOrDefaultAsync(); if (meta != null) { meta.count--; _project3DB.Metas.Update(meta); } _project3DB.Relationships.Remove(rs); } } await _project3DB.SaveChangesAsync(); }
public Metas LlenarClase() { Metas metas = new Metas(); metas.Metaid = Convert.ToInt32(MetaIDnumericUpDown.Value); metas.Descripcion = DescripciontextBox.Text; metas.Cuota = Convert.ToDecimal(CuotanumericUpDown.Value); return(metas); }
public void InsertarTest() { Metas meta = new Metas(); meta.Descripcion = "Mi Meta Personal"; meta.UsuarioId = 1; meta.AgregarMetas(21, 1, 200); Assert.IsTrue(meta.Insertar()); }
public void EditarTest() { Metas meta = new Metas(); meta.MetaId = 21; meta.Descripcion = "Mi Meta"; meta.UsuarioId = 1; meta.AgregarMetas(21, 1, 200); Assert.IsTrue(meta.Editar()); }
public static System.Type GetTypeFromName(string typeName) { CStringID key = new CStringID(typeName); if (Metas.ContainsKey(key)) { CTagObjectDescriptor descriptor = Metas[key]; return(descriptor.type); } return(null); }
public ActionResult ObservacionUpdate(int id, string observacion) { Metas _metas = new Metas(); _metas = (from m in db.Metas where m.id == id select m).First(); _metas.Observacion = observacion; db.SaveChanges(); return(Json(new { mensaje = "Planificación actualizada correctamente" })); }
public Metas LlenaClase() { Metas metas = new Metas() { MetaID = Convert.ToInt32(MetasIdNumericUpDown.Value), Descripcion = DescripciontextBox.Text, Cuota = Convert.ToDouble(CuotanumericUpDown2.Value) }; return(metas); }
public async Task Create(Metas model) { try { _db.DbSetMetas.Add(model); await _db.SaveChangesAsync(); } catch (Exception e) { throw new Exception(e.Message, e); } }
public MetaData FindMetaData(UInt32 hash) { MetaData result; if (Metas.TryGetValue(hash, out result) == false) { return(null); } result.SureLoaded(); return(result); }
public static CTagObjectDescriptor GetDescriptorByName(string className) { CStringID key = new CStringID(className); if (Metas.ContainsKey(key)) { return(Metas[key]); } CTagObjectDescriptor descriptor = new CTagObjectDescriptor(); Metas.Add(key, descriptor); return(descriptor); }
protected void GuadarButton_Click1(object sender, EventArgs e) { Metas meta = new Metas(); meta.Descripcion = DescripcionTextBox.Text; meta.UsuarioId = 5; meta.TipoIngresoId = Convert.ToInt32(TipoDeIngresoDropDownList.SelectedValue); meta.LimpiarList(); for (int i = 0; i < MetasListBox.Items.Count; i++) { Double monto = Convert.ToDouble(MetasListBox.Items[i].ToString()); meta.AgregarMetas(1, meta.TipoIngresoId, monto); } if (MetaIdTextBox.Text.Length <= 0) { if (meta.Insertar()) { ShowToast("success", "Correcto", "Guardado Correctamente"); Limpiar(); } else { ShowToast("error", "Error", "Error Al Guardar"); } } else { int Id; int.TryParse(MetaIdTextBox.Text, out Id); if (Id > 0) { meta.MetaId = Id; if (meta.Editar()) { ShowToast("success", "Modificado", "Modificado Correctamente"); Limpiar(); } else { ShowToast("error", "Error", "Error Al Modificar"); } } else { ShowToast("warning", "Incorrecto", "Id Incorrecto"); } } }
public override object BeforeMethod(string method) { var metas = Metas.Where(x => x.MetaName == method).ToList(); if (metas.Count == 0) { return(base.BeforeMethod(method)); } if (metas.Count == 1) { return(metas.First()); } return(metas); }
public void AddMeta(XElement item) { var f = ParentSettings?.ParentFeed; if (item == null || f == null) { return; } // rawvoice // http://www.rawvoice.com/services/tools-and-resources/rawvoice-rss-2-0-module-xmlns-namespace-rss2/ /* metamark, if present as a sub-item of <item> and <item> includes an <enclosure> item, * specifies additional meta information that may complement the enclosure and/or may be used * during the playback of the enclosure’s media. It has four attributes: * type, link, position and duration and may contain a value. */ if (f.HasRawVoice) { foreach (var metaX in item.Elements(SimpleFeed.xname_rawvoice_metamark)) { var meta = new SFFeedMeta() { Source = "rawvoice.meta", Type = metaX.Attribute("type")?.Value?.Trim(), //.ValueN().TrimN(); Url = metaX.Attribute("link")?.Value?.Trim(), //.ValueN().TrimN(); Value = metaX?.Value?.Trim() }; if (meta.Value.NotNulle() || meta.Url.NotNulle()) { Metas.Add(meta); //BasicMimeType typ = isLinkRVMeta.V(meta.Type, BasicMimeType.none); string url = ExtraTextFuncs.IsWebLink(meta.Url) ? meta.Url : (ExtraTextFuncs.IsWebLink(meta.Value) ? meta.Value : null); if (url != null) { var lnk = new SFLink(url, meta.Type); if (lnk != null && lnk.IsValid) { AddLink(lnk); } } } } } }
public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Metas meta = db.Metas.Find(id); if (meta == null) { return(HttpNotFound()); } return(View(meta)); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Metas meta = new Metas(); MetasReportViewer.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local; MetasReportViewer.Reset(); MetasReportViewer.LocalReport.ReportPath = Server.MapPath(@"~\Rpts/MetasRpt.rdlc"); MetasReportViewer.LocalReport.DataSources.Clear(); MetasReportViewer.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource("MetasDataSet", meta.Listado(" * ", " 1=1 ", ""))); MetasReportViewer.LocalReport.Refresh(); } }
private void OnExecuteSearchCommand() { SearchResults.Clear(); Metas.Clear(); Task.Factory.StartNew(() => { var result = new HtmlWeb().Load(string.Format(Url, QueryString)); //var nodes = result.DocumentNode.SelectNodes("//html//body//div[@class='g']").Select(r => r.InnerHtml).Take(10); //SearchResults.Clear(); //foreach (var node in nodes) //{ // SearchResults.Add(node); //} // extract links var searchResultCount = 0; foreach (var link in result.DocumentNode.SelectNodes("//a[@href]")) { var hrefValue = link.GetAttributeValue("href", string.Empty); if (hrefValue.ToUpper().Contains("GOOGLE") || !hrefValue.Contains("/url?q=") || !hrefValue.ToUpper().Contains("HTTP://")) continue; var index = hrefValue.IndexOf("&", StringComparison.Ordinal); if (index <= 0) continue; hrefValue = hrefValue.Substring(0, index); var searchResultUrl = hrefValue.Replace("/url?q=", ""); if (searchResultCount == 20) continue; searchResultCount++; _dispatcher.Invoke(() => { SearchResults.Add(searchResultUrl); }, DispatcherPriority.Normal); } Parallel.ForEach(SearchResults, (c) => { var meta = LoadMeta(c); HtmlTool.FetchOg(c); _dispatcher.Invoke(() => { Metas.Add(meta); }); }); }); }