public void FunEditarNotasGestion(SoftCob_NOTAS_GESTION _datos) { try { using (SoftCobEntities _db = new SoftCobEntities()) { SoftCob_NOTAS_GESTION _original = _db.SoftCob_NOTAS_GESTION.Where(x => x.NOTA_CODIGO == _datos.NOTA_CODIGO).FirstOrDefault(); _db.SoftCob_NOTAS_GESTION.Attach(_original); _original.nota_descripcion = _datos.nota_descripcion; _original.nota_revisarfecha = _datos.nota_revisarfecha; _original.nota_mantener = _datos.nota_mantener; _original.nota_auxv1 = _datos.nota_auxv1; _original.nota_auxv2 = _datos.nota_auxv2; _original.nota_auxv3 = _datos.nota_auxv3; _original.nota_auxi1 = _datos.nota_auxi1; _original.nota_auxi2 = _datos.nota_auxi2; _original.nota_auxi3 = _datos.nota_auxi3; _db.SaveChanges(); } } catch (Exception ex) { throw ex; } }
public void FunCrearNotasGestion(SoftCob_NOTAS_GESTION _datos) { try { using (SoftCobEntities _db = new SoftCobEntities()) { _db.SoftCob_NOTAS_GESTION.Add(_datos); _db.SaveChanges(); } } catch (Exception ex) { throw ex; } }
public void FunDelNotasGestion(int _codigo) { try { using (SoftCobEntities _db = new SoftCobEntities()) { SoftCob_NOTAS_GESTION _datos = _db.SoftCob_NOTAS_GESTION.SingleOrDefault(x => x.NOTA_CODIGO == _codigo); if (_datos != null) { _db.Entry(_datos).State = System.Data.Entity.EntityState.Deleted; _db.SaveChanges(); } } } catch (Exception ex) { _mensaje = ex.ToString(); } }
protected void BtnGrabar_Click(object sender, EventArgs e) { try { _fechaactual = DateTime.Now.ToString("MM/dd/yyyy"); _dtmfecharecordatorio = DateTime.ParseExact(TxtFechaRecordatorio.Text, "MM/dd/yyyy", CultureInfo.InvariantCulture); _dtmfechaactual = DateTime.ParseExact(_fechaactual, "MM/dd/yyyy", CultureInfo.InvariantCulture); if (_dtmfecharecordatorio < _dtmfechaactual) { new FuncionesDAO().FunShowJSMessage("Fecha de Recordatorio no puede ser menor a Fecha Actual..!", this); return; } if (DdlMantener.SelectedValue == "0") { new FuncionesDAO().FunShowJSMessage("Seleccione Tipo de Recordatorio..!", this); return; } if (string.IsNullOrEmpty(TxtDescripcion.Text.Trim())) { new FuncionesDAO().FunShowJSMessage("Ingrese Descripción..!", this); return; } SoftCob_NOTAS_GESTION datos = new SoftCob_NOTAS_GESTION(); { datos.NOTA_CODIGO = int.Parse(ViewState["codigoNOTA"].ToString()); datos.nota_cedecodigo = int.Parse(ViewState["codigoCEDE"].ToString()); datos.nota_cpcecodigo = int.Parse(ViewState["codigoCPCE"].ToString()); datos.nota_perscodigo = int.Parse(ViewState["codigoPERS"].ToString()); datos.nota_gestor = int.Parse(Session["usuCodigo"].ToString()); datos.nota_descripcion = TxtDescripcion.Text.Trim().ToUpper(); datos.nota_revisarfecha = DateTime.ParseExact(TxtFechaRecordatorio.Text, "MM/dd/yyyy", CultureInfo.InvariantCulture); datos.nota_mantener = DdlMantener.SelectedValue; datos.nota_auxv1 = ""; datos.nota_auxv2 = ""; datos.nota_auxv3 = ""; datos.nota_auxi1 = 0; datos.nota_auxi2 = 0; datos.nota_auxi3 = 0; datos.nota_fechacreacion = DateTime.Now; datos.nota_usuariocreacion = int.Parse(Session["usuCodigo"].ToString()); datos.nota_terminalcreacion = Session["MachineName"].ToString(); } if (int.Parse(ViewState["codigoNOTA"].ToString()) == 0) { new GestionTelefonicaDAO().FunCrearNotasGestion(datos); } else { new GestionTelefonicaDAO().FunEditarNotasGestion(datos); } ScriptManager.RegisterStartupScript(this, GetType(), "pop", "javascript:window.close();", true); } catch (Exception ex) { Lblerror.Text = ex.ToString(); } }