Exemple #1
0
        private void BtnDelete_Click(object sender, EventArgs e)
        {
            userId = Convert.ToInt32(GridViewUsers.GetFocusedRowCellValue("UserId"));

            // 4	2 : สิทธิ์ใช้งานหน้าผู้ใช้งาน	 ลบข้อมูลผู้ใช้งาน
            int AuthorizeId = 4;

            if (SQLAuthorized.CheckAuthorized(ClassProperty.permisRoleId, AuthorizeId) == false)
            {
                SQLAuthorized.AlertAuthorized("สิทธิ์ใช้งานหน้าผู้ใช้งาน", "ไม่มีสิทธิ์ลบข้อมูลผู้ใช้งาน");
                return;
            }

            if (CheckData(userId) == true)
            {
                if (XtraMessageBox.Show(" คุณยืนยันที่จะลบข้อมูล ใช่หรือไม่?", "ยืนยัน", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK)
                {
                    if (UpdateData(false) == true)
                    {
                        XtraMessageBox.Show("ลบข้อมูลสำเร็จ", "สถานะ", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        ClearValues();
                        GetGridData("");
                    }
                }
            }
        }
Exemple #2
0
        private void BtnSave_Click(object sender, EventArgs e)
        {
            // 3	2 : สิทธิ์ใช้งานหน้าผู้ใช้งาน   บันทึกข้อมูลผู้ใช้งาน
            int AuthorizeId = 3;

            if (SQLAuthorized.CheckAuthorized(ClassProperty.permisRoleId, AuthorizeId) == false)
            {
                SQLAuthorized.AlertAuthorized("สิทธิ์ใช้งานหน้าผู้ใช้งาน", "ไม่มีสิทธิ์บันทึกข้อมูลผู้ใช้งาน");
                return;
            }

            if (SaveData() == true)
            {
                GetGridData("");
                GridViewUsers.FocusedRowHandle = GridViewUsers.LocateByValue("UserName", TxtUserName.Text);
                userId = Convert.ToInt32(GridViewUsers.GetFocusedRowCellValue("UserId"));
                GetData(userId);
            }
        }