private void btnAdd_Click(object sender, EventArgs e)
        {
            DataTable dt = LibQLSX.Select("select top 1 UserId from Users where Account = '" + Global.AppUserName + "'");

            if (dt.Rows.Count <= 0)
            {
                MessageBox.Show("Bạn chưa có tài khoản trên phần mềm quản lý sản xuất.", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }

            frmWorkingDiaries frm = new frmWorkingDiaries();

            frm.LoadDataChange += main_LoadDataChange;
            frm.Show();
        }
        private void btnEdit_Click(object sender, EventArgs e)
        {
            int id = TextUtils.ToInt(grvData.GetFocusedRowCellValue(colID));

            if (id == 0)
            {
                return;
            }
            WorkingDiariesModel model = (WorkingDiariesModel)WorkingDiariesBO.Instance.FindByPK(id);

            if (model.IsApproved)
            {
                MessageBox.Show("Nhật ký công việc đã được duyệt, bạn không thể sửa được.", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }

            DataTable dt = LibQLSX.Select("select top 1 UserId from Users where Account = '" + Global.AppUserName + "'");

            if (dt.Rows.Count <= 0)
            {
                MessageBox.Show("Bạn chưa có tài khoản trên phần mềm quản lý sản xuất.", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }
            else
            {
                if (!TextUtils.HasPermission("frmWorkingDiariesManager_AddAll"))
                {
                    string account = TextUtils.ToString(grvData.GetFocusedRowCellValue(colAccount1));
                    if (account.ToUpper() != Global.AppUserName.ToUpper())
                    {
                        MessageBox.Show("Bạn không có quyền sửa nhật ký công việc này.", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                        return;
                    }
                }
            }

            _rownIndex = grvData.FocusedRowHandle;
            frmWorkingDiaries frm = new frmWorkingDiaries();

            frm.WorkingDiaries  = model;
            frm.LoadDataChange += main_LoadDataChange;
            frm.Show();
        }