Example #1
0
        public List <in_Categoria_x_Formula_Info> Get_list_Categoria_x_Formula(int idEmpresa, int idCategoria)
        {
            try
            {
                List <in_Categoria_x_Formula_Info> lM = new List <in_Categoria_x_Formula_Info>();
                EntitiesInventarioEdehsa           OECate_x_formula_Info = new EntitiesInventarioEdehsa();
                var selectCate_x_formula_Info = from C in OECate_x_formula_Info.in_Categoria_x_Formula
                                                where C.IdEmpresa == idEmpresa &&
                                                C.IdCategoria == idCategoria
                                                select C;

                foreach (var item in selectCate_x_formula_Info)
                {
                    //in_Categoria_x_Formula_Info
                    in_Categoria_x_Formula_Info info = new in_Categoria_x_Formula_Info();
                    info.IdEmpresa         = item.IdEmpresa;
                    info.IdCategoria       = item.IdCategoria;
                    info.descripcion_corta = item.descripcion_corta;
                    info.tiene_longitud    = item.tiene_longitud;
                    info.tiene_espesor     = item.tiene_espesor;
                    info.tiene_ancho       = item.tiene_ancho;
                    info.tiene_alto        = item.tiene_alto;
                    info.tiene_ceja        = item.tiene_ceja;
                    info.tiene_diametro    = item.tiene_diametro;
                    info.formula           = item.formula;
                    info.densidad          = item.densidad;
                    info.estado            = item.estado;
                    //prd.estado = (item.estado eq 1) ? "ACTIVO" : "*ANULADO*";

                    // prd.Sestado = (item.Estado == "A") ? "ACTIVO" : "*ANULADO*";
                    lM.Add(info);
                    //lM.Add(info);
                }
                return(lM);
            }
            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() + " " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }
Example #2
0
        public Boolean GrabarDB(in_Categoria_x_Formula_Info info, ref int id, ref string msg)
        {
            try
            {
                using (EntitiesInventarioEdehsa context = new EntitiesInventarioEdehsa())
                {
                    var address = new in_Categoria_x_Formula();
                    int idpv    = GetId(info.IdEmpresa);
                    id = idpv;
                    address.IdEmpresa = info.IdEmpresa;


                    address.IdCategoria    = info.IdCategoria;
                    address.tiene_longitud = info.tiene_longitud;
                    address.tiene_espesor  = info.tiene_espesor;
                    address.tiene_ancho    = info.tiene_ancho;
                    address.tiene_alto     = info.tiene_alto;
                    address.tiene_ceja     = info.tiene_ceja;
                    address.tiene_diametro = info.tiene_diametro;
                    address.densidad       = info.densidad;
                    address.formula        = info.formula;
                    address.estado         = info.estado;


                    context.in_Categoria_x_Formula.Add(address);
                    context.SaveChanges();
                    msg = "Se ha procedido a grabar el registro de la Categoria, sus dimensiones y formula: "
                          //+ info.tp_descripcion
                          + " exitosamente.";
                }
                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.ToString() + " " + ex.Message;
                msg     = "Se ha producido el siguiente error: " + ex.Message;
                throw new Exception(mensaje);
            }
        }