protected override void OnEditClick(DataRow selectedRow) { string pkVal = selectedRow[PrimaryKey].ToString(); UCUserEditor useredit = new UCUserEditor { DbOperaType = DBOperateType.Update, PrimaryKeyValue = pkVal, Title = "修改用户信息" }; DialogResult dr = useredit.ShowDialog(); if (dr == DialogResult.OK) { GetData(); DXMessageBox.Show("修改用户信息成功!", true); } useredit.Dispose(); }
protected override void OnRowCellClick(DataRow dr, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e) { if (e.Column.Name == "gc_user_id") { string pkVal = dr[PrimaryKey].ToString(); UCUserEditor useredit = new UCUserEditor { DbOperaType = DBOperateType.View, PrimaryKeyValue = pkVal, Title = "查看用户信息" }; useredit.ShowDialog(); useredit.Dispose(); } else if (e.Column.Name == "gc_name") { //PHR if (ShowPHR != null) { ShowPHR(this, ModelConvertHelper <Userinfo> .ConvertToOneModel(dr)); } } }
/// <summary> /// 添加用户事件 /// </summary> /// <param name="e"></param> protected override void OnAddClick(EventArgs e) { UCUserEditor useredit = new UCUserEditor { DbOperaType = DBOperateType.Add, Title = "新建个人用户" }; DialogResult dr = useredit.ShowDialog(); if (dr == DialogResult.OK) { GetData(); DXMessageBox.Show("新建个人用户成功!", true); DXMessageBox.btnOKClick += (sender, _e) => { Userinfo user = useredit.userinfo; user.user_id = user.identity; user.user_times = -1; UCQuestionnaire questionnaire = new UCQuestionnaire(user); questionnaire.ShowDialog(this); questionnaire.Dispose(); }; DXMessageBox.ShowQuestion("是否开始填写问卷?"); } useredit.Dispose(); }