Esempio n. 1
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            if (!CheckData())
            {
                return;
            }

            DataRow[] matches = tablePost.Select("Name='" + name + "'");
            if (matches.Length > 0)
            {
                return;
            }

            StaffBean b = new StaffBean();

            AssignData(b);
            b.Status = status;
            if (status != "试用")
            {
                b.DateEntry = dateStatus;
            }

            StaffDAO dao = new StaffDAO();

            dao.AddStaff(b);

            LoadData();
        }
Esempio n. 2
0
        void addStaff()
        {
            string cusID     = (string)Request.Form["id"];
            string cusName   = (string)Request.Form["name"];
            string cusDate   = (string)Request.Form["date"];
            string cusGender = (string)Request.Form["gender"];
            string cusAdress = (string)Request.Form["adress"];
            string cusNote   = (string)Request.Form["note"];
            string username  = (string)Request.Form["username"];
            string pass      = (string)Request.Form["pass"];
            string email     = (string)Request.Form["email"];
            int    type;

            if (cusID.Equals("admin"))
            {
                type = 1;
            }
            else
            {
                type = 0;
            }
            AccountDAO     aDAO        = new AccountDAO();
            List <Account> listAccount = new List <Account>();

            listAccount = aDAO.getAllAccount();
            for (int i = 0; i < listAccount.Count; i++)
            {
                if (listAccount[i].Username.Equals(username))
                {
                    string er = "Tài Khoản Đã Tồn Tại";
                    Session["er"] = er;
                    return;
                }
            }
            aDAO.addAccount(username, pass, type, email);
            StaffDAO sDAO = new StaffDAO();

            sDAO.AddStaff(username, cusName, cusDate, cusGender, cusAdress, cusNote);
            Session["listStaff"] = sDAO.GetStaff();
            Response.Redirect("StaffManagement.aspx");
        }