コード例 #1
0
ファイル: AddUser.aspx.cs プロジェクト: nwccl82/Inventory
        protected void BtnOk_Click(object sender, EventArgs e)
        {
            busEmployees busemp = new busEmployees();
            Employees frmEmp = new Employees();
            frmEmp.FullName = this.txtFullname.Text;
            frmEmp.Email = this.txtEmail.Text;
            frmEmp.Login = this.txtLogin.Text;
            frmEmp.LastName = this.txtLastName.Text;
            frmEmp.passwords = this.txtPassword.Text;
            frmEmp.IDAccess = int.Parse(this.ddpAccess.SelectedValue);

            isExisting = isUserExisting();
            if (isExisting.Equals(true))
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('User existing')", true);
            }
            else
            {
                string x = busemp.insertEmployee(frmEmp);

                if (x.Trim() == string.Empty)
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Successfully added new User')", true);
                }
                else
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Failed to added new User')", true);
                }
            }
            //DataTable dt = new DataTable("User");
            //dt = busemp.allUser();
            //GridView1.DataSource = dt;
            //GridView1.DataBind();
        }
コード例 #2
0
ファイル: AddUser.aspx.cs プロジェクト: NDDC/Inventory
        protected void btnSave_Click(object sender, EventArgs e)
        {
            busEmployees busemp = new busEmployees();
            Employees frmEmp = new Employees();
            frmEmp.FullName = this.txtFullname.Text;
            frmEmp.Email = this.txtEmail.Text;
            frmEmp.Login = this.txtLogin.Text;
            frmEmp.LastName = this.txtLastName.Text;
            frmEmp.passwords = this.txtPassword.Text;

            isExisting = isUserExisting();
            if (isExisting.Equals(true))
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('User existing')", true);
            }
            else
            {
                busemp.insertEmployee(frmEmp);
            }
            DataTable dt = new DataTable("User");
            dt = busemp.allUser();
            GridView1.DataSource = dt;
            GridView1.DataBind();
        }
コード例 #3
0
ファイル: AddUser.aspx.cs プロジェクト: NDDC/Inventory
 private bool isUserExisting()
 {
     string userid = this.txtLogin.Text;
     busEmployees busemp = new busEmployees();
     FrameWork.Employees log = busemp.isUserExisting(userid);
     if (log == null)
     {
         return false;
     }
     else if (userid.Equals(log.Login))
     {
         return true;
     }
     else
     {
         return false;
     }
 }
コード例 #4
0
ファイル: AddUser.aspx.cs プロジェクト: NDDC/Inventory
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["user"] == null)
            {
                Response.Redirect("Login.aspx");
            }
            if (!IsPostBack)
            {
                busEmployees busemp = new busEmployees();
                //FrameWork.Login[] log;
                //log = buslogin.getAllUser();
                //UserGridView.DataSource = log;
                //UserGridView.DataBind();

                DataTable dt = new DataTable("User");
                dt = busemp.allUser();
                GridView1.DataSource = dt;
                GridView1.DataBind();

                /*trial code*/
                //FrameWork.Login a = new FrameWork.Login();
                //BusLogin buslogin = new BusLogin();
                //DataTable userDt = new DataTable();
                //DataTable dt = new DataTable();
                ////dt = buslogin.allUser();
                //a.UserTable = buslogin.allUser();
                //dt = a.UserTable;
                //UserGridView.DataSource = dt;
                //UserGridView.DataBind();
                /*trial code*/
            }
        }
コード例 #5
0
ファイル: ViewUser.aspx.cs プロジェクト: nwccl82/Inventory
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["user"] == null)
            {
                Response.Redirect("Login.aspx");
            }
            if (!IsPostBack)
            {
                busEmployees busemp = new busEmployees();
                //FrameWork.Login[] log;
                //log = buslogin.getAllUser();
                //UserGridView.DataSource = log;
                //UserGridView.DataBind();

                DataTable dt = new DataTable("User");
                dt = busemp.allUser();
                ViewState["User"] = dt;
                GridView1.DataSource = dt;
                GridView1.DataBind();
            }
        }