Ejemplo n.º 1
0
        private int CargarUEN()
        {
            int valorUEN = 0;

            try
            {
                Sesion sesion = new Sesion();
                sesion = (Sesion)Session["Sesion" + Session.SessionID];
                List <CrmCatSolucion> list      = new List <CrmCatSolucion>();
                CN_CrmCatSoluciones   clscrmCat = new CN_CrmCatSoluciones();
                clscrmCat.ComboUen(sesion, ref list);
                ddlUENs.Items.Clear();
                if (list.Count > 0)
                {
                    ddlUENs.DataSource     = list;
                    ddlUENs.DataValueField = "Id";
                    ddlUENs.DataTextField  = "Descripcion";
                    ddlUENs.DataBind();

                    valorUEN = list[0].Id;
                    ddlUENs.SelectedValue = valorUEN.ToString();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(valorUEN);
        }
Ejemplo n.º 2
0
 private List <CrmCatSolucion> GetList()
 {
     try
     {
         if (area == 0)
         {
             area = !string.IsNullOrEmpty(ddlAreas.SelectedValue) ? Convert.ToInt32(ddlAreas.SelectedValue) : 0;
         }
         List <CrmCatSolucion> List = new List <CrmCatSolucion>();
         CN_CrmCatSoluciones   cls  = new CN_CrmCatSoluciones();
         Sesion session2            = new Sesion();
         session2 = (Sesion)Session["Sesion" + Session.SessionID];
         cls.ConsultaCatSolucion(session2, area, ref List);
         return(List);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 3
0
 private int CargarAreas(int segmento)
 {
     area = 0;
     try
     {
         Sesion sesion = new Sesion();
         sesion = (Sesion)Session["Sesion" + Session.SessionID];
         List <CrmCatSolucion> list      = new List <CrmCatSolucion>();
         CN_CrmCatSoluciones   clscrmCat = new CN_CrmCatSoluciones();
         clscrmCat.ComboArea(sesion, segmento, ref list);
         ddlAreas.Items.Clear();
         if (list.Count > 0)
         {
             ddlAreas.DataSource     = list;
             ddlAreas.DataValueField = "Id";
             ddlAreas.DataTextField  = "Descripcion";
             ddlAreas.DataBind();
             area = list[0].Id;
             //for (int i = 0; i < list.Count; i++)
             //    ddlAreas.Items.Add(new RadComboBoxItem(list[i].Id.ToString() + " " + list[i].Descripcion, list[i].Id.ToString()));
             ddlAreas.SelectedValue = area.ToString();
             ddlAreas.Text          = ddlAreas.FindItemByValue(area.ToString()).Text;
             pnlAgrega.Visible      = true;
             this.lblMensajes.Text  = "";
         }
         else
         {
             ddlAreas.Items.Clear();
             ddlAreas.Text         = "";
             pnlAgrega.Visible     = false;
             this.lblMensajes.Text = "No se ha registrado ningún área en el segmento y UEN seleccionada";
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
     return(area);
 }
Ejemplo n.º 4
0
        private int CargarSegmentos(int UEN)
        {
            int valorSegmento = 0;

            try
            {
                Sesion sesion = new Sesion();
                sesion = (Sesion)Session["Sesion" + Session.SessionID];
                List <CrmCatSolucion> list      = new List <CrmCatSolucion>();
                CN_CrmCatSoluciones   clscrmCat = new CN_CrmCatSoluciones();
                clscrmCat.ComboSegmento(sesion, UEN, ref list);
                ddlSegmentos.Items.Clear();
                if (list.Count > 0)
                {
                    ddlSegmentos.DataSource     = list;
                    ddlSegmentos.DataValueField = "Id";
                    ddlSegmentos.DataTextField  = "Descripcion";
                    ddlSegmentos.DataBind();
                    valorSegmento = list[0].Id;
                    ddlSegmentos.SelectedValue = valorSegmento.ToString();
                    ddlSegmentos.Text          = ddlSegmentos.FindItemByValue(valorSegmento.ToString()).Text;
                }
                else
                {
                    ddlSegmentos.Items.Clear();
                    ddlSegmentos.Text = "";
                    ddlAreas.Items.Clear();
                    ddlAreas.Text         = "";
                    pnlAgrega.Visible     = false;
                    this.lblMensajes.Text = "No se ha registrado ningún segmento en la UEN seleccionada";
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(valorSegmento);
        }
Ejemplo n.º 5
0
 private void Eliminar(CrmCatSolucion solucion)
 {
     try
     {
         if (!_PermisoEliminar)
         {
             Alerta("No tiene permisos para eliminar");
             return;
         }
         else
         {
             HF_Modificar.Value = "";
             int    valido  = 0;
             Sesion session = new Sesion();
             session = (Sesion)Session["Sesion" + Session.SessionID];
             CN_CrmCatSoluciones cls = new CN_CrmCatSoluciones();
             cls.EliminarCatSolucion(session, solucion, ref valido);
             if (valido == 1)
             {
                 Alerta("La Solución #" + solucion.Clave + " fue eliminada satisfactoriamente");
             }
             else if (valido == -2)
             {
                 Alerta("No se puede eliminar la solución, ya fue asignada a un proyecto");
             }
             else
             {
                 Alerta("No se pudo eliminar la solución #" + solucion.Clave);
             }
             rgAreas.Rebind();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 6
0
        protected void Guardar()
        {
            try
            {
                CrmCatSolucion soluciones = new CrmCatSolucion();

                soluciones.Area        = !string.IsNullOrEmpty(ddlAreas.SelectedValue) ? Convert.ToInt32(ddlAreas.SelectedValue) : 0;
                soluciones.Descripcion = txtPosicion.Text;         //Request.Form["txtPosicion"].ToString();//txtPosicion.Text;
                soluciones.Porcentaje  = txtPotencial.Value.Value; // == null) ? Convert.ToDouble(txtPotencial.Value.Value) : 0;

                if (soluciones.Area == 0)
                {
                    Alerta("Seleccione una área valida");
                    return;
                }
                if (string.IsNullOrEmpty(soluciones.Descripcion))
                {
                    Alerta("Ingrese una descripción de la solución");
                    return;
                }
                if (soluciones.Porcentaje == 0)
                {
                    Alerta("Ingrese un valor de porcentaje");
                    return;
                }

                soluciones.Id = Convert.ToInt32(MaximoId());
                int valido = 0;
                CN_CrmCatSoluciones cls = new CN_CrmCatSoluciones();
                Sesion session2         = new Sesion();
                session2 = (Sesion)Session["Sesion" + Session.SessionID];

                if (HF_Modificar.Value == "")
                {
                    if (!_PermisoGuardar)
                    {
                        Alerta("No tiene permisos para grabar");
                        return;
                    }
                    cls.InsertCatSolucion(session2, soluciones, ref valido);
                }
                else
                {
                    if (!_PermisoModificar)
                    {
                        Alerta("No tiene permisos para modificar");
                        return;
                    }
                    soluciones.Clave = Convert.ToInt32(HF_Modificar.Value);
                    cls.ModificarSolucion(soluciones, session.Emp_Cnx, session.Id_Emp, ref valido);
                }
                if (valido == 1)
                {
                    FinGuardar();
                    //Alerta("Registro agregado satisfactoriamente");
                }
                else
                {
                    Alerta("Ocurrio un error al intentar guardar");
                }

                rgAreas.Rebind();

                txtPosicion.Focus();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }