Beispiel #1
0
        public List <com_Registro_OrdenCompra_x_Cotizacion> Get_List_Registro_OC_x_Cotizacion()
        {
            try
            {
                List <com_Registro_OrdenCompra_x_Cotizacion> lM = new List <com_Registro_OrdenCompra_x_Cotizacion>();
                EntitiesCompras_Edehsa OEUser = new EntitiesCompras_Edehsa();
                //Core.Erp.Data.Inventario_Edehsa.
                var select_ = from TI in OEUser.com_Registro_OrdenCompra_x_Cotizacion
                              select TI;


                foreach (var item in select_)
                {
                    com_Registro_OrdenCompra_x_Cotizacion dat_ = new com_Registro_OrdenCompra_x_Cotizacion();

                    dat_.IdEmpresa     = item.IdEmpresa;
                    dat_.IdSucursal    = item.IdSucursal;
                    dat_.IdOrdenCompra = item.IdOrdenCompra;
                    dat_.IdCotizacion  = item.IdCotizacion;
                    dat_.estado        = item.estado;

                    lM.Add(dat_);
                }
                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());
            }
        }
Beispiel #2
0
        public Boolean AnularDB(com_ListadoDiseno_Info Info, ref string msg)
        {
            try
            {
                using (EntitiesCompras_Edehsa context = new EntitiesCompras_Edehsa())
                {
                    var address = context.com_ListadoDiseno.First
                                      (A => A.IdEmpresa == Info.IdEmpresa &&
                                      A.IdListadoDiseno == Info.IdListadoDiseno
                                      );

                    address.Estado         = "I";
                    address.Usuario        = Info.Usuario;
                    address.lm_Observacion = Info.lm_Observacion;
                    //contact = address;
                    context.SaveChanges();
                }
                msg = "Guardado con exito";
                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;

                msg = "Error no se guardó " + ex.Message + " ";
                throw new Exception(ex.ToString());
            }
        }
Beispiel #3
0
        public com_Registro_OrdenCompra_x_Cotizacion Get_Info_Registro_OC_x_Cotizacion(int IdEmpresa, int IdSucursal, int IdOrdenCompra, int IdCotizacion)
        {
            try
            {
                com_Registro_OrdenCompra_x_Cotizacion reg_oc_x_cot = new com_Registro_OrdenCompra_x_Cotizacion();
                EntitiesCompras_Edehsa OEt = new EntitiesCompras_Edehsa();
                var registr_oc_x_cot       = OEt.com_Registro_OrdenCompra_x_Cotizacion.First(var =>
                                                                                             var.IdEmpresa == IdEmpresa &&
                                                                                             var.IdSucursal == IdSucursal &&
                                                                                             var.IdOrdenCompra == IdOrdenCompra &&
                                                                                             var.IdCotizacion == IdCotizacion);

                reg_oc_x_cot.IdEmpresa     = registr_oc_x_cot.IdEmpresa;
                reg_oc_x_cot.IdSucursal    = registr_oc_x_cot.IdSucursal;
                reg_oc_x_cot.IdOrdenCompra = registr_oc_x_cot.IdOrdenCompra;
                reg_oc_x_cot.IdCotizacion  = registr_oc_x_cot.IdCotizacion;
                reg_oc_x_cot.estado        = registr_oc_x_cot.estado;



                return(reg_oc_x_cot);
            }
            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());
            }
        }
Beispiel #4
0
        public com_Registro_OrdenCompra_x_Cotizacion_Info Get_Info_BuscarRegistro_OC_x_Cotizacion(int IdEmpresa, int IdSucursal, decimal IdOrdenCompra, decimal IdCotizacion)
        {
            try
            {
                com_Registro_OrdenCompra_x_Cotizacion_Info regOCxCot = new com_Registro_OrdenCompra_x_Cotizacion_Info();
                EntitiesCompras_Edehsa OEOCxCot = new EntitiesCompras_Edehsa();
                var selectOCxCot = from C in OEOCxCot.com_Registro_OrdenCompra_x_Cotizacion
                                   where C.IdEmpresa == IdEmpresa &&
                                   C.IdSucursal == IdSucursal &&
                                   C.IdOrdenCompra == IdOrdenCompra &&
                                   C.IdCotizacion == IdCotizacion
                                   select C;

                foreach (var item in selectOCxCot)
                {
                    regOCxCot.IdEmpresa     = item.IdEmpresa;
                    regOCxCot.IdSucursal    = item.IdSucursal;
                    regOCxCot.IdOrdenCompra = item.IdCotizacion;
                    regOCxCot.IdCotizacion  = item.IdCotizacion;
                    regOCxCot.estado        = item.estado;
                }
                return(regOCxCot);
            }
            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());
            }
        }
Beispiel #5
0
        public Boolean GuardarDB(List <com_ListadoMaterialesDisponibles_PreAsignado_a_Obra_Det_Info> LstInfo, string IdEstado)
        {
            try
            {
                int sec = 1;
                foreach (var item in LstInfo)
                {
                    using (EntitiesCompras_Edehsa Context = new EntitiesCompras_Edehsa())
                    {
                        var Address = new com_ListadoMaterialesDisponibles_PreAsignado_a_Obra_Det();

                        Address.IdEmpresa = item.IdEmpresa;


                        Address.IdSucursal          = item.IdSucursal;
                        Address.IdBodega            = item.IdBodega;
                        Address.IdMovi_inven_tipo   = item.IdMovi_inven_tipo;
                        Address.IdNumMovi           = item.IdNumMovi;
                        Address.CodigoBarra         = item.CodigoBarra;
                        Address.CodObra_preasignada = item.CodObra_preasignada;

                        sec++;
                        Address.IdProducto  = item.IdProducto;
                        Address.dm_cantidad = item.dm_cantidad;
                        Address.Det_Kg      = item.Det_Kg;

                        Address.pr_largo       = item.pr_largo;
                        Address.largo_total    = item.largo_total;
                        Address.largo_restante = item.largo_restante;

                        Address.largo_pieza_entera                  = item.largo_pieza_entera;
                        Address.cantidad_pieza_entera               = item.cantidad_pieza_entera;
                        Address.largo_pieza_complementaria          = item.largo_pieza_complementaria;
                        Address.cantidad_pieza_complementaria       = item.cantidad_pieza_complementaria;
                        Address.cantidad_total_pieza_complementaria = item.cantidad_total_pieza_complementaria;
                        Address.largo_despunte1     = item.largo_despunte1;
                        Address.cantidad_despunte1  = item.cantidad_despunte1;
                        Address.es_despunte_usable1 = item.es_despunte_usable1;
                        Address.largo_despunte2     = item.largo_despunte2;
                        Address.cantidad_despunte2  = item.cantidad_despunte2;
                        Address.es_despunte_usable2 = item.es_despunte_usable2;

                        Address.IdEstadoAprob = IdEstado;
                        Context.com_ListadoMaterialesDisponibles_PreAsignado_a_Obra_Det.Add(Address);
                        Context.SaveChanges();
                    }
                }
                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();
                throw new Exception(ex.ToString());
            }
        }
