コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["Manager"] != null)
            {
                manager = (Manager)Session["Manager"];
            }
            else
            {
                divReservation.Visible = false;
            }//error

            if (Request.QueryString["tableName"] != null)
            {
                tableName = Request.QueryString["tableName"].ToString();
            }
            else
            {
                Response.Write("<Script>alert('no table is selected ')</script>");
                Response.Redirect(System.Configuration.ConfigurationManager.AppSettings["ManagerMain"]);
            }

            if (!IsPostBack)
            {
                LabelTable.Text = tableName;
                LabelTime.Text = DateTime.Now.ToString();
            }
        }
コード例 #2
0
        //Function: initialize a concrete user, return it as use of this session, if the user is valid
        //Paramaters:
        //Return: concrete user type, (Customer or Manager)
        //    null when the user is invalid
        //用户身份验证,根据名字密码查数据库,合法的话,返回出manager或者customer
        //不合法返回NUll
        public static User Login(string pName, string pPwd)
        {
            User user = null;
            DataContextDataContext dc = new DataContextDataContext();
            bool? isValid = false;
            ISingleResult<is_valid_userResult> rs = dc.is_valid_user(pName, pPwd, ref isValid);

            if (isValid == true)
            {
                foreach (is_valid_userResult s in rs)
                {
                    if (s.type == 1)
                    {
                        user = new Customer(s.name, s.pwd, s.mail);
                    }
                    else if (s.type == 2)
                    {
                        user = new Manager(s.name, s.pwd, s.mail);
                    }
                    else
                    { }

                }

            }
            else //invalid
            {}
            return user;
        }
コード例 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            manager = (Manager)Session["Manager"];

            //从url里找到桌子name
            if (Request.QueryString["TableName"] != null)
            {
                tableName = Request.QueryString["TableName"];
            }
            else
            {
                Label1.Text = "no table is selected";
                GridView1.Dispose();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["Manager"] == null)
            {
                ContentPlaceHolder1.Visible = false;
                divLogin.Visible = false;
                divMenu.Visible = false;
                this.ContentPlaceHolder1.Visible = false;
            }
            else
            {
                divNotLogin.Visible = false;

                manager = (Manager)Session["manager"];
                LabelHello.Text = "Hello " + manager.name;
            }
        }
コード例 #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["Manager"] != null)
            {
                manager = (Manager)Session["Manager"];

            }
            else
            { }

            if (Request.QueryString["TableName"] != null)
            {
                tableName = Request.QueryString["TableName"];
            }
            else
            {
                Label1.Text = "no table is selected!";

            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["Manager"] != null)
            {
                manager = (Manager)Session["Manager"];
                UserNameLabel1.Text = manager.name;
            }

            else
            {
                divReservation.Visible = false;
                Response.Write("<Script>alert('please login first')</script>");
            }

            if (!IsPostBack)
            {
                TextBoxArriveDate.Text = DateTime.Now.ToShortDateString();
                //DropDownListDuration.Items.Remove("start");
            }
            else
            { }
        }
コード例 #7
0
        //Function: register a new manager of the system
        //Return: a manager newd if the record is creaded successfully
        //        null if returned if the manager with a same name exists in db
        public Manager RegisterManager(string pName, string pPwd, string pMail)
        {
            Manager manager = null;
            bool? isExist = false;

            DataContextDataContext dc = new DataContextDataContext();
            dc.is_registered(pName, ref isExist);

            if (isExist == true)
            { } //manager = null
            else // not exist, can insert
            {
                try
                {
                    dc.insert_manager(pName, pPwd, pMail);
                    manager = new Manager(pName, pPwd, pMail);
                }
                catch (Exception ex)
                { } //custom = null;

            }

            return manager;
        }
コード例 #8
0
 public void ModifyManager(Manager pManager)
 {
     DataContextDataContext dc = new DataContextDataContext();
     dc.update_user(pManager.name, pManager.pwd, pManager.mail);
 }
コード例 #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //初始化table,dish信息
            Restaurant.InitAllDish();
            Restaurant.InitAllTable();
            CheckService.CheckTableReserved();
            CheckService.CheckTableTimeOut();

            //看是否登录,登录的manager,custoemr都会存session的
            if (Session["Manager"] != null)
            {
                manager = (Manager)Session["Manager"];
            }
            else
            {}

            //非post过来的请求,默认指定一个标签,下拉菜单初始化(选择timout resrvation延时时间的),
            if (!IsPostBack)
            {
                MultiViewMain.SetActiveView(ViewTable);
                for (int i = 10; i <= 60; i+=10)
                {
                    DropDownListTime.Items.Add(i.ToString());
                }
            }
            else
            { }
        }
コード例 #10
0
 protected void Page_Load(object sender, EventArgs e)
 {
     manager = new Manager();
 }