public Boolean EliminarDB(string IdUnidadMedida, ref string mensaje) { try { using (EntitiesInventario Entity = new EntitiesInventario()) { int numeroElimindo = Entity.Database.ExecuteSqlCommand("delete in_UnidadMedida_Equiv_conversion where IdUnidadMedida='" + IdUnidadMedida + "'"); } 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(mensaje); } }
public void EliminarDetalle(in_transferencia_Info info) { try { using (EntitiesInventario Contex = new EntitiesInventario()) { string comando = "DELETE in_transferencia_det WHERE IdEmpresa = " + info.IdEmpresa + " and IdSucursalOrigen = " + info.IdSucursalOrigen + " and IdBodegaOrigen = " + info.IdBodegaOrigen + " and IdTransferencia = " + info.IdTransferencia; Contex.Database.ExecuteSqlCommand(comando); } } 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(mensaje); } }
public List <in_movi_inven_tipo_x_tb_bodega_Info> Get_List_movi_inven_tipo_x_tb_bodega(int IdEmpresa, int IdMoviInvenTipo) { try { EntitiesInventario Oen = new EntitiesInventario(); string Querty = "select * from in_movi_inven_tipo_x_tb_bodega WHERE IdEmpresa =" + IdEmpresa + " and IdMovi_inven_tipo =" + IdMoviInvenTipo; return(Oen.Database.SqlQuery <in_movi_inven_tipo_x_tb_bodega_Info>(Querty).ToList()); } 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(mensaje); } }
public Boolean eliminarRegistro_x_producto(int idEmpresa, int IdProductoPadre, ref string mensaje) { try { using (EntitiesInventario entity = new EntitiesInventario()) { entity.Database.ExecuteSqlCommand("delete in_Producto_Composicion where IdEmpresa = " + idEmpresa + " and IdProductoPadre = " + IdProductoPadre); } 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; throw new Exception(mensaje); } }
public Boolean EliminarDB(int IdEmpresa, decimal IdAjusteFisico) { try { using (EntitiesInventario Entity = new EntitiesInventario()) { int numeroElimindo = Entity.Database.ExecuteSqlCommand("delete in_AjusteFisico_Detalle where IdEmpresa = " + IdEmpresa + " and IdAjusteFisico = " + IdAjusteFisico); } 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; throw new Exception(ex.ToString()); } }
public Boolean ModificarDB(in_movi_inven_tipo_Info MoviI, ref string mensaje) { try { using (EntitiesInventario contex = new EntitiesInventario()) { var contac = contex.in_movi_inven_tipo.FirstOrDefault(VMovi => VMovi.IdEmpresa == MoviI.IdEmpresa && VMovi.IdMovi_inven_tipo == MoviI.IdMovi_inven_tipo); if (contac != null) { contac.tm_descripcion = MoviI.tm_descripcion; contac.cm_descripcionCorta = MoviI.cm_descripcionCorta; contac.Codigo = MoviI.Codigo; contac.cm_tipo_movi = MoviI.cm_tipo_movi; contac.Estado = MoviI.Estado; contac.cm_interno = MoviI.cm_interno; contac.IdTipoCbte = MoviI.IdTipoCbte; contac.IdUsuarioUltMod = MoviI.IdUsuario; contac.Fecha_UltMod = MoviI.Fecha_Transac; contac.Fecha_UltMod = MoviI.Fecha_UltMod; contac.nom_pc = MoviI.nom_pc; contac.ip = MoviI.ip; contac.Genera_Movi_Inven = (MoviI.Genera_Movi_Inven == null) ? false : MoviI.Genera_Movi_Inven; contac.Genera_Diario_Contable = (MoviI.Genera_Diario_Contable == null) ? false : MoviI.Genera_Diario_Contable; contex.SaveChanges(); mensaje = "Grabacion 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 Grabar" + ex.ToString().ToString(); throw new Exception(mensaje); } }
public Boolean GrabarDB(List<in_RecepcionMaterialesDet_Info> lmDetalleInfo, int idempresa, decimal IdRecepcionMaterial, ref string msgd) { try { using (EntitiesInventario context = new EntitiesInventario()) { foreach (var item in lmDetalleInfo) { var address = new in_recepcion_material_det(); address.IdEmpresa = idempresa; address.IdSucursal = item.IdSucursal; address.IdRecepcionMaterial = IdRecepcionMaterial; address.Secuencia = item.Secuencia; address.IdProducto = item.IdProducto; address.do_Cantidad = item.do_Cantidad; address.IdOrdenCompra = item.IdOrdenCompra; address.Secuencia = item.Secuencia; address.re_CantRecibida = item.re_CantRecibida; address.re_Saldo = item.re_Saldo; context.in_recepcion_material_det.Add(address); context.SaveChanges(); } context.Dispose(); } msgd = "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.ToString() + " " + ex.Message; throw new Exception(mensaje); } }
public Boolean GrabarDB(in_UnidadMedida_Equiv_conversion_Info prI, ref string mensaje) { try { using (EntitiesInventario context = new EntitiesInventario()) { EntitiesInventario EDB = new EntitiesInventario(); var Q = from per in EDB.in_UnidadMedida_Equiv_conversion where per.IdUnidadMedida == prI.IdUnidadMedida && per.IdUnidadMedida_equiva == prI.IdUnidadMedida_equiva select per; if (Q.ToList().Count == 0) { var address = new in_UnidadMedida_Equiv_conversion(); address.IdUnidadMedida = prI.IdUnidadMedida; address.IdUnidadMedida_equiva = prI.IdUnidadMedida_equiva; address.valor_equiv = prI.valor_equiv; address.interpretacion = prI.interpretacion; context.in_UnidadMedida_Equiv_conversion.Add(address); context.SaveChanges(); mensaje = "Grabacion ok.."; } else { return(false); } } 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; throw new Exception(mensaje); } }
public in_Ing_Egr_Inven_Info Get_Info_Ing_Egr_Inven_x_in_movi_inve(int IdEmpresa, int IdSucursal, int IdMovi_inve_tipo, decimal IdNumMovi) { try { in_Ing_Egr_Inven_Info Obj = new in_Ing_Egr_Inven_Info(); EntitiesInventario oEnti = new EntitiesInventario(); var Query = from q in oEnti.vwin_Ing_Egr_Inven_x_in_movi_inve where q.IdEmpresa == IdEmpresa && q.IdSucursal == IdSucursal && q.IdMovi_inven_tipo == IdMovi_inve_tipo && q.IdNumMovi == IdNumMovi select q; foreach (var item in Query) { Obj.IdEmpresa = item.IdEmpresa; Obj.IdSucursal = item.IdSucursal; Obj.IdMovi_inven_tipo = item.IdMovi_inven_tipo; Obj.IdNumMovi = item.IdNumMovi; Obj.signo = item.signo; Obj.IdMotivo_Inv = item.IdMotivo_Inv; Obj.Desc_mov_inv = item.Desc_mov_inv; Obj.tm_descripcion = item.tm_descripcion; Obj.cm_descripcionCorta = item.cm_descripcionCorta; Obj.cm_observacion = item.cm_observacion; Obj.cm_fecha = item.cm_fecha; } 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.ToString() + " " + ex.Message; throw new Exception(ex.ToString()); } }
public int GetSecuencia(in_producto_x_tb_bodega_Costo_Historico_Info Info) { try { int Id; EntitiesInventario entInve = new EntitiesInventario(); var select = (from q in entInve.in_producto_x_tb_bodega_Costo_Historico where q.IdEmpresa == Info.IdEmpresa && q.IdSucursal == Info.IdSucursal && q.IdBodega == Info.IdBodega && q.IdProducto == Info.IdProducto && q.IdFecha == Info.IdFecha select q.Secuencia).Count(); if (select == 0) { Id = 1; } else { var select_IdCXC = (from q in entInve.in_producto_x_tb_bodega_Costo_Historico where q.IdEmpresa == Info.IdEmpresa && q.IdSucursal == Info.IdSucursal && q.IdBodega == Info.IdBodega && q.IdProducto == Info.IdProducto && q.IdFecha == Info.IdFecha select q.Secuencia).Max(); Id = Convert.ToInt32(select_IdCXC.ToString()) + 1; } return(Id); } catch (Exception ex) { string arreglo = ToString(); 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 List <in_transferencia_det_Info> Get_List_transferencia_det(in_transferencia_Info Info, int idEmpresa) { try { List <in_transferencia_det_Info> lst = new List <in_transferencia_det_Info>(); EntitiesInventario Oentities = new EntitiesInventario(); var select = from q in Oentities.in_transferencia_det where q.IdEmpresa == idEmpresa && q.IdTransferencia == Info.IdTransferencia && q.IdBodegaOrigen == Info.IdBodegaOrigen && q.IdSucursalOrigen == Info.IdSucursalOrigen select q; foreach (var item in select) { in_transferencia_det_Info info = new in_transferencia_det_Info(); info.IdProducto = item.IdProducto; info.IdProducto = item.IdProducto; info.IdSucursalOrigen = item.IdSucursalOrigen; info.IdBodegaOrigen = item.IdBodegaOrigen; info.IdTransferencia = item.IdTransferencia; info.tr_Observacion = item.tr_Observacion; lst.Add(info);; } 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() + " " + ex.Message; throw new Exception(mensaje); } }
public in_subgrupo_info Get_Info_in_subgrupo(int IdEmpresa, string IdCategoria, int IdLinea, int IdGrupo, int IdSubGrupo) { try { in_subgrupo_info dat_ = new in_subgrupo_info(); EntitiesInventario OEUser = new EntitiesInventario(); var select_ = from TI in OEUser.in_subgrupo where TI.IdEmpresa == IdEmpresa && TI.IdCategoria == IdCategoria && TI.IdLinea == IdLinea && TI.IdGrupo == IdGrupo && TI.IdSubgrupo == IdSubGrupo select TI; foreach (var item in select_) { // in_subgrupo_info dat_ = new in_subgrupo_info(); dat_.IdEmpresa = item.IdEmpresa; dat_.IdCategoria = item.IdCategoria; dat_.IdLinea = item.IdLinea; dat_.IdGrupo = item.IdGrupo; dat_.IdSubgrupo = item.IdSubgrupo; dat_.nom_subgrupo = item.nom_subgrupo; dat_.observacion = item.observacion; dat_.cod_subgrupo = item.cod_subgrupo; dat_.Estado = item.Estado; } return(dat_); } 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(mensaje); } }
public decimal Get_Id_NumMoviInven(int idEmpresa, int idSucursal, int Idbodega, int idtipomovi) { try { decimal id; using (EntitiesInventario Contex = new EntitiesInventario()) { EntitiesInventario oEInventario = new EntitiesInventario(); var select = from q in oEInventario.in_movi_inve where q.IdEmpresa == idEmpresa && q.IdBodega == Idbodega && q.IdSucursal == idSucursal && q.IdMovi_inven_tipo == idtipomovi select q; if (select.ToList().Count == 0) { return(1); } var max = (from q in oEInventario.in_movi_inve where q.IdEmpresa == idEmpresa && q.IdBodega == Idbodega && q.IdSucursal == idSucursal && q.IdMovi_inven_tipo == idtipomovi select q).Max(); id = Convert.ToDecimal(max.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.ToString() + " " + ex.Message; throw new Exception(mensaje); } }
public List <in_producto_x_tb_bodega_Info> Get_list_Productos_x_Bodega(int idempresa, decimal IdProducto) { try { List <in_producto_x_tb_bodega_Info> lm = new List <in_producto_x_tb_bodega_Info>(); EntitiesInventario OEInventario = new EntitiesInventario(); var sql = from A in OEInventario.in_producto_x_tb_bodega where A.IdEmpresa == idempresa && A.IdProducto == IdProducto select A; foreach (var item in sql) { in_producto_x_tb_bodega_Info info = new in_producto_x_tb_bodega_Info(); info.IdEmpresa = item.IdEmpresa; info.IdBodega = item.IdBodega; info.IdSucursal = item.IdSucursal; info.IdProducto = item.IdProducto; info.IdCtaCble_Vta = item.IdCtaCble_Vta; info.IdCtaCble_Inven = item.IdCtaCble_Inven; info.IdCtaCble_Costo = item.IdCtaCble_Costo; info.IdCtaCble_Gasto_x_cxp = item.IdCtaCble_Gasto_x_cxp; info.EstaEnBase = true; 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(mensaje); } }
public List <vwin_categoria_lin_gr_subgr_Info> Get_List_in_categoria_lin_gr_subgr(int IdEmpresa) { try { List <vwin_categoria_lin_gr_subgr_Info> lM = new List <vwin_categoria_lin_gr_subgr_Info>(); EntitiesInventario OEUser = new EntitiesInventario(); var select_ = from TI in OEUser.vwin_categoria_lin_gr_subgr where TI.IdEmpresa == IdEmpresa select TI; foreach (var item in select_) { vwin_categoria_lin_gr_subgr_Info dat_ = new vwin_categoria_lin_gr_subgr_Info(); dat_.IdEmpresa = item.IdEmpresa; dat_.ID = item.ID; dat_.IDPadre = item.IDPadre; dat_.Codigo = item.Codigo; dat_.descripcion = item.descripcion; dat_.Estado = item.Estado; dat_.IdCategoria = item.IdCategoria; dat_.IdLinea = Convert.ToInt32(item.IdLinea); dat_.IdGrupo = Convert.ToInt32(item.IdGrupo); dat_.IdSubGrupo = Convert.ToInt32(item.IdSubGrupo); dat_.IdNivel = Convert.ToInt32(item.IdNivel); 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(mensaje); } }
public Boolean GuardarDB(in_devolucion_inven_det_Info info, ref string mensaje) { try { using (EntitiesInventario Context = new EntitiesInventario()) { var Address = new in_devolucion_inven_det(); Address.IdEmpresa = info.IdEmpresa; Address.IdDev_Inven = info.IdDev_Inven; Address.cantidad_a_devolver = info.cantidad_a_devolver; Address.cantidad_devuelta = info.cantidad_devuelta; Address.cantidad_egresada = info.cantidad_egresada; Address.IdBodega_movi_inv = info.IdBodega_movi_inv; Address.IdDev_Inven = info.IdDev_Inven; Address.IdEmpresa_movi_inv = info.IdEmpresa_movi_inv; Address.IdMovi_inven_tipo_movi_inv = info.IdMovi_inven_tipo_movi_inv; Address.IdNumMovi_movi_inv = info.IdNumMovi_movi_inv; Address.IdSucursal_movi_inv = info.IdSucursal_movi_inv; Address.secuencia = info.secuencia; Address.Secuencia_movi_inv = info.Secuencia_movi_inv; Context.in_devolucion_inven_det.Add(Address); Context.SaveChanges(); mensaje = "Grabación ok.."; } 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; throw new Exception(ex.ToString()); } }
public List <in_grupo_info> Get_List_Grupo(int IdEmpresa, string IdCategoria, int IdLinea) { try { List <in_grupo_info> lM = new List <in_grupo_info>(); EntitiesInventario OEUser = new EntitiesInventario(); var select_ = from TI in OEUser.in_grupo where TI.IdEmpresa == IdEmpresa && TI.IdCategoria == IdCategoria && TI.IdLinea == IdLinea select TI; foreach (var item in select_) { in_grupo_info dat_ = new in_grupo_info(); dat_.IdEmpresa = item.IdEmpresa; dat_.IdCategoria = item.IdCategoria; dat_.IdLinea = item.IdLinea; dat_.IdGrupo = item.IdGrupo; dat_.nom_grupo = item.nom_grupo; dat_.observacion = item.observacion; dat_.cod_grupo = item.cod_grupo; dat_.abreviatura = item.abreviatura; 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()); } }
public Boolean EliminarDB(int imp_IdEmpresa, int imp_IdSucursal, decimal imp_IdOrdenCompraExt, int in_IdEmpresa, int in_IdSucursal, int in_IdBodega, int in_IdMovi_inven_tipo, decimal in_IdNumMovi) { try { using (EntitiesInventario oEnt = new EntitiesInventario()) { string qry = "delete from in_movi_inven_X_imp_OrdCompraExterna where imp_IdEmpresa = " + imp_IdEmpresa + " and imp_IdSucursal = " + imp_IdSucursal + " and imp_IdOrdenCompraExt = " + imp_IdOrdenCompraExt + " and in_IdEmpresa = " + in_IdEmpresa + " and in_IdSucursal = " + in_IdSucursal + " and in_IdBodega = " + in_IdBodega + " and in_IdMovi_inven_tipo = " + in_IdMovi_inven_tipo + " and in_IdNumMovi = " + in_IdNumMovi; var asa = oEnt.Database.ExecuteSqlCommand(qry); } 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; throw new Exception(mensaje); } }
public Boolean EliminarDB(int IdEmpresa, decimal IdGuia) { try { EntitiesInventario Oent = new EntitiesInventario(); string Query = "delete from in_Guia_x_traspaso_bodega_det_sin_oc where IdEmpresa = " + IdEmpresa + " and IdGuia= " + IdGuia + ""; Oent.Database.ExecuteSqlCommand(Query); 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); mensaje = ex.ToString() + " " + ex.Message; oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); throw new Exception(ex.ToString()); } }
public Boolean ElminarDB(in_movi_inve_detalle_Info Info) { try { string qry = "delete from in_movi_inve_detalle where IdMovi_inven_tipo = " + Info.IdMovi_inven_tipo + " and IdNumMovi = " + Info.IdNumMovi + " and IdSucursal = " + Info.IdSucursal + " and IdBodega =" + Info.IdBodega + " and IdEmpresa =" + Info.IdEmpresa; using (EntitiesInventario oEnt = new EntitiesInventario()) { oEnt.Database.ExecuteSqlCommand(qry); } 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; throw new Exception(ex.ToString()); } }
public Boolean EliminarDB(int IdEmpresa) { try { using (EntitiesInventario entity = new EntitiesInventario()) { entity.Database.ExecuteSqlCommand("delete in_producto_x_tb_bodega where IdEmpresa = " + IdEmpresa); } 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; throw new Exception(mensaje); } }
public in_Motivo_Inven_Info Get_Info_Motivo_Inven(int IdEmpresa, int IdMotivo_Inv) { try { in_Motivo_Inven_Info Obj = new in_Motivo_Inven_Info(); EntitiesInventario oEnti = new EntitiesInventario(); var Query = from q in oEnti.in_Motivo_Inven where q.IdEmpresa == IdEmpresa && q.IdMotivo_Inv == IdMotivo_Inv select q; foreach (var item in Query) { Obj.IdEmpresa = item.IdEmpresa; Obj.IdMotivo_Inv = item.IdMotivo_Inv; Obj.Cod_Motivo_Inv = item.Cod_Motivo_Inv; Obj.Desc_mov_inv = item.Desc_mov_inv; Obj.Genera_Movi_Inven = item.Genera_Movi_Inven; Obj.Genera_CXP = item.Genera_CXP; Obj.estado = item.estado; Obj.Exigir_Punto_Cargo = item.Exigir_Punto_Cargo; Obj.IdCtaCble_Inven = item.IdCtaCble_Inven; Obj.IdCtaCble_Costo = item.IdCtaCble_Costo; Obj.IdUsuarioUltMod = item.IdUsuarioUltMod; Obj.es_Inven_o_Consumo = (item.es_Inven_o_Consumo == null) ? ein_Inventario_O_Consumo.TIC_INVEN : (ein_Inventario_O_Consumo)Enum.Parse(typeof(ein_Inventario_O_Consumo), item.es_Inven_o_Consumo); Obj.Tipo_Ing_Egr = (item.Tipo_Ing_Egr == null) ? ein_Tipo_Ing_Egr.ING : (ein_Tipo_Ing_Egr)Enum.Parse(typeof(ein_Tipo_Ing_Egr), item.Tipo_Ing_Egr); } 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.ToString() + " " + ex.Message; throw new Exception(ex.ToString()); } }
public List <in_categorias_Info> Get_List_categorias(int IdEmpresa) { try { in_categorias_Info Categoria_info = new in_categorias_Info(); List <in_categorias_Info> ListadoCategoris = new List <in_categorias_Info>(); EntitiesInventario OECbtecble_Info = new EntitiesInventario(); var selectCbtecble = from C in OECbtecble_Info.in_categorias where C.IdEmpresa == IdEmpresa select C; //Categoria_info.IdCategoria="000"; //Categoria_info.ca_Categoria = "TODOS"; //ListadoCategoris.Add(Categoria_info); foreach (var item in selectCbtecble) { Categoria_info = new in_categorias_Info(); Categoria_info.IdCategoria = item.IdCategoria; Categoria_info.ca_Categoria = item.ca_Categoria; Categoria_info.IdEmpresa = item.IdEmpresa; Categoria_info.Estado = item.Estado; Categoria_info.IdCtaCtble_Costo = item.IdCtaCtble_Costo; Categoria_info.IdCtaCtble_Inve = item.IdCtaCtble_Inve; Categoria_info.ca_Categoria2 = "[" + item.IdCategoria + "] " + item.ca_Categoria; Categoria_info.IdCtaCble_venta = item.IdCtaCble_venta; ListadoCategoris.Add(Categoria_info); } return(ListadoCategoris); } 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 double Get_stock_a_fecha_corte(int IdEmpresa, int IdSucursa, int IdBodega, Decimal IdProducto, DateTime Fecha) { EntitiesInventario oEnti = new EntitiesInventario(); try { double Stock_Actual = 0; var TStock = from det in oEnti.vwin_movi_inve_detalle_para_stock_a_la_fecha where det.IdEmpresa == IdEmpresa && det.IdSucursal == IdSucursa && det.IdBodega == IdBodega && det.IdProducto == IdProducto && det.cm_fecha <= Fecha group det by new { det.IdEmpresa, det.IdSucursal, det.IdBodega, det.IdProducto } into grouping select new { grouping.Key, StockTotal = grouping.Sum(p => p.dm_cantidad) }; if (TStock != null) { foreach (var item in TStock) { Stock_Actual = item.StockTotal; } } return(Stock_Actual); } 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(mensaje); } }
public decimal GetId(int idEmpresa) { try { decimal IdAjusteFisico = 0; using (EntitiesInventario Contex = new EntitiesInventario()) { EntitiesInventario oEInventario = new EntitiesInventario(); var Select = from q in oEInventario.in_ajusteFisico where q.IdEmpresa == idEmpresa select q; if (Select.ToList().Count == 0) { _IdAjusteFisico = 1; return(1); } else { var qmax = (from q in oEInventario.in_ajusteFisico where q.IdEmpresa == idEmpresa select q.IdAjusteFisico).Max(); IdAjusteFisico = Convert.ToInt32(qmax.ToString()) + 1; _IdAjusteFisico = IdAjusteFisico; return(IdAjusteFisico); } } } 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 in_movi_inve_detalle_x_com_ordencompra_local_det_Info Get_Info_in_movi_inve_detalle_x_com_ordencompra_local_det(in_movi_inve_detalle_Info MovInv) { try { in_movi_inve_detalle_x_com_ordencompra_local_det_Info Obj = new in_movi_inve_detalle_x_com_ordencompra_local_det_Info(); EntitiesInventario oEnti = new EntitiesInventario(); var Query = from q in oEnti.in_movi_inve_detalle_x_com_ordencompra_local_det where q.mi_IdEmpresa == MovInv.IdEmpresa && q.mi_IdSucursal == MovInv.IdSucursal && q.mi_IdBodega == MovInv.IdBodega && q.mi_IdMovi_inven_tipo == MovInv.IdMovi_inven_tipo && q.mi_IdNumMovi == MovInv.IdNumMovi && q.mi_Secuencia == MovInv.Secuencia select q; foreach (var item in Query) { Obj.mi_IdEmpresa = item.mi_IdEmpresa; Obj.mi_IdSucursal = item.mi_IdSucursal; Obj.mi_IdBodega = item.mi_IdBodega; Obj.mi_IdMovi_inven_tipo = item.mi_IdMovi_inven_tipo; Obj.mi_IdNumMovi = item.mi_IdNumMovi; Obj.mi_Secuencia = item.mi_Secuencia; Obj.ocd_IdEmpresa = item.ocd_IdEmpresa; Obj.ocd_IdSucursal = item.ocd_IdSucursal; Obj.ocd_IdOrdenCompra = item.ocd_IdOrdenCompra; Obj.ocd_Secuencia = item.ocd_Secuencia; } 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); mensaje = ex.ToString() + " " + ex.Message; oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); throw new Exception(ex.ToString()); } }
public in_devolucion_inven_Info Get_Info_in_devolucion_inven(int IdEmpresa, decimal IdDev_Inven) { try { in_devolucion_inven_Info Obj = new in_devolucion_inven_Info(); EntitiesInventario oEnti = new EntitiesInventario(); var Query = from q in oEnti.vwin_devolucion_inven where q.IdEmpresa == IdEmpresa && q.IdDev_Inven == IdDev_Inven select q; foreach (var item in Query) { Obj.IdEmpresa = item.IdEmpresa; Obj.IdSucursal_movi_inven = item.IdSucursal_movi_inven; Obj.IdMovi_inven_tipo = item.IdMovi_inven_tipo; Obj.IdNumMovi = item.IdNumMovi; Obj.cod_Dev_Inven = item.cod_Dev_Inven; Obj.Fecha = item.Fecha; Obj.estado = item.estado; Obj.observacion = item.observacion; Obj.nom_sucursal = item.nom_sucursal; Obj.Devuelve_toda_tran = item.Devuelve_toda_tran; Obj.IdDev_Inven = item.IdDev_Inven; Obj.IdUsuario = item.IdUsuario; } 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.ToString() + " " + ex.Message; throw new Exception(ex.ToString()); } }
public Boolean GrabarDB(List <in_movi_inve_Info> lmcabmovin, ref string mensaje) { try { using (EntitiesInventario context = new EntitiesInventario()) { EntitiesInventario EDB = new EntitiesInventario(); foreach (var item in lmcabmovin) { var address = new in_movi_inve_x_in_ordencompra_local(); 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.IdEmpresaOC = item.IdEmpresa; address.IdSucursalOC = item.IdSucursal; address.IdOrdenCompra = item.IdOrdenCompra; context.in_movi_inve_x_in_ordencompra_local.Add(address); context.SaveChanges(); mensaje = "Grabacion ok.."; } 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; throw new Exception(ex.ToString()); } }
public Boolean GuardarDB(in_presentacion_Info info, ref string Mensaje) { try { using (EntitiesInventario oEnti = new EntitiesInventario()) { var Q = from per in oEnti.in_presentacion where per.IdEmpresa == info.IdEmpresa && per.IdPresentacion == info.IdPresentacion select per; if (Q.ToList().Count == 0) { var registo = new in_presentacion(); registo.IdEmpresa = info.IdEmpresa; registo.IdPresentacion = (info.IdPresentacion == "" || info.IdPresentacion == null) ? Convert.ToString(GetId(info.IdEmpresa)) : info.IdPresentacion; registo.nom_presentacion = info.nom_presentacion.Trim(); registo.estado = "A"; oEnti.in_presentacion.Add(registo); oEnti.SaveChanges(); Mensaje = "Registro Ingresado Correctamente"; } } 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 ingresar el registro "; throw new Exception(ex.ToString()); } }
public Boolean EliminarDB(in_ProductoTipo_Info info, ref string msg) { try { EntitiesInventario OEPProductoTipo = new EntitiesInventario(); var select = from q in OEPProductoTipo.in_ProductoTipo where q.IdEmpresa == info.IdEmpresa && q.IdProductoTipo == info.IdProductoTipo select q; if (select.ToList().Count > 0) { using (EntitiesInventario context = new EntitiesInventario()) { var contact = context.in_ProductoTipo.First(obj => obj.IdEmpresa == info.IdEmpresa && obj.IdProductoTipo == info.IdProductoTipo); contact.IdUsuarioUltAnu = info.IdUsuarioUltAnu; contact.Fecha_UltAnu = info.Fecha_UltAnu; contact.MotivoAnulacion = info.MotivoAnulacion; contact.Estado = "I"; context.SaveChanges(); msg = "Se ha procedido anular el registro del Tipo de Producto: " + info.tp_descripcion + " exitosamente"; } return(true); } else { msg = "No es posible anular el registro del Tipo de Producto: " + info.tp_descripcion + " debido a que ya se encuentra anulado."; return(false); } } 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); } }