Beispiel #6
0
        public Boolean ActualizarEstadoAprob(com_ListadoElementos_x_OT_Det_Info Info, ref string msg)
        {
            try
            {
                using (EntitiesCompras_Edehsa context = new EntitiesCompras_Edehsa())
                {
                    var contact = context.com_ListadoElementos_x_OT_Det.FirstOrDefault(obj => obj.IdEmpresa == Info.IdEmpresa &&
                                                                                       obj.IdListadoElementos_x_OT == Info.IdListadoElementos_x_OT && obj.IdDetalle == Info.IdDetalle);

                    if (contact != null)
                    {
                        contact.IdEstadoAprob = Info.lm_IdEstadoAprobado;

                        context.SaveChanges();
                        msg = "Se ha procedido actualizar elListado de Elementos #: " + Info.IdListadoElementos_x_OT.ToString() + " 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.InnerException + " " + ex.Message;
                msg     = "Se ha producido el siguiente error: " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }
Beispiel #7
0
        public Boolean EliminarDB(List <com_ListadoDiseno_Det_Info> LstInfo, ref string msg)
        {
            try
            {
                using (EntitiesCompras_Edehsa context = new EntitiesCompras_Edehsa())
                {
                    foreach (var item in LstInfo)
                    {
                        var address = context.com_ListadoDiseno_Det.FirstOrDefault
                                          (A => A.IdEmpresa == item.IdEmpresa &&
                                          A.IdOrdenTaller == item.IdOrdenTaller && A.IdListadoDiseno == item.IdListadoDiseno);

                        if (address != null)
                        {
                            context.com_ListadoDiseno_Det.Remove(address);
                            context.SaveChanges();
                        }
                    }
                }
                msg = "Guardado con exito";
                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;

                msg = "Error no se guardó " + ex.Message + " ";
                throw new Exception(ex.ToString());
            }
        }
Beispiel #8
0
        public List <com_ListadoDisenoTipo_Info> ObtenerListaDisenoTipo(int IdEmpresa)
        {
            List <com_ListadoDisenoTipo_Info> Lst = new List <com_ListadoDisenoTipo_Info>();

            try
            {
                using (EntitiesCompras_Edehsa tipo = new EntitiesCompras_Edehsa())
                {
                    var Consulta = from q in tipo.com_ListadoDisenoTipo
                                   where q.IdEmpresa == IdEmpresa
                                   select q;
                    foreach (var item in Consulta)
                    {
                        com_ListadoDisenoTipo_Info info = new com_ListadoDisenoTipo_Info();
                        info.IdEmpresa           = item.IdEmpresa;
                        info.IdTipoListadoDiseno = item.IdTipoListadoDiseno;
                        info.TipoListadoDiseno   = item.TipoListadoDiseno;
                        info.Estado = item.Estado;

                        Lst.Add(info);
                    }
                }
                return(Lst);
            }
            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());
            }
        }
Beispiel #9
0
        public Boolean GuardarDB(List <com_ListadoElementos_x_OT_Det_Info> LstInfo, string IdEstado)
        {
            try
            {
                int sec = 1;
                foreach (var item in LstInfo)
                {
                    using (EntitiesCompras_Edehsa Context = new EntitiesCompras_Edehsa())
                    {
                        var Address = new com_ListadoElementos_x_OT_Det();

                        Address.IdEmpresa = item.IdEmpresa;

                        Address.IdOrdenTaller           = item.IdOrdenTaller;
                        Address.IdListadoElementos_x_OT = item.IdListadoElementos_x_OT;
                        Address.CodObra   = item.CodObra;
                        Address.IdDetalle = sec;
                        sec++;
                        Address.IdProducto = item.IdProducto;
                        Address.Unidades   = item.Unidades;
                        Address.Det_Kg     = item.Det_Kg;

                        Address.pr_largo       = item.pr_largo;
                        Address.largo_total    = item.largo_total;
                        Address.largo_restante = item.largo_restante;

                        Address.largo_pieza_entera                  = item.largo_pieza_entera;
                        Address.cantidad_pieza_entera               = item.cantidad_pieza_entera;
                        Address.largo_pieza_complementaria          = item.largo_pieza_complementaria;
                        Address.cantidad_pieza_complementaria       = item.cantidad_pieza_complementaria;
                        Address.cantidad_total_pieza_complementaria = item.cantidad_total_pieza_complementaria;
                        Address.largo_despunte1     = item.largo_despunte1;
                        Address.cantidad_despunte1  = item.cantidad_despunte1;
                        Address.es_despunte_usable1 = item.es_despunte_usable1;
                        Address.largo_despunte2     = item.largo_despunte2;
                        Address.cantidad_despunte2  = item.cantidad_despunte2;
                        Address.es_despunte_usable2 = item.es_despunte_usable2;

                        Address.IdEstadoAprob = IdEstado;
                        Context.com_ListadoElementos_x_OT_Det.Add(Address);
                        Context.SaveChanges();
                    }
                }
                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();
                throw new Exception(ex.ToString());
            }
        }
Beispiel #10
0
        public List <com_ListadoElementos_x_OT_Det_Info> Get_List_ListadoElementos_x_OT_Det(int IdEmpresa, decimal idLstMater)
        {
            List <com_ListadoElementos_x_OT_Det_Info> Lst = new List <com_ListadoElementos_x_OT_Det_Info>();
            EntitiesCompras_Edehsa oEnti = new EntitiesCompras_Edehsa();

            try
            {
                var Query = from q in oEnti.vwcom_ListadoElementos_x_OT_Detalle
                            where q.IdEmpresa == IdEmpresa && q.IdListadoElementos_x_OT == idLstMater
                            select q;
                foreach (var item in Query)
                {
                    com_ListadoElementos_x_OT_Det_Info Obj = new com_ListadoElementos_x_OT_Det_Info();
                    Obj.IdEmpresa = item.IdEmpresa;

                    Obj.IdOrdenTaller           = item.IdOrdenTaller;
                    Obj.IdListadoElementos_x_OT = item.IdListadoElementos_x_OT;
                    Obj.IdDetalle           = item.IdDetalle;
                    Obj.IdProducto          = item.IdProducto;
                    Obj.pr_largo            = item.pr_largo;
                    Obj.largo_total         = item.largo_total;
                    Obj.Unidades            = item.Unidades;
                    Obj.Det_Kg              = item.Det_Kg;
                    Obj.CodObra             = item.CodObra;
                    Obj.pr_codigo           = item.pr_codigo;
                    Obj.pr_descripcion      = item.pr_descripcion;
                    Obj.lm_IdEstadoAprobado = item.IdEstadoAprob;

                    Obj.largo_pieza_entera                  = item.largo_pieza_entera;
                    Obj.cantidad_pieza_entera               = item.cantidad_pieza_entera;
                    Obj.largo_pieza_complementaria          = item.largo_pieza_complementaria;
                    Obj.cantidad_pieza_complementaria       = item.cantidad_pieza_complementaria;
                    Obj.cantidad_total_pieza_complementaria = item.cantidad_total_pieza_complementaria;
                    Obj.largo_despunte1     = item.largo_despunte1;
                    Obj.cantidad_despunte1  = item.cantidad_despunte1;
                    Obj.es_despunte_usable1 = item.es_despunte_usable1;
                    Obj.largo_despunte2     = item.largo_despunte2;
                    Obj.cantidad_despunte2  = item.cantidad_despunte2;
                    Obj.es_despunte_usable2 = item.es_despunte_usable2;


                    Lst.Add(Obj);
                }
                return(Lst);
            }
            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());
            }
        }
