private Boolean fx_Verificar_Reg_Repetidos(fa_compensacion_x_ct_centro_costo_det_Info Info_det)
        {
            try
            {
                int cont = 0;



                cont = (from C in lista_compensacion
                        where C.num_mes == Info_det.num_mes
                        select C).Count();
                if (cont > 0)
                {
                    return(false);
                }

                else
                {
                    return(true);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                Log_Error_bus.Log_Error(ex.ToString()); return(false);
            }
        }
        private Boolean Agregar_fila_copiada(string data)
        {
            try
            {
                if (string.IsNullOrWhiteSpace(data))
                {
                    return(false);
                }
                string[] rowData = data.Split(new char[] { '\r', '\x09' });

                fa_compensacion_x_ct_centro_costo_det_Info newRow = new fa_compensacion_x_ct_centro_costo_det_Info();
                if (rowData.Count() >= 3) //return false;
                {
                    string num_mes                    = Convert.ToString(rowData[0]);
                    string capital_reducido           = Convert.ToString(rowData[1]);
                    string valor_amortizacion         = Convert.ToString(rowData[2]);
                    string valor_interes_banco        = Convert.ToString(rowData[3]);
                    string valor_interes_centro_costo = Convert.ToString(rowData[4]);
                    string valor_interes_diferencia   = Convert.ToString(rowData[5]);
                    string dividendo                  = Convert.ToString(rowData[6]);



                    if (!string.IsNullOrWhiteSpace(num_mes.ToString()))
                    {
                        //
                        newRow.num_mes                    = num_mes == "0.00" ? 0 : Convert.ToInt32(num_mes.Replace(".00", ""));
                        newRow.capital_reducido           = capital_reducido == "" ? 0 : Convert.ToDouble(capital_reducido.Replace(".00", ""));
                        newRow.valor_amortizacion         = valor_amortizacion == "" ? 0 : Convert.ToDouble(valor_amortizacion);
                        newRow.valor_interes_banco        = valor_interes_banco == "" ? 0 : Convert.ToDouble(valor_amortizacion);
                        newRow.valor_interes_centro_costo = valor_interes_centro_costo == "" ? 0 : Convert.ToDouble(valor_interes_centro_costo);
                        newRow.valor_interes_diferencia   = valor_interes_diferencia == "" ? 0 : Convert.ToDouble(valor_interes_diferencia);
                        newRow.dividendo                  = dividendo == "" ? 0 : Convert.ToDouble(dividendo);
                        if (fx_Verificar_Reg_Repetidos(newRow))
                        {
                            lista_compensacion.Add(newRow);
                        }



                        return(true);
                    }
                    else
                    {
                        MessageBox.Show("No hay las columnas necesarias para insertar al registros");
                        return(false);
                    }
                }

                return(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
                Log_Error_bus.Log_Error(ex.ToString());
                return(false);
            }
        }
Exemple #3
0
        public List <fa_compensacion_x_ct_centro_costo_det_Info> GetList(int IdEmpresa, int IdCompensacion)
        {
            try
            {
                List <fa_compensacion_x_ct_centro_costo_det_Info> lista = new List <fa_compensacion_x_ct_centro_costo_det_Info>();


                using (Entity_Facturacion_FJ Context = new Entity_Facturacion_FJ())
                {
                    var contact = from q in Context.fa_compensacion_x_ct_centro_costo_det
                                  where q.IdEmpresa == IdEmpresa &&
                                  q.IdCompensacion == IdCompensacion
                                  select q;

                    foreach (var item in contact)
                    {
                        fa_compensacion_x_ct_centro_costo_det_Info Info = new fa_compensacion_x_ct_centro_costo_det_Info();
                        Info.IdEmpresa                  = item.IdEmpresa;
                        Info.IdCompensacion             = item.IdCompensacion;
                        Info.Secuencia                  = item.Secuencia;
                        Info.num_mes                    = item.num_mes;
                        Info.capital_reducido           = item.IdEmpresa;
                        Info.valor_amortizacion         = item.valor_amortizacion;
                        Info.valor_interes_centro_costo = item.valor_interes_centro_costo;
                        Info.valor_interes_diferencia   = item.valor_interes_diferencia;
                        Info.dividendo                  = item.dividendo;
                        Info.IdPeriodo                  = item.IdPeriodo;
                        Info.estado_cobro               = item.estado_cobro;
                        Info.IdPeriodo                  = item.IdPeriodo;
                        lista.Add(Info);
                    }
                }
                return(lista);
            }
            catch (Exception ex)
            {
                string array = 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(), "", array, "", "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref MensajeError);
                MensajeError = ex.ToString() + " " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }