internal void SetDataKeys(DataKey dataKey) { for (int i = 0; i < dataKey.Values.Keys.Count; i++) { SetColumn(i + 1, dataKey.Values[i]); } }
// Populate a datakey with data from a stream public void FromReader(DataReader reader, DataKey root, Logger logger) { // Read up to five bytes and reverse them byte[] data = reader.ReadBytes(5, false).Reverse().ToArray(); logger.LogInfo("Read {0} bytes from stream", data.Length); // Add to key root.AddValue("data", data); }
// Write a datakey to a stream public void ToWriter(DataWriter writer, DataKey root, Logger logger) { logger.LogInfo("Writing to stream"); // Write Data node back to stream // Will throw MissingDataNodeException if it does not exist byte[] data = root["data"].ToArray().Reverse().ToArray(); writer.Write(data); }
public object this[DataKey dataKey] { get { return GetKeyValue(dataKey); } set { _requestData[dataKey] = value; } }
protected TabSection CreateSection(DataKey dataKey) { var fieldList = (FieldList)RequestData[dataKey]; if (fieldList == null) return null; var section = new TabSection("Property", "Value"); DisplayFields(fieldList.Fields, section); return section; }
// Return a string to display to the user public string ToDisplayString(DataKey root, Logger logger) { DataNode node = root.SelectSingleNode("data"); if (node == null) { return String.Empty; } else { return node.ToString(); } }
protected void gvBidEventsForOpening_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { string key1 = gvBidEventsForOpening.DataKeys[e.Row.RowIndex].Values[0].ToString(); string key2 = gvBidEventsForOpening.DataKeys[e.Row.RowIndex].Values[1].ToString(); string key3 = gvBidEventsForOpening.DataKeys[e.Row.RowIndex].Values[2].ToString(); string key4 = gvBidEventsForOpening.DataKeys[e.Row.RowIndex].Values[3].ToString(); string key5 = gvBidEventsForOpening.DataKeys[e.Row.RowIndex].Values[4].ToString(); string key6 = gvBidEventsForOpening.DataKeys[e.Row.RowIndex].Values[5].ToString(); } if (e.Row.RowType == DataControlRowType.Footer) { if (gvBidEventsForOpening.DataKeys.Count > 0) { // Use the GetEnumerator method to create an enumerator that // contains the DataKey objects for the GridView control. IEnumerator keyEnumerator = gvBidEventsForOpening.DataKeys.GetEnumerator(); // Iterate though the enumerator and display the primary key // value of each record displayed. int i = 0; while (keyEnumerator.MoveNext()) { DataKey key = (DataKey)keyEnumerator.Current; Panel pnl1 = (Panel)gvBidEventsForOpening.Rows[i].Cells[3].Controls[1]; Panel pnl2 = (Panel)gvBidEventsForOpening.Rows[i].Cells[3].Controls[3]; LinkButton lb = (LinkButton)gvBidEventsForOpening.Rows[i].Cells[3].Controls[3].Controls[1]; pnl1.Visible = ISOpened(key[1].ToString(), key[2].ToString(), key[3].ToString(), key[4].ToString()); pnl2.Visible = !pnl1.Visible; if (pnl2.Visible) { lb.Enabled = IsEnabled(key[5].ToString()); if (lb.Enabled) { lb.Attributes.Add("onclick", "return confirm('Open this event?');"); } else { lb.Attributes.Add("style", "cursor:default;"); } } // move counter i++; } } } }
public override void OnInspectorGUI() { EditorGUI.BeginChangeCheck(); tile.m_DefaultSprite = EditorGUILayout.ObjectField("Default Sprite", tile.m_DefaultSprite, typeof(Sprite), false) as Sprite; tile.m_DefaultGameObject = EditorGUILayout.ObjectField("Default Game Object", tile.m_DefaultGameObject, typeof(GameObject), false) as GameObject; tile.m_DefaultColliderType = (Tile.ColliderType)EditorGUILayout.EnumPopup("Default Collider", tile.m_DefaultColliderType); DrawCustomFields(false); EditorGUILayout.Space(); EditorGUILayout.LabelField("On Close"); onCloseTileEditor.m_ReorderableList.DoLayoutList(); EditorGUILayout.LabelField("On Open"); onOpenTileEditor.m_ReorderableList.DoLayoutList(); EditorGUILayout.Space(); if (EditorGUI.EndChangeCheck()) { SaveTile(); } m_DataList.Clear(); var tilemaps = FindObjectsOfType <Tilemap>(); foreach (var tilemap in tilemaps) { var bounds = tilemap.cellBounds; for (int x = bounds.xMin; x < bounds.xMax; x++) { for (int y = bounds.yMin; y < bounds.yMax; y++) { var position = new Vector3Int(x, y, 0); var other = tilemap.GetTile(position); if (other == doorTile) { bool isOpen = doorTile.IsOpen(position, tilemap.GetComponent <GridInformation>()); var dataKey = new DataKey(); dataKey.tilemap = tilemap; dataKey.position = position; m_DataList.Add(new KeyValuePair <DataKey, bool>(dataKey, isOpen)); } } } } instanceList.DoLayoutList(); }
// Tìm kiếm chính sách protected void tb_timKiemChinhSach_TextChanged(object sender, EventArgs e) { string searchText = tb_timKiemChinhSach.Text.Trim(); try { DataKey id = FV_ShopWatch.DataKey; lstChinhSach = b.SearchChinhSach(int.Parse(id.Value.ToString()), searchText); this.fetchDataToChinhSachGridView(); } catch (Exception ex) { this.errorAlert(ex.Message); } }
public void Get_Inner_Missed() { // Arrange var datakey = new DataKey <int>("k"); m_mockCache.Setup(cache => cache.Get(datakey)).Returns(true); // Act m_cacheProxy.Get(datakey); // Assert Assert.False(datakey.HasValue); Assert.Equal(1, m_cacheProxy.Count); Assert.Equal(1, m_cacheProxy.MissCount); }
public CacheProxyTest() { m_mockCache = new Mock <ICache>(MockBehavior.Strict); m_cacheProxy = new CacheProxy(m_mockCache.Object); var datakey = new DataKey <int>("x") { Value = 100 }; m_mockCache.Setup(cache => cache.Store(datakey)).Returns(true); m_cacheProxy.Store(datakey); Assert.Equal(1, m_cacheProxy.Count); Assert.Equal(0, m_cacheProxy.MissCount); }
protected void SetContextToCustomer(int RowID) { SetContextToNewCustomer(); DataKey data = GridView1.DataKeys[RowID]; int iCustomerID = (int)data.Values["CustomerID"]; EMailAlreadyTaken.Visible = false; SearchCustomerPanel.Visible = false; CustomerIDPanel.Visible = true; CreateNewCustomerPanel.Visible = true; SetContextToCustomerID(iCustomerID); CreateCustomer.Visible = false; UseCustomer.Visible = true; UpdateCustomer.Visible = true; }
protected void dgvDetallePedido_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Update") { DataKey data = dgvDetallePedido.DataKeys[Convert.ToInt32(e.CommandArgument)]; insertaProductosCanasta("", ((DropDownList)dgvDetallePedido.Rows[dgvDetallePedido.EditIndex].FindControl("lstAgente")).SelectedValue, data.Values["Codigo"].ToString(), "", "", Convert.ToInt32(((TextBox)dgvDetallePedido.Rows[dgvDetallePedido.EditIndex].FindControl("txtunidades")).Text), "", Convert.ToString(((TextBox)dgvDetallePedido.Rows[dgvDetallePedido.EditIndex].FindControl("txtComentarios")).Text) , Convert.ToString(((TextBox)dgvDetallePedido.Rows[dgvDetallePedido.EditIndex].FindControl("txtFechaDesvio")).Text), 1 , data.Values["FH_PEDIDO"].ToString(), Convert.ToBoolean(data.Values["CD_SELECT"].ToString())); dgvDetallePedido.DataBind(); } }
public FacebookDataSource(string applicationid, string applicationsecret, string objectid) { if (string.IsNullOrEmpty(applicationid) || string.IsNullOrEmpty(applicationsecret) || string.IsNullOrEmpty(objectid)) { throw new ConfigurationErrorsException("Facebook requires applicationId, applicationsecret and objectid parameters."); } this.application_id = applicationid; this.application_secret = applicationsecret; this.object_id = objectid; this.RefreshInterval = 30000; this.InitializeClient(); this.dataKey = DataKey.Checkins; }
protected void gridgiohang_RowDeleting(object sender, GridViewDeleteEventArgs e) { DataKey data = gridgiohang.DataKeys[e.RowIndex]; Delete(int.Parse(data.Values["IdGioHang"].ToString())); HienThiGioHang(); int Dem = gridgiohang.Rows.Count; if (Dem == 0) { lblTotal.Text = "0 VND"; lblThongBao.Text = "Bạn chưa có sản phẩm nào trong giỏ hàng"; } }
public void DataKeyArray_CopyTo() { OrderedDictionary dictionary = new OrderedDictionary(); dictionary.Add("key", "value"); ArrayList list = new ArrayList(); DataKey key = new DataKey(dictionary); list.Add(key); DataKeyArray keyarray = new DataKeyArray(list); DataKey[] keys = new DataKey[list.Count]; keyarray.CopyTo(keys, 0); Assert.AreEqual("value", keys[0].Value, "CopyToValue"); }
protected TabSection CreateSection(DataKey dataKey) { var fieldList = (FieldList)RequestData[dataKey]; if (fieldList == null) { return(null); } var section = new TabSection("Property", "Value"); DisplayFields(fieldList.Fields, section); return(section); }
protected void EmployeeGridView_SelectedIndexChanged(object sender, EventArgs e) { if (EmployeeGridView.SelectedIndex > -1) { string employeeID = ""; log.Debug("Getting DataKeys from User GridView. Function EmployeeGridView_SelectedIndexChanged from DefinePermissionsByUser.aspx page"); DataKey DataKeyData = EmployeeGridView.DataKeys[EmployeeGridView.SelectedIndex]; employeeID = DataKeyData.Values["UserId"].ToString(); SelectedUserIdHiddenField.Value = employeeID; UserLabel.Text = DataKeyData.Values["FullName"].ToString(); PermissionPanel.Visible = true; SelectUserLabel.Visible = false; ChangeLabel.Visible = true; } }
protected void lnkEditarPreventiva_Click(object sender, EventArgs e) { LinkButton lnkConfirmar = sender as LinkButton; DataKey dk = grdPreventivaPesq.SelectedDataKey; ViewState["cmpIdPreventivaAgenda"] = lnkConfirmar.CommandArgument.ToString(); int row = int.Parse(lnkConfirmar.CommandArgument.ToString()); //Response.Redirect("webPRE_EditarPreventiva.aspx?idPreventivaAgenda=" + grdPreventivaPesq.DataKeys[row].Values[0].ToString()); //ScriptManager.RegisterStartupScript(Page, typeof(Page), "OpenWindow", "window.open(webPRE_EditarPreventiva.aspx?idPreventivaAgenda=" + grdPreventivaPesq.DataKeys[row].Values[0].ToString() + "');", true); //Response.Write( "<script> window.open(webPRE_EditarPreventiva.aspx?idPreventivaAgenda=" + grdPreventivaPesq.DataKeys[row].Values[0].ToString() + "</script>"); // Response.End(); Response.Write("<script>window.open('webPRE_EditarPreventiva.aspx?idPreventivaAgenda=" + grdPreventivaPesq.DataKeys[row].Values[0].ToString() + "&cmpCoObraGrupolista=" + cmbObra.SelectedValue + "','_blank');</script>"); }
protected void grdGrupoUsuario_RowDeleting(object sender, GridViewDeleteEventArgs e) { try { DataKey dk = grdGrupoUsuario.DataKeys[e.RowIndex]; new BllAdmGrupoRelUsuario().Excluir(ObjectUtils.ToInt(dk.Value)); PopulaGridGrupoUsuario(StringUtils.ToInt(this.HddnFldIdAdmGrupo.Value)); MessageBox(this.Page, "Registro excluido com sucesso!"); } catch (Exception) { MessageBox(this.Page, "Erro ao tentar excluir o registro!"); } }
public bool Increment(DataKey <long> datakey, long delta, int expires) { var keybytes = m_keyEncoder.GetBytes(datakey.Key); m_commandWriter.Incr(new IncrPacket() { Key = keybytes, Delta = delta, InitialValue = datakey.Value, Expires = expires }, Options.NoReply); var succeed = true; return(m_factory.Context(keybytes)((connection, state) => { m_builder.WriteTo(connection.Writer); if (!Options.NoReply) { var commandReader = m_factory.CreateCommandReader( m_factory.CreatePacketParser(connection.Reader, m_buffer)); var increment = commandReader.ReadIncrement(); if (increment >= 0L) { datakey.Value = increment; return; } int flags; var bytes = m_formatter.Serialize(datakey.Value.ToString(CultureInfo.InvariantCulture), out flags); m_commandWriter.Store(new StorePacket() { Operation = StoreOperation.Set, //// TODO: TextProtocol Key = keybytes, Flags = flags, Expires = expires, Value = bytes }, false); m_builder.WriteTo(connection.Writer); succeed = commandReader.ReadStored(); } else { datakey.Value += delta; } }) && succeed); }
protected void gdVehiculos_RowDataBound(object sender, GridViewRowEventArgs e) { Int32 aux; if (e.Row.RowType == DataControlRowType.DataRow) { DataKey dataKey = gdVehiculos.DataKeys[e.Row.RowIndex]; Int32.TryParse(dataKey.Values["nid_vehiculo"].ToString(), out aux); if (aux == 0) { e.Row.Visible = false; return; } e.Row.Cells[5].Visible = oParm.SRC_CodPais.Equals("2"); e.Row.Cells[6].Visible = oParm.SRC_CodPais.Equals("2"); if (oParm.SRC_CodPais.Equals("2")) { if (string.IsNullOrEmpty(dataKey.Values["co_tipo"].ToString())) { e.Row.Cells[5].Text = ""; e.Row.Cells[6].Text = ""; } else { string strTpos = oParm.N_TiposVehiculo; foreach (string strTipo in strTpos.Split('|')) { if (strTipo.Split('-').GetValue(0).ToString().Trim().Equals(dataKey.Values["co_tipo"].ToString())) { e.Row.Cells[6].Text = strTipo.Split('-').GetValue(1).ToString().Trim(); break; } } } } //--------------------- e.Row.Style["cursor"] = "pointer"; //if (VerBoton()) e.Row.Attributes["onclick"] = String.Format("javascript: fc_SeleccionaFilaSimple(this); document.getElementById('{0}').value = '{1}'" , txh_nid_vehiculo.ClientID, dataKey.Values["nid_vehiculo"].ToString()); Session["verdet_objEnt"] = "2"; Session["edidet_objEnt"] = null; Session["NUEVO"] = null; e.Row.Attributes["ondblclick"] = String.Format("javascript: location.href='SRC_Maestro_Detalle_Vehiculo.aspx?nid_vehiculo={0}'", dataKey.Values["nid_vehiculo"].ToString()); } }
protected void grdpesquisa_RowCommand(object sender, GridViewCommandEventArgs e) { try { if (e.CommandName == "cmdAlterar" || e.CommandName == "cmdExcluir" || e.CommandName == "cmdAbrir") { int index = Convert.ToInt32(e.CommandArgument); DataKey data = grdpesquisa.DataKeys[index]; if (e.CommandName == "cmdAlterar") { Session["eoMinhaCertificacaousuario"] = data.Values["idcertificacao"].ToString(); Session["Origem"] = "MinhasCertificacoes"; Response.Redirect("CertificacaoColaboradorOperacao.aspx"); } //else if (e.CommandName == "cmdExcluir") //{ // CertificacaousuarioBusinessLayer bl = new CertificacaousuarioBusinessLayer(); // CertificacaousuarioEntity eo = new CertificacaousuarioEntity(); // eo.idcertificacao = Convert.ToInt32(data.Values["idcertificacao"].ToString()); // bl.Excluir(eo); // CarregarGrid(); //} //else else if (e.CommandName == "cmdAbrir") { CertficadoDigitalizadoBusinessLayer bl = new CertficadoDigitalizadoBusinessLayer(); CertficadoDigitalizadoEntity eo = new CertficadoDigitalizadoEntity(); eo.idcertificacao = Convert.ToInt32(data.Values["idcertificacao"].ToString()); DataTable dt = new DataTable(); dt = bl.ConsultarArquivo(eo); if (dt.Rows.Count > 0) { DownloadPDF(dt); } else { diverro.Visible = true; lblmsgerro.Text = "Mensagem do Sistema: Não há arquivo a ser exibido para esse registro"; } } } } catch (Exception ex) { diverro.Visible = true; lblmsgerro.Text = "Mensagem do Sistema: " + ex.Message; } }
protected void grdcertificacao_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "cmdExcluir") { try { int index = Convert.ToInt32(e.CommandArgument); DataKey data = grdcertificacao.DataKeys[index]; RemoverLinhaDtCertificacao(data.Values["idcertificado"].ToString()); } catch (Exception ex) { // summary.Text = "Mensagem do Sistema: " + ex.Message; } } }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Update") { DataKey data = GridView1.DataKeys[Convert.ToInt32(e.CommandArgument)]; sdsProductosPendientes.UpdateParameters[0].DefaultValue = data.Values["Clave"].ToString(); sdsProductosPendientes.UpdateParameters[1].DefaultValue = ((TextBox)GridView1.Rows[Convert.ToInt32(e.CommandArgument)].FindControl("Descripcion")).Text.Trim(); sdsProductosPendientes.UpdateParameters[2].DefaultValue = ((DropDownList)GridView1.Rows[Convert.ToInt32(e.CommandArgument)].FindControl("ClaveMarca")).SelectedValue.ToString(); sdsProductosPendientes.UpdateParameters[3].DefaultValue = ((DropDownList)GridView1.Rows[Convert.ToInt32(e.CommandArgument)].FindControl("ClaveUnidadMedida")).SelectedValue.ToString(); sdsProductosPendientes.UpdateParameters[4].DefaultValue = ((DropDownList)GridView1.Rows[Convert.ToInt32(e.CommandArgument)].FindControl("Moneda")).SelectedValue.ToString(); sdsProductosPendientes.UpdateParameters[5].DefaultValue = ((TextBox)GridView1.Rows[Convert.ToInt32(e.CommandArgument)].FindControl("PrecioListaProveedor")).Text.Trim(); sdsProductosPendientes.UpdateParameters[6].DefaultValue = ((CheckBox)GridView1.Rows[Convert.ToInt32(e.CommandArgument)].FindControl("banderaImportacion")).Checked.ToString(); sdsProductosPendientes.UpdateParameters[7].DefaultValue = Session["usuarioID"].ToString(); } }
protected void lnkLifeInsurancePolicy_Click(object sender, EventArgs e) { GridViewRow gvRow = ((GridViewRow)(((LinkButton)sender).Parent.Parent)); int rowIndex = gvRow.RowIndex; DataKey dk = gvLifeInsurance.DataKeys[rowIndex]; int insuranceId = Convert.ToInt32(dk.Value); DataTable dtAssociationId = new DataTable(); //insuranceVo = insuranceBo.GetInsuranceAsset(insuranceId); insuranceVo = insuranceBo.GetInsuranceAssetLI(insuranceId, out dtAssociationId); Session["dtAssociationId"] = dtAssociationId; Session["insuranceVo"] = insuranceVo; Session["customerAccountVo"] = customerAccountsBo.GetCustomerInsuranceAccount(insuranceVo.AccountId); Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "leftpane", "loadcontrol('PortfolioInsuranceEntry','action=view');", true); }
// -- // -- private string GetKey(DataKey key) { string res = ""; for (int i = 0; i < key.Values.Count; i++) { if (i > 0) { res += "|"; } res += key.Values[i].ToString(); } return(res); }
public void Database_CreateAndSaveLOTSInDatabase() { var index = new Index <int>(_indexStorage); using (_target = new Database(index, _dataStorage)) { for (int i = 1; i < 1000; i++) { _target.Write(DataKey.CreateKey(i), string.Format("hello {0}", i)); } for (int i = 1; i < 1000; i++) { Assert.AreEqual(string.Format("hello {0}", i), _target.Read(DataKey.CreateKey(i))); } } }
protected void GridViewDocumentos_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Editar") { int Index = Convert.ToInt32(e.CommandArgument); DataKey keys = GridViewDocumentos.DataKeys[Index]; string IdDocumento = keys.Value.ToString(); Modelo.Documento documento = new DAL.DALDocumento().Select(IdDocumento); TextBoxDocumento.Text = documento.documento; DropDownListValidadeAtualizacao.SelectedValue = Convert.ToInt32(documento.validade).ToString(); DropDownListTipoDocumentoAtualizacao.SelectedValue = documento.tipo.ToString(); Session["Documento"] = documento; PanelVisualizaçãoDocumento.Visible = false; PanelEdicaoDocumento.Visible = true; } }
protected void grdEscritorioRegional_RowDeleting(object sender, GridViewDeleteEventArgs e) { try { DataKey dk = grdEscritorioRegional.DataKeys[e.RowIndex]; EntEscritorioRegional EscritorioRegional = new BllEscritorioRegional().ObterPorId(ObjectUtils.ToInt(dk.Value)); new BllEscritorioRegional().Excluir(EscritorioRegional); this.PopulaGridEscritorioRegional(); MessageBox(this, "Escritório Regional alterado com sucesso!"); } catch (Exception ex) { MessageBox(this, "Erro ao tentar alterar!"); } }
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) { DataKey dk = GridView1.SelectedDataKey; int a = 0; FormView1.PageIndex = 0; FormView1.DataBind(); while (FormView1.DataKey.Value.ToString() != dk.Value.ToString() && a < FormView1.PageCount) { if (a + 1 < FormView1.PageCount) { FormView1.PageIndex++; FormView1.DataBind(); } } }
protected override void PerformDataBinding(System.Collections.IEnumerable data) { base.PerformDataBinding(data); if (data == null && this.DataItem != null) { data = new object[] { this.DataItem } } ; else if (data == null) { return; } foreach (var i in data) { _dataItemContainer.DataItem = i; if (i == null && EmptyDataTemplate != null) { EmptyDataTemplate.InstantiateIn(_dataItemContainer); } else { ItemTemplate.InstantiateIn(_dataItemContainer); } _dataItemContainer.DataBind(); if (i != null) { OrderedDictionary keyTable = this.KeyTable; if (keyTable != null) { keyTable.Clear(); string[] dataKeyNamesInternal = this.DataKeyNamesInternal; if (dataKeyNamesInternal != null && dataKeyNamesInternal.Length != 0) { foreach (string str in dataKeyNamesInternal) { object propertyValue = DataBinder.GetPropertyValue(i, str); keyTable.Add(str, propertyValue); } _dataKey = new DataKey(keyTable); } } } } this.ExtractRowValues(this.BoundFieldValues, false); }
void GridViewUtentiRuolo_DataBound(object sender, EventArgs e) { try { int contatore = 0; string percorso = ""; string chiamata; //Griglia contenente dati if (GridViewUtentiRuolo.Rows.Count > 0) { // Use the Count property to determine whether the // DataKeys collection contains any items. if (GridViewUtentiRuolo.DataKeys.Count > 0) { IEnumerator keyEnumerator = GridViewUtentiRuolo.DataKeys.GetEnumerator(); while (keyEnumerator.MoveNext()) { DataKey key = (DataKey)keyEnumerator.Current; ((CheckBox)GridViewUtentiRuolo.Rows[contatore].FindControl("CheckBoxStatoRuolo")).Checked = Convert.ToBoolean((GridViewUtentiRuolo.DataKeys[contatore].Values["URL_STATO_RUOLO_UTENTE"])); LinkButton btnEdit = (LinkButton)GridViewUtentiRuolo.Rows[contatore].FindControl("ButtonEditRuoliUtente"); //btnEdit.Text = GetValueDizionarioUI("BUTTON_MODIFICA"); btnEdit.Text = "<i class='fas fa-pencil-alt' data-toggle='modal' data-target='#modalPage'></i>"; if (allowEdit) { percorso = @"frm_MSE_RUL_UTE.aspx?PROVENIENZA=UTE&MODALITA=EDIT&RUL_ID_RUOLO=" + GridViewUtentiRuolo.DataKeys[contatore].Values["RUL_ID_RUOLO"] + "&UTE_ID_UTENTE=" + GridViewUtentiRuolo.DataKeys[contatore].Values["UTE_ID_UTENTE"] + "&URL_ID_RUOLI_UTENTE=" + GridViewUtentiRuolo.DataKeys[contatore].Values["URL_ID_RUOLI_UTENTE"]; //chiamata = "javascript:self.parent.openEditor('" + percorso + "');return false;"; chiamata = "javascript:openModal('" + percorso + "', 'RUL_UTE');return false;"; GridViewUtentiRuolo.Rows[contatore].Cells[0].Attributes["onClick"] = chiamata; } contatore++; } } else { throw new System.Exception("GridViewUtentiRuolo:no DataKey objects."); } } } catch (Exception ex) { // Gestione messaggistica all'utente e trace in DB dell'errore ExceptionPolicy.HandleException(ex, "Propagate Policy"); } }
protected void gdvExpediente_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { DataKey key = (DataKey)gdvExpediente.DataKeys[Convert.ToInt32(e.Row.RowIndex)]; //Mostrar fechas nulas en blanco Label lblgvFecIngreso = (Label)e.Row.FindControl("lblgvFecIngreso"); if (lblgvFecIngreso.Text.Trim() == "01/01/1900") { lblgvFecIngreso.Text = string.Empty; } Label lblgvFecIngSIGEL = (Label)e.Row.FindControl("lblgvFecIngSIGEL"); if (lblgvFecIngreso.Text.Trim() == "01/01/1900") { lblgvFecIngSIGEL.Text = string.Empty; } //Pintar Alertas Label lblAlerta = (Label)e.Row.FindControl("lblAlerta"); Image ImgAlertaInterno = (Image)e.Row.FindControl("ImgAlertaInt"); if (Convert.ToInt32(lblAlerta.Text) >= Convert.ToInt32(Constante.Numeros.Cero) && Convert.ToInt32(lblAlerta.Text) <= Convert.ToInt32(Constante.Numeros.Cuatro)) { ImgAlertaInterno.ImageUrl = "~/Images/circle_green.png"; } else if (Convert.ToInt32(lblAlerta.Text) == Convert.ToInt32(Constante.Numeros.Cinco)) { ImgAlertaInterno.ImageUrl = "~/Images/circle_yellow.png"; } else if (Convert.ToInt32(lblAlerta.Text) > Convert.ToInt32(Constante.Numeros.Seis)) { ImgAlertaInterno.ImageUrl = "~/Images/circle_red.png"; } //Colorea las columnas de la cabeceras del gridview gdvExpediente.Columns[8].HeaderStyle.BackColor = System.Drawing.Color.Orange; gdvExpediente.Columns[9].HeaderStyle.BackColor = System.Drawing.Color.Orange; gdvExpediente.Columns[10].HeaderStyle.BackColor = System.Drawing.Color.Orange; gdvExpediente.Columns[11].HeaderStyle.BackColor = System.Drawing.Color.Orange; gdvExpediente.Columns[12].HeaderStyle.BackColor = System.Drawing.Color.Orange; gdvExpediente.Columns[13].HeaderStyle.BackColor = System.Drawing.Color.Orange; gdvExpediente.Columns[14].HeaderStyle.BackColor = System.Drawing.Color.Orange; gdvExpediente.Columns[15].HeaderStyle.BackColor = System.Drawing.Color.Orange; } }
public override T Retrieve <T>(string id) { var key = Prefix + id; var datakey = new DataKey <T>(key); if (!m_cache.Get(datakey)) { return(base.Retrieve <T>(id)); } if (!datakey.HasValue) { return(base.Retrieve <T>(id)); } return(datakey.Value); }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName.ToString() == "CheckOrder") { int index = Convert.ToInt32(e.CommandArgument); DataKey key = this.GridView1.DataKeys[index]; int ScenicID = Convert.ToInt32(key.Value.ToString()); string sql1 = "select PathID,pathname ,CompName ,pathprice ,totalpeople ,finalpeople ,PathState "; string sql2 = ",PathStay ,PathFood ,Pathtraffice ,PathGuide from TB_Path,TB_Company "; string sql3 = "where TB_Company.CompID = TB_Path.CompID and TB_Path.PathID in "; string sql4 = "(select PathID from TB_SJP where ScenicID = " + ScenicID + ") order by pathprice asc;"; string sql = sql1 + sql2 + sql3 + sql4; ds = db.GetDataSet(sql); GridView2.DataSource = ds; GridView2.DataBind(); } }
private void AddCookie(string cookie, DataKey root, Logger logger) { string[] kv = cookie.Split(new [] { '=' }, 2, StringSplitOptions.RemoveEmptyEntries); string k = kv[0].Trim(); string v = ""; if (kv.Length > 1) { v = kv[1].Trim(); } if (!String.IsNullOrEmpty(k)) { root.AddValue(k, v); } }
public void DataKeyArray_Item () { OrderedDictionary dictionary = new OrderedDictionary(); dictionary.Add("key","value"); ArrayList list = new ArrayList (); DataKey key = new DataKey (dictionary); list.Add (key); DataKeyArray keyarray = new DataKeyArray (list); Assert.AreEqual(1,keyarray.Count,"CreateItems"); Assert.AreEqual (key, keyarray[0], "CreateKeyData"); Assert.AreEqual ("value",((DataKey)keyarray[0]).Value,"KeyArrayValue"); dictionary.Add ("key1", "value1"); key = new DataKey (dictionary); list.Add (key); keyarray = new DataKeyArray (list); Assert.AreEqual (2, keyarray.Count, "CreateItemsMulty"); }
public void DataKey_Functionality() { OrderedDictionary dictionary = new OrderedDictionary (); IOrderedDictionary iDictionary; dictionary.Add ("key", "value"); DataKey key = new DataKey (dictionary); Assert.AreEqual ("value", key[0].ToString(), "DataKeyItemIndex"); Assert.AreEqual ("value", key["key"].ToString (), "DataKeyItemKeyName"); Assert.AreEqual ("value", key.Value, "FirstIndexValue"); iDictionary = key.Values; Assert.AreEqual (1, iDictionary.Count, "AllValuesReferringToKey"); Assert.AreEqual ("value", iDictionary[0], "ValueReferringToKey"); dictionary.Add("key1", "value1"); key = new DataKey (dictionary); iDictionary = key.Values; Assert.AreEqual (2, iDictionary.Count, "AllValuesReferringToKey#1"); Assert.AreEqual ("value1", iDictionary[1], "ValueReferringToKey#1"); }
protected static void _copy_with_key(DataKey* dst, DataKey* src) { // copy value fields. dst->flags = src->flags; dst->etime = src->etime; dst->cas = src->cas; dst->val_addr = null; dst->status = 0; dst->lrup = dst->lrux = null; dst->next = null; // copy key part. dst->hash = src->hash; var ds = (byte*)(dst + 1); var ls = (long*)(src + 1); var cnt = src->KeySize; dst->size = (uint)cnt; for (; cnt >= 8; ls++, ds += 8, cnt -= 8) *(long*)ds = *ls; for (var bs = (byte*)ls; cnt > 0; bs++, ds++, cnt--) *ds = *bs; }
protected int SpecOps(DataKey* cop) { if (cop->opcode == xFlush || cop->opcode == xFlushQ) return FlushCache(cop->etime); return iSpecialCommand; }
private DataKey* LookupKey(DataKey* rqs, bool deleteKey = false) { var level = 0; var he = _htable + (rqs->hash & _hashMask); do { if (he->IsList) { DataKey* cp = he->List, nx; for (DataKey* wx = null; cp != null; wx = cp, cp = nx) { nx = cp->next; // check eviction opportunities. if (IsExpired(cp)) { var expired = DataKey.Equal(cp, rqs); he->Pop(wx); DeleteKey(cp); if (expired) break; cp = wx; continue; } // check if we have a clean match. if (DataKey.Equal(cp, rqs)) { if (!deleteKey) return LruUpdate(cp); he->Pop(wx); DeleteKey(cp); return null; } } } else { var htp = _hashBits + iHSubBits * level++; htp = (int)(rqs->hash >> htp) & iHSubMask; he = he->Htab + htp; continue; } // if command can append to cache, request entry will be consumed. if (!ReqsAdds.Has(rqs->opcode) || deleteKey) return null; Stats.CurrentItems++; // create new data key for the request. var nk = GetDk(rqs->KeySize); _copy_with_key(nk, rqs); // add new key to the head of LRU list. var head = _lruHead; nk->lrup = null; if (head != null) { nk->lrux = head; head->lrup = nk; } else _lruTail = nk; var hmax = he->Push(_lruHead = nk); if (hmax > 8 && hmax > 8 + level * 2 && level < 3) he->Split(GetBucket(), _hashBits + level * iHSubBits, iHSubMask); return nk; } while (true); }
protected int CasCounts(DataKey* cit, DataKey* src, bool inc) { if (cit->CheckCas(src)) return iNotStored; // apply inc/dec logic to key mem buffer only when size == 8. long counter = 0; if (cit->val_addr != null) { if (!cit->GetNumeric(ref counter)) return iNotNumeric; if (inc) counter += (long)src->longval; else { counter -= (long)src->longval; if (counter < 0) counter = 0; } } else { cit->val_addr = GetMem(22); counter = src->def_val; } // extract current counter value for the response. cit->SetNumeric(counter); src->longval = counter; return iSpecialCommand; }
protected static void _set_key(DataKey* ce, byte* key) { const ulong principal = 1099511628211; var ds = (byte*)(ce + 1); ulong hv = 14695981039346656037; for (var cnt = ce->KeySize; cnt > 0; key++, cnt--) { var cb = *key; *ds++ = cb; hv = (hv * principal) ^ (ulong)cb; } ce->hash = hv; }
protected static void _init_dk(DataKey* dk, int opc) { ulong* bp = (ulong*)dk, ep = (ulong*)(dk + 1); while (bp < ep) *bp++ = 0; dk->opcode = (byte)opc; }
public void DataKeyArray_CopyTo () { OrderedDictionary dictionary = new OrderedDictionary (); dictionary.Add ("key", "value"); ArrayList list = new ArrayList (); DataKey key = new DataKey (dictionary); list.Add (key); DataKeyArray keyarray = new DataKeyArray (list); DataKey[] keys = new DataKey[list.Count]; keyarray.CopyTo(keys,0); Assert.AreEqual ("value", keys[0].Value, "CopyToValue"); }
protected void AppendValuesData(DataKey* lkey, DataKey* rkey) { var left = lkey->val_addr; int lsize = lkey->ValSize, rsize = rkey->ValSize; var total = lsize + rsize; if (total <= iBigBlockSize) { int lid = _slab_id(lsize), tid = _slab_id(total); if (lid != tid) { var next = GetMem(total); _memcopy(_skip(next, 0), _skip(left, 0), lsize); ReleaseValue(lkey); lkey->val_addr = left = next; } lkey->ValSize = total; _memcopy(_skip(left, lsize), _skip(rkey->val_addr, 0), rsize); return; } // could be optimized later to skip most of the copying in some common scenarios. byte* bp = stackalloc byte[total]; _memcopy_rc(bp, left, lsize); _memcopy_rc(bp + lsize, rkey->val_addr, rsize); var bigm = GetMem(total); _dbkcopy(bigm, bp, total); ReleaseValue(lkey); lkey->val_addr = bigm; lkey->ValSize = total; }
public void SetValue(DataKey* src) { size = src->size; var rc = src->val_addr; val_addr = rc; if (rc != null) rc->AddRef(); }
public static bool Equal(DataKey* ce, DataKey* cx) { if (cx->hash != ce->hash) return false; var cnt = ce->KeySize; if (cnt != cx->KeySize) return false; var ks = (byte*)(ce + 1); var lp = (long*)(cx + 1); for (; cnt >= 8; lp++, ks += 8, cnt -= 8) if (*lp != *(long*)ks) return false; for (var bs = (byte*)lp; cnt > 0; bs++, ks++, cnt--) if (*bs != *ks) return false; return true; }
public bool CheckCas(DataKey* rqs) { var rcs = rqs->cas; if (rcs != 0 && cas != rcs) return true; rqs->cas = cas = rcs + 1; return false; }
protected static string _get_key(DataKey* ce) { return new string((sbyte*)(ce + 1), 0, ce->KeySize, System.Text.Encoding.UTF8); }
protected static void _set_key(DataKey* ce, byte[] key, int cnt) { const ulong principal = 1099511628211; var ds = (byte*)(ce + 1); ulong hv = 14695981039346656037; ce->size = (uint)cnt; for (var i = 0; i < cnt; i++) { var cb = key[i]; *ds++ = cb; hv = (hv * principal) ^ (ulong)cb; } ce->hash = hv; }
public void DataKeyArray_GetEnumerator () { OrderedDictionary dictionary = new OrderedDictionary (); dictionary.Add ("key", "value"); ArrayList list = new ArrayList (); DataKey key = new DataKey (dictionary); list.Add (key); DataKeyArray keyarray = new DataKeyArray (list); IEnumerator inumerator = keyarray.GetEnumerator (); Assert.IsNotNull (inumerator, "GetEnumerator"); }
protected int GetAndTouch(DataKey* ret, DataKey* cit, bool touch = false) { if (cit == null) { Stats.CountMisses++; return iKeyNotFound; } Stats.CountGetHits++; ret->cas = cit->cas; ret->flags = cit->flags; ret->SetValue(cit); if (touch) ret->etime = CalcEtime(cit->etime); return iSuccess; }
protected int CasAppend(DataKey* dst, DataKey* src, bool append) { Stats.CountUpdates++; if (dst->CheckCas(src)) return iNotStored; if (append) AppendValues(dst, src); else { AppendValues(src, dst); dst->val_addr = src->val_addr; dst->ValSize = src->ValSize; src->val_addr = null; src->ValSize = 0; } return iSuccess; }
protected int ExecuteRequest(DataKey* cop) { Stats.RequestCount++; int oc = cop->opcode; if (ReqsSpecial.Has(oc)) return SpecOps(cop); var deleteKey = (oc == xDelete) || (oc == xDeleteQ); var lce = LookupKey(cop, deleteKey); var xtag = false; switch (cop->opcode) { case xGet: case xGetK: case xGetQ: case xGetKQ: return GetAndTouch(cop, lce, xtag); case xGat: case xGatQ: case xGatK: case xGatKQ: xtag = true; goto case xGet; case xAdd: case xAddQ: if (lce->cas == 0) return CasUpdate(lce, cop); ReleaseValue(cop); return iKeyExists; case xReplace: case xReplaceQ: if (lce == null) return iKeyNotFound; goto case xSet; case xSet: case xSetQ: return CasUpdate(lce, cop); case xInc: case xIncQ: xtag = true; goto case xDec; case xDec: case xDecQ: return CasCounts(lce, cop, xtag); case xDelete: case xDeleteQ: break; // done by del_key flag. case xAppend: case xAppendQ: xtag = true; goto case xPrepend; case xPrepend: case xPrependQ: return CasAppend(lce, cop, xtag); default: return iUnknownCommand; } return iSuccess; }
// bucket data access methods. public int Push(DataKey* ne) { var i = _data; var cnt = ++i & 0x7FFF; ne->next = (DataKey*)(i >> 16); _data = ((ulong)ne << 16) | cnt; return (int)cnt; }
protected int CasUpdate(DataKey* dst, DataKey* src) { Stats.CountUpdates++; if (dst->CheckCas(src)) return iNotStored; dst->val_addr = src->val_addr; dst->size = src->size; dst->etime = CalcEtime(src->etime); src->val_addr = null; src->ValSize = 0; return iSuccess; }
public void Pop(DataKey* prev) { var i = _data; if (prev == null) { var ne = (DataKey*)(i >> 16); _data = ((ulong)ne->next << 16) | (--i & 0x7FFF); } else { var ne = prev->next; prev->next = ne->next; _data--; } }
protected void AppendValues(DataKey* lkey, DataKey* rkey) { if (rkey->ValSize == 0) return; if (lkey->ValSize != 0) { AppendValuesData(lkey, rkey); ReleaseValue(rkey); } else { lkey->val_addr = rkey->val_addr; lkey->ValSize = rkey->ValSize; rkey->val_addr = null; rkey->ValSize = 0; } }