public AddOrUpdateTeacherCommentForm(DB.Entitys.TeacherComment commentObj)
        {
            InitializeComponent();

            CommentObj = commentObj;
            if (CommentObj != null)
            {
                txtCommentDate.Value = commentObj.CommentDate;
                txtCommentText.Text  = commentObj.CommentText;
            }
            else
            {
                CommentObj = new DB.Entitys.TeacherComment();
            }
        }
示例#2
0
        private void dgvDetail_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e)
        {
            string teacherCommentID       = string.Empty;
            object objectTeacherCommentID = dgvDetail.GetRowCellValue(e.RowHandle, "row3");

            if (objectTeacherCommentID != null)
            {
                teacherCommentID = objectTeacherCommentID.ToString();
            }

            DB.Entitys.TeacherComment commentObj = ConnectionManager.Context.table("TeacherComment").where ("TeacherCommentID='" + teacherCommentID + "'").select("*").getItem <DB.Entitys.TeacherComment>(new DB.Entitys.TeacherComment());
            if (string.IsNullOrEmpty(commentObj.TeacherCommentID))
            {
                return;
            }
            else
            {
                if (e.Column.FieldName == "row4")
                {
                    //编辑
                    if (new AddOrUpdateTeacherCommentForm(commentObj).ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        updateTeacherComments();
                    }
                }
                else if (e.Column.FieldName == "row5")
                {
                    //删除
                    if (MessageBox.Show("真的要删除吗?", "提示", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
                    {
                        ConnectionManager.Context.table("TeacherComment").where ("TeacherCommentID='" + commentObj.TeacherCommentID + "'").delete();
                        updateTeacherComments();
                    }
                }
            }
        }