private void ucGe_Menu_event_btnModificar_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            try
            {
                _CentroCostoNivelInfo = (ct_Centro_costo_nivel_Info)gridViewNivel.GetFocusedRow();

                if (_CentroCostoNivelInfo != null)
                {
                    frm = new frmCon_CentroCostos_Nivel_Mant();
                    frm.event_frmCon_CentroCostos_Nivel_Mant_FormClosing += frm_event_frmCon_CentroCostos_Nivel_Mant_FormClosing;
                    frm.Text = frm.Text + "***MODIFICAR REGISTRO***";
                    frm._CentroCostoNivelInfo = _CentroCostoNivelInfo;
                    frm.set_CentroCostoNivel(_CentroCostoNivelInfo);
                    frm.set_Accion(Cl_Enumeradores.eTipo_action.actualizar);
                    frm.MdiParent = this.MdiParent;
                    frm.Show();
                }
                else
                {
                    MessageBox.Show("Seleccione un Registro ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return;
                }
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
 public Boolean ModificarDB(ct_Centro_costo_nivel_Info info)
 {
     try
     {
         using (EntitiesDBConta context = new EntitiesDBConta())
         {
             var contact = context.ct_centro_costo_nivel.FirstOrDefault(minfo => minfo.IdNivel == info.IdNivel && minfo.IdEmpresa == info.IdEmpresa);
             if (contact != null)
             {
                 contact.IdEmpresa      = info.IdEmpresa;
                 contact.IdNivel        = Convert.ToByte(info.IdNivel);
                 contact.ni_descripcion = info.ni_descripcion;
                 contact.ni_digitos     = Convert.ToByte(info.ni_digitos);
                 contact.Estado         = info.Estado;
                 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 List <ct_Centro_costo_nivel_Info> Get_Info_Centro_Costo_nivel(int IdEmpresa)
        {
            try
            {
                List <ct_Centro_costo_nivel_Info> lM = new List <ct_Centro_costo_nivel_Info>();
                EntitiesDBConta OECCostoN            = new EntitiesDBConta();
                var             selectCCostoN        = from C in OECCostoN.ct_centro_costo_nivel
                                                       where C.IdEmpresa == IdEmpresa
                                                       select C;

                foreach (var item in selectCCostoN)
                {
                    ct_Centro_costo_nivel_Info Cbt = new ct_Centro_costo_nivel_Info();
                    Cbt.IdEmpresa      = item.IdEmpresa;
                    Cbt.IdNivel        = item.IdNivel;
                    Cbt.ni_descripcion = item.ni_descripcion;
                    Cbt.ni_digitos     = item.ni_digitos;
                    Cbt.Estado         = item.Estado;
                    lM.Add(Cbt);
                }
                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();
                throw new Exception(ex.ToString());
            }
        }
        public Boolean EliminarDB(ct_Centro_costo_nivel_Info info)
        {
            try
            {
                using (EntitiesDBConta context = new EntitiesDBConta())
                {
                    var contact = context.ct_centro_costo_nivel.FirstOrDefault(dinfo => dinfo.IdEmpresa == info.IdEmpresa && dinfo.IdNivel == info.IdNivel);

                    if (contact != null)
                    {
                        contact.IdUsuarioUltAnu = info.IdUsuarioUltAnu;
                        contact.Fecha_UltAnu    = info.Fecha_UltAnu;
                        contact.MotivoAnulacion = info.MotivoAnulacion;
                        contact.Estado          = "I";
                        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());
            }
        }
 private void gridViewNivel_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
 {
     try
     {
         _CentroCostoNivelInfo = GetSelectedRow((DevExpress.XtraGrid.Views.Grid.GridView)sender);
     }
     catch (Exception ex)
     {
         Log_Error_bus.Log_Error(ex.ToString());
         MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Exemplo n.º 6
0
 public Boolean GrabarDB(ct_Centro_costo_nivel_Info info)
 {
     try
     {
         ct_Centro_costo_nivel_Data data = new ct_Centro_costo_nivel_Data();
         return(data.GrabarDB(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("", "GrabarDB", ex.Message), ex)
               {
                   EntityType = typeof(ct_Centro_costo_nivel_Bus)
               };
     }
 }
Exemplo n.º 7
0
 public void set_CentroCostoNivel(ct_Centro_costo_nivel_Info info)
 {
     try
     {
         lblnivel.Text         = info.IdNivel.ToString();
         txtdescripcion.Text   = info.ni_descripcion;
         num_digitos.Value     = Convert.ToInt32(info.ni_digitos);
         chk_estado.Checked    = (info.Estado == "A") ? true : false;
         _CentroCostoNivelInfo = info;
     }
     catch (Exception ex)
     {
         Log_Error_bus.Log_Error(ex.ToString());
         MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Exemplo n.º 8
0
 void LimpiarDatos()
 {
     try
     {
         _Accion = Cl_Enumeradores.eTipo_action.grabar;
         _CentroCostoNivelInfo = new ct_Centro_costo_nivel_Info();
         this.lblnivel.Text    = _CentroCostoNivelBus.Get_Id(param.IdEmpresa).ToString();
         txtdescripcion.Text   = "";
         num_digitos.Value     = 0;
         chk_estado.Checked    = true;
     }
     catch (Exception ex)
     {
         Log_Error_bus.Log_Error(ex.ToString());
         MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
 public Boolean GrabarDB(ct_Centro_costo_nivel_Info info)
 {
     try
     {
         using (EntitiesDBConta context = new EntitiesDBConta())
         {
             EntitiesDBConta EDB = new EntitiesDBConta();
             var             Q   = from per in EDB.ct_centro_costo_nivel
                                   where per.IdNivel == info.IdNivel && per.IdEmpresa == info.IdEmpresa
                                   select per;
             if (Q.ToList().Count == 0)
             {
                 var address = new ct_centro_costo_nivel();
                 address.IdEmpresa      = info.IdEmpresa;
                 address.IdNivel        = Convert.ToByte(info.IdNivel);
                 address.ni_descripcion = info.ni_descripcion;
                 address.ni_digitos     = Convert.ToByte(info.ni_digitos);
                 address.Estado         = "A";
                 context.ct_centro_costo_nivel.Add(address);
                 context.SaveChanges();
             }
             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();
         throw new Exception(ex.ToString());
     }
 }