private void UnLockResource(Transaction context, MyLM.LockMode mode, RID rId) { LockableID id = new LockableID( ResourceLockPrefix, new LockableID(rId.ToString())); this.UnLock(context, mode, id); }
/// <summary> /// Write the resource to the shadow /// It supports multiple transactions /// </summary> /// <param name="context">Design for supporting multiple transactions</param> /// <param name="key"> </param> /// <param name="resource"> </param> /// <returns>success</returns> public void Write(Transaction context, RID key, Resource resource) { this.NumberWrites++; SelfDestructing(); var row = SerializationHelper.ConvertResourceToRow(resource); _simpleDatabase.UpsertRecord(context, Constants.ResourcesTableName, key.ToString(), row); }
/// <summary> /// Deletes reservations for a customer /// </summary> /// <param name="context">Design for supporting multiple transactions</param> /// <param name="key"></param> /// <returns></returns> public bool Delete(Transaction context, RID key) { //TransactionData currentShadow = CreateShadowIfNotExists(context); //return currentShadow.Resources.Remove(key); this.NumberWrites++; SelfDestructing(); try { _simpleDatabase.DeleteRecord(context, Constants.ResourcesTableName, key.ToString()); return(true); } catch (RecordNotFoundException) { return(false); } }
public override string ToString() { return(string.Format("[{0}:0x{1}]", Table, RID.ToString("x4"))); }
/// <summary> /// Reads the requested resource from the storage /// </summary> /// <param name="context">Design for supporting multiple transactions</param> /// <param name="key"></param> /// <returns></returns> public Resource Read(Transaction context, RID key) { try { var record = _simpleDatabase.ReadRecord(context, Constants.ResourcesTableName, key.ToString()); return(SerializationHelper.ConvertRowToResource(record)); } catch (RecordNotFoundException) { return(null); } }
/// <summary> /// Deletes reservations for a customer /// </summary> /// <param name="context">Design for supporting multiple transactions</param> /// <param name="key"></param> /// <returns></returns> public bool Delete(Transaction context, RID key) { //TransactionData currentShadow = CreateShadowIfNotExists(context); //return currentShadow.Resources.Remove(key); this.NumberWrites++; SelfDestructing(); try { _simpleDatabase.DeleteRecord(context, Constants.ResourcesTableName, key.ToString()); return true; } catch(RecordNotFoundException) { return false; } }
/// <summary> /// Write the resource to the shadow /// It supports multiple transactions /// </summary> /// <param name="context">Design for supporting multiple transactions</param> /// <param name="key"> </param> /// <param name="resource"> </param> /// <returns>success</returns> public void Write(Transaction context, RID key, Resource resource) { this.NumberWrites++; SelfDestructing(); var row = SerializationHelper.ConvertResourceToRow(resource); _simpleDatabase.UpsertRecord(context, Constants.ResourcesTableName, key.ToString(), row); }
/// <summary> /// Reads the requested resource from the storage /// </summary> /// <param name="context">Design for supporting multiple transactions</param> /// <param name="key"></param> /// <returns></returns> public Resource Read(Transaction context, RID key) { try { var record = _simpleDatabase.ReadRecord(context, Constants.ResourcesTableName, key.ToString()); return SerializationHelper.ConvertRowToResource(record); } catch(RecordNotFoundException) { return null; } }
protected void btnSelectRestaurant_Click(object sender, EventArgs e) { ArrayList arrProducts = new ArrayList(); // used to store the ProductNumber for each selected product int count = 0; // used to count the number of selected products int RID; // Iterate through the rows (records) of the GridView and store the ProductNumber divMenuSlect.Visible = true; // for each row that is checked for (int row = 0; row < gvRestaurant.Rows.Count; row++) { CheckBox CBox; // Get the reference for the chkSelect control in the current row CBox = (CheckBox)gvRestaurant.Rows[row].FindControl("chbxRestaurant"); if (CBox.Checked) { string ItemID = ""; // Get the ProductNumber from the BoundField from the GridView for the current row // and store the value in the array of selected products. ItemID = gvRestaurant.Rows[row].Cells[1].Text; arrProducts.Add(ItemID); count = count + 1; // lbltest.Text = arrProducts[0].ToString(); string RestaurantName = arrProducts[0].ToString(); //lbltest.Text = RestaurantName; objCommand.CommandType = CommandType.StoredProcedure; objCommand.CommandText = "TPGetRestaurantIdUsingRestaurantName"; objCommand.Parameters.AddWithValue("@RestaurantName", RestaurantName); DataSet dataset = objDB.GetDataSetUsingCmdObj(objCommand); RID = (int)objDB.GetField("RestaurantId", 0); //lbltest.Text = RID.ToString(); objCommand.Parameters.Clear(); objCommand.CommandType = CommandType.StoredProcedure; objCommand.CommandText = "TPGetMenusByRestarauntID"; objCommand.Parameters.AddWithValue("@RestaurantId", RID.ToString()); ddlMenu.DataSource = objDB.GetDataSetUsingCmdObj(objCommand); ddlMenu.DataTextField = "MenuName"; ddlMenu.DataValueField = "MenuId"; ddlMenu.DataBind(); } } }
internal void ToStringAsExpected(string expected, RID rid) { string actual = rid.ToString(); Assert.Equal(expected, actual); }
public override String ToString() { return(i.ToString() + "," + c + "," + p); }