protected override void OnDelClick(DataRow selectedRow) { int inte_status = selectedRow.GetDataRowIntValue("inte_status"); if (inte_status != 1) { DXMessageBox.ShowInfo("只能删除未执行的干预!"); GetData(); return; } string pkVal = selectedRow[PrimaryKey].ToString(); DXMessageBox.btnOKClick += (object sender, EventArgs e) => { bool suc = Tmo_FakeEntityClient.Instance.DeleteData(TableName, PrimaryKey, pkVal); if (suc) { GetData(); DXMessageBox.Show(string.Format("干预删除成功!", name), true); } else { DXMessageBox.ShowWarning("删除失败!"); } }; DXMessageBox.ShowQuestion("确定要删除该干预吗?"); }
/// <summary> /// 编辑按钮点击 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void linkEdit_Click(object sender, EventArgs e) { DataRowView drv = treeList1.GetDataRecordByNode(treeList1.FocusedNode) as DataRowView; if (drv != null) { object dpt_id = drv["dpt_id"]; if (dpt_id != null && !string.IsNullOrWhiteSpace(dpt_id.ToString())) { if (dpt_id.ToString() == TmoComm.login_docInfo.doc_department.ToString()) { DXMessageBox.ShowInfo("没有权限!"); return; } UCDepartmentEditor edit = new UCDepartmentEditor { Title = "修改部门信息", DbOperaType = DBOperateType.Update, PrimaryKeyValue = dpt_id.ToString() }; if (edit.ShowDialog() == DialogResult.OK) { Tmo_CommonClient.Instance.RefreshDocChildrenDpt(); GetData(); DXMessageBox.Show("部门修改成功!", true); } edit.Dispose(); } } }
protected override void OnEditClick(DataRow selectedRow) { int inte_status = selectedRow.GetDataRowIntValue("inte_status"); if (inte_status != 1) { DXMessageBox.ShowInfo("只能修改未执行的干预!"); GetData(); return; } string pkVal = selectedRow[PrimaryKey].ToString(); UCInterveneEditor edit = new UCInterveneEditor() { DbOperaType = DBOperateType.Update, PrimaryKeyValue = pkVal, Title = "修改健康干预" }; DialogResult dr = edit.ShowDialog(); if (dr == DialogResult.OK) { GetData(); DXMessageBox.Show("修改干预成功!", true); } edit.Dispose(); }
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); } }
/// <summary> /// 单元格选中时触发 /// </summary> /// <param name="e"></param> protected void OnRowCellClick(RowCellClickEventArgs e) { GridView mainView = (GridView)_gridControl.MainView; DataRow row = mainView.GetDataRow(e.RowHandle); if (e.Column.Name == "gc_edit") { if (row["edit"].ToString().Trim() == "预置") { DXMessageBox.ShowInfo("系统预置项禁止修改!"); } else { OnEditClick(row); } } else if (e.Column.Name == "gc_del") { if (row["del"].ToString().Trim() == "预置") { DXMessageBox.ShowInfo("系统预置项禁止修改!"); } else { OnDelClick(row); } } OnRowCellClick(row, e); }
private void BtnUse_Click(object sender, EventArgs e) { int[] rhs = this.gridView1.GetSelectedRows(); if (rhs.Length < 1) { DXMessageBox.ShowInfo("未选中任何行"); } else { var dr = ((DataRowView)this.gridView1.GetRow(rhs[0])).Row; if (UseLibData != null) { UseLibData(dr["intelb_title"].ToString(), dr["intelb_content"].ToString()); } } }
private void BtnUse_Click(object sender, EventArgs e) { int[] rhs = this.gridView1.GetSelectedRows(); if (rhs.Length == 0 || rhs[0] == -1) { DXMessageBox.ShowInfo("未选中任何行"); } else { var dr = ((DataRowView)this.gridView1.GetRow(rhs[0])).Row; if (UseLibData != null) { UseLibData("", dr["project_name"] + " " + dr["solve_content"]); } } }
/// <summary> /// 删除按钮点击 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void linkDel_Click(object sender, EventArgs e) { DataRowView drv = treeList1.GetDataRecordByNode(treeList1.FocusedNode) as DataRowView; if (drv != null) { object dpt_id = drv["dpt_id"]; object dpt_name = drv["dpt_name"]; if (dpt_id != null && !string.IsNullOrWhiteSpace(dpt_id.ToString())) { if (dpt_id.ToString() == TmoComm.login_docInfo.doc_department.ToString()) { DXMessageBox.ShowInfo("没有权限!"); return; } string dptds = Tmo_CommonClient.Instance.GetChildrenNodeFromTable(TableName, PrimaryKey, "dpt_parent", dpt_id.ToString()); DataTable dt = Tmo_FakeEntityClient.Instance.GetData("tmo_docinfo", new string[] { "count(*) c" }, "doc_department in (" + dptds + ")"); if (TmoShare.DataTableIsEmpty(dt)) { DXMessageBox.ShowError("删除失败,请重试!"); return; } if (dt.Rows[0].GetDataRowIntValue("c") > 0) { DXMessageBox.ShowWarning2("该部门下分配有健康师,删除被阻止!"); return; } DXMessageBox.btnOKClick += (object sender1, EventArgs e1) => { //删除部门操作 bool suc = Tmo_FakeEntityClient.Instance.DeleteData(TableName, PrimaryKey, dpt_id.ToString()); if (!suc) { DXMessageBox.ShowError("删除失败,请重试!"); return; } //Dictionary<string, object> dic = new Dictionary<string, object>(); //dic.Add("doc_department", -1); //suc = Tmo_FakeEntityClient.Instance.SubmitData(DBOperateType.Update, "tmo_docinfo", "doc_department", dpt_id.ToString(), dic); Tmo_CommonClient.Instance.RefreshDocChildrenDpt(); GetData(); DXMessageBox.Show("部门 [" + dpt_name + "] 删除成功!", true); }; DXMessageBox.ShowQuestion("你确定要删除部门 [" + dpt_name + "] 吗?"); } } }
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 btnAllToSelected_Click(object sender, EventArgs e) { DataTable source = gridControlUnSelected.DataSource as DataTable; if (TmoShare.DataTableIsNotEmpty(source)) { var users = ModelConvertHelper <Userinfo> .ConvertToModel(source); if (users != null) { foreach (Userinfo user in users) { AddUserToSelected(user); } } } else { DXMessageBox.ShowInfo("查询结果为空", this); } }
/// <summary> /// 加载问卷 /// </summary> /// <param name="qc_id"></param> void LoadQuestionnaire(params string[] qc_id) { this.ShowWaitingPanel(() => { var firstqc = qc_id == null || qc_id.Length == 0 ? TmoServiceClient.InvokeServerMethodT <List <tmo_questionnaire_category> >( funCode.GetFistQuestionnaires, currentUser.user_id, _usertimes) : TmoServiceClient.InvokeServerMethodT <List <tmo_questionnaire_category> >( funCode.GetQuestionnaires, currentUser.user_id, _usertimes, qc_id); XtabControlData tabControlData = new XtabControlData(currentUser); tabControlData.Init(firstqc); controlData = tabControlData; return(tabControlData); }, x => { XtabControlData tabControlData = x as XtabControlData; if (tabControlData != null) { tabControlData.TagetToXTabControl(xtraTabControlMain); btnSave.Enabled = true; if (controlData.Status.questionnare_status == 0 && controlData.Status.questionnaire_time != default(DateTime) && !string.IsNullOrEmpty(controlData.Status.qc_ids)) { DXMessageBox.ShowInfo(string.Format("已加载上次{0}暂存的问卷!", controlData.Status.questionnaire_time.ToFormatDateTimeStr()), this); } if (controlData.Status.questionnare_status == 1) { ReadOnly = true; DXMessageBox.ShowInfo("当前问卷【已提交】,不能编辑修改,请进行评估。\n已自动切换到浏览模式!", this); } if (controlData.Status.questionnare_status == 2) { ReadOnly = true; DXMessageBox.ShowInfo("当前问卷【已评估】,只能浏览。\n已自动切换到浏览模式!", this); } CheckButtonState(tabControlData.TabPages.Keys.FirstOrDefault()); } }, "问卷拼命加载中" ); }
protected override void OnDelClick(DataRow selectedRow) { string doc_name = selectedRow["doc_name"].ToString(); string pkVal = selectedRow[PrimaryKey].ToString(); if (TmoComm.login_docInfo.doc_id.ToString() == pkVal) { DXMessageBox.ShowInfo("不能删除自身!"); return; } DXMessageBox.btnOKClick += (object sender, EventArgs e) => { DataTable dtcount = Tmo_FakeEntityClient.Instance.GetData("tmo_userinfo", new[] { "count(*) as count" }, "doc_id='" + pkVal + "'"); if (TmoShare.DataTableIsNotEmpty(dtcount)) { int count = dtcount.Rows[0].GetDataRowIntValue("count"); if (count > 0) { DXMessageBox.ShowWarning("该健康师下分配有用户不能删除!"); return; } } bool suc = Tmo_FakeEntityClient.Instance.DeleteData(TableName, PrimaryKey, pkVal); if (suc) { DXMessageBox.Show("健康师删除成功!", true); Tmo_CommonClient.Instance.RefreshDocChildrenID(); GetData(); } else { DXMessageBox.ShowWarning("删除失败!"); } }; DXMessageBox.ShowQuestion("确定要删除健康师【" + doc_name + "】吗?"); base.OnDelClick(selectedRow); }
protected override bool AfterSaveButtonClick() { bool pass = false; pass = dxvalidation.Validate(); if (!pass) { return(false); } if (string.IsNullOrWhiteSpace(phone.Text) && string.IsNullOrWhiteSpace(tel.Text)) { DXMessageBox.ShowInfo("手机号码和电话号码至少要输入一个!"); phone.Focus(); return(false); } //string errMsg = null; //string family1 = familymem1.Text.Trim(); //if (!string.IsNullOrEmpty(family1)) //{ // pass = TmoShare.isIdCardNo(family1, out errMsg); // if (!pass) // { // DXMessageBox.ShowWarning("输入的身份证号码不正确!\r\n原因:" + errMsg); // familymem1.Focus(); // return false; // } //} //string family2 = familymem2.Text.Trim(); //if (!string.IsNullOrEmpty(family2)) //{ // pass = TmoShare.isIdCardNo(family2, out errMsg); // if (!pass) // { // DXMessageBox.ShowWarning("输入的身份证号码不正确!\r\n原因:" + errMsg); // familymem2.Focus(); // return false; // } //} //string family3 = familymem3.Text.Trim(); //if (!string.IsNullOrEmpty(family3)) //{ // pass = TmoShare.isIdCardNo(family3, out errMsg); // if (!pass) // { // DXMessageBox.ShowWarning("输入的身份证号码不正确!\r\n原因:" + errMsg); // familymem3.Focus(); // return false; // } //} //string family4 = familymem4.Text.Trim(); //if (!string.IsNullOrEmpty(family4)) //{ // pass = TmoShare.isIdCardNo(family4, out errMsg); // if (!pass) // { // DXMessageBox.ShowWarning("输入的身份证号码不正确!\r\n原因:" + errMsg); // familymem4.Focus(); // return false; // } //} //string family5 = familymem5.Text.Trim(); //if (!string.IsNullOrEmpty(family5)) //{ // pass = TmoShare.isIdCardNo(family5, out errMsg); // if (!pass) // { // DXMessageBox.ShowWarning("输入的身份证号码不正确!\r\n原因:" + errMsg); // familymem5.Focus(); // return false; // } //} if (DbOperaType == DBOperateType.Add) { //pass = TmoShare.isIdCardNo(identity.EditValue.ToString(), out errMsg); //if (!pass) //{ // DXMessageBox.ShowWarning("输入的身份证号码不正确!\r\n原因:" + errMsg); // identity.Focus(); // return false; //} //birthday.DateTime = Convert.ToDateTime(errMsg); bool unpass = Tmo_FakeEntityClient.Instance.ExistSameValue(TableName, account.Name, account.EditValue.ToString()); if (unpass) { DXMessageBox.ShowWarning2("登录账号已存在!请尝试其他名称"); return(false); } } return(true); }
private void btnLogin_Click(object sender, EventArgs e) { if (!dxvalidation.Validate() || string.IsNullOrWhiteSpace(txtUid.Text)) { DXMessageBox.ShowInfo("用户名和密码不能为空!", this); } else { this.loginPress.Show(); btnLogin.Enabled = btnCancel.Enabled = chkRember.Enabled = btnSet.Enabled = false; this.CrossThreadCallsSync(x => { this.loginPress.Hide(); btnLogin.Enabled = btnCancel.Enabled = chkRember.Enabled = btnSet.Enabled = true; DocInfo docInfo = x as DocInfo; if (docInfo == null) { DXMessageBox.ShowError("获取登录信息失败!\r\n请检查网络连接", this); } else { switch (docInfo.err_Code) { case -2: DXMessageBox.ShowError("无法连接到服务器,请检查网络连接或重试!", this); break; case -1: DXMessageBox.ShowError("参数错误!请重试", this); break; case 1: DXMessageBox.ShowWarning("用户名不存在!", this); txtUid.Focus(); break; case 2: DXMessageBox.ShowWarning("密码错误!", this); txtPwd.Focus(); break; case 3: DXMessageBox.ShowWarning("该用户已经在其它地方登录!", this); break; case 4: DXMessageBox.ShowError("客户端版本低,请升级客户端!", this); break; case 0: //登陆成功 #region 本地记住用户名和密码 if (chkRember.Checked) { string uidmd5 = DESEncrypt.Encrypt(txtUid.Text); string pwdmd5 = DESEncrypt.Encrypt(txtPwd.Text); ConfigHelper.UpdateConfig("u", uidmd5, true); ConfigHelper.UpdateConfig("p", pwdmd5, true); } #endregion #region 返回值解析 TmoComm.login_docInfo = docInfo; if (frmMain != null) { frmMain.Initfunction(); } #endregion #region 设置主窗体显示 this.Hide(); string skin_name = ConfigHelper.GetConfigString("skin_name", TSCommon.Default_skin_name, true); TSCommon.SetSkin(skin_name); frmMain.Show(); #endregion TCPClient.Instance.SendHeartBeat(); //登录成功后 主动发送心跳包 break; default: LogHelper.Log.Error("未知错误->错误码:" + docInfo.err_Code); DXMessageBox.ShowError("未知错误!错误码:" + docInfo.err_Code, this); break; } } }, () => { return(Tmo_CommonClient.Instance.GetDocInfo(txtUid.Text, txtPwd.Text)); }); } }