Exemplo n.º 1
0
        private void Modificar_Gracia(GridCommandEventArgs e)
        {
            GridItem      gi = e.Item;
            int           columna_respuesta = rgGracia.Columns.FindByUniqueName("GUID").OrderIndex;
            PeriodoGracia a = list_gracia.Where(PeriodoGracia => PeriodoGracia.GUID == gi.Cells[columna_respuesta].Text).ToList()[0];

            txtGUIDGracia.Text       = a.GUID;
            TxtCondiciones.DbValue   = a.Reg_Condicion;
            TxtPeriodoGracia.DbValue = a.Reg_Periodo;
        }
Exemplo n.º 2
0
 private void CrearGracia(ref PeriodoGracia gracia)
 {
     try
     {
         gracia.Reg_Periodo   = Convert.ToInt32(TxtPeriodoGracia.Value);
         gracia.Reg_Condicion = Convert.ToInt32(TxtCondiciones.Value);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 3
0
 protected void imgAgregarGracia_Click(object sender, ImageClickEventArgs e)
 {
     try
     {
         PeriodoGracia gracia;
         if (txtGUIDGracia.Text == "")
         {
             gracia      = new PeriodoGracia();
             gracia.GUID = TxtCondiciones.Text;
             if (list_gracia.Where(PeriodoGracia => PeriodoGracia.GUID == gracia.GUID).ToList().Count == 0)
             {
                 CrearGracia(ref gracia);
                 list_gracia.Add(gracia);
             }
             else
             {
                 AlertaFocus("Ya existe una regla para condiciones de pago a " + gracia.GUID + " días", TxtCondiciones.ClientID);
                 return;
             }
         }
         else
         {
             if (list_gracia.Where(PeriodoGracia => PeriodoGracia.GUID == TxtCondiciones.Text).ToList().Count == 0)
             {
                 gracia      = list_gracia.Where(PeriodoGracia => PeriodoGracia.GUID == txtGUIDGracia.Text).ToList()[0];
                 gracia.GUID = TxtCondiciones.Text;
                 CrearGracia(ref gracia);
             }
             else
             {
                 AlertaFocus("Ya existe una regla para condiciones de pago a " + TxtCondiciones.Text + " días", TxtCondiciones.ClientID);
                 return;
             }
         }
         rgGracia.Rebind();
         LimpiarGracia();
         TxtCondiciones.Focus();
     }
     catch (Exception ex)
     {
         ErrorManager(ex, new System.Diagnostics.StackTrace().GetFrame(0).GetMethod().Name);
     }
 }
        public void Consultar(ref List <PeriodoGracia> list_gracia, ref List <Acciones> list_acciones, ref List <Alertas> list_alertas, int Id_Emp, string db, ref Reglas reglas, string Conexion)
        {
            try
            {
                CD_Datos   CapaDatos  = new CD_Datos(Conexion);
                string[]   Parametros = { "@Id_Emp", "@db" };
                object[]   Valores    = { Id_Emp, db };
                DataSet    ds         = null;
                SqlCommand sqlcmd     = CapaDatos.GenerarSqlCommand("spCatConfCobranza_Consultar", ref ds, Parametros, Valores);

                Acciones acciones;
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    acciones = new Acciones();

                    acciones.GUID              = Guid.NewGuid().ToString();
                    acciones.Id_Conf           = Convert.ToInt32(dr["Id_Conf"]);
                    acciones.Etapa             = dr["Etapa"].ToString();
                    acciones.EtapaStr          = dr["EtapaStr"].ToString();
                    acciones.Dias              = Convert.ToDouble(dr["Dias"]);
                    acciones.Tipo_Respuesta    = dr["Tipo_Respuesta"].ToString();
                    acciones.Tipo_RespuestaStr = dr["Tipo_RespuestaStr"].ToString();
                    acciones.Pregunta          = dr["Pregunta"].ToString();
                    acciones.Respuestas        = new System.Collections.ArrayList();
                    acciones.RespuestasStr     = "";
                    list_acciones.Add(acciones);
                }

                foreach (DataRow dr in ds.Tables[1].Rows)
                {
                    acciones = list_acciones.Where(Acciones => Acciones.Id_Conf == Convert.ToInt32(dr["Id_Conf"])).ToList()[0];
                    acciones.Respuestas.Add(dr["Conf_Respuesta"].ToString());

                    if (acciones.RespuestasStr != "")
                    {
                        acciones.RespuestasStr += ", ";
                    }

                    acciones.RespuestasStr += dr["Conf_Respuesta"].ToString();
                }

                Alertas alertas;
                foreach (DataRow dr in ds.Tables[2].Rows)
                {
                    alertas = new Alertas();

                    alertas.GUID                = Guid.NewGuid().ToString();
                    alertas.Etapa               = dr["Etapa"].ToString();
                    alertas.EtapaStr            = dr["EtapaStr"].ToString();
                    alertas.Dias                = Convert.IsDBNull(dr["Dias"]) ? (Double?)null : Convert.ToDouble(dr["Dias"]);
                    alertas.EnviarA             = Convert.ToInt32(dr["EnviarA"]);
                    alertas.EnviarAStr          = dr["EnviarAStr"].ToString();
                    alertas.SuspenderCredito    = Convert.ToBoolean(dr["SuspenderCredito"]);
                    alertas.SuspenderCreditoStr = dr["SuspenderCreditoStr"].ToString();
                    list_alertas.Add(alertas);
                }

                reglas.Plazo = ds.Tables[3].Select("Id_Regla = 1").Length == 0 ? null : ds.Tables[3].Select("Id_Regla = 1")[0]["Reg_Valor"];

                reglas.Id_Tu1 = ds.Tables[3].Select("Id_Regla = 2").Length == 0 ? null : ds.Tables[3].Select("Id_Regla = 2")[0]["Reg_Valor"];
                reglas.Id_Tu2 = ds.Tables[3].Select("Id_Regla = 3").Length == 0 ? null : ds.Tables[3].Select("Id_Regla = 3")[0]["Reg_Valor"];
                reglas.Id_Tu3 = ds.Tables[3].Select("Id_Regla = 4").Length == 0 ? null : ds.Tables[3].Select("Id_Regla = 4")[0]["Reg_Valor"];

                reglas.Val1 = ds.Tables[3].Select("Id_Regla = 5").Length == 0 ? null : ds.Tables[3].Select("Id_Regla = 5")[0]["Reg_Valor"];
                reglas.Val2 = ds.Tables[3].Select("Id_Regla = 6").Length == 0 ? null : ds.Tables[3].Select("Id_Regla = 6")[0]["Reg_Valor"];
                reglas.Val3 = ds.Tables[3].Select("Id_Regla = 7").Length == 0 ? null : ds.Tables[3].Select("Id_Regla = 7")[0]["Reg_Valor"];
                reglas.Val4 = ds.Tables[3].Select("Id_Regla = 8").Length == 0 ? null : ds.Tables[3].Select("Id_Regla = 8")[0]["Reg_Valor"];
                reglas.Val5 = ds.Tables[3].Select("Id_Regla = 9").Length == 0 ? null : ds.Tables[3].Select("Id_Regla = 9")[0]["Reg_Valor"];
                reglas.Val6 = ds.Tables[3].Select("Id_Regla = 10").Length == 0 ? null : ds.Tables[3].Select("Id_Regla = 10")[0]["Reg_Valor"];

                PeriodoGracia periodogracia;
                foreach (DataRow dr in ds.Tables[4].Rows)
                {
                    periodogracia = new PeriodoGracia();

                    periodogracia.GUID          = dr["Reg_Condicion"].ToString();
                    periodogracia.Reg_Condicion = Convert.ToInt32(dr["Reg_Condicion"]);
                    periodogracia.Reg_Periodo   = Convert.ToInt32(dr["Reg_Periodo"]);
                    list_gracia.Add(periodogracia);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }