Exemplo n.º 1
0
        protected void cmbKAM_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
        {
            try
            {
                #region Desbloqueos y más

                if (cmbKAM.Text.Equals(String.Empty) || cmbKAM.SelectedValue.Equals(String.Empty))
                {
                    RadAjaxManager1.ResponseScripts.Add(String.Format("alert('Seleccion invalida, seleccione un KAM de la lista.');"));
                    btEditar.Enabled = false;
                    return;
                }

                btEditar.Enabled = true;
                lbxCuentasFuente.Items.Clear();
                lbxCuentasDestino.Items.Clear();

                #endregion

                valoresInicio = new List<string>();

                Connection conexion = new Connection();
                string query = String.Format("SELECT KAM_NAME, KAM_MAIL, KAM_ACTIVE, RECEIVE_MAIL FROM KAM WHERE KAM_ID = '{0}'", cmbKAM.SelectedValue);
                DataTable Kaminfo = conexion.getGridDataSource(query);

                //Carga los controles con la info del KAM devuleta por el query
                txtNombreKAM.Text = Kaminfo.Rows[0]["KAM_NAME"].ToString();
                txtCorreo.Text = Kaminfo.Rows[0]["KAM_MAIL"].ToString();
                chkHabilitarKam.Checked = Convert.ToBoolean(Kaminfo.Rows[0]["KAM_ACTIVE"].ToString());
                chkHabilitarCorreo.Checked = Convert.ToBoolean(Kaminfo.Rows[0]["RECEIVE_MAIL"].ToString());

                cargarCuentasDisponibles(conexion);

                query = String.Format("SELECT CK.CLIENT_ID, CK.CLIENT_NAME FROM CLIENTES_KC AS CK JOIN CUENTAS_KAM AS C ON CK.CLIENT_ID = C.CLIENT_ID WHERE C.KAM_ID = '{0}'",
                    cmbKAM.SelectedValue);
                Kaminfo = conexion.getGridDataSource(query);

                foreach (DataRow fila in Kaminfo.Rows)
                {
                    RadListBoxItem item = new RadListBoxItem();

                    valoresInicio.Add(fila["CLIENT_ID"].ToString());
                    item.Text = fila["CLIENT_NAME"].ToString();
                    item.Value = fila["CLIENT_ID"].ToString();

                    item.DataBind();
                    lbxCuentasDestino.Items.Add(item);
                }
            }
            catch (Exception error)
            {
                RadAjaxManager1.ResponseScripts.Add(String.Format("errorEnvio('{0}');", error.Message));
            }
        }
Exemplo n.º 2
0
        private void cargarCuentasDisponibles(Connection conexion)
        {
            try
            {
                string query = String.Format("select ckc.CLIENT_ID, ckc.CLIENT_NAME from CLIENTES_KC as ckc where ckc.COUNTRY = '{0}' and ckc.DIRECT_CUSTOMER = 0 and 0 = (select COUNT(ck.KAM_ID) from CUENTAS_KAM as ck where ck.CLIENT_ID = ckc.CLIENT_ID)",
                        conexion.getUserCountry(Session.Contents["userid"].ToString()));

                DataTable resultset = conexion.getGridDataSource(query);
                foreach (DataRow fila in resultset.Rows)
                {
                    RadListBoxItem item = new RadListBoxItem();

                    item.Text = fila["CLIENT_NAME"].ToString();
                    item.Value = fila["CLIENT_ID"].ToString();

                    item.DataBind();
                    lbxCuentasFuente.Items.Add(item);
                }
            }
            catch (Exception error)
            {
                RadAjaxManager1.ResponseScripts.Add(String.Format("errorEnvio('{0}');", error.Message));
            }
        }