Beispiel #11
0
        public Boolean GrabarDB(com_ListadoDiseno_Info info, ref int id, ref string msg)
        {
            try
            {
                using (EntitiesCompras_Edehsa context = new EntitiesCompras_Edehsa())
                {
                    var address = new com_ListadoDiseno();
                    int idEmp   = GetId(info.IdEmpresa, ref mensaje);
                    id = idEmp;

                    address.IdListadoDiseno = id;
                    address.IdEmpresa       = info.IdEmpresa;
                    address.ot_IdSucursal   = info.IdSucursal;
                    address.CodObra         = info.CodObra;
                    //address.IdOrdenTaller = (decimal)info.IdOrdenTaller;
                    address.FechaReg       = info.FechaReg;
                    address.Estado         = info.Estado;
                    address.Usuario        = info.Usuario;
                    address.Motivo         = info.Motivo.Trim();
                    address.tipo_listado   = info.tipo_listado;
                    address.lm_Observacion = info.lm_Observacion;

                    context.com_ListadoDiseno.Add(address);
                    context.SaveChanges();
                    msg = "Se ha procedido a grabar el Listado de Diseno #: " + id.ToString() + " 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.InnerException + " " + ex.Message;

            //    msg = "Se ha producido el siguiente error: " + ex.Message;
            //    throw new Exception(ex.ToString());
            //}
            catch (DbEntityValidationException dbEx)
            {
                foreach (var validationErrors in dbEx.EntityValidationErrors)
                {
                    foreach (var validationError in validationErrors.ValidationErrors)
                    {
                        Trace.TraceInformation("Property: {0} Error: {1}",
                                               validationError.PropertyName,
                                               validationError.ErrorMessage);
                    }
                }
                throw new Exception(dbEx.ToString());
            }
        }
Beispiel #12
0
        public List <com_ListadoDiseno_Info> Get_List_ListadoDiseno(int idempresa)
        {
            List <com_ListadoDiseno_Info> Lst   = new List <com_ListadoDiseno_Info>();
            EntitiesCompras_Edehsa        oEnti = new EntitiesCompras_Edehsa();

            try
            {
                var Query = from q in oEnti.vwcom_ListadoDiseno
                            where q.IdEmpresa == idempresa
                            select q;


                //var selectCbtecble = from C in Oentities.in_Producto
                //                     join t in Oentities.in_ProductoTipo
                //                     on new { C.IdEmpresa, C.IdProductoTipo } equals new { t.IdEmpresa, t.IdProductoTipo }
                //                     where C.IdEmpresa == IdEmpresa
                //                     && t.EsProductoTerminado == "S"
                //                     select C;


                foreach (var item in Query)
                {
                    com_ListadoDiseno_Info Obj = new com_ListadoDiseno_Info();
                    Obj.IdEmpresa       = item.IdEmpresa;
                    Obj.IdListadoDiseno = item.IdListadoDiseno;
                    Obj.IdSucursal      = item.IdSucursal;

                    Obj.FechaReg       = item.FechaReg;
                    Obj.Estado         = item.Estado;
                    Obj.ob_descripcion = "[" + item.CodObra + "] " + item.ob_descripcion;

                    Obj.lm_Observacion = item.lm_Observacion;
                    Obj.CodObra        = item.CodObra;
                    Obj.Usuario        = item.Usuario;
                    Obj.Motivo         = item.Motivo;
                    Obj.su_descripcion = item.Su_Descripcion;
                    Obj.tipo_listado   = item.TipoListadoDiseno;

                    Lst.Add(Obj);
                }
                return(Lst);
            }
            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.ToString());
            }
        }
Beispiel #13
0
        public com_ListadoMaterialesDisponibles_Det_Info Get_List_ListadoMaterialesDisponibles_Det(int IdEmpresa, decimal IdListadoMat, int IdDetalle)
        {
            com_ListadoMaterialesDisponibles_Det_Info Obj = new com_ListadoMaterialesDisponibles_Det_Info();
            EntitiesCompras_Edehsa oEnti = new EntitiesCompras_Edehsa();

            try
            {
                var Query = from q in oEnti.vwcom_ListadoMaterialesDisponibles_Detalle
                            where q.IdEmpresa == IdEmpresa &&
                            q.IdListadoMaterialesDisponibles == IdListadoMat &&
                            q.IdDetalle == IdDetalle
                            select q;
                foreach (var item in Query)
                {
                    Obj.IdEmpresa = item.IdEmpresa;
                    Obj.IdListadoMaterialesDisponibles = item.IdListadoMaterialesDisponibles;
                    Obj.IdDetalle = item.IdDetalle;
                    Obj.CodObra   = item.CodObra;

                    Obj.IdProducto          = item.IdProducto;
                    Obj.Unidades            = item.Unidades;
                    Obj.Det_Kg              = item.Det_Kg;
                    Obj.lm_IdEstadoAprobado = item.IdEstadoAprob;
                    Obj.pr_descripcion      = item.pr_descripcion;
                    Obj.pr_codigo           = item.pr_codigo;
                    Obj.producto            = "[" + item.IdProducto + "] [" + item.pr_codigo + "] " + item.pr_descripcion;

                    Obj.largo_pieza_entera                  = item.largo_pieza_entera;
                    Obj.cantidad_pieza_entera               = item.cantidad_pieza_entera;
                    Obj.largo_pieza_complementaria          = item.largo_pieza_complementaria;
                    Obj.cantidad_pieza_complementaria       = item.cantidad_pieza_complementaria;
                    Obj.cantidad_total_pieza_complementaria = item.cantidad_total_pieza_complementaria;
                    Obj.largo_despunte1     = item.largo_despunte1;
                    Obj.cantidad_despunte1  = item.cantidad_despunte1;
                    Obj.es_despunte_usable1 = item.es_despunte_usable1;
                    Obj.largo_despunte2     = item.largo_despunte2;
                    Obj.cantidad_despunte2  = item.cantidad_despunte2;
                    Obj.es_despunte_usable2 = item.es_despunte_usable2;
                }
                return(Obj);
            }
            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.ToString());
            }
        }
Beispiel #14
0
        public List <com_ListadoMaterialesDisponibles_PreAsignado_a_Obra_Det_Info> TraerTodoMP_Preasignado_a_Obra(int IdEmpresa)
        {
            List <com_ListadoMaterialesDisponibles_PreAsignado_a_Obra_Det_Info> Lst = new List <com_ListadoMaterialesDisponibles_PreAsignado_a_Obra_Det_Info>();
            EntitiesCompras_Edehsa oEnti = new EntitiesCompras_Edehsa();

            try
            {
                var Query = from q in oEnti.vwcom_AllListDetMateriales_PreAsignado_a_Obra
                            where q.IdEmpresa == IdEmpresa
                            select q;
                foreach (var item in Query)
                {
                    com_ListadoMaterialesDisponibles_PreAsignado_a_Obra_Det_Info Obj = new com_ListadoMaterialesDisponibles_PreAsignado_a_Obra_Det_Info();
                    Obj.IdEmpresa = item.IdEmpresa;


                    Obj.IdSucursal        = item.IdSucursal;
                    Obj.IdBodega          = item.IdBodega;
                    Obj.IdMovi_inven_tipo = item.IdMovi_inven_tipo;
                    Obj.IdNumMovi         = item.IdNumMovi;
                    Obj.Secuencia         = item.Secuencia;
                    Obj.mv_Secuencia      = item.mv_Secuencia;

                    Obj.CodObra_preasignada = item.CodObra_preasignada;
                    Obj.Obra                = item.Obra;
                    Obj.IdProducto          = item.IdProducto;
                    Obj.CodigoBarra         = item.CodigoBarra;
                    Obj.dm_cantidad         = Convert.ToDouble(item.dm_cantidad);
                    Obj.CodObra_preasignada = item.CodObra_preasignada;
                    Obj.pr_codigo           = item.pr_codigo;
                    Obj.pr_descripcion      = item.pr_descripcion;


                    Lst.Add(Obj);
                }
                return(Lst);
            }
            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());
            }
        }
Beispiel #15
0
        public List <com_ListadoDiseno_Info> Get_List_ListadoDisenoCMB(int idempresa, int IdSucursal, string CodObra)
        {
            List <com_ListadoDiseno_Info> Lst   = new List <com_ListadoDiseno_Info>();
            EntitiesCompras_Edehsa        oEnti = new EntitiesCompras_Edehsa();

            try
            {
                var Query = from q in oEnti.vwcom_ListadoDiseno
                            where q.IdEmpresa == idempresa && q.IdSucursal == IdSucursal && q.CodObra == CodObra
                            select q;

                foreach (var item in Query)
                {
                    com_ListadoDiseno_Info Obj = new com_ListadoDiseno_Info();

                    //Obj.IdEmpresa = item.IdEmpresa;
                    Obj.CodObra         = item.CodObra;
                    Obj.IdListadoDiseno = item.IdListadoDiseno;
                    // Obj.IdSucursal = item.IdSucursal;

                    //Obj.Estado = item.Estado;
                    //Obj.ob_descripcion = "[" + item.CodObra + "] " + item.ob_descripcion;

                    //Obj.lm_Observacion = item.lm_Observacion;

                    //Obj.Usuario = item.Usuario;
                    //Obj.Motivo = item.Motivo;
                    // Obj.su_descripcion = item.Su_Descripcion;
                    Obj.TipoListadoDiseno    = item.TipoListadoDiseno;
                    Obj.DetalleListadoDiseno = "[" + item.IdListadoDiseno + "] " + item.lm_Observacion + " " + item.TipoListadoDiseno;
                    Obj.lm_Observacion       = item.lm_Observacion;
                    Lst.Add(Obj);
                }
                return(Lst);
            }
            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.ToString());
            }
        }
