本文整理汇总了C#中Connection.getUserCountry方法的典型用法代码示例。如果您正苦于以下问题:C# Connection.getUserCountry方法的具体用法?C# Connection.getUserCountry怎么用?C# Connection.getUserCountry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Connection
的用法示例。
在下文中一共展示了Connection.getUserCountry方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
try
{
Menu menu = Master.FindControl("NavigationMenu") as Menu;
menu.Items[2].ChildItems[0].ChildItems.RemoveAt(1);
if (Session.Contents["rol"].ToString().Equals("DSTADM"))
Response.Redirect("../Default.aspx");
Connection conexion = new Connection();
string query = String.Empty;
SqlDataSource1.ConnectionString = conexion.getConnectionString();
if (Session.Contents["rol"].ToString().Equals("KCPADM"))
query = String.Format("SELECT USER_ID, USER_NAME, STATUS, E_MAIL FROM USUARIOS AS U WHERE USER_ID <> '{0}' AND ID_COUNTRY = '{1}' AND 0 = (SELECT count(Kam.KAM_NAME) from Kam where Kam.KAM_ID = U.USER_ID AND Kam.KAM_ACTIVE = 1)",
Session.Contents["userid"].ToString(), conexion.getUserCountry(Session.Contents["userid"].ToString()));
else if (Session.Contents["rol"].ToString().Equals("KCPCCR"))
query = String.Format("SELECT USER_ID, USER_NAME, STATUS, E_MAIL FROM USUARIOS WHERE USER_ID <> '{0}' AND ID_COUNTRY = '{1}' AND (ID_ROL <> 'KCPADM' AND ID_ROL <> 'KCPCCR')",
Session.Contents["userid"].ToString(), conexion.getUserCountry(Session.Contents["userid"].ToString()));
SqlDataSource1.SelectCommand = query;
SqlDataSource1.ConflictDetection = ConflictOptions.CompareAllValues;
}
catch (Exception error)
{
RadAjaxManager1.ResponseScripts.Add(String.Format("errorEnvio('{0}');", error.Message));
}
}
示例2: cargarDataSources
private void cargarDataSources()
{
try
{
Connection conexion = new Connection();
sqlEstadoCiudad.ConnectionString = conexion.getConnectionString();
sqlEstadoCiudad.SelectCommand = String.Format("SELECT DIVISION_NAME, CITY_NAME FROM DIVISION_TERRITORIAL WHERE COUNTRY_ID = '{0}';", conexion.getUserCountry(Session.Contents["userid"].ToString()));
sqlSegmentos.ConnectionString = conexion.getConnectionString();
sqlSegmentos.SelectCommand = String.Format("SELECT SUB_SEGMENT_ID, SUB_SEGMENT_NAME FROM SUB_SEGMENTOS WHERE SUB_SEGMENT_ID <> 0 ORDER BY SUB_SEGMENT_ID ASC;");
sqlDispensadorProducto.ConnectionString = conexion.getConnectionString();
sqlDispensadorProducto.SelectCommand = String.Format("SELECT D.ID_DISPENSER, D.DESCRIPTION, D.DISPENSER_FACE FROM DISPENSADORES AS D JOIN DISPENSADOR_PAIS AS DP ON DP.DISPENSER_ID = D.ID_DISPENSER WHERE DP.COUNTRY_ID = '{0}' AND DP.DISPENSER_STATUS = 1 ORDER BY D.ID_DISPENSER ASC;",
conexion.getUserCountry(Session.Contents["userid"].ToString()));
}
catch (Exception error)
{
radajaxmanager.ResponseScripts.Add(String.Format("errorEnvio('{0}');", error.Message));
}
}
示例3: cargarProducto
private void cargarProducto(string dispenserID)
{
try
{
Connection conexion = new Connection();
cmbProducto.EmptyMessage = "Seleccione un producto";
cmbProducto.Items.Clear();
string userCountry = conexion.getUserCountry(Session["userid"].ToString());
string query = String.Format("SELECT PRODUCT_ID, PRODUCT_DESCRIP FROM PRODUCTOS WHERE DISPENSER_ID = '{0}' AND COUNTRY_ID = '{1}'", dispenserID, userCountry);
try
{
SqlConnection bridge = new SqlConnection(conexion.getConnectionString());
SqlDataAdapter adapter = new SqlDataAdapter(query, bridge);
DataTable datatable = new DataTable();
adapter.Fill(datatable);
foreach (DataRow datarow in datatable.Rows)
{
RadComboBoxItem item = new RadComboBoxItem();
item.Text = datarow["PRODUCT_ID"].ToString() + " " + datarow["PRODUCT_DESCRIP"].ToString();
item.Value = datarow["PRODUCT_ID"].ToString();
cmbProducto.Items.Add(item);
item.DataBind();
}
}
catch (SqlException)
{
radajaxmanager.ResponseScripts.Add(@"alert('Error inesperado de conexion, no se logro cargar la lista de productos refresque la pagina" +
" o intentelo mas tarde.');");
return;
}
}
catch (Exception error)
{
radajaxmanager.ResponseScripts.Add(String.Format("errorEnvio('{0}');", error.Message));
}
}
示例4: cargarCuentasDisponibles
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));
}
}
示例5: btCrear_Click
protected void btCrear_Click(object sender, EventArgs e)
{
try
{
Connection conexion = new Connection();
foreach (GridDataItem dataItem in grdDescripciones.MasterTableView.Items)
{
TableCell celdaProducto = dataItem["CodigoProducto"];
TableCell celdaDispensador = dataItem["CodigoDispensador"];
string tempProducto = celdaProducto.Text;
string tempDispensador = celdaDispensador.Text;
if (cmbDispensador.SelectedValue.Equals(tempDispensador))
{
string queryProducto = String.Format("SELECT PRODUCT_ID FROM PRODUCTOS WHERE DISPENSER_ID = '{0}' AND COUNTRY_ID = '{1}'",
cmbDispensador.SelectedValue, conexion.getUserCountry(Session.Contents["userid"].ToString()));
DataTable codigosProducto = conexion.getGridDataSource(queryProducto);
foreach (DataRow fila in codigosProducto.Rows)
{
if (fila["PRODUCT_ID"].ToString().Equals(tempProducto))
{
radajaxmanager.ResponseScripts.Add(@"alert('Ya existe un detalle en la solicitud con estos requisitos.');");
return;
}
}
}
}
DataTable tabla = conexion.getGridDataSource(String.Format("SELECT DISPENSER_PRICE FROM DISPENSADOR_PAIS WHERE DISPENSER_ID = '{0}' AND COUNTRY_ID = '{1}'",
cmbDispensador.SelectedValue, conexion.getUserCountry(Session.Contents["userid"].ToString())));
double precio = Convert.ToDouble(tabla.Rows[0]["DISPENSER_PRICE"].ToString());
double inversion = precio * Convert.ToInt32(txtCantDis.Text);
/*string query = String.Format("INSERT INTO DESCRIPCION_DISPENSADORES (DR_ID, DISPENSER_ID, PRODUCT_ID, DISPENSER_QUANTITY, PRODUCT_QUANTITY, STATUS_ID, INVERSION) VALUES " +
"({0}, '{1}', '{2}', {3}, {4}, 1, {5})", Convert.ToInt32(Session["solicitud"].ToString()), cmbDispensador.SelectedValue, cmbProducto.SelectedValue, Convert.ToInt32(txtCantDis.Text),
Convert.ToInt32(txtProducto.Text), inversion);
string estadoActual = conexion.getSolicitudInfo("STATUS_ID", Session["solicitud"].ToString());
//Se usa dispenser general ya que acepta un string como query se agrega el nuevo dispensador
if (conexion.setDispenserGeneral(query))
RadAjaxManager1.ResponseScripts.Add(@"alert('Ingresado con exito.');");
else
RadAjaxManager1.ResponseScripts.Add(@"alert('Error al insertar contactese con el administrador.');");
//Recalcula la inversion despues de la inserccion
recalcularInversion();
query = String.Format("UPDATE SOLICITUD_DISPENSADORES SET STATUS_ID = 5 WHERE DR_ID = '{0}'", Session.Contents["solicitud"].ToString());
if (estadoActual.Equals("1"))
if (conexion.Actualizar(query))
lblDescripcionEstado.Text = conexion.getStatusDescripInfo("STATUS_DESCRIP", "STATUS_ID", "5");
cmbDispensador.Items.Clear();
cmbProducto.Items.Clear();
txtCantDis.Value = 0;
txtProducto.Value = 0;
mostrarOcultar(false);
btNuevo.Visible = true;
pnlDescripcionSol.Visible = true;
btAprobar.Visible = true;
btRechazar.Visible = true;
btGuardar.Visible = true;
btCerrarCita.Visible = true;
grdDescripciones.Rebind();*/
}
catch (Exception error)
{
radajaxmanager.ResponseScripts.Add(String.Format("errorEnvio('{0}');", error.Message));
}
}
示例6: setDataSources
protected void setDataSources()
{
Connection conexion = new Connection();
sqlCiudad.ConnectionString = conexion.getConnectionString();
sqlCiudad.SelectCommand = String.Format("SELECT DIVISION_NAME, CITY_NAME FROM DIVISION_TERRITORIAL WHERE COUNTRY_ID = '{0}'", conexion.getUserCountry(Session.Contents["userid"].ToString()));
sqlMotivos.ConnectionString = conexion.getConnectionString();
sqlMotivos.SelectCommand = String.Format("SELECT ID_REASON, REASON_DESCRIP FROM RAZONES WHERE ID_REASON <> 3");
sqlClientes.ConnectionString = conexion.getConnectionString();
string clientid = conexion.getUsersInfo("CLIENT_ID", "USER_ID", Session["userid"].ToString());
sqlClientes.SelectCommand = String.Format("SELECT END_USER_ID, TRADE_NAME FROM CLIENTES_FINALES WHERE CLIENT_ID = '{0}' AND CLIENT_STATUS = 1", clientid);
sqlVendedores.ConnectionString = conexion.getConnectionString();
sqlVendedores.SelectCommand = String.Format("SELECT SALES_ID, SALES_NAME FROM VENDEDORES WHERE CLIENT_ID = '{0}'", clientid);
sqlSegmento.ConnectionString = conexion.getConnectionString();
sqlSegmento.SelectCommand = String.Format("SELECT SUB_SEGMENT_ID, SUB_SEGMENT_NAME FROM SUB_SEGMENTOS WHERE SUB_SEGMENT_ID <> 0 ORDER BY SUB_SEGMENT_ID ASC");
sqlCondicionesPago.ConnectionString = conexion.getConnectionString();
sqlCondicionesPago.SelectCommand = String.Format("SELECT ID_PAYMENT_CONDITION, PAYMENT_CONDITION FROM CONDICIONES_PAGO");
}
示例7: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
try
{
Menu menu = Master.FindControl("NavigationMenu") as Menu;
menu.Items[2].ChildItems[1].ChildItems.RemoveAt(1);
if (!IsPostBack)
{
if (Session.Contents["rol"].ToString().Equals("DSTADM"))
Response.Redirect("../Default.aspx");
Connection conexion = new Connection();
string query = String.Format("SELECT K.KAM_ID, K.KAM_NAME FROM KAM AS K WHERE K.COUNTRY = '{0}' AND 0 = (SELECT COUNT(U.USER_ID) FROM USUARIOS AS U WHERE U.USER_ID = K.KAM_ID AND U.STATUS = 1)"
, conexion.getUserCountry(Session.Contents["userid"].ToString()));
DataTable resultset = conexion.getGridDataSource(query);
foreach (DataRow fila in resultset.Rows)
{
RadComboBoxItem item = new RadComboBoxItem();
item.Text = fila["KAM_NAME"].ToString();
item.Value = fila["KAM_ID"].ToString();
item.DataBind();
cmbKAM.Items.Add(item);
}
cargarCuentasDisponibles(conexion);
}
}
catch (Exception error)
{
RadAjaxManager1.ResponseScripts.Add(String.Format("errorEnvio('{0}');", error.Message));
}
}
示例8: grdDispensadoresProducto_NeedDataSource
protected void grdDispensadoresProducto_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
{
try
{
Connection conexion = new Connection();
string idpais = conexion.getUserCountry(Session["userid"].ToString());
string query = String.Format("SELECT D.ID_DISPENSER, D.DESCRIPTION, D.DISPENSER_FACE, D.DISPENSER_TYPE, DP.DISPENSER_PRICE FROM DISPENSADORES AS D " +
"JOIN DISPENSADOR_PAIS AS DP ON D.ID_DISPENSER = DP.DISPENSER_ID WHERE DP.DISPENSER_STATUS = 'TRUE' AND DP.COUNTRY_ID = '{0}'", idpais);
grdDispensadoresProducto.DataSource = conexion.getGridDataSource(query);
}
catch (Exception error)
{
radajaxmanager.ResponseScripts.Add(String.Format("errorEnvio('{0}');", error.Message));
}
}
示例9: funcion
protected DataTable funcion(string idDispensador)
{
try
{
Connection conexion = new Connection();
string idpais = conexion.getUserCountry(Session["userid"].ToString());
string query = String.Format("SELECT PRODUCT_ID, PRODUCT_DESCRIP FROM PRODUCTOS WHERE DISPENSER_ID = '{0}' AND COUNTRY_ID = '{1}'", idDispensador, idpais);
return conexion.getGridDataSource(query);
}
catch (Exception error)
{
radajaxmanager.ResponseScripts.Add(String.Format("errorEnvio('{0}');", error.Message));
}
return new DataTable();
}
示例10: btEnviar_Click
protected void btEnviar_Click(object sender, EventArgs e)
{
try
{
//En el caso de que falle con javascript
if (!CustomValidator1.IsValid || !CustomValidator2.IsValid || !CustomValidator3.IsValid || !CustomValidator4.IsValid || !CustomValidator5.IsValid
|| !CustomValidator6.IsValid || !CustomValidator7.IsValid)
{
radajaxmanager.ResponseScripts.Add(@"alert('Existen conflictos en campos requeridos favor verifique.');");
return;
}
Connection conexion = new Connection();
string clientid = conexion.getUsersInfo("CLIENT_ID", "USER_ID", Session["userid"].ToString());
bool paraSiguienteMes = false;
bool esEditable = true;
int inconsistencias = 0;
#region Recuperacion de data del grid
foreach (GridDataItem dataItem in grdDispensadoresProducto.MasterTableView.Items)
{
if ((dataItem.FindControl("txtCantidadDispensadores") as RadNumericTextBox).Text.Equals(String.Empty))
(dataItem.FindControl("txtCantidadDispensadores") as RadNumericTextBox).Text = "0";
if ((dataItem.FindControl("txtCantidadProducto") as RadNumericTextBox).Text.Equals(String.Empty))
(dataItem.FindControl("txtCantidadProducto") as RadNumericTextBox).Text = "0";
if (((dataItem.FindControl("txtCantidadDispensadores") as RadNumericTextBox).Text != "0" && (dataItem.FindControl("txtCantidadDispensadores") as RadNumericTextBox).Text != String.Empty)
&& ((dataItem.FindControl("txtCantidadProducto") as RadNumericTextBox).Text != "0" && (dataItem.FindControl("txtCantidadProducto") as RadNumericTextBox).Text != String.Empty))
{
string temporal = String.Empty;
string temporal1 = String.Empty;
TableCell celda = dataItem["Codigo"];
TableCell celdaPrecio = dataItem["dispenserPrice"];
temporal = celda.Text;
codigoDispensadores.Add(temporal);
temporal1 = (dataItem.FindControl("cmbProducto") as RadComboBox).SelectedValue;
codigoProducto.Add(temporal1);
int dispensadores = Convert.ToInt32((dataItem.FindControl("txtCantidadDispensadores") as RadNumericTextBox).Text);
int productos = Convert.ToInt32((dataItem.FindControl("txtCantidadProducto") as RadNumericTextBox).Text);
double valorDetalle = Convert.ToDouble(celdaPrecio.Text.Substring(1)) * dispensadores;
cantidadDispensadores.Add(dispensadores);
cantidadProductos.Add(productos);
costoDetalle.Add(valorDetalle);
}
else
{
if (((dataItem.FindControl("txtCantidadDispensadores") as RadNumericTextBox).Text != "0" && (dataItem.FindControl("txtCantidadProducto") as RadNumericTextBox).Text == "0")
|| ((dataItem.FindControl("txtCantidadDispensadores") as RadNumericTextBox).Text == "0" && (dataItem.FindControl("txtCantidadProducto") as RadNumericTextBox).Text != "0"))
inconsistencias++;
}
}
#endregion
if (inconsistencias > 0)
{
codigoDispensadores.Clear();
codigoProducto.Clear();
cantidadDispensadores.Clear();
cantidadProductos.Clear();
costoDetalle.Clear();
radajaxmanager.ResponseScripts.Add(String.Format(@"alert('Se han encontrado {0} inconsistencias favor revise la tabla de dispensadores y productos.');", inconsistencias));
return;
}
//Validacion de la cantidad de dispensadores
if (cantidadDispensadores.Count == 0)
{
codigoDispensadores.Clear();
codigoProducto.Clear();
cantidadDispensadores.Clear();
cantidadProductos.Clear();
costoDetalle.Clear();
radajaxmanager.ResponseScripts.Add(@"alert('No se han contabilizado productos.');");
return;
}
#region Datos y proceso necesario para el query
DateTime hoy = DateTime.Now;
Session.Add("fechasolicitud", hoy.ToString("yyyMMdd"));
DateTime fechaRequerida = DateTime.Parse(Convert.ToString(dpFechaSolicitada.SelectedDate));
Session.Add("fecharequerida", fechaRequerida.ToString("yyyMMdd"));
string query = String.Empty;
string idpais = conexion.getUserCountry(Session["userid"].ToString());
//Sumo todos los detalles para conseguir el costo de toda la solicitud
double valorDetalle2 = 0;
for (int i = 0; i < costoDetalle.Count; i++)
//.........这里部分代码省略.........
示例11: btProcesar_Click
protected void btProcesar_Click(object sender, EventArgs e)
{
try
{
Connection conexion = new Connection();
string query = String.Empty;
string password = String.Empty;
Random random = new Random(DateTime.Now.Millisecond);
for (int i = 0; i < 5; i++)
password += (char)random.Next(97, 123);
for (int j = 0; j < 5; j++)
password += Convert.ToString(random.Next(0, 9));
if (cmbUbicacion.SelectedValue.Equals("0"))
{
query = String.Format("SELECT USER_ID FROM USUARIOS WHERE ID_COUNTRY = '{0}' AND CLIENT_ID IS NULL",
conexion.getUserCountry(Session.Contents["userid"].ToString()));
DataTable usuariosExistentes = conexion.getGridDataSource(query);
foreach (DataRow fila in usuariosExistentes.Rows)
{
if (fila["USER_ID"].ToString().Equals(txtCodigo.Text.ToUpper()))
{
RadAjaxManager1.ResponseScripts.Add(String.Format("alert('El codigo ya existe.');"));
return;
}
}
query = String.Format("SELECT KAM_ID FROM KAM WHERE COUNTRY = '{0}' AND KAM_ACTIVE = 1", conexion.getUserCountry(Session.Contents["userid"].ToString()));
usuariosExistentes = conexion.getGridDataSource(query);
foreach (DataRow fila in usuariosExistentes.Rows)
{
if (fila["KAM_ID"].ToString().Equals(txtCodigo.Text.ToUpper()))
{
RadAjaxManager1.ResponseScripts.Add(String.Format("alert('El codigo ya existe para un KAM.');"));
return;
}
}
query = String.Format("INSERT INTO USUARIOS (USER_ID, USER_NAME, PASSWORD, P_EXPIRATION, ID_ROL, LOGIN_ID, STATUS, ID_COUNTRY, E_MAIL) "
+ "VALUES ('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', 1, '{6}', '{7}')"
, txtCodigo.Text, txtUsuario.Text, password, DateTime.Now.AddMonths(1).ToString("yyyMMdd"), cmbRol.SelectedValue, txtCodigo.Text,
conexion.getUserCountry(Session.Contents["userid"].ToString()), txtCorreo.Text);
}
else
query = String.Format("INSERT INTO USUARIOS (USER_ID, USER_NAME, PASSWORD, P_EXPIRATION, ID_ROL, LOGIN_ID, STATUS, ID_COUNTRY, E_MAIL, CLIENT_ID) "
+ "VALUES ('{0}', '{1}', '{2}', '{3}', 'DSTADM', '{4}', 1, '{5}', '{6}', '{7}')", txtCodigo.Text, txtUsuario.Text, password,
DateTime.Now.AddMonths(1).ToString("yyyMMdd"), txtCodigo.Text, conexion.getUserCountry(Session.Contents["userid"].ToString()),
txtCorreo.Text, cmbUbicacion.SelectedValue);
List<string> datos = new List<string>();
datos.Add(cmbUbicacion.SelectedValue);
datos.Add(txtCodigo.Text);
datos.Add(txtUsuario.Text);
datos.Add(password);
datos.Add(txtCorreo.Text);
if (conexion.Actualizar(query))
if(conexion.notificacionNuevoUsuario(datos))
RadAjaxManager1.ResponseScripts.Add(String.Format("exitoNuevoUsuario(1);"));
else
RadAjaxManager1.ResponseScripts.Add(String.Format("exitoNuevoUsuario(0);"));
else
RadAjaxManager1.ResponseScripts.Add(String.Format("alert('Error inesperado de conexion, intentelo mas tarde');"));
}
catch (Exception error)
{
RadAjaxManager1.ResponseScripts.Add(String.Format("errorEnvio('{0}');", error.Message));
}
}
示例12: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
try
{
Menu menu = Master.FindControl("NavigationMenu") as Menu;
menu.Items[2].ChildItems[0].ChildItems.RemoveAt(0);
if (!IsPostBack)
{
Connection conexion = new Connection();
if (Session.Contents["rol"].ToString().Equals("DSTADM"))
Response.Redirect("../Default.aspx");
string query = String.Format("SELECT CLIENT_ID, CLIENT_NAME FROM CLIENTES_KC WHERE COUNTRY = '{0}' AND DIRECT_CUSTOMER = 0",
conexion.getUserCountry(Session.Contents["userid"].ToString()));
DataTable clientes = conexion.getGridDataSource(query);
RadComboBoxItem temp = new RadComboBoxItem();
temp.Value = "0";
temp.Text = "Kimberly-Clark";
temp.DataBind();
cmbUbicacion.Items.Add(temp);
foreach (DataRow fila in clientes.Rows)
{
RadComboBoxItem item = new RadComboBoxItem();
item.Text = fila["CLIENT_ID"].ToString() + " | " + fila["CLIENT_NAME"].ToString();
item.Value = fila["CLIENT_ID"].ToString();
item.DataBind();
cmbUbicacion.Items.Add(item);
}
cargarRoles();
}
}
catch (Exception error)
{
RadAjaxManager1.ResponseScripts.Add(String.Format("errorEnvio('{0}');", error.Message));
}
}