void btnToSelected_Click(object sender, EventArgs e) { int[] selectedRows = this.gridView1.GetSelectedRows(); if (selectedRows.Length < 1) { DXMessageBox.ShowInfo("查询结果为空", this); } else { if (SingleMode && SelectedUsers.Count > 0) { DXMessageBox.ShowInfo("单选模式只能选择一个用户", this); return; } var selectedHandle = selectedRows[0]; DataRowView rowv = this.gridView1.GetRow(selectedHandle) as DataRowView; if (rowv == null) { return; } DataRow row = rowv.Row; var user = ModelConvertHelper <Userinfo> .ConvertToOneModel(row); AddUserToSelected(user); } }
protected override bool BeforeSubmitData(Dictionary <string, object> dicData) { DateTime inte_plantime = DateTime.Now; if (!chkNow.Checked) { inte_plantime = dteIntePlantime.DateTime.Date.Add(teIntePlantime.Time.TimeOfDay); } if (inte_plantime < DateTime.Now) { inte_plantime = DateTime.Now; } dicData.Add("inte_plantime", inte_plantime); dicData.Add("inte_status", 1); dicData.Add("doc_id", TmoComm.login_docInfo.doc_id); if (DbOperaType == DBOperateType.Add) { int rgval = int.Parse(rgSaveLib.EditValue.ToString()); if (rgval != 0 && _inte_type != 1) //需要保存到库 { Dictionary <string, object> dic = new Dictionary <string, object>(); dic.Add("intelb_id", Tmo_FakeEntityClient.Instance.GetNextID("tmo_intervenelib", "intelb_id")); dic.Add("intelb_title", inte_title.Text); dic.Add("intelb_content", inte_content.Text); dic.Add("intelb_type", lbType.EditValue); dic.Add("doc_id", TmoComm.login_docInfo.doc_id); dic.Add("is_public", rgval - 1); Tmo_FakeEntityClient.Instance.SubmitData(DBOperateType.Add, "tmo_intervenelib", "intelb_id", null, dic); } var model = ModelConvertHelper <tmo_intervene> .ConvertToOneModel(dicData); model.inte_id = TmoShare.GetGuidString(); model.user_id = user_id.Tag.ToString(); model.inte_type = _inte_type; bool suc = TmoServiceClient.InvokeServerMethodT <bool>(funCode.AddIntervene, model); if (suc) { this.ParentForm.DialogResult = DialogResult.OK; } else { DXMessageBox.ShowError("新建干预失败,请稍后再试!", this); } return(false); } return(true); }
protected override bool BeforeSubmitData(Dictionary <string, object> dicData) { if (dicData == null || dicData.Count < 1) { return(false); } try { if (DbOperaType == DBOperateType.Add) { string identity = dicData["identity"].ToString(); bool existSame = Tmo_FakeEntityClient.Instance.ExistSameValue(TableName, "user_id", identity); if (existSame) { DXMessageBox.ShowWarning2("已存在相同的用户!请检查信息是否正确"); return(false); } existSame = Tmo_FakeEntityClient.Instance.ExistSameValue(TableName, "user_id", identity, null, false); if (existSame) { //之前建立过相关用户档案 DbOperaType = DBOperateType.Update; PrimaryKeyValue = identity; dicData.Add("is_del", 0); } else { dicData.Add("user_id", dicData["identity"]); } if (!dicData.ContainsKey("user_pwd")) { dicData.Add("user_pwd", Convert.ToDateTime(dicData["birthday"].ToString()).ToString("yyyyMMdd")); } dicData.Add("doc_id", TmoComm.login_docInfo.doc_id); } dicData.Add("age", TmoShare.CalAge(Convert.ToDateTime(dicData["birthday"].ToString()))); //修改时更新年龄 dicData[dpt_id.Name] = dpt_id.Tag; dicData.Add("retire", dpt_id.Text); userinfo = ModelConvertHelper <Userinfo> .ConvertToOneModel(dicData); return(true); } catch (Exception ex) { LogHelper.Log.Error("提交用户信息失败", ex); return(false); } }
/// <summary> /// 得到个人信息 /// </summary> /// <param name="user_id"></param> /// <returns></returns> public Userinfo GetUserinfo(string user_id) { if (string.IsNullOrWhiteSpace(user_id)) { return(null); } DataTable dt = Tmo_FakeEntityClient.Instance.GetData("tmo_userinfo", null, null, "user_id", user_id); if (TmoShare.DataTableIsEmpty(dt)) { return(null); } DataRow row = dt.Rows[0]; Userinfo userinfo = ModelConvertHelper <Userinfo> .ConvertToOneModel(row); return(userinfo); }
protected override void OnRowCellClick(DataRow dr, RowCellClickEventArgs e) { base.OnRowCellClick(dr, e); if (e.Column.Name == "gc_actionplan") { //健康计划 int status = dr.GetDataRowIntValue("questionnare_status"); string apid = dr.GetDataRowStringValue("apid"); Userinfo user = ModelConvertHelper <Userinfo> .ConvertToOneModel(dr); if (string.IsNullOrWhiteSpace(apid)) { var ucActionPlanEditor = new UCActionPlanEditor(user); ucActionPlanEditor.ShowDialog(this); ucActionPlanEditor.Dispose(); GetData(); } else { DataTable dt = TmoServiceClient.InvokeServerMethodT <DataTable>(funCode.GetActionPlan, apid); if (TmoShare.DataTableIsEmpty(dt)) { DXMessageBox.ShowWarning2("数据加载失败,请稍后再试!"); return; } string content = dt.Rows[0].GetDataRowStringValue("content"); if (status <= 3) { var ucActionPlanEditor = new UCActionPlanEditor(user, content); ucActionPlanEditor.ShowDialog(this); ucActionPlanEditor.Dispose(); GetData(); } else { var ucActionPlan = new UCActionPlan(user, content); ucActionPlan.ShowDialog(this); ucActionPlan.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)); } } }
void gridView1_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e) { if (e.Button == System.Windows.Forms.MouseButtons.Left && e.Clicks > 1) //双击 { if (SingleMode && SelectedUsers.Count > 0) { DXMessageBox.ShowInfo("单选模式只能选择一个用户", this); return; } DataRowView rowv = this.gridView1.GetRow(e.RowHandle) as DataRowView; if (rowv == null) { return; } DataRow row = rowv.Row; var user = ModelConvertHelper <Userinfo> .ConvertToOneModel(row); AddUserToSelected(user); } }
void btnPHR_Click(object sender, EventArgs e) { if (this.gridViewMain.GetSelectedRows().Length < 1) { DXMessageBox.ShowWarning("未选中任何用户!"); } else { int selectedHandle = this.gridViewMain.GetSelectedRows()[0]; DataRowView rowv = this.gridViewMain.GetRow(selectedHandle) as DataRowView; if (rowv == null) { return; } DataRow row = rowv.Row; if (ShowPHR != null) { ShowPHR(this, ModelConvertHelper <Userinfo> .ConvertToOneModel(row)); } } }
void btnQues_Click(object sender, EventArgs e) { int[] rowHandles = this.gridViewMain.GetSelectedRows(); if (rowHandles == null || rowHandles.Length < 1) { DXMessageBox.ShowWarning("请您先选择用户!"); } else { var selectedHandle = rowHandles[0]; DataRow row = gridViewMain.GetDataRow(selectedHandle); Userinfo user = ModelConvertHelper <Userinfo> .ConvertToOneModel(row); user.user_times = -1; UCQuestionnaire questionnaire = new UCQuestionnaire(user); questionnaire.ShowDialog(this); questionnaire.Dispose(); //var identity = gridViewMain.GetRowCellValue(selectedHandle, "user_id").ToString(); //frmquertions frmda = new frmquertions(); //frmda.ShowDialog(identity, 1); } }