示例#1
0
        public async Task <ActionResult> AddGuest(GuestViewModel guest, Guid?storerId = null)
        {
            if (storerId == null)
            {
                storerId = GuestStore.Helpers.GetStorerIdFromCookie(Request);
            }
            await _GuestManager.AddGuest(guest, storerId);

            TempData["StorerId"] = guest.AddedBy;
            Response.SetCookie(new HttpCookie("storer", guest.AddedBy.ToString()));
            return(RedirectToAction("/RSVP"));
        }
示例#2
0
        /// <summary>
        /// 保存功能
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void 保存ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Guest guest = new Guest();

            guest.Name       = this.txtName.Text.Trim();
            guest.LeaveTime  = Convert.ToDateTime(this.txtLeaveTime.Text);
            guest.ArriveTime = Convert.ToDateTime(this.txtArriveTime.Text);
            guest.CategoryId = 1;
            guest.Mobile     = this.txtPhone.Text.Trim();
            guest.Sex        = this.txtSex.Text.Trim();
            guest.RoomId     = Convert.ToInt32(this.txtRoomID.Text.Trim());
            GuestManager.AddGuest(guest);
            MessageBox.Show("保存成功");

            this.dgvGuest.DataSource = GuestManager.GetAllGuests();
        }
示例#3
0
        /// <summary>
        /// 添加旅客按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void AddButton_OnClick(object sender, EventArgs e)
        {
            if (GuestName.Text == "" || GuestID.Text == "" ||
                !Regex.IsMatch(GuestID.Text, "\\d{14}"))
            {
                Response.Write("<script>alert('旅客信息不正确!');</script>");
                return;
            }

            try
            {
                GuestManager.AddGuest(new Guest
                {
                    GuestID   = GuestID.Text,
                    GuestName = GuestName.Text.Trim(),
                    Username  = UsernameLabel.Text
                });
            }
            catch
            {
                Response.Write("<script>alert('该旅客已存在!');</script>");
            }
            GuestTable.DataBind();
        }