当前位置: 首页>>代码示例>>C#>>正文


C# AdminController类代码示例

本文整理汇总了C#中AdminController的典型用法代码示例。如果您正苦于以下问题:C# AdminController类的具体用法?C# AdminController怎么用?C# AdminController使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AdminController类属于命名空间,在下文中一共展示了AdminController类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ReservationSummaryListView_ItemCommand

    protected void ReservationSummaryListView_ItemCommand(object sender, ListViewCommandEventArgs e)
    {
        //this is the mthod which will gather the seating  information for reservation and pass to the BLL for proceosessing

        if (e.CommandName.Equals("Seat"))
        {
            //execuion if the code wukk ve uynder tghe controll
            MessageUserControl.TryRun(() =>
            {
                int reservationid = int.Parse(e.CommandArgument.ToString());
                    int waiterid = int.Parse(WaiterDropDownList.SelectedValue);
                    DateTime when = Mocker.MockDate.Add(Mocker.MockTime);
                List<byte> selectedTables = new List<byte>();
                //walk throug the list box row by row
                foreach (ListItem item_tableid in ReservationTableListBox.Items)
                {
                    if (item_tableid.Selected)
                    {
                        selectedTables.Add(byte.Parse(item_tableid.Text.Replace("Table ", "")));
                    }
                }

                //with all data gatherd, connet to your library controller, and send data for processing
                AdminController sysmgr = new AdminController();
                sysmgr.SeatCustomer(when reservationid, selectedTables, waiterid);

                SeatingGridView.DataBind();
                ReservationsRepeater.DataBind();
            }, "customer Seated", "Reservation  customer has been saeated");
        }
    }
开发者ID:wcoonghe1,项目名称:InClassDemos-archive,代码行数:31,代码来源:FrontDesk.aspx.cs

示例2: SeatingGridView_SelectedIndexChanging

    protected void SeatingGridView_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
    {
        //extract the table number, number in party and the waiter ID
        //from the grid view
        //we will also create the time from the MockDateTime controls at the top of this form
        //Typically you would use DateTime.Today for current datetime

        //once the date is collected then it will be sent to the BLL for processing

        //the command will be done under the control of the MessageUserControl
        //so if there is an error, the MUC can handle it.
        //we will use the in-line MUC TryRun technique

        MessageUserControl.TryRun(() =>
            {
                //obtain the selected gridview row
                GridViewRow agvrow = SeatingGridView.Rows[e.NewSelectedIndex];
                //accessing a web control on the gridview row uses .FindControl("xxx) as 
                //datatype xxx be the name of control
                //points to the control
                string tablenumber = (agvrow.FindControl("TableNumber") as Label).Text;
                string numberinparty = (agvrow.FindControl("NumberInParty") as TextBox).Text;
                string waiterid = (agvrow.FindControl("WaiterList") as DropDownList).SelectedValue;
                DateTime when = Mocker.MockDate.Add(Mocker.MockTime); //Parse(SearchDate.Text).Add(TimeSpan.Parse(SearchTime.Text));

                //standard call to insert a record into the DB
                AdminController sysmgr = new AdminController();
                sysmgr.SeatCustomer(when, byte.Parse(tablenumber), int.Parse(numberinparty),
                                      int.Parse(waiterid));
                //refresh the gridview
                SeatingGridView.DataBind();
            }, "Customer Seated", "New walk-in customer has been saved"); //message
    }
开发者ID:sluo1nait,项目名称:InClassDemos,代码行数:33,代码来源:FrontDesk.aspx.cs

