public Boolean ModificarDB(cxc_Cobro_Tipo_x_Anticipo_Info Info)
 {
     try
     {
         Boolean res = false;
         EntitiesCuentas_x_Cobrar context = new EntitiesCuentas_x_Cobrar();
         var address = context.cxc_cobro_tipo_x_anticipo.FirstOrDefault(var => var.IdCobro_tipo == Info.IdCobro_tipo && var.IdEmpresa == Info.IdEmpresa);
         if (address != null)
         {
             address.posicion = (int)Info.posicion;
             context.SaveChanges();
             res = true;
         }
         return(res);
     }
     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 <cxc_Cobro_Tipo_x_Anticipo_Info> Get_List_Cobro_Tipo_x_Anticipo(int IdEmpresa)
        {
            try
            {
                List <cxc_Cobro_Tipo_x_Anticipo_Info> lst = new List <cxc_Cobro_Tipo_x_Anticipo_Info>();
                cxc_Cobro_Tipo_x_Anticipo_Info        Info;
                EntitiesCuentas_x_Cobrar context = new EntitiesCuentas_x_Cobrar();
                var address = from q in context.cxc_cobro_tipo_x_anticipo
                              where q.IdEmpresa == IdEmpresa
                              orderby q.posicion
                              select q;

                foreach (var item in address)
                {
                    Info              = new cxc_Cobro_Tipo_x_Anticipo_Info();
                    Info.IdEmpresa    = item.IdEmpresa;
                    Info.IdCobro_tipo = item.IdCobro_tipo;
                    Info.posicion     = (int)item.posicion;

                    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.InnerException + " " + ex.Message;
                throw new Exception(ex.InnerException.ToString());
            }
        }
Beispiel #3
0
        private void gridViewcxc_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e)
        {
            try
            {
                if (e.Column.Name == "colIco")
                {
                    ConsultarCobro();
                }

                if (e.Column.Name == "colNewTipoCobro")
                {
                    frmCxc_cobro_tipo_Mant frm = new frmCxc_cobro_tipo_Mant();
                    frm.setAccion(Cl_Enumeradores.eTipo_action.grabar);
                    frm.ShowDialog();

                    string IdTipoCobro = frm.IdTipoCobro;
                    if (IdTipoCobro != null)
                    {
                        cxc_Cobro_Tipo_x_Anticipo_Bus  busTipAntCob  = new cxc_Cobro_Tipo_x_Anticipo_Bus();
                        cxc_Cobro_Tipo_x_Anticipo_Info InfoTipAntCob = new cxc_Cobro_Tipo_x_Anticipo_Info();
                        InfoTipAntCob.IdEmpresa    = param.IdEmpresa;
                        InfoTipAntCob.IdCobro_tipo = IdTipoCobro;
                        InfoTipAntCob.posicion     = 1;
                        busTipAntCob.GuardarDB(InfoTipAntCob);
                        CargarTipoCobro();
                        gridViewcxc.SetFocusedRowCellValue(colIdCobro_tipo, IdTipoCobro);
                    }
                }
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void gridViewCobroAnticipo_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            try
            {
                cxc_Cobro_Tipo_x_Anticipo_Info item = (cxc_Cobro_Tipo_x_Anticipo_Info)gridViewCobroAnticipo.GetFocusedRow();
                cTipoAntiBus.ModificarDB(item);
                ActualizarGrid();
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());

                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
 public Boolean EliminarDB(cxc_Cobro_Tipo_x_Anticipo_Info Info)
 {
     try
     {
         return(data.EliminarDB(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("", "EliminarDB", ex.Message), ex)
               {
                   EntityType = typeof(cxc_Cobro_Tipo_x_Anticipo_Bus)
               };
     }
 }
        void Transformar()
        {
            try
            {
                var item = (List <cxc_cobro_tipo_Info>)gridViewTipoCobro.DataSource;
                foreach (var a in item)
                {
                    Info              = new cxc_Cobro_Tipo_x_Anticipo_Info();
                    Info.IdEmpresa    = param.IdEmpresa;
                    Info.IdCobro_tipo = a.IdCobro_tipo;
                    Info.posicion     = 0;
                    lst.Add(Info);
                }
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());

                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
 public Boolean GuardarDB(cxc_Cobro_Tipo_x_Anticipo_Info Info)
 {
     try
     {
         EntitiesCuentas_x_Cobrar context = new EntitiesCuentas_x_Cobrar();
         var address = new cxc_cobro_tipo_x_anticipo();
         address.IdEmpresa    = Info.IdEmpresa;
         address.IdCobro_tipo = Info.IdCobro_tipo;
         address.posicion     = (int)Info.posicion;
         context.cxc_cobro_tipo_x_anticipo.Add(address);
         context.SaveChanges();
         return(true);
     }
     catch (Exception ex)
     {
         string arreglo = ToString();
         tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
         tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "",
                                                                                   "", "", "", "", DateTime.Now);
         oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
         mensaje = ex.InnerException + " " + ex.Message;
         throw new Exception(ex.InnerException.ToString());
     }
 }