public List <Aca_Periodo_Info> Get_List_Periodo_Pre(int IdInstitucion) { List <Aca_Periodo_Info> lM = new List <Aca_Periodo_Info>(); try { Entities_Academico OEPeriodo = new Entities_Academico(); var selectPeriodo = from C in OEPeriodo.Aca_periodo group C by new { C.pe_anio, C.IdInstitucion } into grouping select new { grouping.Key, grouping.Key.pe_anio }; foreach (var item in selectPeriodo) { Aca_Periodo_Info Cbt = new Aca_Periodo_Info(); Cbt.IdInstitucion = item.Key.IdInstitucion; Cbt.pe_anio = Convert.ToInt32(item.pe_anio); lM.Add(Cbt); } return(lM); } catch (Exception ex) { string array = ToString(); tb_sis_Log_Error_Vzen_Data oDataLog = new tb_sis_Log_Error_Vzen_Data(); tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", array, "", "", "", "", "", DateTime.Now); oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); mensaje = ex.InnerException + " " + ex.Message; throw new Exception(ex.InnerException.ToString()); } }
public void Set_Periodo(Aca_Periodo_Info Info) { try { Info_Periodo = Info; txtIdPeriodo.Text = Info_Periodo.IdPeriodo.ToString(); searchLookUpAnio_Lectivo.EditValue = Info_Periodo.IdAnioLectivo; dtFechaIni.Text = Convert.ToString(Info_Periodo.pe_FechaIni); dtFechaFin.Text = Convert.ToString(Info_Periodo.pe_FechaFin); CheckEstado.Checked = (Info_Periodo.pe_estado == "A") ? true : false; lblEstado.Visible = (Info_Periodo.pe_estado == "I") ? true : false; if (Info_Periodo.pe_estado == "I") { lblEstado.Visible = true; } else { lblEstado.Visible = false; } } catch (Exception ex) { MessageBox.Show(param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas) + ":" + ex.Message, param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error); Log_Error_bus.Log_Error(ex.ToString()); } }
void generarMensual() { try { DateTime fecha; string IdPeriodo = ""; int rangoMeses = 0; rangoMeses = Math.Abs((dt_FechaFin.Value.Month - dt_FechaDesde.Value.Month) + 12 * (dt_FechaFin.Value.Year - dt_FechaDesde.Value.Year)); for (int i = 0; i < rangoMeses + 1; i++) { Aca_Periodo_Info item = new Aca_Periodo_Info(); int dayMes = 0; fecha = dt_FechaDesde.Value.AddMonths(i); IdPeriodo = ((fecha.Year) * 100 + fecha.Month).ToString(); dayMes = System.DateTime.DaysInMonth(fecha.Year, fecha.Month); DateTime p = new DateTime(fecha.Year, fecha.Month, 1); DateTime q = new DateTime(fecha.Year, fecha.Month, dayMes); item.IdPeriodo = Convert.ToInt32(IdPeriodo); item.pe_anio = fecha.Year; item.pe_mes = fecha.Month; item.pe_FechaIni = p; item.pe_FechaFin = q; item.pe_estado = "A"; if (i == 0) { item.est_apertura = "A"; } else { item.est_apertura = "I"; } //item.IdAnioLectivo = cmbAnio.EditValue.ToString(); item.IdAnioLectivo = Convert.ToInt16(cmbAnio.EditValue.ToString()); item.IdInstitucion = param.IdInstitucion; lista_Periodo.Add(item); } this.gridControlPeriodo.DataSource = lista_Periodo; } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show(param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas) + ex.Message + " ", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public Boolean AnularDB(Aca_Periodo_Info Info, ref string msg) { try { return(Odata.AnularDB(Info, ref msg)); } catch (Exception ex) { Core.Erp.Info.Log_Exception.LoggingManager.Logger.Log(Core.Erp.Info.Log_Exception.LoggingCategory.Error, ex.Message); throw new Core.Erp.Info.Log_Exception.DalException(string.Format("", "AnularDB", ex.Message), ex) { EntityType = typeof(Boolean) }; } }
private void cmb_periodo_EditValueChanged(object sender, EventArgs e) { try { info_periodo = (Aca_Periodo_Info)cmb_periodo.Properties.View.GetFocusedRow(); if (info_periodo == null) { info_periodo = lista_periodo.Where(v => v.IdPeriodo == info_prefac.IdPeriodo).FirstOrDefault(); } dtp_Fecha_Fact.EditValue = info_prefac.pe_FechaIni; } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show(ex.Message); } }
public Boolean ModificarDB(Aca_Periodo_Info Info, ref string msg) { try { Boolean resultado = false; using (Entities_Academico context = new Entities_Academico()) { var contact = context.Aca_periodo.FirstOrDefault(minfo => minfo.IdPeriodo == Info.IdPeriodo && minfo.IdInstitucion == Info.IdInstitucion && minfo.IdAnioLectivo == Info.IdAnioLectivo); if (contact != null) { contact.IdInstitucion = Info.IdInstitucion; contact.IdPeriodo = Info.IdPeriodo; contact.IdAnioLectivo = Info.IdAnioLectivo; contact.pe_FechaIni = Info.pe_FechaIni; contact.pe_FechaFin = Info.pe_FechaFin; contact.pe_estado = Info.pe_estado; contact.Fecha_UltMod = Info.Fecha_UltMod; contact.IdUsuarioUltMod = Info.IdUsuarioUltMod; contact.MotivoAnulacion = ""; contact.est_apertura = Info.est_apertura; context.SaveChanges(); resultado = true; } else { msg = "No se pudo modificar, ya que la consulta regreso vacia"; } } return(resultado); } catch (Exception ex) { string array = ToString(); tb_sis_Log_Error_Vzen_Data oDataLog = new tb_sis_Log_Error_Vzen_Data(); tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", array, "", "", "", "", "", DateTime.Now); oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); mensaje = ex.InnerException + " " + ex.Message; throw new Exception(ex.InnerException.ToString()); } }
public Boolean GrabarDB(Aca_Periodo_Info Info, ref string msg) { try { using (Entities_Academico context = new Entities_Academico()) { var que = from C in context.Aca_periodo where C.IdPeriodo == Info.IdPeriodo select C; if (que.Count() == 0) { var address = new Aca_periodo(); //Info.IdPeriodo = getId(Info.IdInstitucion, Info.pe_anio, Info.pe_mes); address.IdInstitucion = Info.IdInstitucion; address.IdPeriodo = Info.IdPeriodo; address.IdAnioLectivo = Info.IdAnioLectivo; address.pe_FechaIni = Convert.ToDateTime(Info.pe_FechaIni); address.pe_FechaFin = Convert.ToDateTime(Info.pe_FechaFin); address.pe_anio = Convert.ToInt32(Info.pe_anio); address.pe_mes = Convert.ToByte(Info.pe_mes); address.pe_estado = Info.pe_estado; context.Aca_periodo.Add(address); context.SaveChanges(); } else { msg = "Error en el ingreso; Periodo Existente"; return(false); } } return(true); } catch (Exception ex) { string array = ToString(); tb_sis_Log_Error_Vzen_Data oDataLog = new tb_sis_Log_Error_Vzen_Data(); tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", array, "", "", "", "", "", DateTime.Now); oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); mensaje = ex.InnerException + " " + ex.Message; throw new Exception(ex.InnerException.ToString()); } }
//public List<Aca_Periodo_Info> Get_List_PeriodoActivo_x_AnioLectivo(int IdInstitucion, string IdAnioLectivo) public List <Aca_Periodo_Info> Get_List_PeriodoActivo_x_AnioLectivo(int IdInstitucion, int IdAnioLectivo) { List <Aca_Periodo_Info> lM = new List <Aca_Periodo_Info>(); try { Entities_Academico OEPeriodo = new Entities_Academico(); var selectPeriodo = from C in OEPeriodo.Aca_periodo where C.IdInstitucion == IdInstitucion && C.IdAnioLectivo == IdAnioLectivo && C.est_apertura == "A" select C; foreach (var item in selectPeriodo) { Aca_Periodo_Info Cbt = new Aca_Periodo_Info(); Cbt.IdInstitucion = item.IdInstitucion; Cbt.IdPeriodo = item.IdPeriodo; Cbt.IdAnioLectivo = item.IdAnioLectivo; Cbt.pe_anio = Convert.ToInt32(item.pe_anio); Cbt.pe_mes = Convert.ToInt32(item.pe_mes); Cbt.pe_FechaIni = Convert.ToDateTime(item.pe_FechaIni.ToShortDateString()); Cbt.pe_FechaFin = Convert.ToDateTime(item.pe_FechaFin.ToShortDateString()); Cbt.pe_Descripcion = item.pe_FechaIni.ToShortDateString() + " - " + item.pe_FechaFin.ToShortDateString(); Cbt.pe_estado = item.pe_estado; Cbt.MotivoAnulacion = item.MotivoAnulacion; lM.Add(Cbt); } return(lM); } catch (Exception ex) { string array = ToString(); tb_sis_Log_Error_Vzen_Data oDataLog = new tb_sis_Log_Error_Vzen_Data(); tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", array, "", "", "", "", "", DateTime.Now); oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); mensaje = ex.InnerException + " " + ex.Message; throw new Exception(ex.InnerException.ToString()); } }
private void ucGe_Menu_Mantenimiento_x_usuario1_event_btnAnular_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { Info = (Aca_Periodo_Info)this.gridViewPeriodo.GetFocusedRow(); if (Info == null) { MessageBox.Show(param.Get_Mensaje_sys(enum_Mensajes_sys.Por_favor_seleccione_item_a_anular), param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { Preparar_Formulario(Cl_Enumeradores.eTipo_action.Anular); } } catch (Exception ex) { MessageBox.Show(param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas) + ":" + ex.Message, param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error); Log_Error_bus.Log_Error(ex.ToString()); } }