示例3: SeatingGridView_SelectedIndexChanged

    protected void SeatingGridView_SelectedIndexChanged(object sender, GridViewSelectEventArgs e)
    {
        //extarct the table number in the party and the awaiter ID from the grid view
        //will also create the time from the mockDateTime contrtorls at the top of this form
        //once the date uis collected then it will ne sent to the BLL for processeing
        //the comman will be done under the control of the MessegeUserControll
        //so if there is an error the MUS will handle it.
        // we wll use the Inline MUC tryRun technique

        MessageUserControl.TryRun(() =>
        {
            //obtain the selected grid view
            GridViewRow agvrow = SeatingGridView.Rows[e.NewSelectedIndex];
            //asscessing a wen control on the gridview row
            //uses .FindControl("xxx") as a datatype
            string tablenumber = (agvrow.FindControl("TableNumber") as Label).Text;
            string numberinparty = (agvrow.FindControl("NumberInParty")as TextBox).Text;
            string waiterID = (agvrow.FindControl("WaiterList") as DropDownList).SelectedValue;
            DateTime when = Mocker.MockDate.Add(Mocker.MockTime);

            //standerd call insert a record to the DB
            AdminController sysmgr = new AdminController();
            sysmgr.SeatCustomer(when, byte.Parse(tablenumber), int.Parse(numberinparty), int.Parse(waiterID));

            //refresh the gridview
            SeatingGridView.DataBind();
         }, "Customer Seated", "New Wall-in Customer has been saved"
        );
    }
开发者ID:wcoonghe1,项目名称:InClassDemos-archive,代码行数:29,代码来源:FrontDesk.aspx.cs

示例4: ReservationSummaryListView_OnItemCommand

 protected void ReservationSummaryListView_OnItemCommand(object sender, ListViewCommandEventArgs e)
 {
     // Check the command name and add the reservation for the specified seats.
     if (e.CommandName.Equals("Seat"))
     {
         MessageUserControl.TryRun(() =>
         {
             // Get the data
             var reservationId = int.Parse(e.CommandArgument.ToString());
             var selectedItems = new List<byte>();//for multiple table numbers
             foreach (ListItem item in ReservationTableListBox.Items)
             {
                 if (item.Selected)
                     selectedItems.Add(byte.Parse(item.Text.Replace("Table ", "")));
             }
             var when = Mocker.MockDate.Add(Mocker.MockTime);
             // Seat the reservation customer
             var controller = new AdminController();
             controller.SeatCustomer(when, reservationId, selectedItems, int.Parse(WaiterDropDownList.SelectedValue));
             // Refresh the gridview
             SeatingGridView.DataBind();
             ReservationsRepeater.DataBind();
             ReservationTableListBox.DataBind();
         }, "Customer Seated", "Reservation customer has arrived and has been seated");
     }
 }
开发者ID:gthind4,项目名称:InClassDemo,代码行数:26,代码来源:FrontDesk.aspx.cs

示例5: SeatingGridView_SelectedIndexChanging

    protected void SeatingGridView_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
    {
        //extract tablenumber, waiterid, numberinparty from the gridview
        // we will also create a datetime variable using the mock clock at the top of
        //the page. (Typically in real-time you use use DateTime.Today)

        //once the data is collected it will be passed to the BLL from processing

        //the command will be done under the control of the MessageUserControl
        //we will use the MUC inline technique

        MessageUserControl.TryRun(() =>
            {
                //obtain our data from the GridView row
                GridViewRow agvrow = SeatingGridView.Rows[e.NewSelectedIndex];

                //accessing a web control on thee gridview row
                //the command to do this is .FindControl("xxxx") as datatype
                //all data from the gridview is a string
                string tablenumber = (agvrow.FindControl("TableNumber") as Label).Text;
                string numberinparty = (agvrow.FindControl("NumberInParty") as TextBox).Text;
                string waiterid = (agvrow.FindControl("WaiterList") as DropDownList).SelectedValue;
                DateTime when = DateTime.Parse(SearchDate.Text).Add(TimeSpan.Parse(SearchTime.Text));

                //standard typical call to your controller in the BLL
                AdminController sysmgr = new AdminController();
                sysmgr.SeatCustomer(when, byte.Parse(tablenumber),
                                          int.Parse(numberinparty),
                                          int.Parse(waiterid));

                //refresh the gridview
                SeatingGridView.DataBind();
            },"Customer Seated","New walk-in customer has been saved");
    }
开发者ID:ggould5,项目名称:InClassDemos-master,代码行数:34,代码来源:FrontDesk.aspx.cs

