示例#1
0
        public void Cargar(ref BE.AfpComision beAfpComision, ref DataRow dr)
        {
            try
            {
                beAfpComision.IdAfpComision           = dr["IdAfpComision"] == DBNull.Value ? 0 : int.Parse(dr["IdAfpComision"].ToString());
                beAfpComision.Anho                    = dr["Anho"] == DBNull.Value ? 0 : int.Parse(dr["Anho"].ToString());
                beAfpComision.Mes                     = dr["Mes"] == DBNull.Value ? 0 : int.Parse(dr["Mes"].ToString());
                beAfpComision.PorcentajeFondo         = dr["PorcentajeFondo"] == DBNull.Value ? 0.0 : double.Parse(dr["PorcentajeFondo"].ToString());
                beAfpComision.PorcentajeSeguro        = dr["PorcentajeSeguro"] == DBNull.Value ? 0.0 : double.Parse(dr["PorcentajeSeguro"].ToString());
                beAfpComision.PorcentajeComisionFlujo = dr["PorcentajeComisionFlujo"] == DBNull.Value ? 0.0 : double.Parse(dr["PorcentajeComisionFlujo"].ToString());
                beAfpComision.PorcentajeComisionMixta = dr["PorcentajeComisionMixta"] == DBNull.Value ? 0.0 : double.Parse(dr["PorcentajeComisionMixta"].ToString());

                if (dr["IdAfp"] != DBNull.Value)
                {
                    int idAfp = dr["IdAfp"] == DBNull.Value ? 0 : int.Parse(dr["IdAfp"].ToString());
                    beAfpComision.Afp = new BE.Afp()
                    {
                        IdAfp = idAfp
                    };
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#2
0
        public List <BE.AfpComision> Listar(BE.AfpComision beAfpComision)
        {
            List <BE.AfpComision> lstAfpComision = new List <BE.AfpComision>();

            try
            {
                var daAfpComision = new DA.AfpComision();

                DataTable dt = daAfpComision.Listar(beAfpComision);

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    var beComision = new BE.AfpComision();

                    DataRow dr = dt.Rows[i];
                    daAfpComision.Cargar(ref beComision, ref dr);

                    var afp = beComision.Afp;
                    new DA.Afp().Obtener(ref afp);
                    beComision.Afp = afp;

                    lstAfpComision.Add(beComision);
                }


                return(lstAfpComision);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#3
0
        public int Actualizar(ref BE.AfpComision beAfpComision)
        {
            try
            {
                string sp           = "SpTbAfpComisionActualizar";
                int    rowsAffected = 0;

                using (SqlConnection cnn = new SqlConnection(ConnectionManager.ConexionLocal))
                {
                    cnn.Open();

                    SqlCommand cmd = new SqlCommand(sp, cnn);
                    cmd.CommandType = CommandType.StoredProcedure;

                    cmd.Parameters.Add(new SqlParameter("@IDAFPCOMISION", beAfpComision.IdAfpComision));
                    cmd.Parameters.Add(new SqlParameter("@ANHO", beAfpComision.Anho));
                    cmd.Parameters.Add(new SqlParameter("@MES", beAfpComision.Mes));
                    cmd.Parameters.Add(new SqlParameter("@IDAFP", beAfpComision.Afp.IdAfp));
                    cmd.Parameters.Add(new SqlParameter("@PORCENTAJEFONDO", beAfpComision.PorcentajeFondo));
                    cmd.Parameters.Add(new SqlParameter("@PORCENTAJESEGURO", beAfpComision.PorcentajeSeguro));
                    cmd.Parameters.Add(new SqlParameter("@PORCENTAJECOMISIONFLUJO", beAfpComision.PorcentajeComisionFlujo));
                    cmd.Parameters.Add(new SqlParameter("@PORCENTAJECOMISIONMIXTA", beAfpComision.PorcentajeComisionMixta));

                    rowsAffected = cmd.ExecuteNonQuery();
                }

                return(rowsAffected);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#4
0
        public int Eliminar(BE.AfpComision beAfpComision)
        {
            try
            {
                string sp           = "SpTbAfpComisionEliminar";
                int    rowsAffected = 0;

                using (SqlConnection cnn = new SqlConnection(ConnectionManager.ConexionLocal))
                {
                    cnn.Open();

                    SqlCommand cmd = new SqlCommand(sp, cnn);
                    cmd.CommandType = CommandType.StoredProcedure;

                    cmd.Parameters.Add(new SqlParameter("@IDAFPCOMISION", beAfpComision.IdAfpComision));

                    rowsAffected = cmd.ExecuteNonQuery();
                }

                return(rowsAffected);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#5
0
        public BE.AfpComision Obtener(int idAfpComision)
        {
            BE.AfpComision beAfpComision = null;
            try
            {
                string sp = "SpTbAfpComisionObtener2";

                using (SqlConnection cnn = new SqlConnection(ConnectionManager.ConexionLocal))
                {
                    cnn.Open();

                    SqlCommand cmd = new SqlCommand(sp, cnn);
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.Add(new SqlParameter("@IDAFPCOMISION", idAfpComision));

                    SqlDataReader reader = cmd.ExecuteReader();
                    if (reader.Read())
                    {
                        beAfpComision = new BE.AfpComision();

                        beAfpComision.IdAfpComision           = reader["IdAfpComision"] == DBNull.Value ? 0 : int.Parse(reader["IdAfpComision"].ToString());
                        beAfpComision.Anho                    = reader["Anho"] == DBNull.Value ? 0 : int.Parse(reader["Anho"].ToString());
                        beAfpComision.Mes                     = reader["Mes"] == DBNull.Value ? 0 : int.Parse(reader["Mes"].ToString());
                        beAfpComision.PorcentajeFondo         = reader["PorcentajeFondo"] == DBNull.Value ? 0.0 : double.Parse(reader["PorcentajeFondo"].ToString());
                        beAfpComision.PorcentajeSeguro        = reader["PorcentajeSeguro"] == DBNull.Value ? 0.0 : double.Parse(reader["PorcentajeSeguro"].ToString());
                        beAfpComision.PorcentajeComisionFlujo = reader["PorcentajeComisionFlujo"] == DBNull.Value ? 0.0 : double.Parse(reader["PorcentajeComisionFlujo"].ToString());
                        beAfpComision.PorcentajeComisionMixta = reader["PorcentajeComisionMixta"] == DBNull.Value ? 0.0 : double.Parse(reader["PorcentajeComisionMixta"].ToString());

                        if (reader["IdAfp"] != DBNull.Value)
                        {
                            int idAfp = reader["IdAfp"] == DBNull.Value ? 0 : int.Parse(reader["IdAfp"].ToString());
                            var beAfp = new BE.Afp()
                            {
                                IdAfp = idAfp
                            };

                            if (new DA.Afp().Obtener(ref beAfp))
                            {
                                beAfpComision.Afp = beAfp;
                            }
                        }
                    }
                }

                return(beAfpComision);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#6
0
 public List <BE.AfpComision> Listar(int anho, int mes)
 {
     try
     {
         var beAfpComision = new BE.AfpComision();
         beAfpComision.Anho = anho;
         beAfpComision.Mes  = mes;
         return(Listar(beAfpComision));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
示例#7
0
        public BE.AfpComision Obtener(int idAfp, int anho, int mes)
        {
            BE.AfpComision beAfpComision = null;
            try
            {
                var daAfpComision = new DA.AfpComision();

                beAfpComision = daAfpComision.Obtener(idAfp, anho, mes);

                return(beAfpComision);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#8
0
        private void BtnSave_Click(object sender, EventArgs e)
        {
            try
            {
                int anho = int.Parse(this.cboAnho.SelectedValue.ToString());
                int mes  = int.Parse(this.cboMes.SelectedValue.ToString());

                foreach (BE.UI.AfpComision uiComision in this.lstUiComisiones)
                {
                    var beAfp = new BE.Afp()
                    {
                        IdAfp  = uiComision.AfpID,
                        Nombre = uiComision.AfpNombre
                    };

                    var beComision = new BE.AfpComision
                    {
                        Afp                     = beAfp,
                        IdAfpComision           = uiComision.IdAfpComision,
                        Anho                    = anho,
                        Mes                     = mes,
                        PorcentajeFondo         = uiComision.PorcentajeFondo,
                        PorcentajeSeguro        = uiComision.PorcentajeSeguro,
                        PorcentajeComisionFlujo = uiComision.PorcentajeComisionFlujo,
                        PorcentajeComisionMixta = uiComision.PorcentajeComisionMixta,
                    };

                    var lnComision = new LN.AfpComision();
                    if (beComision.IdAfpComision > 0)
                    {
                        lnComision.Actualizar(beComision);
                    }
                    else
                    {
                        lnComision.Insertar(ref beComision);
                    }
                }

                Util.InformationMessage("Se guardo los datos de la Comision");

                this.CargarComisiones();
            }
            catch (Exception ex)
            {
                Util.ErrorMessage(ex.Message);
            }
        }
示例#9
0
        public int Eliminar(BE.AfpComision beAfpComision)
        {
            int rowsAffected = 0;

            try
            {
                var daAfpComision = new DA.AfpComision();

                rowsAffected = daAfpComision.Eliminar(beAfpComision);

                return(rowsAffected);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#10
0
        public int Actualizar(BE.AfpComision beAfpComision)
        {
            int rowsAffected = 0;

            try
            {
                var daAfpComision = new DA.AfpComision();

                rowsAffected = daAfpComision.Actualizar(ref beAfpComision);

                return(rowsAffected);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#11
0
        public BE.AfpComision Obtener(int idAfp, int anho, int mes)
        {
            BE.AfpComision beAfpComision = null;
            try
            {
                string sp = "SpTbAfpComisionObtener";

                SqlConnection cnn = new SqlConnection(ConnectionManager.ConexionLocal);
                SqlCommand    cmd = new SqlCommand(sp, cnn);
                cmd.CommandType = CommandType.StoredProcedure;

                SqlDataAdapter dad = new SqlDataAdapter(cmd);
                dad.SelectCommand.Parameters.Add(new SqlParameter("@IDAFP", idAfp));
                dad.SelectCommand.Parameters.Add(new SqlParameter("@ANHO", anho));
                dad.SelectCommand.Parameters.Add(new SqlParameter("@MES", mes));

                DataTable dt = new DataTable();
                dad.Fill(dt);

                if ((dt.Rows.Count == 1))
                {
                    DataRow dr = dt.Rows[0];
                    beAfpComision = new BE.AfpComision();
                    Cargar(ref beAfpComision, ref dr);

                    var beAfp = beAfpComision.Afp;
                    if (new Afp().Obtener(ref beAfp) == true)
                    {
                        beAfpComision.Afp = beAfp;
                    }
                }

                return(beAfpComision);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#12
0
        public DataTable Listar(BE.AfpComision beAfpComision)
        {
            try
            {
                string sp = "SpTbAfpComisionListar";

                SqlConnection cnn = new SqlConnection(ConnectionManager.ConexionLocal);
                SqlCommand    cmd = new SqlCommand(sp, cnn);
                cmd.CommandType = CommandType.StoredProcedure;

                SqlDataAdapter dad = new SqlDataAdapter(cmd);
                dad.SelectCommand.Parameters.Add(new SqlParameter("@ANHO", beAfpComision.Anho));
                dad.SelectCommand.Parameters.Add(new SqlParameter("@MES", beAfpComision.Mes));

                DataTable dt = new DataTable();
                dad.Fill(dt);

                return(dt);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }