public void InsertarPeriodo() { DateTime fecha = DateTime.Now; ClPeriodoInscripcion per = new ClPeriodoInscripcion(); int activo = 0; //per.CodPeriodoInscripcion = txtCodigoPeriodo.Text.ToUpper().Trim(); per.Periodo = txtPeriodo.Text.ToUpper().Trim(); per.AnoLectivo = Convert.ToInt32(txtAnoLectivo.Text); per.FechaInicio = Convert.ToDateTime(txtFechaInicio.Text); per.FechaFin = Convert.ToDateTime(txtFechaFin.Text); if (RabActivo.Checked == true) { activo = 1; } else { activo = 0; } per.EstadoPeriodo = activo; if (Convert.ToDateTime(txtFechaFin.Text) < Convert.ToDateTime(txtFechaInicio.Text)) { string script = @"<script type='text/javascript'> alert('No se pudo procesar la solicitud la fecha no debe ser menor a la fecha inicial'); </script>"; ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, false); } else { ServicioInsertarPeriodo(per); string script = "confirm();"; ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, true); } }
public async void ServicioInsertarPeriodo(ClPeriodoInscripcion per) { string uri = "api/PeriodoInscripcion"; try { var myContent = JsonConvert.SerializeObject(per); var stringContent = new StringContent(myContent, UnicodeEncoding.UTF8, "application/json"); var client = new HttpClient(); client.BaseAddress = new Uri(url); client.DefaultRequestHeaders.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/jason")); HttpResponseMessage res = await client.PostAsync(uri, stringContent); if (res.IsSuccessStatusCode) { var empResponse = res.Content.ReadAsStringAsync().Result; string script = @"<script type='text/javascript'> alert('Añadido Correctamente'); </script>"; ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, false); limpiarCampos(); } else { string script = @"<script type='text/javascript'> alert('No se pudo procesar la solicitud'); </script>"; ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, false); limpiarCampos(); } } catch (Exception ex) { throw ex; } }
public bool actualizarPeriodoInscripcion(ClPeriodoInscripcion perIns, int idPeriodo) { ISession mySesions = SessionFactory.OpenSession; bool resp = false; using (mySesions) { using (ITransaction transaction = mySesions.BeginTransaction()) { try { IQuery query = mySesions.CreateQuery("FROM ClPeriodoInscripcion WHERE IdPeriodoInscripcion=: idPeriodo").SetInt32("idPeriodo", idPeriodo); ClPeriodoInscripcion perIns_ = query.List <ClPeriodoInscripcion>()[0]; perIns_.Periodo = perIns.Periodo; perIns_.AnoLectivo = perIns.AnoLectivo; perIns_.CodPeriodoInscripcion = perIns.CodPeriodoInscripcion; perIns_.FechaInicio = perIns.FechaInicio; perIns_.FechaFin = perIns.FechaFin; perIns_.EstadoPeriodo = perIns.EstadoPeriodo; mySesions.Update(perIns_); transaction.Commit(); resp = true; return(resp); } catch (Exception ex) { throw ex; } finally { mySesions.Flush(); } } } }
//Insertar un Periodo de Inscripcion public void InsertarPeriodoInscripcion(ClPeriodoInscripcion perIns) { ISession mySesions = SessionFactory.OpenSession; using (mySesions) { using (ITransaction transaction = mySesions.BeginTransaction()) { try { mySesions.Save(perIns); transaction.Commit(); } catch (Exception ex) { throw ex; } } } }
protected void btnActualizar_Click(object sender, EventArgs e) { ClPeriodoInscripcion periodo = new ClPeriodoInscripcion(); int activo = 0; periodo.IdPeriodoInscripcion = Convert.ToInt32(txtId.Text); periodo.Periodo = txtPeriodoM.Text.ToUpper().Trim(); periodo.AnoLectivo = Convert.ToInt32(txtAnoLectivo.Text); periodo.CodPeriodoInscripcion = ""; periodo.FechaInicio = Convert.ToDateTime(txtFechaInicio.Text); periodo.FechaFin = Convert.ToDateTime(txtFechaFin.Text); if (RabActivo.Checked == true) { activo = 1; } else { activo = 0; } periodo.EstadoPeriodo = activo; ServicioActualizarPeriodo(periodo); }
public async void ServicioActualizarPeriodo(ClPeriodoInscripcion periodo) { try { string uri = "api/PeriodoInscripcion?idper=" + periodo.IdPeriodoInscripcion; var myContent = JsonConvert.SerializeObject(periodo); var stringContent = new StringContent(myContent, UnicodeEncoding.UTF8, "application/json"); var client = new HttpClient(); client.BaseAddress = new Uri(url); client.DefaultRequestHeaders.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/jason")); HttpResponseMessage res = await client.PutAsync(uri, stringContent); if (res.IsSuccessStatusCode) { var empResponse = res.Content.ReadAsStringAsync().Result; } } catch (Exception ex) { throw ex; } }
public bool UpdateInscritosAutonomoXCedula(ClPeriodoInscripcion perInsc, int idper)//actualizar PeriodoInscripcion { return(serv.actualizarPeriodoInscripcion(perInsc, idper)); }
public void PostInsertarPeriodoInscripcion(ClPeriodoInscripcion perIns)//insertar un Periodo de Inscripcion { serv.InsertarPeriodoInscripcion(perIns); }