示例6: MockLastBillingDateTime_Click

 protected void MockLastBillingDateTime_Click(object sender, EventArgs e)
 {
     AdminController sysmgr=new AdminController();
     DateTime info = sysmgr.GetLastBillDateTime();
     SearchDate.Text = info.ToString("yyyy-MM-dd");
     SearchTime.Text = info.ToString("HH:mm");
 }
开发者ID:xdu3,项目名称:InClassDemo,代码行数:7,代码来源:FrontDesk.aspx.cs

示例7: ShowReservationSeating

 protected bool ShowReservationSeating()
 {
     bool showreservations= false;
     //this method will query the database to
     //show any available seats for reservations
     DateTime when = Mocker.MockDate.Add(Mocker.MockTime);
     AdminController sysmgr = new AdminController();
     showreservations = sysmgr.IsAvailableSeats(when);
     return showreservations;
 }
开发者ID:gthind4,项目名称:InClassDemo,代码行数:10,代码来源:FrontDesk.aspx.cs

示例8: DashboardTest

 public void DashboardTest()
 {
     IMembershipRepository membershipRepository = null; // TODO: Initialize to an appropriate value
     IFormsAuthentication formsAuthentication = null; // TODO: Initialize to an appropriate value
     AdminController target = new AdminController(membershipRepository, formsAuthentication); // TODO: Initialize to an appropriate value
     ActionResult expected = null; // TODO: Initialize to an appropriate value
     ActionResult actual;
     actual = target.Dashboard();
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
开发者ID:Naviam,项目名称:Shop-Any-Ware,代码行数:11,代码来源:AdminControllerTest.cs

示例9: ReservationSummaryListView_ItemCommand

    protected void ReservationSummaryListView_ItemCommand(object sender, ListViewCommandEventArgs e)
    {
        // this is the method which will gather the seating
        // information for reservations and pass to the BLL
        // for processing

        // no processing will be done unless the e.CommandName is
        // equal to "Seat"

        if (e.CommandName.Equals.("Seat"))
        {
           // execution of the code will be under the control
           // of the MessageUserControl
            MessageUserControl.TryRun(() =>
                {
                  //1. gather necessary data from the web controls
                  int reservationid = int.Parse(e.CommandArgument.ToString());
                  int waiterid = int.Parse(WaiterDropDownList.SelectedValue);
                  DateTime when = Mocker.MockDate.Add(Mocker.MockTime);
                  //2. we need to collect possible multiple values
                  // from the ListBox control which contains
                  // the selected tables to be assigned to this
                  // group of customers

                    List<byte> selectedTables = new List<byte>();

                 //3.walk throuth the ListBox row by row
                    foreach (ListItem item_tableid in ReservationTableListBox.Items)
                    {
                       if (item_tableid.Selected)
                       {
                       selectedTables.Add(byte.Parse(item_tableid.Text.Replace("Table ","")));                          )

                       }

                    }

                    //4.with all data gathered, connect to your
                    //library controller, and send data for
                    //processing

                    AdminController sysmgr = new AdminController();
                    sysmgr.SeatCustomer(when, reservationid,selectedTables,waiterid);

                    //5.Refresh the page(Screen)
                    SeatingGridView.DataBind();
                    //6.Refresh the reservation Repeater
                    ReservationsRepeater.DataBind();
                    ReservationTableListBox.DataBind();

                },"Customer Seated","Reservation customer has arrived and has been seated");

        }
    }
开发者ID:swu18,项目名称:InClassDemo,代码行数:54,代码来源:FrontDesk.aspx.cs