Beispiel #16
0
        public com_ListadoDiseno_Info Get_Info_ListadoDiseno(int idempresa, decimal idLstMater)
        {
            com_ListadoDiseno_Info info  = new com_ListadoDiseno_Info();
            EntitiesCompras_Edehsa oEnti = new EntitiesCompras_Edehsa();

            try
            {
                var select = from A in oEnti.vwcom_ListadoDiseno
                             where A.IdEmpresa == idempresa &&
                             A.IdListadoDiseno == idLstMater

                             select A;

                foreach (var item in select)
                {
                    info.IdEmpresa  = item.IdEmpresa;
                    info.IdSucursal = item.IdSucursal;

                    info.IdListadoDiseno = item.IdListadoDiseno;
                    info.FechaReg        = item.FechaReg;
                    info.Estado          = item.Estado;
                    info.ob_descripcion  = item.ob_descripcion;

                    info.lm_Observacion = item.lm_Observacion;
                    info.su_descripcion = item.Su_Descripcion;
                    info.CodObra        = item.CodObra;
                    info.Motivo         = item.Motivo;
                    info.Usuario        = item.Usuario;

                    info.DetalleListadoDiseno = "[" + item.IdListadoDiseno + "] - " + item.TipoListadoDiseno.Trim();
                }
                return(info);
            }
            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.ToString());
            }
        }
        public List <com_ListadoMaterialesDisponibles_PreAsignado_a_Obra_Info> Get_List_ListadoMaterialesDisponibles_PreAsignado_a_Obra(int idempresa)
        {
            List <com_ListadoMaterialesDisponibles_PreAsignado_a_Obra_Info> Lst = new List <com_ListadoMaterialesDisponibles_PreAsignado_a_Obra_Info>();
            EntitiesCompras_Edehsa oEnti = new EntitiesCompras_Edehsa();

            try
            {
                var Query = from q in oEnti.vwcom_ListadoMaterialesDisponibles_PreAsignado_a_Obra
                            where q.IdEmpresa == idempresa
                            select q;
                foreach (var item in Query)
                {
                    com_ListadoMaterialesDisponibles_PreAsignado_a_Obra_Info Obj = new com_ListadoMaterialesDisponibles_PreAsignado_a_Obra_Info();
                    Obj.IdEmpresa         = item.IdEmpresa;
                    Obj.IdSucursal        = item.IdSucursal;
                    Obj.IdBodega          = item.IdBodega;
                    Obj.IdMovi_inven_tipo = item.IdMovi_inven_tipo;
                    Obj.IdNumMovi         = item.IdNumMovi;

                    Obj.FechaReg       = item.FechaReg;
                    Obj.Estado         = item.Estado;
                    Obj.ob_descripcion = "[" + item.CodObra_preasignada + "] " + item.ob_descripcion;

                    Obj.lm_Observacion      = item.lm_Observacion;
                    Obj.CodObra_preasignada = item.CodObra_preasignada;
                    Obj.Usuario             = item.Usuario;
                    Obj.Motivo         = item.Motivo;
                    Obj.su_descripcion = item.Su_Descripcion;

                    Lst.Add(Obj);
                }
                return(Lst);
            }
            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.ToString());
            }
        }
Beispiel #18
0
        public Boolean GrabarDB(List <com_Registro_OrdenCompra_x_Cotizacion_Info> lista, ref string mensaje)
        {
            try
            {
                int sec = 0;
                foreach (var item in lista)
                {
                    using (EntitiesCompras_Edehsa context = new EntitiesCompras_Edehsa())
                    {
                        var address = new com_Registro_OrdenCompra_x_Cotizacion();
                        //int idpv = GetSecuencia(info.IdEmpresa,);
                        // id = idpv;
                        address.IdEmpresa = item.IdEmpresa;
                        //address.Secuencia = GetSecuencia(info.IdEmpresa,1);

                        address.IdSucursal    = item.IdSucursal;
                        address.IdOrdenCompra = item.IdOrdenCompra;
                        address.IdCotizacion  = item.IdCotizacion;
                        address.SecuenciaDetalleCotizacion = item.SecuenciaDetalleCotizacion;
                        address.IdListadoMateriales        = item.IdListadoMateriales;

                        address.estado = item.estado;

                        context.com_Registro_OrdenCompra_x_Cotizacion.Add(address);
                        context.SaveChanges();
                    }
                }
                mensaje = "Se ha procedido a grabar el registro de Ordenes de Compra por Cotizacion"
                          //+ 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;
                mensaje = "Se ha producido el siguiente error: " + ex.Message;
                throw new Exception(mensaje);
            }
        }
        public List <com_ListadoElementos_x_OT_Info> Get_List_ListadoElementos_x_OT(int idempresa)
        {
            List <com_ListadoElementos_x_OT_Info> Lst = new List <com_ListadoElementos_x_OT_Info>();
            EntitiesCompras_Edehsa oEnti = new EntitiesCompras_Edehsa();

            try
            {
                var Query = from q in oEnti.vwcom_ListadoElementos_x_OT
                            where q.IdEmpresa == idempresa
                            select q;
                foreach (var item in Query)
                {
                    com_ListadoElementos_x_OT_Info Obj = new com_ListadoElementos_x_OT_Info();
                    Obj.IdEmpresa = item.IdEmpresa;
                    Obj.IdListadoElementos_x_OT = item.IdListadoElementos_x_OT;
                    Obj.IdSucursal     = item.IdSucursal;
                    Obj.IdOrdenTaller  = item.IdOrdenTaller;
                    Obj.FechaReg       = item.FechaReg;
                    Obj.Estado         = item.Estado;
                    Obj.ob_descripcion = "[" + item.CodObra + "] " + item.ob_descripcion;
                    Obj.ot_descripcion = item.ot_descripcion;
                    Obj.lm_Observacion = item.lm_Observacion;
                    Obj.CodObra        = item.CodObra;
                    Obj.Usuario        = item.Usuario;
                    Obj.Motivo         = item.Motivo;
                    Obj.su_descripcion = item.Su_Descripcion;

                    Lst.Add(Obj);
                }
                return(Lst);
            }
            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.ToString());
            }
        }
