コード例 #1
0
        public void Guardar(tbl_logEstado data)
        {
            try
            {
                using (var ctx = new ceContext())
                {
                    //Existe
                    ctx.Configuration.AutoDetectChangesEnabled = false;
                    ctx.Configuration.ValidateOnSaveEnabled    = false;


                    if (data.id > 0)
                    {
                        ctx.Entry(data).State = EntityState.Modified;
                    }
                    else  //nuevo registro
                    {
                        var logData = ctx.Entry(data);
                        logData.State = EntityState.Added;
                        // ctx.Entry(data).State = EntityState.Added;
                        logData.Property(x => x.fecha).IsModified = false;
                    }



                    ctx.SaveChanges();
                }
            }
            catch (Exception e)
            {
                throw;
            }
        }
コード例 #2
0
        public bool Guardar(decimal solicitud, decimal Estado)
        {
            var dataSolicitud = new SL_SolicitudCredito()
            {
                C5000 = solicitud, C5063 = Estado
            };
            var datSo = new SL_SolicitudCredito();

            try
            {
                using (var ctx = new ceContext())
                {
                    if (solicitud > 0)
                    {
                        var sol = ctx.SL_SolicitudCredito.First(x => x.C5000 == solicitud);
                        sol.C5063 = Estado;
                        ctx.SaveChanges();
                    }
                    return(true);
                }
            }

            catch (Exception)
            {
                return(false);
            }
        }
