Esempio n. 1
0
        public Boolean GrabarDB(in_grupo_info info, ref int IdGrupo, ref string msg)
        {
            try
            {
                Boolean res = true;
                if (Validar_objeto_Grupo(info, ref msg))
                {
                    return(oDat.GrabarDB(info, ref IdGrupo, ref msg));
                }
                else
                {
                    res = false;
                }

                return(res);
            }
            catch (Exception ex)
            {
                Core.Erp.Info.Log_Exception.LoggingManager.Logger.Log(Core.Erp.Info.Log_Exception.LoggingCategory.Error, ex.Message);
                throw new Core.Erp.Info.Log_Exception.DalException(string.Format("", "GrabarDB", ex.Message), ex)
                      {
                          EntityType = typeof(in_grupo_Bus)
                      };
            }
        }
Esempio n. 2
0
 public Boolean AnularDB(in_grupo_info info, ref string msg)
 {
     try
     {
         using (EntitiesInventario context = new EntitiesInventario())
         {
             var contact = context.in_grupo.FirstOrDefault(var => var.IdEmpresa == info.IdEmpresa && var.IdLinea == info.IdLinea && var.IdGrupo == info.IdGrupo && var.IdCategoria == info.IdCategoria);
             if (contact != null)
             {
                 contact.Estado          = "I";
                 contact.IdUsuarioUltAnu = info.IdUsuarioUltAnu;
                 contact.Fecha_UltAnu    = info.Fecha_UltAnu;
                 contact.MotiAnula       = info.MotiAnula;
                 context.SaveChanges();
                 msg = "Anulació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());
     }
 }
Esempio n. 3
0
 public Boolean ModificarDB(in_grupo_info info, ref string msg)
 {
     try
     {
         return(oDat.ModificarDB(info, ref msg));
     }
     catch (Exception ex)
     {
         Core.Erp.Info.Log_Exception.LoggingManager.Logger.Log(Core.Erp.Info.Log_Exception.LoggingCategory.Error, ex.Message);
         throw new Core.Erp.Info.Log_Exception.DalException(string.Format("", "ModificarDB", ex.Message), ex)
               {
                   EntityType = typeof(in_grupo_Bus)
               };
     }
 }
Esempio n. 4
0
 void LimpiarDatos()
 {
     try
     {
         enu                    = Cl_Enumeradores.eTipo_action.grabar;
         txtIdGrupo.Text        = "";
         txtCodGrupo.Text       = "";
         cmbCategoria.EditValue = null;
         cmbLinea.EditValue     = null;
         txtDescripcion.Text    = "";
         txtAbreviatura.Text    = "";
         txtObservacion.Text    = "";
         infoGrupo              = new in_grupo_info();
     }
     catch (Exception ex)
     {
         Log_Error_bus.Log_Error(ex.ToString());
         MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Esempio n. 5
0
        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());
            }
        }
Esempio n. 6
0
        public Boolean Validar_objeto_Grupo(in_grupo_info Info, ref string msg)
        {
            try
            {
                if (Info.IdEmpresa == 0 || Info.IdEmpresa == null)
                {
                    msg = "las variable está en cero... IdEmpresa == 0 ";
                    return(false);
                }
                if (Info.IdCategoria == "" || Info.IdCategoria == null)
                {
                    msg = "Seleccione la Categoría";
                    return(false);
                }

                if (Info.IdLinea == 0 || Info.IdLinea == null)
                {
                    msg = "Seleccione la Linea";
                    return(false);
                }

                if (Info.nom_grupo == "" || Info.nom_grupo == null)
                {
                    msg = "Ingrese la descripción";
                    return(false);
                }

                return(true);
            }
            catch (Exception ex)
            {
                Core.Erp.Info.Log_Exception.LoggingManager.Logger.Log(Core.Erp.Info.Log_Exception.LoggingCategory.Error, ex.Message);
                throw new Core.Erp.Info.Log_Exception.DalException(string.Format("", "Validar_objeto_Grupo", ex.Message), ex)
                      {
                          EntityType = typeof(in_grupo_Bus)
                      };
            }
        }
Esempio n. 7
0
        public in_grupo_info Get_info_grupo()
        {
            try
            {
                in_grupo_info info = new in_grupo_info();

                if (cmb_subgrupo.EditValue == null)
                {
                    return(null);
                }

                info = GrupoList.FirstOrDefault(q => q.IdCategoria == Convert.ToString(cmb_categoria.EditValue) && q.IdLinea == Convert.ToInt32(cmb_linea.EditValue) && q.IdGrupo == Convert.ToInt32(cmb_grupo.EditValue));

                return(info);
            }
            catch (Exception ex)
            {
                string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
                MessageBox.Show(NameMetodo + " - " + ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
                return(null);
            }
        }
Esempio n. 8
0
        public Boolean GrabarDB(in_grupo_info info, ref int IdGrupo, ref string msg)
        {
            try
            {
                using (EntitiesInventario context = new EntitiesInventario())
                {
                    var lst = from q in context.in_grupo
                              where q.IdEmpresa == info.IdEmpresa &&
                              q.IdCategoria == info.IdCategoria &&
                              q.IdLinea == info.IdLinea &&
                              q.IdGrupo == info.IdGrupo
                              select q;

                    if (lst.Count() == 0)
                    {
                        in_grupo objGrupo = new in_grupo();

                        objGrupo.IdEmpresa   = info.IdEmpresa;
                        objGrupo.IdCategoria = info.IdCategoria;
                        objGrupo.IdLinea     = info.IdLinea;

                        objGrupo.IdGrupo = IdGrupo = (info.IdGrupo == null || info.IdGrupo == 0) ? GetIdgrupo(info.IdEmpresa, info.IdCategoria, info.IdLinea) : info.IdGrupo;

                        if (info.cod_grupo == null || info.cod_grupo == "")
                        {
                            info.cod_grupo = objGrupo.IdGrupo.ToString();
                        }

                        objGrupo.cod_grupo = info.cod_grupo.Trim();
                        objGrupo.nom_grupo = info.nom_grupo.Trim();

                        if (info.abreviatura == null || info.abreviatura == "")
                        {
                            info.abreviatura = info.cod_grupo.Trim();
                        }

                        objGrupo.abreviatura = info.abreviatura;
                        objGrupo.Estado      = "A";

                        if (info.observacion == "" || info.observacion == null)
                        {
                            info.observacion = "";
                        }

                        objGrupo.observacion   = info.observacion;
                        objGrupo.IdUsuario     = (info.IdUsuario == null) ? "" : info.IdUsuario;
                        objGrupo.Fecha_Transac = DateTime.Now;
                        objGrupo.nom_pc        = info.nom_pc;
                        objGrupo.ip            = info.ip;

                        context.in_grupo.Add(objGrupo);
                        context.SaveChanges();
                    }
                    msg = "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());
            }
        }
Esempio n. 9
0
        void Update_Search_Delete(Cl_Enumeradores.eTipo_action accion, string titulo)
        {
            try
            {
                if (_iCategoria != null)
                {
                    if (_iCategoria.IdNivel == 1)
                    {
                        if (_iCategoria.Estado == "I" && accion == Cl_Enumeradores.eTipo_action.actualizar)
                        {
                            MessageBox.Show("No se pueden modificar registros inactivos (I)", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            return;
                        }
                        else
                        {
                            if (_iCategoria.Estado == "I" && accion == Cl_Enumeradores.eTipo_action.Anular)
                            {
                                MessageBox.Show("El registro seleccionado ya fue anulado", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                                return;
                            }

                            else
                            {
                                fr = new FrmIn_Categoria_Mant();
                                fr.set_Accion(accion);

                                info = new in_categorias_Info();
                                info = listCategoria.FirstOrDefault(q => q.IdEmpresa == _iCategoria.IdEmpresa && q.IdCategoria == _iCategoria.IdCategoria);

                                _iCategoriaPadre = listCategoria.Find(delegate(in_categorias_Info ca)
                                {
                                    return(ca.IdCategoria == info.IdCategoriaPadre && ca.IdEmpresa == _iCategoria.IdEmpresa);
                                });

                                fr.set_categoria(info);
                                fr.set_categoriaPadre(_iCategoriaPadre);

                                fr.MdiParent   = MdiParent;
                                fr.ReloadGrid += fr_ReloadGrid;
                                fr.Show();
                            }
                        }
                    }

                    if (_iCategoria.IdNivel == 2)
                    {
                        if (_iCategoria.Estado == "I" && accion == Cl_Enumeradores.eTipo_action.actualizar)
                        {
                            MessageBox.Show("No se pueden modificar registros inactivos (I)", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            return;
                        }
                        else
                        {
                            if (_iCategoria.Estado == "I" && accion == Cl_Enumeradores.eTipo_action.Anular)
                            {
                                MessageBox.Show("El registro seleccionado ya fue anulado", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                                return;
                            }

                            else
                            {
                                ofrLinea = new FrmIn_Linea_Mant();

                                infoLinea = new in_linea_info();
                                infoLinea = listLinea.FirstOrDefault(q => q.IdEmpresa == _iCategoria.IdEmpresa && q.IdCategoria == _iCategoria.IdCategoria && q.IdLinea == _iCategoria.IdLinea);

                                ofrLinea = new FrmIn_Linea_Mant(accion);
                                ofrLinea.Delegado_FrmIn_Linea_Mant += ofr_Delegado_FrmIn_Linea_Mant;
                                ofrLinea.Text      = ofrLinea.Text + titulo;
                                ofrLinea._SetInfo  = infoLinea;
                                ofrLinea.MdiParent = this.MdiParent;
                                ofrLinea.Show();
                            }
                        }
                    }

                    if (_iCategoria.IdNivel == 3)
                    {
                        if (_iCategoria.Estado == "I" && accion == Cl_Enumeradores.eTipo_action.actualizar)
                        {
                            MessageBox.Show("No se pueden modificar registros inactivos (I)", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            return;
                        }
                        else
                        {
                            if (_iCategoria.Estado == "I" && accion == Cl_Enumeradores.eTipo_action.Anular)
                            {
                                MessageBox.Show("El registro seleccionado ya fue anulado", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                                return;
                            }

                            else
                            {
                                ofrGrupo = new FrmIn_Grupo_Mant();
                                ofrGrupo.Delegado_FrmIn_Grupo_Mant += ofrGrupo_Delegado_FrmIn_Grupo_Mant;

                                infoGrupo = new in_grupo_info();
                                infoGrupo = listGrupo.FirstOrDefault(q => q.IdEmpresa == _iCategoria.IdEmpresa && q.IdCategoria == _iCategoria.IdCategoria && q.IdLinea == _iCategoria.IdLinea && _iCategoria.IdGrupo == q.IdGrupo);

                                ofrGrupo = new FrmIn_Grupo_Mant(accion);
                                ofrGrupo.Delegado_FrmIn_Grupo_Mant += ofrGrupo_Delegado_FrmIn_Grupo_Mant;
                                ofrGrupo.Text      = ofrGrupo.Text + titulo;
                                ofrGrupo._SetInfo  = infoGrupo;
                                ofrGrupo.MdiParent = this.MdiParent;
                                ofrGrupo.Show();
                            }
                        }
                    }

                    if (_iCategoria.IdNivel == 4)
                    {
                        if (_iCategoria.Estado == "I" && accion == Cl_Enumeradores.eTipo_action.actualizar)
                        {
                            MessageBox.Show("No se pueden modificar registros inactivos (I)", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            return;
                        }
                        else
                        {
                            if (_iCategoria.Estado == "I" && accion == Cl_Enumeradores.eTipo_action.Anular)
                            {
                                MessageBox.Show("El registro seleccionado ya fue anulado", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                                return;
                            }

                            else
                            {
                                ofrSubGrupo = new FrmIn_SubGrupo_Mant();
                                ofrSubGrupo.Event_FrmIn_SubGrupo_Mant_FormClosing += ofrSubGrupo_Event_FrmIn_SubGrupo_Mant_FormClosing;

                                infoSubGrupo = new in_subgrupo_info();
                                infoSubGrupo = listSubGrupo.FirstOrDefault(q => q.IdEmpresa == _iCategoria.IdEmpresa && q.IdCategoria == _iCategoria.IdCategoria && q.IdLinea == _iCategoria.IdLinea && _iCategoria.IdGrupo == q.IdGrupo && _iCategoria.IdSubGrupo == q.IdSubgrupo);

                                ofrSubGrupo = new FrmIn_SubGrupo_Mant(accion);
                                ofrSubGrupo.Event_FrmIn_SubGrupo_Mant_FormClosing += ofrSubGrupo_Event_FrmIn_SubGrupo_Mant_FormClosing;
                                ofrSubGrupo.Text      = ofrSubGrupo.Text + titulo;
                                ofrSubGrupo._SetInfo  = infoSubGrupo;
                                ofrSubGrupo.MdiParent = this.MdiParent;
                                ofrSubGrupo.Show();
                            }
                        }
                    }
                }
                else
                {
                    MessageBox.Show(param.Get_Mensaje_sys(enum_Mensajes_sys.Seleccione_un_registro), param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            catch (Exception ex)
            {
                string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
                MessageBox.Show(param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas) + ex.Message + " ", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
                Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
            }
        }
Esempio n. 10
0
        public List <in_grupo_info> ProcesarDataTablein_grupo_info(DataTable ds, int IdEmpresa, ref string MensajeError)
        {
            List <in_grupo_info> lista = new List <in_grupo_info>();

            lista.Clear();
            try
            {
                //VALIDAR QUE TENGA MENOS DE 5 COLUMNAS
                if (ds.Columns.Count <= 5)
                {
                    //RECORRE EL DATATABLE REGISTRO X REGISTRO
                    if (ds.Rows.Count > 0)
                    {
                        foreach (DataRow row in ds.Rows)
                        {
                            in_grupo_info info = new in_grupo_info();

                            info.IdEmpresa = IdEmpresa;
                            info.Estado    = "A";

                            for (int col = 0; col < ds.Columns.Count + 1; col++)
                            {
                                switch (col)
                                {
                                case 0:    //IdCategoria
                                    info.IdCategoria = Convert.ToString(row[col]);
                                    break;

                                case 1:    //IdLinea
                                    info.IdLinea = Convert.ToInt32(row[col]);
                                    break;

                                case 2:    //IdGrupo
                                    info.IdGrupo = Convert.ToInt32(row[col]);
                                    break;

                                case 3:    //NombreGrupo
                                    info.nom_grupo = Convert.ToString(row[col]);
                                    break;

                                default:
                                    break;
                                }
                            }
                            lista.Add(info);
                        }
                    }
                    else
                    {
                        MensajeError = "Por favor verifique que el archivo contenga Datos.";
                        lista        = new List <in_grupo_info>();
                    }
                }
                else
                {
                    MensajeError = "Por favor verifique que el archivo tenga el formato correcto.\r Son 2 columnas.";
                    lista        = new List <in_grupo_info>();
                }
            }
            catch (Exception ex)
            {
                Core.Erp.Info.Log_Exception.LoggingManager.Logger.Log(Core.Erp.Info.Log_Exception.LoggingCategory.Error, ex.Message);
                throw new Core.Erp.Info.Log_Exception.DalException(string.Format("", "ProcesarDataTablein_grupo_info", ex.Message), ex)
                      {
                          EntityType = typeof(in_grupo_info)
                      };
            }
            return(lista);
        }