Example #1
0
 protected void SetMockLastBillingDateTime()
 {
     var controller = new eRestaurantController();
     var info = controller.GetLastBillDate();
     TB_SearchDate.Text = info.ToString("yyyy-MM-dd");
     TB_SearchTime.Text = info.ToString("HH:mm:ss");
 }
Example #2
0
    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();
    }
Example #3
0
    //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();

        

    }
Example #4
0
 public void GetWaiterInfo()
 {
     eRestaurantController controller = new eRestaurantController();
     var waiter = controller.GetWaiter(int.Parse(WaiterList.SelectedValue));
     WaiterID.Text = waiter.WaiterID.ToString();
     FirstName.Text = waiter.FirstName;
     LastName.Text = waiter.LastName;
     Phone.Text = waiter.Phone;
     Address.Text = waiter.Address;
     HiredDate.Text = waiter.HireDate.ToShortDateString();
     if (waiter.ReleaseDate.HasValue)
         ReleaseDate.Text = waiter.ReleaseDate.Value.ToShortDateString();
 }