コード例 #1
0
    protected void bntSaveOrder(object sender, EventArgs e)
    {
        Account customer     = new Account();
        string  customerName = (MultiView1.Views[3].FindControl("tbName") as TextBox).Text;

        customer.Birthday     = DateTime.Parse((MultiView1.Views[3].FindControl("tbBirthday") as TextBox).Text);
        customer.Phone        = (MultiView1.Views[3].FindControl("tbMoble") as TextBox).Text;
        customer.Email        = (MultiView1.Views[3].FindControl("tbMail") as TextBox).Text;
        customer.Address      = (MultiView1.Views[3].FindControl("tbAdd") as TextBox).Text;
        customer.IdentifyCode = "khong hieu";


        int       row      = BLLAccount.InsertAccount(customer);
        ArrayList arrSeart = (ArrayList)ViewState["CountSeat"];

        if (row > 0)
        {
            // save ticket
            for (int i = 0; i < arrSeart.Count; i++)
            {
                Ticket ticket = new Ticket();
                ticket.DateBooking = DateTime.Now;
                ticket.CancelDate  = DateTime.Now;
                ticket.ListBusID   = int.Parse(_listbusID.Value.ToString());
                ticket.AccountID   = row;
                ticket.NumberSeat  = Int32.Parse(arrSeart[i].ToString());
                ticket.PromoteID   = (int)ViewState["promoteID"];
                ticket.TotalFees   = float.Parse(lbTotalPrice.Text);
                ticket.TotalFare   = (float)ViewState["totalFare"];
                ticket.Status      = "Pending";
                int rows = BLLTicket.InsertTicket(ticket);
            }
        }
        MultiView1.ActiveViewIndex++;
    }
コード例 #2
0
        private void testUser()
        {
            string strUser = txtTaiKhoan.Text;
            string strPass = txtMatKhau.Text;

            if (strUser != "" && strPass != "")
            {
                try
                {
                    var result = BLLAccount.FindAccount(strUser, strPass);
                    if (result.IsSuccess)
                    {
                        var user = (PMS.Data.TaiKhoan)result.Data;
                        AccountSuccess.TenTK         = user.UserName;
                        AccountSuccess.TenChuTK      = user.Name;
                        AccountSuccess.ThanhPham     = user.ThanhPham;
                        AccountSuccess.BTP           = user.BTP;
                        AccountSuccess.ThaoTac       = user.ThaoTac ?? 0;
                        AccountSuccess.IdFloor       = (user.Floor ?? 0).ToString();
                        AccountSuccess.IsOwner       = user.IsOnwer;
                        AccountSuccess.IsCompleteAcc = user.IsCompleteAcc;
                        if (!string.IsNullOrEmpty(user.ListChuyenId))
                        {
                            AccountSuccess.strListChuyenId = user.ListChuyenId;
                            AccountSuccess.listChuyenId    = user.ListChuyenId.Split(',').ToList();
                        }
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show(result.Messages[0].msg, result.Messages[0].Title, MessageBoxButtons.OK, MessageBoxIcon.Error);
                        txtTaiKhoan.Text = "";
                        txtTaiKhoan.Focus();
                        txtMatKhau.Text = "";
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("finish" + ex.Message);
                }
            }
            else
            {
                MessageBox.Show("Tên tài khoản và mật khẩu không được rỗng", "Lỗi đăng nhập", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }