Exemplo n.º 1
0
        private void cmb_subgrupo_EditValueChanged(object sender, EventArgs e)
        {
            try
            {
                if (cmb_subgrupo.EditValue == null)
                {
                    return;
                }

                string IdCategoria = "";
                int    IdLinea     = 0;
                int    IdGrupo     = 0;
                int    IdSubGrupo  = 0;

                IdCategoria = Convert.ToString(cmb_categoria.EditValue);
                IdLinea     = Convert.ToInt32(cmb_linea.EditValue);
                IdGrupo     = Convert.ToInt32(cmb_grupo.EditValue);
                IdSubGrupo  = Convert.ToInt32(cmb_subgrupo.EditValue);

                SubGrupoInfo = new in_subgrupo_info();
                SubGrupoInfo = SubGrupoBus.ObtenerInfoSubGrupo(param.IdEmpresa, IdCategoria, IdLinea, IdGrupo, IdSubGrupo);
                event_cmb_subgrupo_EditValueChanged(sender, e);
            }
            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());
            }
        }
Exemplo n.º 2
0
 public Boolean AnularDB(in_subgrupo_info info, ref string msg)
 {
     try
     {
         using (EntitiesInventario context = new EntitiesInventario())
         {
             var contact = context.in_subgrupo.FirstOrDefault(var => var.IdEmpresa == info.IdEmpresa && var.IdLinea == info.IdLinea && var.IdGrupo == info.IdGrupo && var.IdCategoria == info.IdCategoria && var.IdSubgrupo == info.IdSubgrupo);
             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(mensaje);
     }
 }
Exemplo n.º 3
0
        public Boolean GrabarDB(in_subgrupo_info info, ref int IdSubGrupo, ref string msg)
        {
            try
            {
                Boolean res = true;
                if (Validar_objeto_SubGrupo(info, ref msg))
                {
                    return(oDat.GrabarDB(info, ref IdSubGrupo, 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_subgrupo_Bus)
                      };

                throw new Exception(mensaje);
            }
        }
Exemplo n.º 4
0
        public Boolean ModificarDB(in_subgrupo_info info, ref string msg)
        {
            try
            {
                using (EntitiesInventario context = new EntitiesInventario())
                {
                    var contact = context.in_subgrupo.FirstOrDefault(var => var.IdEmpresa == info.IdEmpresa && var.IdLinea == info.IdLinea && var.IdGrupo == info.IdGrupo && var.IdCategoria == info.IdCategoria && var.IdSubgrupo == info.IdSubgrupo);
                    if (contact != null)
                    {
                        contact.cod_subgrupo     = info.cod_subgrupo;
                        contact.nom_subgrupo     = info.nom_subgrupo;
                        contact.abreviatura      = info.abreviatura;
                        contact.observacion      = info.observacion;
                        contact.IdUsuarioUltMod  = info.IdUsuarioUltMod;
                        contact.Fecha_UltMod     = info.Fecha_UltMod;
                        contact.IdCtaCtble_Inve  = info.IdCtaCtble_Inve;
                        contact.IdCtaCtble_Costo = info.IdCtaCtble_Costo;

                        contact.IdCtaCtble_Gasto_x_cxp = info.IdCtaCtble_Gasto_x_cxp;
                        contact.IdCtaCble_Vta          = info.IdCtaCble_Vta;
                        contact.IdCtaCble_Des0         = info.IdCtaCble_Des0;
                        contact.IdCtaCble_Dev0         = info.IdCtaCble_Dev0;


                        //contact.IdCentro_Costo_Inv = info.IdCentro_Costo_Inv;
                        //contact.IdCentro_Costo_Cost = info.IdCentro_Costo_Cost;
                        //contact.IdCentro_Costo_x_Gasto_x_cxp = info.IdCentro_Costo_x_Gasto_x_cxp;
                        //contact.IdCentroCosto_sub_centro_costo_inv = info.IdCentroCosto_sub_centro_costo_inv;
                        //contact.IdCentroCosto_sub_centro_costo_cost = info.IdCentroCosto_sub_centro_costo_cost;
                        //contact.IdCentroCosto_sub_centro_costo_cxp = info.IdCentroCosto_sub_centro_costo_cxp;
                        //contact.IdCtaCble_CosBaseIva = info.IdCtaCble_CosBaseIva;
                        //contact.IdCtaCble_CosBase0 = info.IdCtaCble_CosBase0;
                        //contact.IdCtaCble_VenIva = info.IdCtaCble_VenIva;
                        //contact.IdCtaCble_Ven0 = info.IdCtaCble_Ven0;
                        //contact.IdCtaCble_DesIva = info.IdCtaCble_DesIva;
                        //contact.IdCtaCble_DevIva = info.IdCtaCble_DevIva;



                        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(mensaje);
            }
        }
Exemplo n.º 5
0
 public Boolean AnularDB(in_subgrupo_info info, ref string msg)
 {
     try
     {
         return(oDat.AnularDB(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("", "AnularDB", ex.Message), ex)
               {
                   EntityType = typeof(in_subgrupo_Bus)
               };
     }
 }
Exemplo n.º 6
0
        public Boolean Validar_objeto_SubGrupo(in_subgrupo_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.IdGrupo == 0 || Info.IdGrupo == null)
                {
                    msg = "Seleccione el Grupo";
                    return(false);
                }

                if (Info.nom_subgrupo == "" || Info.nom_subgrupo == 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_SubGrupo", ex.Message), ex)
                      {
                          EntityType = typeof(in_subgrupo_Bus)
                      };
            }
        }
Exemplo n.º 7
0
        public List <in_subgrupo_info> Get_List_in_subgrupo(int IdEmpresa, string IdCategoria, int IdLinea, int IdGrupo)
        {
            try
            {
                List <in_subgrupo_info> lM = new List <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
                              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;


                    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);
            }
        }
Exemplo n.º 8
0
 void LimpiarDatos()
 {
     try
     {
         enu                    = Cl_Enumeradores.eTipo_action.grabar;
         infoSubGrupo           = new in_subgrupo_info();
         txtIdSubGrupo.Text     = "";
         txtCodSubGrupo.Text    = "";
         txtAbreviatura.Text    = "";
         cmbCategoria.EditValue = null;
         cmbLinea.EditValue     = null;
         cmbGrupo.EditValue     = null;
         txtDescripcion.Text    = "";
     }
     catch (Exception ex)
     {
         Log_Error_bus.Log_Error(ex.ToString());
         MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Exemplo n.º 9
0
        public in_subgrupo_info Get_info_subgrupo()
        {
            try
            {
                in_subgrupo_info info = new in_subgrupo_info();

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

                info = SubGrupoList.FirstOrDefault(q => q.IdCategoria == Convert.ToString(cmb_categoria.EditValue) && q.IdLinea == Convert.ToInt32(cmb_linea.EditValue) && q.IdGrupo == Convert.ToInt32(cmb_grupo.EditValue) && q.IdSubgrupo == Convert.ToInt32(cmb_subgrupo.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);
            }
        }
Exemplo n.º 10
0
        public Boolean GrabarDB(in_subgrupo_info info, ref int IdSubGrupo, ref string msg)
        {
            try
            {
                using (EntitiesInventario context = new EntitiesInventario())
                {
                    var lst = from q in context.in_subgrupo
                              where q.IdEmpresa == info.IdEmpresa &&
                              q.IdCategoria == info.IdCategoria &&
                              q.IdLinea == info.IdLinea &&
                              q.IdGrupo == info.IdGrupo &&
                              q.IdSubgrupo == info.IdSubgrupo
                              select q;

                    if (lst.Count() == 0)
                    {
                        in_subgrupo objSubGrupo = new in_subgrupo();

                        objSubGrupo.IdEmpresa   = info.IdEmpresa;
                        objSubGrupo.IdCategoria = info.IdCategoria;
                        objSubGrupo.IdLinea     = info.IdLinea;
                        objSubGrupo.IdGrupo     = info.IdGrupo;

                        objSubGrupo.IdSubgrupo = IdSubGrupo = (info.IdSubgrupo == null || info.IdSubgrupo == 0) ? GetIdSubGrupo(info.IdEmpresa, info.IdCategoria, info.IdLinea, info.IdGrupo) : info.IdSubgrupo;

                        if (info.cod_subgrupo == null || info.cod_subgrupo == "")
                        {
                            info.cod_subgrupo = objSubGrupo.IdSubgrupo.ToString();
                        }

                        objSubGrupo.cod_subgrupo = info.cod_subgrupo.Trim();


                        objSubGrupo.nom_subgrupo = info.nom_subgrupo.Trim();

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

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

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

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

                        objSubGrupo.IdCtaCtble_Inve  = info.IdCtaCtble_Inve;
                        objSubGrupo.IdCtaCtble_Costo = info.IdCtaCtble_Costo;

                        objSubGrupo.IdCtaCtble_Gasto_x_cxp = info.IdCtaCtble_Gasto_x_cxp;
                        objSubGrupo.IdCtaCble_Vta          = info.IdCtaCble_Vta;


                        //objSubGrupo.IdCentro_Costo_Inv = info.IdCentro_Costo_Inv;
                        //objSubGrupo.IdCentro_Costo_Cost = info.IdCentro_Costo_Cost;
                        //objSubGrupo.IdCentro_Costo_x_Gasto_x_cxp = info.IdCentro_Costo_x_Gasto_x_cxp;
                        //objSubGrupo.IdCentroCosto_sub_centro_costo_inv = info.IdCentroCosto_sub_centro_costo_inv;
                        //objSubGrupo.IdCentroCosto_sub_centro_costo_cost = info.IdCentroCosto_sub_centro_costo_cost;
                        //objSubGrupo.IdCentroCosto_sub_centro_costo_cxp = info.IdCentroCosto_sub_centro_costo_cxp;
                        //objSubGrupo.IdCtaCble_CosBaseIva = info.IdCtaCble_CosBaseIva;
                        //objSubGrupo.IdCtaCble_CosBase0 = info.IdCtaCble_CosBase0;
                        //objSubGrupo.IdCtaCble_VenIva = info.IdCtaCble_VenIva;
                        //objSubGrupo.IdCtaCble_Ven0 = info.IdCtaCble_Ven0;
                        //objSubGrupo.IdCtaCble_DesIva = info.IdCtaCble_DesIva;
                        //objSubGrupo.IdCtaCble_DevIva = info.IdCtaCble_DevIva;

                        objSubGrupo.IdCtaCble_Des0 = info.IdCtaCble_Des0;
                        objSubGrupo.IdCtaCble_Dev0 = info.IdCtaCble_Dev0;


                        context.in_subgrupo.Add(objSubGrupo);
                        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(mensaje);
            }
        }
Exemplo n.º 11
0
        public List <in_subgrupo_info> Get_List_in_subgrupo(int IdEmpresa)
        {
            try
            {
                List <in_subgrupo_info> lM = new List <in_subgrupo_info>();

                EntitiesInventario OEUser = new EntitiesInventario();

                var select_ = from TI in OEUser.in_subgrupo
                              where TI.IdEmpresa == IdEmpresa

                              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_.abreviatura            = item.abreviatura;
                    dat_.Estado                 = item.Estado;
                    dat_.IdCtaCtble_Inve        = item.IdCtaCtble_Inve;
                    dat_.IdCtaCtble_Costo       = item.IdCtaCtble_Costo;
                    dat_.IdCtaCtble_Gasto_x_cxp = item.IdCtaCtble_Gasto_x_cxp;
                    dat_.IdCtaCble_Vta          = item.IdCtaCble_Vta;
                    dat_.IdCtaCble_Des0         = item.IdCtaCble_Des0;
                    dat_.IdCtaCble_Dev0         = item.IdCtaCble_Dev0;


                    //dat_.IdCentro_Costo_Inv = item.IdCentro_Costo_Inv;
                    //dat_.IdCentro_Costo_Cost = item.IdCentro_Costo_Cost;
                    //dat_.IdCentro_Costo_x_Gasto_x_cxp = item.IdCentro_Costo_x_Gasto_x_cxp;
                    //dat_.IdCentroCosto_sub_centro_costo_inv = item.IdCentroCosto_sub_centro_costo_inv;
                    //dat_.IdCentroCosto_sub_centro_costo_cost = item.IdCentroCosto_sub_centro_costo_cost;
                    //dat_.IdCentroCosto_sub_centro_costo_cxp = item.IdCentroCosto_sub_centro_costo_cxp;
                    //dat_.IdCtaCble_CosBaseIva = item.IdCtaCble_CosBaseIva;
                    //dat_.IdCtaCble_CosBase0 = item.IdCtaCble_CosBase0;
                    //dat_.IdCtaCble_VenIva = item.IdCtaCble_VenIva;
                    //dat_.IdCtaCble_Ven0 = item.IdCtaCble_Ven0;
                    //dat_.IdCtaCble_DesIva = item.IdCtaCble_DesIva;
                    //dat_.IdCtaCble_DevIva = item.IdCtaCble_DevIva;

                    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);
            }
        }
Exemplo n.º 12
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());
            }
        }
Exemplo n.º 13
0
        public List <in_subgrupo_info> ProcesarDataTablein_subgrupo_info(DataTable ds, int IdEmpresa, ref string MensajeError)
        {
            List <in_subgrupo_info> lista = new List <in_subgrupo_info>();

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

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

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

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

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

                                case 3:    //Codigo
                                    info.IdSubgrupo = Convert.ToInt32(row[col]);
                                    break;

                                case 4:    //Codigo
                                    info.nom_subgrupo = Convert.ToString(row[col]);
                                    break;

                                default:
                                    break;
                                }
                            }
                            lista.Add(info);
                        }
                    }
                    else
                    {
                        MensajeError = "Por favor verifique que el archivo contenga Datos.";
                        lista        = new List <in_subgrupo_info>();
                    }
                }
                else
                {
                    MensajeError = "Por favor verifique que el archivo tenga el formato correcto.\r Son 2 columnas.";
                    lista        = new List <in_subgrupo_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_subgrupo_info", ex.Message), ex)
                      {
                          EntityType = typeof(in_subgrupo_info)
                      };
            }
            return(lista);
        }