Beispiel #20
0
        public List <com_ListadoDiseno_Det_Info> Get_List_ListadoDiseno_Det(int IdEmpresa, decimal idLstMater)
        {
            List <com_ListadoDiseno_Det_Info> Lst   = new List <com_ListadoDiseno_Det_Info>();
            EntitiesCompras_Edehsa            oEnti = new EntitiesCompras_Edehsa();

            try
            {
                var Query = from q in oEnti.vwcom_ListadoDiseno_Detalle
                            where q.IdEmpresa == IdEmpresa && q.IdListadoDiseno == idLstMater
                            select q;
                foreach (var item in Query)
                {
                    com_ListadoDiseno_Det_Info Obj = new com_ListadoDiseno_Det_Info();
                    Obj.IdEmpresa = item.IdEmpresa;


                    Obj.IdListadoDiseno     = item.IdListadoDiseno;
                    Obj.IdDetalle           = item.IdDetalle;
                    Obj.IdProducto          = item.IdProducto;
                    Obj.Unidades            = item.Unidades;
                    Obj.Det_Kg              = item.Det_Kg;
                    Obj.CodObra             = item.CodObra;
                    Obj.pr_codigo           = item.pr_codigo;
                    Obj.pr_descripcion      = item.pr_descripcion;
                    Obj.lm_IdEstadoAprobado = item.IdEstadoAprob;


                    Lst.Add(Obj);
                }
                return(Lst);
            }
            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());
            }
        }
        public decimal GetIdMovi_Inven(int IdEmpresa, int IdSucursal, int IdBodega, int IdMovi_inven_tipo)
        {
            try
            {
                decimal IdMovi_inven_tipo1;

                EntitiesCompras_Edehsa OECbtecble = new EntitiesCompras_Edehsa();
                var q = from A in OECbtecble.com_ListadoMaterialesDisponibles_PreAsignado_a_Obra
                        where A.IdEmpresa == IdEmpresa &&
                        A.IdBodega == IdBodega &&
                        A.IdMovi_inven_tipo == IdMovi_inven_tipo &&
                        A.IdSucursal == IdSucursal
                        select A;

                if (q.ToList().Count < 1)
                {
                    IdMovi_inven_tipo1 = 1;
                }
                else
                {
                    OECbtecble = new EntitiesCompras_Edehsa();
                    var selectCbtecble = (from CbtCble in OECbtecble.com_ListadoMaterialesDisponibles_PreAsignado_a_Obra
                                          where CbtCble.IdEmpresa == IdEmpresa &&
                                          CbtCble.IdBodega == IdBodega &&
                                          CbtCble.IdMovi_inven_tipo == IdMovi_inven_tipo &&
                                          CbtCble.IdSucursal == IdSucursal
                                          select CbtCble.IdNumMovi).Max();
                    IdMovi_inven_tipo1 = Convert.ToDecimal(selectCbtecble.ToString()) + 1;
                }
                return(IdMovi_inven_tipo1);
            }
            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());
            }
        }
        //public Boolean AnularDB(in_movi_inve_Info MoviInfo, ref  string mensaje)
        //{
        //    try
        //    {
        //        using (EntitiesInventario context = new EntitiesInventario())
        //        {
        //            var contact = context.in_movi_inve.FirstOrDefault(prod1 => prod1.IdEmpresa == MoviInfo.IdEmpresa && prod1.IdSucursal == MoviInfo.IdSucursal && prod1.IdBodega == MoviInfo.IdBodega && prod1.IdMovi_inven_tipo == MoviInfo.IdMovi_inven_tipo && prod1.IdNumMovi == MoviInfo.IdNumMovi);
        //            //no elimino el registro solo cambia el estado de activo a inactivo
        //            if (contact != null)
        //            {
        //                contact.Estado = "I"; //cambio el estado de activo por inactivo
        //                contact.cm_observacion = " ***ANULADO***" + contact.cm_observacion;
        //                contact.IdusuarioUltAnu = MoviInfo.IdusuarioUltAnu;
        //                contact.Fecha_UltAnu = DateTime.Now;
        //                contact.Fecha_UltMod = DateTime.Now;
        //                contact.IdUsuarioUltModi = MoviInfo.IdUsuarioUltModi;
        //                contact.MotivoAnulacion = MoviInfo.MotivoAnulacion;
        //                contact.IdEmpresa_x_Anu = MoviInfo.IdEmpresa_x_Anu;
        //                contact.IdSucursal_x_Anu = MoviInfo.IdSucursal_x_Anu;
        //                contact.IdBodega_x_Anu = MoviInfo.IdBodega_x_Anu;
        //                contact.IdMovi_inven_tipo_x_Anu = MoviInfo.IdMovi_inven_tipo_x_Anu;
        //                contact.IdNumMovi_x_Anu = MoviInfo.IdNumMovi_x_Anu;
        //                contact.MotivoAnulacion = MoviInfo.MotivoAnulacion;
        //                context.SaveChanges();
        //                mensaje = "Anulacion Exitosa..";
        //            }
        //        }
        //        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;
        //        mensaje = "Error al Anular:  " + ex.Message;
        //        throw new Exception(ex.ToString());
        //    }
        //}

        public Boolean GrabarDB(com_ListadoMaterialesDisponibles_PreAsignado_a_Obra_Info info, ref decimal id, ref string msg)
        {
            try
            {
                using (EntitiesCompras_Edehsa context = new EntitiesCompras_Edehsa())
                {
                    var     address = new com_ListadoMaterialesDisponibles_PreAsignado_a_Obra();
                    decimal idEmp   = GetIdMovi_Inven(info.IdEmpresa, info.IdSucursal, info.IdBodega, info.IdMovi_inven_tipo);
                    id = idEmp;

                    address.IdNumMovi = id;
                    address.IdEmpresa = info.IdEmpresa;

                    address.CodObra_preasignada = info.CodObra_preasignada;

                    address.FechaReg       = info.FechaReg;
                    address.Estado         = info.Estado;
                    address.Usuario        = info.Usuario;
                    address.Motivo         = info.Motivo.Trim();
                    address.lm_Observacion = info.lm_Observacion;

                    context.com_ListadoMaterialesDisponibles_PreAsignado_a_Obra.Add(address);
                    context.SaveChanges();
                    msg = "Se ha procedido a grabar el Listado de Materiales #: " + id.ToString() + " 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.InnerException + " " + ex.Message;

                msg = "Se ha producido el siguiente error: " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }
        public Boolean GrabarDB(com_ListadoElementos_x_OT_Info info, ref int id, ref string msg)
        {
            try
            {
                using (EntitiesCompras_Edehsa context = new EntitiesCompras_Edehsa())
                {
                    var address = new com_ListadoElementos_x_OT();
                    int idEmp   = GetId(info.IdEmpresa, ref mensaje);
                    id = idEmp;

                    address.IdListadoElementos_x_OT = id;
                    address.IdEmpresa      = info.IdEmpresa;
                    address.ot_IdSucursal  = info.IdSucursal;
                    address.CodObra        = info.CodObra;
                    address.IdOrdenTaller  = (decimal)info.IdOrdenTaller;
                    address.FechaReg       = info.FechaReg;
                    address.Estado         = info.Estado;
                    address.Usuario        = info.Usuario;
                    address.Motivo         = info.Motivo.Trim();
                    address.lm_Observacion = info.lm_Observacion;

                    context.com_ListadoElementos_x_OT.Add(address);
                    context.SaveChanges();
                    msg = "Se ha procedido a grabar el Listado de Elementos por OT #: " + id.ToString() + " 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.InnerException + " " + ex.Message;

                msg = "Se ha producido el siguiente error: " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }
Beispiel #24
0
        public Boolean GuardarDB(List <com_ListadoDiseno_Det_Info> LstInfo, string IdEstado)
        {
            try
            {
                int sec = 1;
                foreach (var item in LstInfo)
                {
                    using (EntitiesCompras_Edehsa Context = new EntitiesCompras_Edehsa())
                    {
                        var Address = new com_ListadoDiseno_Det();

                        Address.IdEmpresa = item.IdEmpresa;

                        Address.IdOrdenTaller   = item.IdOrdenTaller;
                        Address.IdListadoDiseno = item.IdListadoDiseno;
                        Address.CodObra         = item.CodObra;
                        Address.IdDetalle       = sec;
                        sec++;
                        Address.IdProducto    = item.IdProducto;
                        Address.Unidades      = item.Unidades;
                        Address.Det_Kg        = item.Det_Kg;
                        Address.IdEstadoAprob = IdEstado;
                        Context.com_ListadoDiseno_Det.Add(Address);
                        Context.SaveChanges();
                    }
                }
                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();
                throw new Exception(ex.ToString());
            }
        }
        public Boolean ModificarDB(com_ListadoMaterialesDisponibles_PreAsignado_a_Obra_Info info, ref string msg)
        {
            try
            {
                using (EntitiesCompras_Edehsa context = new EntitiesCompras_Edehsa())
                {
                    var contact = context.com_ListadoMaterialesDisponibles_PreAsignado_a_Obra.FirstOrDefault(obj => obj.IdEmpresa == info.IdEmpresa &&
                                                                                                             obj.IdSucursal == info.IdSucursal && obj.IdBodega == info.IdBodega && obj.IdMovi_inven_tipo == info.IdMovi_inven_tipo &&
                                                                                                             obj.IdNumMovi == info.IdNumMovi);


                    if (contact != null)
                    {
                        contact.FechaReg       = info.FechaReg;
                        contact.Motivo         = info.Motivo;
                        contact.Usuario        = info.Usuario;
                        contact.lm_Observacion = info.lm_Observacion;
                        contact.Estado         = info.Estado;

                        context.SaveChanges();
                        msg = "Se ha procedido actualizar el Listado de Materiales #: " + info.IdNumMovi.ToString() + " 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.InnerException + " " + ex.Message;

                msg = "Se ha producido el siguiente error: " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }
Beispiel #26
0
        public List <com_Registro_OrdenCompra_x_Cotizacion_Info> Get_List_Reg_OC_x_Cotizacion(int idEmpresa, int idSucursal, int idOrdenCompra, int idCotizacion)
        {
            try
            {
                List <com_Registro_OrdenCompra_x_Cotizacion_Info> lM = new List <com_Registro_OrdenCompra_x_Cotizacion_Info>();
                EntitiesCompras_Edehsa OEselectReg_OCxCot_Info       = new EntitiesCompras_Edehsa();
                var selectReg_OCxCot = from C in OEselectReg_OCxCot_Info.com_Registro_OrdenCompra_x_Cotizacion
                                       where C.IdEmpresa == idEmpresa &&
                                       C.IdSucursal == idSucursal &&
                                       C.IdOrdenCompra == idOrdenCompra &&
                                       C.IdCotizacion == idCotizacion
                                       select C;

                foreach (var item in selectReg_OCxCot)
                {
                    //in_Categoria_x_Formula_Info
                    com_Registro_OrdenCompra_x_Cotizacion_Info dat_ = new com_Registro_OrdenCompra_x_Cotizacion_Info();

                    dat_.IdEmpresa     = item.IdEmpresa;
                    dat_.IdSucursal    = item.IdSucursal;
                    dat_.IdOrdenCompra = item.IdOrdenCompra;
                    dat_.IdCotizacion  = item.IdCotizacion;
                    dat_.estado        = item.estado;
                    lM.Add(dat_);
                }
                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());
            }
        }
Beispiel #27
0
        public int GetId(int IdEmpresa, ref string mensaje)
        {
            try
            {
                int Id;
                EntitiesCompras_Edehsa OEProd = new EntitiesCompras_Edehsa();
                var select = from q in OEProd.com_ListadoDiseno
                             where q.IdEmpresa == IdEmpresa

                             select q;

                if (select.ToList().Count == 0)
                {
                    Id = 1;
                }
                else
                {
                    var select_pv = (from q in OEProd.com_ListadoDiseno
                                     where q.IdEmpresa == IdEmpresa

                                     select q.IdListadoDiseno).Max();
                    Id = Convert.ToInt32(select_pv.ToString()) + 1;
                }
                return(Id);
            }
            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.ToString());
            }
        }
Beispiel #28
0
        public List <com_ListadoElementos_x_OT_Det_Info> Get_List_ListadoDespunteMateriales_Det(int IdEmpresa, string CodObra)
        {
            List <com_ListadoElementos_x_OT_Det_Info> Lst = new List <com_ListadoElementos_x_OT_Det_Info>();
            EntitiesCompras_Edehsa oEnti = new EntitiesCompras_Edehsa();

            try
            {
                var Query = from q in oEnti.vwcom_AllListDetElementos_x_OT
                            where q.IdEmpresa == IdEmpresa &&
                            q.CodObra == CodObra &&
                            q.largo_despunte1 != null
                            select q;
                foreach (var item in Query)
                {
                    com_ListadoElementos_x_OT_Det_Info Obj = new com_ListadoElementos_x_OT_Det_Info();
                    Obj.IdEmpresa     = item.IdEmpresa;
                    Obj.IdOrdenTaller = item.IdOrdenTaller;

                    Obj.ot_IdSucursal           = item.IdSucursal;
                    Obj.IdListadoElementos_x_OT = item.IdListadoElementos_x_OT;
                    Obj.IdDetalle           = item.IdDetalle;
                    Obj.IdProducto          = item.IdProducto;
                    Obj.Unidades            = item.Unidades;
                    Obj.Det_Kg              = item.Det_Kg;
                    Obj.CodObra             = item.CodObra;
                    Obj.pr_codigo           = item.pr_codigo;
                    Obj.pr_descripcion      = item.pr_descripcion;
                    Obj.lm_IdEstadoAprobado = item.IdEstadoAprob;
                    Obj.ea_codigo           = item.IdEstadoAprob;

                    Obj.FechaRequer    = item.FechaReg;
                    Obj.mr_descripcion = item.mr_descripcion;
                    Obj.Motivo         = item.Motivo;
                    Obj.ob_descripcion = item.ob_descripcion;
                    Obj.ot_codigo      = item.ot_descripcion;
                    Obj.obra           = item.ob_descripcion;
                    Obj.largo_restante = item.largo_restante;
                    Obj.producto       = item.pr_descripcion + "[" + item.pr_codigo + "/" + item.IdProducto + "] ";
                    Obj.solicitante    = item.Usuario;

                    Obj.largo_pieza_entera                  = item.largo_pieza_entera;
                    Obj.cantidad_pieza_entera               = item.cantidad_pieza_entera;
                    Obj.largo_pieza_complementaria          = item.largo_pieza_complementaria;
                    Obj.cantidad_pieza_complementaria       = item.cantidad_pieza_complementaria;
                    Obj.cantidad_total_pieza_complementaria = item.cantidad_total_pieza_complementaria;
                    Obj.largo_despunte1     = item.largo_despunte1;
                    Obj.cantidad_despunte1  = item.cantidad_despunte1;
                    Obj.es_despunte_usable1 = item.es_despunte_usable1;
                    Obj.largo_despunte2     = item.largo_despunte2;
                    Obj.cantidad_despunte2  = item.cantidad_despunte2;
                    Obj.es_despunte_usable2 = item.es_despunte_usable2;


                    Lst.Add(Obj);
                }
                return(Lst);
            }
            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());
            }
        }
Beispiel #29
0
        public List <com_ListadoMaterialesDisponibles_PreAsignado_a_Obra_Det_Info> Get_List_ListadoMaterialesDisponibles_PreAsignado_a_Obra_Det(int IdEmpresa, string CodObra)
        {
            List <com_ListadoMaterialesDisponibles_PreAsignado_a_Obra_Det_Info> Lst = new List <com_ListadoMaterialesDisponibles_PreAsignado_a_Obra_Det_Info>();
            EntitiesCompras_Edehsa oEnti = new EntitiesCompras_Edehsa();

            try
            {
                var Query = from q in oEnti.vwcom_ListadoMaterialesDisponibles_PreAsignado_a_Obra_Detalle
                            where q.IdEmpresa == IdEmpresa && q.CodObra_preasignada == CodObra
                            select q;
                foreach (var item in Query)
                {
                    com_ListadoMaterialesDisponibles_PreAsignado_a_Obra_Det_Info Obj = new com_ListadoMaterialesDisponibles_PreAsignado_a_Obra_Det_Info();
                    Obj.IdEmpresa = item.IdEmpresa;


                    Obj.IdSucursal          = item.IdSucursal;
                    Obj.IdBodega            = item.IdBodega;
                    Obj.IdMovi_inven_tipo   = item.IdMovi_inven_tipo;
                    Obj.IdNumMovi           = item.IdNumMovi;
                    Obj.CodObra_preasignada = item.CodObra_preasignada;
                    Obj.IdProducto          = item.IdProducto;
                    Obj.CodigoBarra         = item.CodigoBarra;
                    Obj.dm_cantidad         = item.dm_cantidad;
                    Obj.Det_Kg = item.Det_Kg;

                    Obj.pr_codigo      = item.pr_codigo;
                    Obj.pr_descripcion = item.pr_descripcion;
                    Obj.IdEstadoAprob  = item.IdEstadoAprob;

                    Obj.espesor  = item.espesor;
                    Obj.longitud = item.longitud;
                    Obj.alto     = item.alto;
                    Obj.ancho    = item.ancho;


                    Obj.largo_pieza_entera                  = item.largo_pieza_entera;
                    Obj.cantidad_pieza_entera               = item.cantidad_pieza_entera;
                    Obj.largo_pieza_complementaria          = item.largo_pieza_complementaria;
                    Obj.cantidad_pieza_complementaria       = item.cantidad_pieza_complementaria;
                    Obj.cantidad_total_pieza_complementaria = item.cantidad_total_pieza_complementaria;
                    Obj.largo_despunte1     = item.largo_despunte1;
                    Obj.cantidad_despunte1  = item.cantidad_despunte1;
                    Obj.es_despunte_usable1 = item.es_despunte_usable1;
                    Obj.largo_despunte2     = item.largo_despunte2;
                    Obj.cantidad_despunte2  = item.cantidad_despunte2;
                    Obj.es_despunte_usable2 = item.es_despunte_usable2;


                    Lst.Add(Obj);
                }
                return(Lst);
            }
            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());
            }
        }