コード例 #3
0
        public bool updateWF(decimal id, int open, decimal process)
        {
            try
            {
                var procResult = new SqlParameter
                {
                    ParameterName = "@procResult",
                    SqlDbType     = SqlDbType.Int,
                    Direction     = ParameterDirection.Output
                };


                using (var ctx = new ceContext())
                {
                    int result = ctx.Database.ExecuteSqlCommand("exec @procResult =  USPE_PROCESSWF_UP @pId, @pOpen, @processId",
                                                                new object[]
                    {
                        new SqlParameter
                        {
                            ParameterName = "@pId",
                            Value         = id,
                            SqlDbType     = SqlDbType.Decimal,
                            Direction     = ParameterDirection.Input
                        },
                        new SqlParameter
                        {
                            ParameterName = "@pOpen",
                            Value         = open,
                            SqlDbType     = SqlDbType.Int,
                            Direction     = ParameterDirection.Input
                        },
                        new SqlParameter
                        {
                            ParameterName = "@processId",
                            Value         = process,
                            SqlDbType     = SqlDbType.Decimal,
                            Direction     = ParameterDirection.Input
                        },

                        procResult
                    }

                                                                );
                    int resp = result;
                    return(true);
                }
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
コード例 #4
0
 public uspe_get_process_sol getProccesWF(decimal idSolicitud)
 {
     try
     {
         using (var ctx = new ceContext())
         {
             return(ctx.Database.SqlQuery <uspe_get_process_sol>("USPE_GET_PROCESS_SOL @p0", idSolicitud).SingleOrDefault());
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
コード例 #5
0
        public int validaSolicitud(decimal idsol)
        {
            int response = 0;

            try
            {
                var param2 = new SqlParameter
                {
                    ParameterName = "@valida",
                    SqlDbType     = System.Data.SqlDbType.Int,
                    Direction     = System.Data.ParameterDirection.Output
                };

                var procResult = new SqlParameter
                {
                    ParameterName = "@procResult",
                    SqlDbType     = SqlDbType.Int,
                    Direction     = ParameterDirection.Output
                };


                using (var ctx = new ceContext())
                {
                    int result = ctx.Database.ExecuteSqlCommand("exec @procResult =  USPE_SD_VALIDAEST @codsolicitud, @valida OUTPUT",
                                                                new object[]
                    {
                        new SqlParameter
                        {
                            ParameterName = "@codsolicitud",
                            Value         = idsol,
                            SqlDbType     = SqlDbType.Decimal,
                            Direction     = ParameterDirection.Input
                        },
                        param2,
                        procResult
                    }

                                                                );

                    response = (int)param2.Value;
                    int resp = (int)procResult.Value;
                }
            }
            catch (Exception)
            {
                throw;
            }

            return(response);
        }
コード例 #6
0
 public List <uspe_sd_estados> EstadoSolicitud(string estadoNuevo)
 {
     try
     {
         using (var ctx = new ceContext())
         {
             return(ctx.Database.SqlQuery <uspe_sd_estados>("USPE_SD_ESTADOS @p0", estadoNuevo).ToList());
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
コード例 #7
0
 public usp_solicitud getDataSolicitud(decimal idSolicitud)
 {
     try
     {
         using (var ctx = new ceContext())
         {
             return(ctx.Database.SqlQuery <usp_solicitud>("usp_solicitud_data @p0", idSolicitud).SingleOrDefault());
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
コード例 #8
0
 public List <uspe_sd_rpt_fecha> getReport(string fechaIni, string FechaFin)
 {
     try
     {
         using (var ctx = new ceContext())
         {
             return(ctx.Database.SqlQuery <uspe_sd_rpt_fecha>("USPE_SD_RPT_FECHA @p0, @p1", fechaIni, FechaFin).ToList());
         }
     }
     catch (Exception ex)
     {
         return(null);
     }
 }
コード例 #9
0
 public List <usp_solicitud> listadoSol()
 {
     try
     {
         using (var ctx = new ceContext())
         {
             return(ctx.Database.SqlQuery <usp_solicitud>("usp_solicitud").ToList());
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
コード例 #10
0
 public void Eliminar(int id)
 {
     try
     {
         using (var ctx = new ceContext())
         {
             ctx.Entry(new tbl_logEstado {
                 id = id
             }).State = EntityState.Deleted;
             ctx.SaveChanges();
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
コード例 #11
0
        public string nuevoEstado(string estadoTopaz, string estadoWF)
        {
            string response = "";

            try
            {
                using (var ctx = new ceContext())
                {
                    response = ctx.Database.SqlQuery <string>("select dbo.fnce_getNewState('" + estadoTopaz + "','" + estadoWF + "')").Single().ToString();
                }
            }catch (Exception e)
            {
                throw;
            }

            return(response);
        }
コード例 #12
0
        public List <tbl_logEstado> Listar()
        {
            var tbl_logEstado = new List <tbl_logEstado>();

            try
            {
                using (var ctx = new ceContext())
                {
                    tbl_logEstado = ctx.tbl_logEstado.ToList();
                }
            }catch (Exception)
            {
                throw;
            }

            return(tbl_logEstado);
        }
コード例 #13
0
        public tbl_logEstado Obtener(int id)
        {
            var tblData = new tbl_logEstado();

            try
            {
                using (var ctx = new ceContext())
                {
                    tblData = ctx.tbl_logEstado.Where(x => x.id == id)
                              .SingleOrDefault();
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(tblData);
        }
コード例 #14
0
        public SL_SolicitudCredito Obtener(long idSolicitud)
        {
            var dataSolicitud = new SL_SolicitudCredito();

            try
            {
                using (var ctx = new ceContext())
                {
                    dataSolicitud = ctx.SL_SolicitudCredito.Where(x => x.C5000 == idSolicitud)
                                    .SingleOrDefault();
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(dataSolicitud);
        }
コード例 #15
0
        public bool updateWF(decimal id_, decimal process_)
        {
            bool result = false;

            try
            {
                using (var ctx = new ceContext())
                {
                    int noOfRowUpdated = ctx.Database.ExecuteSqlCommand("update JBPM_TASKINSTANCE set ISOPEN_ = 0 where id_ = 208363 and PROCINST_ = 56733");
                }

                result = true;
            }
            catch (Exception)
            {
                result = false;
            }

            return(result);
        }
コード例 #16
0
        public bool esObservadaAnulada(long idSolicitud, int estado)
        {
            bool result = false;

            try
            {
                using (var ctx = new ceContext())
                {
                    int resp = ctx.Database.SqlQuery <int>("select 1 from SL_SolicitudCredito (nolock) sl where sl.C5000= " + idSolicitud + " and sl.C5063=" + estado)
                               .FirstOrDefault();

                    if (resp > 0)
                    {
                        result = true;
                    }
                }
            }
            catch (Exception)
            {
                result = false;
            }
            return(result);
        }
コード例 #17
0
        public int[] validaSolicitudDEL(decimal idsol)
        {
            int[] response = new int[2];
            try
            {
                var param1 = new SqlParameter
                {
                    ParameterName = "@respWF",
                    SqlDbType     = System.Data.SqlDbType.Int,
                    Direction     = System.Data.ParameterDirection.Output
                };
                var param2 = new SqlParameter
                {
                    ParameterName = "@respTopaz",
                    SqlDbType     = System.Data.SqlDbType.Int,
                    Direction     = System.Data.ParameterDirection.Output
                };

                var procResult = new SqlParameter
                {
                    ParameterName = "@procResult",
                    SqlDbType     = SqlDbType.Int,
                    Direction     = ParameterDirection.Output
                };


                using (var ctx = new ceContext())
                {
                    int result = ctx.Database.ExecuteSqlCommand("exec @procResult =  USPE_SD_VALIDAEST_DEL @codSol, @respWF OUTPUT, @respTopaz OUTPUT",
                                                                new object[]
                    {
                        new SqlParameter
                        {
                            ParameterName = "@codSol",
                            Value         = idsol,
                            SqlDbType     = SqlDbType.Decimal,
                            Direction     = ParameterDirection.Input
                        },
                        param1,
                        param2,
                        procResult
                    }



                                                                );

                    int res0 = (int)param1.Value; //si es 1 Eliminar solamente en solicitudes
                    int res1 = (int)param2.Value; // si es 1 eliminar en solicitudes y topaz
                    int resp = (int)procResult.Value;

                    response[0] = res0;
                    response[1] = res1;
                }
            }
            catch (Exception)
            {
                throw;
            }

            return(response);
        }