示例10: GetWaiterInfo

 public void GetWaiterInfo()
 {
     AdminController sysmgr = new AdminController();
     var waiter = sysmgr.GetWaiterByID(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;
     DateHired.Text = waiter.HireDate.ToShortDateString();
     if (waiter.ReleaseDate.hasValue)
         DateReleased = waiter.ReleaseDate.ToShortDateString();
 }
开发者ID:ashaw11,项目名称:InClassDemos,代码行数:13,代码来源:WaiterAdmin.aspx.cs

示例11: CanDeleteArticle

        public void CanDeleteArticle()
        {
            var articleIds = GetArticleIds();

            var mock = new Mock<IArticleRepository>();
            mock.Setup(m => m.Articles).Returns(GetArticles(articleIds));

            var controller = new AdminController(mock.Object);

            var deletedArticleId = articleIds[3];

            controller.Delete(deletedArticleId);

            mock.Verify(m => m.DeleteArticle(deletedArticleId));
        }
开发者ID:KuuuPER,项目名称:RussianTeaClubSite,代码行数:15,代码来源:UnitTest1.cs

示例12: Cannot_Edit_Nonexistent_Client

 public void Cannot_Edit_Nonexistent_Client()
 {
     // Arrange - create the mock repository
     Mock<IClientRepository> mock = new Mock<IClientRepository>();
     mock.Setup(m => m.Clients).Returns(new Client[] {
        new Client {ClientId = 1, ContractNumber = "L1"},
     new Client {ClientId = 2, ContractNumber = "L2"},
     new Client {ClientId = 3, ContractNumber = "L3"},
       }.AsQueryable());
     // Arrange - create the controller
     AdminController target = new AdminController(mock.Object);
     // Act
     Client result = (Client)target.Edit(4).ViewData.Model;
     // Assert
     Assert.IsNull(result);
 }
开发者ID:TimHanes,项目名称:OB,代码行数:16,代码来源:AdminTests.cs

示例13: Cannot_Save_Invalid_Changes

 public void Cannot_Save_Invalid_Changes()
 {
     // Arrange - create mock repository
     Mock<IProductRepository> mock = new Mock<IProductRepository>();
     // Arrange - create the controller
     AdminController target = new AdminController(mock.Object);
     // Arrange - create a product
     Product product = new Product {Name = "Test"};
     // Arrange - add an error to the model state
     target.ModelState.AddModelError("error", "error");
     // Act - try to save the product
     ActionResult result = target.Edit(product);
     // Assert - check that the repository was not called
     mock.Verify(m => m.SaveProduct(It.IsAny<Product>()), Times.Never());
     // Assert - check the method result type
     Assert.IsInstanceOfType(result, typeof (ViewResult));
 }
开发者ID:kademat,项目名称:FoodStore,代码行数:17,代码来源:AdminTests.cs

示例14: CanEditArticle

        public void CanEditArticle()
        {
            var articleIds = GetArticleIds();

            var mock = new Mock<IArticleRepository>();
            mock.Setup(m => m.Articles).Returns(GetArticles(articleIds));

            var controller = new AdminController(mock.Object);

            var article1 = controller.Edit(articleIds[0]).ViewData.Model as Article;
            var article2 = controller.Edit(articleIds[1]).ViewData.Model as Article;
            var article3 = controller.Edit(articleIds[2]).ViewData.Model as Article;

            Assert.AreEqual(articleIds[0], article1.ArticleId);
            Assert.AreEqual(articleIds[1], article2.ArticleId);
            Assert.AreEqual(articleIds[2], article3.ArticleId);
        }
开发者ID:KuuuPER,项目名称:RussianTeaClubSite,代码行数:17,代码来源:UnitTest1.cs

示例15: Cannot_Save_Invalid_Changes

 public void Cannot_Save_Invalid_Changes()
 {
     // Arrange - create mock repository
     Mock<IClientRepository> mock = new Mock<IClientRepository>();
     // Arrange - create the controller
     AdminController target = new AdminController(mock.Object);
     // Arrange - create a client
     Client client = new Client { ContractNumber = "Test" };
     // Arrange - add an error to the model state
     target.ModelState.AddModelError("error", "error");
     // Act - try to save the client
     ActionResult result = target.Edit(client);
     // Assert - check that the repository was not called
     mock.Verify(m => m.SaveClient(It.IsAny<Client>()), Times.Never());
     // Assert - check the method result type
     Assert.IsInstanceOfType(typeof(ViewResult), result);
 }
开发者ID:TimHanes,项目名称:OB,代码行数:17,代码来源:AdminTests.cs


注:本文中的AdminController类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。