本文整理汇总了C#中Waiter类的典型用法代码示例。如果您正苦于以下问题:C# Waiter类的具体用法?C# Waiter怎么用?C# Waiter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Waiter类属于命名空间,在下文中一共展示了Waiter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WaiterInsert_Click
protected void WaiterInsert_Click(object sender, EventArgs e)
{
//inline version of using MessageUserControl
MessageUserControl.TryRun(() =>
//remainder of the code is what would have gone in the external method of
//(processRequest(MethodName)
{
Waiter item = new Waiter();
item.FirstName = FirstName.Text;
item.LastName = LastName.Text;
item.Address = Address.Text;
item.Phone = Phone.Text;
item.HireDate = DateTime.Parse(HireDate.Text);
//nullable field
if(string.IsNullOrEmpty(ReleaseDate.Text))
{
item.ReleaseDate = null;
}
else
{
item.ReleaseDate = DateTime.Parse(ReleaseDate.Text);
}
AdminController SystemManager = new AdminController();
WaiterID.Text = SystemManager.Waiters_Add(item).ToString();
MessageUserControl.ShowInfo("Waiter added");
RefreshWaiterList(WaiterID.Text);
}
);
}
示例2: WaitThenClick
internal WaitThenClick(Driver driver, Options options, Waiter waiter, ElementFinder elementFinder)
: base(driver, options)
{
this.options = options;
this.waiter = waiter;
this.elementFinder = elementFinder;
}
示例3: InsertWaiterInfo
//INSERT
public void InsertWaiterInfo()
{
//The code that exists within this method is a standard CRUD insert.
//Similar to what was learned in APPDEV 1
eRestaurantController controller = new eRestaurantController();
//Load an instance of Waiter.
Waiter insertWaiter = new Waiter();
insertWaiter.WaiterID = 0;
insertWaiter.FirstName = FirstName.Text;
insertWaiter.LastName = LastName.Text;
insertWaiter.Phone = Phone.Text;
insertWaiter.Address = Address.Text;
insertWaiter.HireDate = DateTime.Parse(HiredDate.Text);
//Check if the release date is Null/Empty
if (string.IsNullOrEmpty(ReleaseDate.Text))
{
insertWaiter.ReleaseDate = null; //This can be null becuase in the database it is set to "Nullable"
}
else
{
insertWaiter.ReleaseDate = DateTime.Parse(ReleaseDate.Text);
}
//Add waiter to the database.
controller.Waiter_Add(insertWaiter);
//Rebind the dropdown (WaiterList) so the new entry will appear in the list.
WaiterList.DataBind();
}
示例4: Main
public static void Main()
{
Cook joe = new Cook();
Waiter suzy = new Waiter(joe);
Customer fred = new Customer(suzy);
fred.PlaceOrder();
}
示例5: InsertWaiterInfo
public void InsertWaiterInfo()
{
//the code that exists within this method
//is a standard CRUD insert which you learned in AppDev 1
eRestaurantController controller = new eRestaurantController();
//load an instance of Waiter
Waiter item = new Waiter();
item.WaiterID = 0; //identity field on SQL therefore set to 0
item.FirstName = FirstName.Text;
item.LastName = LastName.Text;
item.Phone = Phone.Text;
item.Address = Address.Text;
item.HireDate = DateTime.Parse(HiredDate.Text);
if (string.IsNullOrEmpty(ReleaseDate.Text))
{
item.ReleaseDate = null;
}
else
{
item.ReleaseDate = DateTime.Parse(ReleaseDate.Text);
}
//call the controller's Add method for the Waiter
controller.Waiter_Add(item);
//rebind the drop down list (WaiterList) so the new
//waiter will appear in the list
WaiterList.DataBind();
}
示例6: wait
async Task<bool> wait(CancellationToken token)
{
Waiter<bool> waiter = null;
bool lockTaken = false;
try
{
spinner.Enter(ref lockTaken);
if (!this.IsLocked && this.waiters.Count == 0)
{
this.IsLocked = true;
return true;
}
waiter = new Waiter<bool>(token);
if (token != CancellationToken.None)
waiter.OnCancel += Waiter_OnCancel;
waiters.InsertAtTail(waiter);
}
finally
{
if (lockTaken)
spinner.Exit(false);
}
if (waiter == null)
return false;
bool hasLock = await waiter;
token.ThrowIfCancellationRequested();
return hasLock;
}
示例7: Get
public async Task<Dictionary<string, string>> Get([FromUri] int ms)
{
//Sanitize
ms = ms > 2000 ? 1 : ms;
var waiting = new Waiter();
var stopwatch = new Stopwatch();
stopwatch.Start();
stopwatch.Restart();
waiting.DoWork(ms);
var inOrderSpan = stopwatch.Elapsed;
stopwatch.Restart();
await waiting.DoWorkAsync(ms);
var asyncSpan = stopwatch.Elapsed;
var returnDictionary = new Dictionary<string, string>
{
{"processors", Environment.ProcessorCount.ToString()},
{"inOrderSpan", inOrderSpan.ToString()},
{"asyncSpan", asyncSpan.ToString()}
};
var results = JsonConvert.SerializeObject(returnDictionary);
LogManager.GetCurrentClassLogger().Log(LogLevel.Info, results);
return returnDictionary;
}
示例8: WaitThenClick
internal WaitThenClick(Driver driver, Options options, Waiter waiter, ElementFinder elementFinder, DisambiguationStrategy disambiguationStrategy)
: base(driver, options)
{
waitBeforeClick = options.WaitBeforeClick;
this.waiter = waiter;
this.elementFinder = elementFinder;
this.disambiguationStrategy = disambiguationStrategy;
}
示例9: GetWaiterForCurrentThread
private static Waiter GetWaiterForCurrentThread()
{
Waiter waiter = t_waiterForCurrentThread;
if (waiter == null)
waiter = t_waiterForCurrentThread = new Waiter();
waiter.signalled = false;
return waiter;
}
示例10: Input
internal static async Task<string> Input(ConsoleControl.ConsoleControl cons)
{
using (var waitr = new Waiter(cons))
{
await waitr.Completion.Task;
return waitr.Content;
}
}
示例11: AddWaitersScenerio
public void AddWaitersScenerio()
{
Waiter newGuy = new Waiter();
int waiterId = -1;
this.Given(_=>GiveWaiterInformation(newGuy))
.when(_=>WhenIAddTheWaiter(newGuy, out waitId))
.then(_=>ThenTheWaiterExists(waiterId))
.And(_=>TheWaiterDetailsMatch(waiterId, newGuy))
.BDDfy
示例12: AssertIsNotInList
private unsafe void AssertIsNotInList(Waiter waiter)
{
Contract.Assert(waiter.next == null && waiter.prev == null);
Contract.Assert((_waitersHead == null) == (_waitersTail == null));
for (Waiter current = _waitersHead; current != null; current = current.next)
if (current == waiter)
Contract.Assert(false, "Waiter is in the waiter list, but should not be");
}
示例13: MakeFries
public void MakeFries(Waiter waiter)
{
if (fries > 0) {
Console.WriteLine("Cook making Fries");
waiter.ServeFood("Fries");
fries--;
}
else
Console.WriteLine("Sorry -- No more Fries");
}
示例14: MakeBurger
public void MakeBurger(Waiter waiter)
{
if (burgers > 0) {
Console.WriteLine("Cook making Burger");
waiter.ServeFood("Burger");
burgers--;
}
else
Console.WriteLine("Sorry -- No more Burgers");
}
示例15: AssertIsInList
private unsafe void AssertIsInList(Waiter waiter)
{
Contract.Assert(_waitersHead != null && _waitersTail != null);
Contract.Assert((_waitersHead == waiter) == (waiter.prev == null));
Contract.Assert((_waitersTail == waiter) == (waiter.next == null));
for (Waiter current = _waitersHead; current != null; current = current.next)
if (current == waiter)
return;
Contract.Assert(false, "Waiter is not in the waiter list");
}