예제 #1
0
        public ct_cbtecble_Plantilla_Info Get_Info_Plantilla(int IdEmpresa, int IdTipoCbte, decimal IdPlantilla)
        {
            try
            {
                ct_cbtecble_Plantilla_Info Pla_I           = new ct_cbtecble_Plantilla_Info();
                EntitiesDBConta            OECbtecble_Info = new EntitiesDBConta();
                var selectCbtecble = from C in OECbtecble_Info.ct_cbtecble_Plantilla
                                     where C.IdEmpresa == IdEmpresa && C.IdTipoCbte == IdTipoCbte && C.IdPlantilla == IdPlantilla
                                     select C;

                foreach (var item in selectCbtecble)
                {
                    Pla_I.IdEmpresa        = item.IdEmpresa;
                    Pla_I.IdTipoCbte       = item.IdTipoCbte;
                    Pla_I.IdPlantilla      = item.IdPlantilla;
                    Pla_I.cb_Fecha         = Convert.ToDateTime(item.cb_Fecha);
                    Pla_I.cb_Observacion   = item.cb_Observacion;
                    Pla_I.cb_Estado        = item.cb_Estado;
                    Pla_I.IdUsuario        = item.IdUsuario;
                    Pla_I.IdUsuarioAnu     = item.IdUsuarioAnu;
                    Pla_I.cb_MotivoAnu     = item.cb_MotivoAnu;
                    Pla_I.IdUsuarioUltModi = item.IdUsuarioUltModi;
                    Pla_I.cb_FechaAnu      = Convert.ToDateTime(item.cb_FechaAnu);
                    Pla_I.cb_FechaTransac  = Convert.ToDateTime(item.cb_FechaTransac);
                    Pla_I.cb_FechaUltModi  = Convert.ToDateTime(item.cb_FechaUltModi);

                    ct_cbtecble_Plantilla_det_Data data = new ct_cbtecble_Plantilla_det_Data();

                    Pla_I.LstDet = data.Get_list_Planilla_det(IdEmpresa, IdTipoCbte, IdPlantilla);
                }
                return(Pla_I);
            }
            catch (Exception ex)
            {
                string arreglo = 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(), "", arreglo, "",
                                                                                          "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                mensaje = ex.ToString();
                throw new Exception(ex.ToString());
            }
        }
예제 #2
0
        public Boolean EliminarDB(ct_cbtecble_Plantilla_Info info)
        {
            try
            {
                using (EntitiesDBConta context = new EntitiesDBConta())
                {
                    var contact = context.ct_cbtecble_Plantilla.FirstOrDefault(tb => tb.IdEmpresa == info.IdEmpresa && tb.IdTipoCbte == info.IdTipoCbte && tb.IdPlantilla == info.IdPlantilla);
                    if (contact != null)
                    {
                        contact.cb_Estado      = "I";
                        contact.IdUsuarioAnu   = info.IdUsuarioAnu;
                        contact.cb_MotivoAnu   = info.cb_MotivoAnu;
                        contact.cb_Observacion = "*** ANULADO *** - " + info.cb_Observacion;
                        contact.cb_FechaAnu    = DateTime.Now;
                        context.SaveChanges();

                        ct_cbtecble_Plantilla_det_Data        PLa_Data      = new ct_cbtecble_Plantilla_det_Data();
                        List <ct_cbtecble_Plantilla_det_Info> Lista_detalle = new List <ct_cbtecble_Plantilla_det_Info>();
                        Lista_detalle = PLa_Data.Get_list_Planilla_det(info.IdEmpresa, info.IdTipoCbte, info.IdPlantilla);

                        foreach (var item in Lista_detalle)
                        {
                            item.dc_Observacion = "***ANULADO*** - " + item.dc_Observacion;
                            PLa_Data.ModificarDB(item);
                        }
                    }
                }
                return(true);
            }
            catch (Exception ex)
            {
                string arreglo = 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(), "", arreglo, "",
                                                                                          "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                mensaje = ex.InnerException + " " + ex.Message;
                throw new Exception(ex.InnerException.ToString());
            }
        }