void btnSave_Click(object sender, EventArgs e) { if (!AfterSaveButtonClick()) { return; } Dictionary <string, object> dicControlData = GetControlData(); if (!BeforeSubmitData(dicControlData)) { return; } this.ShowWaitingPanel(() => { return(null); //Tmo_FakeEntityClient.Instance.SubmitData(dbOperaType, tableName, primaryKey, primaryKeyValue, dicControlData); }, x => { bool suc = (bool)x; if (suc) { if (this.ParentForm != null && !this.ParentForm.IsDisposed) { this.ParentForm.DialogResult = DialogResult.OK; this.ParentForm.Close(); } } else { DXMessageBox.ShowError("保存失败!请重试!"); } }); }
/// <summary> ///提交数据前调用 /// </summary> /// <returns></returns> protected virtual bool BeforeSubmitData(Dictionary <string, object> dicData) { if (dicData == null) { DXMessageBox.ShowError("未知错误,请重试!"); return(false); } foreach (var item in dicNotSameField) { bool same = false; if (dicData.ContainsKey(item.Key) && dicData[item.Key] != null) { same = false;//Tmo_FakeEntityClient.Instance.ExistSameValue(TableName, item.Key, dicData[item.Key].ToString()); } if (same) { if (dbOperaType == DbOperateType.Update && (dicData[item.Key].Equals(dicNotSameFieldVale[item.Key]) || dicData[item.Key].ToString() == dicNotSameFieldVale[item.Key].ToString())) { continue; } else { DXMessageBox.ShowWarning2(string.Format("已存在相同的 {0} 请修改!", item.Value)); return(false); } } } return(true); }
private void btnDownload_Click(object sender, EventArgs e) { if (downBytes == null || downBytes.Length == 0) { DXMessageBox.ShowWarning("还未上传过检查报告单,请先上传!"); return; } SaveFileDialog sfd = new SaveFileDialog(); sfd.DefaultExt = downExName; sfd.FileName = UserName + "-" + userTime + downExName; DialogResult dr = sfd.ShowDialog(this); if (dr == DialogResult.OK) { try { FileStream stream = (FileStream)sfd.OpenFile(); stream.Write(downBytes, 0, downBytes.Length); stream.Close(); } catch (Exception ex) { DXMessageBox.ShowError("文件保存失败!\n" + ex.Message); } } sfd.Dispose(); }
void btnOK_Click(object sender, EventArgs e) { var list = GetSelectedCategories(); if (list.Any()) { var tmp = list.Except(_list); var names = tmp.Select(x => x.qc_name).ToList(); if (names.Any()) { string name = StringPlus.GetArrayStr(names, "、"); DXMessageBox.btnOKClick += (x, y) => { CloseForm(true); }; DXMessageBox.ShowQuestion(string.Format("确认要放弃 {0} 吗?", name), this); } else { CloseForm(true); } } else { DXMessageBox.ShowError("至少要选择一种风险评估", this); } }
protected override void OnRowCellClick(DataRow dr, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e) { if (e.Column.Name == "gc_group_function") //设置权限 { UCFunctionEditor edit = new UCFunctionEditor(); edit.Title = string.Format("设置【{0}】群组权限", dr["group_name"]); edit.EditValue = dr["group_function"].ToString(); if (edit.ShowDialog() == DialogResult.OK) {//设置权限 if (dr["group_function"].ToString() != edit.EditValue) { Dictionary <string, object> dic = new Dictionary <string, object>(); dic.Add("group_function", edit.EditValue); bool suc = Tmo_FakeEntityClient.Instance.SubmitData(TmoCommon.DBOperateType.Update, TableName, PrimaryKey, dr[PrimaryKey].ToString(), dic); if (!suc) { DXMessageBox.ShowError("权限设置失败,请重试!"); } else { GetData(); } } } edit.Dispose(); } base.OnRowCellClick(dr, e); }
private void btnDownLoad_Click(object sender, EventArgs e) { if (_opened && _stream != null && !string.IsNullOrWhiteSpace(_documentExt)) { SaveFileDialog sfd = new SaveFileDialog(); sfd.OverwritePrompt = true; sfd.AddExtension = true; sfd.DefaultExt = _documentExt; sfd.Filter = _documentExt + "|*" + _documentExt; if (sfd.ShowDialog(this) == DialogResult.OK) { if (sfd.FileName != null) { try { Stream fStream = sfd.OpenFile(); _stream.Position = 0; fStream.Position = 0; _stream.CopyTo(fStream); fStream.Flush(); fStream.Close(); } catch (Exception ex) { DXMessageBox.ShowError("文件保存失败!" + ex.Message); } } } } else { DXMessageBox.ShowWarning("文件未初始化完毕!"); } }
void btnSaveTmp_Click(object sender, EventArgs e) { if (_user == null) { return; } if (dateEditStart.EditValue == null || dateEditEnd.EditValue == null) { DXMessageBox.ShowWarning2("管理时间未填写完整!"); xtraTabControlMain.SelectedTabPageIndex = 0; return; } else { if (dateEditStart.DateTime == DateTime.MinValue || dateEditEnd.DateTime == DateTime.MinValue || dateEditStart.DateTime > dateEditEnd.DateTime) { DXMessageBox.ShowWarning2("管理时间填写不正确,请修改!"); xtraTabControlMain.SelectedTabPageIndex = 0; return; } } string jsonData = GetDataJsonString(); bool suc = TmoServiceClient.InvokeServerMethodT <bool>(funCode.SaveActionPlan, _user.user_id, _user.user_times, jsonData, null); if (suc) { DXMessageBox.Show("健康行动计划暂存成功!", true); } else { DXMessageBox.ShowError("健康行动计划暂存失败!"); } }
private void btnAdd_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(user_id.Text)) { DXMessageBox.ShowWarning2("证件号不能为空!"); return; } bool idCard = Convert.ToBoolean(TmoServiceClient.InvokeServerMethodT <bool>(funCode.CheckIDCard, user_id.Text)); if (idCard) { DXMessageBox.ShowWarning2("用户ID不存在!"); return; } if (string.IsNullOrWhiteSpace(diary_date.Text)) { DXMessageBox.ShowWarning2("日期不能为空!"); return; } string result = "-2"; string data = diary_date.Text; DataSet ds = TmoShare.getDataSetFromXML(xmlTargetAppend, true); DataRow dr = ds.Tables[0].NewRow(); try { foreach (DevExpress.XtraEditors.PanelControl temp in this.Controls) { foreach (Control det in temp.Controls) { foreach (DataColumn dc in ds.Tables[0].Columns) { if (det.Name == dc.ColumnName) { dr[dc] = det.Text; } } } } } catch { DXMessageBox.ShowError("指标补充失败!", this); } ds.Tables[0].Rows.Add(dr); ds.AcceptChanges(); TmoServiceClient.InvokeServerMethodT <string>(funCode.CreatePointsUser, user_id.Text); result = (TmoServiceClient.InvokeServerMethodT <int>(funCode.AddTargetAppend, TmoShare.getXMLFromDataSet(ds))).ToString(); if (Convert.ToInt16(result) >= 0) { DXMessageBox.Show("指标补充成功!", true); if (this.ParentForm != null) { this.ParentForm.DialogResult = DialogResult.OK; this.ParentForm.Close(); } } else { DXMessageBox.ShowError("指标补充失败!", this); } }
private void btnAdd_Click(object sender, EventArgs e) { string protype = cmproType.SelectedText; protype = cmproType.Text; if (this.btnAdd.Text == "确认保存") { Dictionary <string, object> dicPrams = new Dictionary <string, object>(); dicPrams.Add("projectType", protype); dicPrams.Add("projectdescribe", txtTypeName.Text); bool istrue = Tmo_FakeEntityClient.Instance.SubmitData(DBOperateType.Add, "tmo_describe", "", "", dicPrams); if (istrue) { this.Close(); } else { DXMessageBox.ShowError("添加失败!"); } } else if (this.btnAdd.Text == "确认修改") { Dictionary <string, object> dicPrams = new Dictionary <string, object>(); if (string.IsNullOrEmpty(txtTypeName.Text)) { bool istrue = Tmo_FakeEntityClient.Instance.DeleteData("tmo_describe", "projectType", protype); if (istrue) { this.Close(); } else { DXMessageBox.ShowError("删除失败!"); } } else { dicPrams.Add("projectdescribe", txtTypeName.Text); bool istrue = Tmo_FakeEntityClient.Instance.SubmitData(DBOperateType.Update, "tmo_describe", "projectType", protype, dicPrams); if (istrue) { this.Close(); } else { DXMessageBox.ShowError("修改失败!"); } } } }
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 void OnFirstLoad() { string watingstr = _isfirst ? "文件存储中" : "文档加载中"; this.ShowWaitingPanel(() => { //_user = Tmo_CommonClient.Instance.GetUserinfo("130103199010228346"); Dictionary <string, object> dicdata = TmoShare.GetValueFromJson <Dictionary <string, object> >(_content); _xReport = new XReportFirstPage(_user, dicdata); _xReport.CreateDocument(); XReportActionPlan xrap = new XReportActionPlan(dicdata); xrap.CreateDocument(); Page lastPage = _xReport.Pages.Last; _xReport.Pages.Remove(lastPage); _xReport.Pages.AddRange(xrap.Pages); _xReport.Pages.Add(lastPage); if (_isfirst) { MemoryStream ms = new MemoryStream(); _xReport.PrintingSystem.ExportToPdf(ms); SaveSucess = TmoServiceClient.InvokeServerMethodT <bool>(funCode.SaveActionPlan, _user.user_id, _user.user_times, _content, ms.ToArray()); _isfirst = false; if (SaveSucess) { DXMessageBox.Show("健康行动计划创建成功!", true); } else { DXMessageBox.ShowError("保存失败,请稍后再次尝试!"); return(null); } } return(_xReport); }, o => { if (o == null) { CloseForm(true); return; } documentViewer1.PrintingSystem = _xReport.PrintingSystem; documentViewer1.ShowPageMargins = false; //documentViewer1.PrintingSystem.ExecCommand( PrintingSystemCommand.Customize); documentViewer1.PrintingSystem.ExecCommand(PrintingSystemCommand.DocumentMap, new object[] { true }); }, watingstr); }
protected override bool BeforeSubmitData(Dictionary <string, object> dicData) { string groupId = DbOperaType == DBOperateType.Add ? Tmo_FakeEntityClient.Instance.GetNextID(TableName, PrimaryKey) : PrimaryKeyValue; if (string.IsNullOrWhiteSpace(groupId)) { LogHelper.Log.Warn(DbOperaType + "操作" + TableName + "时得到主键为空"); DXMessageBox.ShowError("提交失败!请重试!"); return(false); } dicData.Add(PrimaryKey, groupId); dicData[group_function.Name] = group_function.Tag; dicData["input_time"] = DateTime.Now; return(true); }
/// <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 + "] 吗?"); } } }
protected override void OnAddClick(EventArgs e) { if (Is_public == 1 && !TmoComm.login_docInfo.doc_function_list.Contains("funSaveActionPlanLib")) { DXMessageBox.ShowError("无法操作,您没有相关权限!", this); return; } if (Is_public == 2 && !TmoComm.login_docInfo.doc_function_list.Contains("funSaveSystemActionPlanLib")) { DXMessageBox.ShowError("无法操作,您没有相关权限!", this); return; } if (GetLibData == null && Is_public != 2) { return; } string content = Is_public != 2 ? GetLibData() : null; UCActionPlanLibEditor ucActionPlanLibEditor = new UCActionPlanLibEditor(); ucActionPlanLibEditor.Is_Public = Is_public; ucActionPlanLibEditor.DbOperaType = DBOperateType.Add; string txt = "个人库"; if (Is_public == 1) { txt = "公共库"; } if (Is_public == 2) { txt = "系统库"; } ucActionPlanLibEditor.Title = "保存到" + txt; ucActionPlanLibEditor.aclb_content = content; if (ucActionPlanLibEditor.ShowDialog() == DialogResult.OK) { DXMessageBox.Show(ucActionPlanLibEditor.Title + "成功!", true); GetData(); } else { } ucActionPlanLibEditor.Dispose(); }
protected override void OnDelClick(DataRow selectedRow) { if (Is_public && !TmoComm.login_docInfo.doc_function_list.Contains("funSaveInterveneLib")) { DXMessageBox.ShowError("无法操作,您没有相关权限!", this); return; } DXMessageBox.btnOKClick += (_sender, _e) => { bool del = Tmo_FakeEntityClient.Instance.DeleteData(TableName, PrimaryKey, selectedRow[PrimaryKey].ToString()); if (del) { DXMessageBox.Show("健康干预库删除成功!", true); GetData(); } }; DXMessageBox.ShowQuestion("确定要删除该健康干预库吗?"); }
protected override void AfterGetData(DataRow drSource) { int inte_status = drSource.GetDataRowIntValue("inte_status"); if (inte_status != 1) //干预在执行中或已执行 { DXMessageBox.ShowError("干预正在执行中或已执行,无法修改!"); this.ParentForm.DialogResult = DialogResult.Cancel; this.ParentForm.Close(); } else { DateTime inte_plantime = drSource.GetDataRowDateTimeValue("inte_plantime"); dteIntePlantime.DateTime = inte_plantime.Date; teIntePlantime.Time = inte_plantime; _users = new List <Userinfo>(); _users.Add(Tmo_CommonClient.Instance.GetUserinfo(drSource.GetDataRowStringValue("user_id"))); ucInterveneSystem1.Userinfo = _users.FirstOrDefault(); } }
protected override void OnDelClick(DataRow selectedRow) { string group_id = selectedRow[PrimaryKey].ToString(); string group_name = selectedRow["group_name"].ToString(); DXMessageBox.btnOKClick += (object sender, EventArgs e) => { bool suc = Tmo_FakeEntityClient.Instance.DeleteData(TableName, PrimaryKey, group_id); if (!suc) { DXMessageBox.ShowError("删除失败,请重试!"); return; } Dictionary <string, object> dic = new Dictionary <string, object>(); dic.Add("doc_group", -1); suc = Tmo_FakeEntityClient.Instance.SubmitData(TmoCommon.DBOperateType.Update, "tmo_docinfo", "doc_group", group_id, dic); GetData(); }; DXMessageBox.ShowQuestion(string.Format("确定要删除群组【{0}】吗?", group_name)); }
protected override void OnAddClick(EventArgs e) { if (Is_public && !TmoComm.login_docInfo.doc_function_list.Contains("funSaveInterveneLib")) { DXMessageBox.ShowError("无法操作,您没有相关权限!", this); return; } UCInterveneLibEditor ucInterveneLibEditor = new UCInterveneLibEditor(); ucInterveneLibEditor.DbOperaType = DBOperateType.Add; ucInterveneLibEditor.Is_Public = Is_public; ucInterveneLibEditor.Title = "新建健康干预库"; if (ucInterveneLibEditor.ShowDialog() == DialogResult.OK) { DXMessageBox.Show("新建健康干预库成功!", true); GetData(); } ucInterveneLibEditor.Dispose(); }
void btnAll_Click(object sender, EventArgs e) { if (IsAll) { bool isSuccess = submit(); if (!isSuccess) { DXMessageBox.ShowError("保存失败!"); } else { DXMessageBox.ShowSuccess("保存成功!"); IsAll = !IsAll; } } else { IsAll = !IsAll; } }
protected override void OnEditClick(DataRow selectedRow) { if (Is_public && !TmoComm.login_docInfo.doc_function_list.Contains("funSaveInterveneLib")) { DXMessageBox.ShowError("无法操作,您没有相关权限!", this); return; } UCInterveneLibEditor ucInterveneLibEditor = new UCInterveneLibEditor(); ucInterveneLibEditor.DbOperaType = DBOperateType.Update; ucInterveneLibEditor.Is_Public = Is_public; ucInterveneLibEditor.Title = "修改健康干预库"; ucInterveneLibEditor.PrimaryKeyValue = selectedRow[PrimaryKey].ToString(); if (ucInterveneLibEditor.ShowDialog() == DialogResult.OK) { DXMessageBox.Show("修改健康干预库成功!", true); GetData(); } ucInterveneLibEditor.Dispose(); }
private void DealSyncResult(DialogResult dr, SyncDevice sDev = null) { if (dr == System.Windows.Forms.DialogResult.OK) { string msg = (sDev == null ? "" : "【" + sDev.deviceName + "】") + "数据同步成功!"; DXMessageBox.Show(msg, true); } else if (dr == System.Windows.Forms.DialogResult.Ignore) { DXMessageBox.Show("部分设备同步未成功!", true); } else if (dr == System.Windows.Forms.DialogResult.Cancel) { string msg = (sDev == null ? "" : "【" + sDev.deviceName + "】") + "数据同步失败!\n请尝试重新插拔设备并重试"; DXMessageBox.ShowError(msg); } else if (dr == System.Windows.Forms.DialogResult.Abort) { DXMessageBox.Show("没有可同步设备,已取消同步!", true); } }
protected override bool BeforeSubmitData(Dictionary <string, object> dicData) { DataRow[] drParents = dtSel.Select("dpt_id='" + dpt_parent.Tag + "'"); if (drParents != null && drParents.Length > 0) { object parentparent = drParents[0][dpt_parent.Name]; if (PrimaryKeyValue == parentparent.ToString()) //父部门的父部门是自己 { if (oldParent != null) { Dictionary <string, object> dic = new Dictionary <string, object>(); dic.Add(dpt_parent.Name, oldParent); bool suc = Tmo_FakeEntityClient.Instance.SubmitData(DBOperateType.Update, TableName, PrimaryKey, dpt_parent.Tag.ToString(), dic); if (!suc) { DXMessageBox.ShowError("提交失败,请重试!"); return(false); } } } } if (dicData.ContainsKey(dpt_parent.Name)) { dicData[dpt_parent.Name] = dpt_parent.Tag; } else { dicData.Add(dpt_parent.Name, dpt_parent.Tag); } string nextid = DbOperaType == DBOperateType.Add ? Tmo_FakeEntityClient.Instance.GetNextID(TableName, PrimaryKey) : PrimaryKeyValue; if (string.IsNullOrWhiteSpace(nextid) || nextid.StartsWith("err_")) { DXMessageBox.ShowError("提交失败,请重试!"); return(false); } dicData.Add(PrimaryKey, nextid); dicData.Add("input_time", DateTime.Now); return(true); }
protected override void OnDelClick(DataRow selectedRow) { string pkval = selectedRow[PrimaryKey].ToString(); string pkname = selectedRow["mt_name"].ToString(); DXMessageBox.btnOKClick += (object sender, EventArgs e) => { bool suc = Tmo_FakeEntityClient.Instance.DeleteData(TableName, PrimaryKey, pkval); if (suc) { DXMessageBox.Show("删除监测项目成功!", true); GetData(); } else { DXMessageBox.ShowError("删除监测项目失败,请重试!"); } }; DXMessageBox.ShowQuestion(string.Format("确定要删除监测项目【{0}】吗?", pkname)); base.OnDelClick(selectedRow); }
protected override bool BeforeSubmitData(Dictionary <string, object> dicData) { string docid = DbOperaType == DBOperateType.Add ? Tmo_FakeEntityClient.Instance.GetNextID(TableName, PrimaryKey) : PrimaryKeyValue; if (string.IsNullOrWhiteSpace(docid)) { LogHelper.Log.Warn(DbOperaType + "操作" + TableName + "时得到主键为空"); DXMessageBox.ShowError("提交失败!请重试!"); return(false); } dicData.Add(PrimaryKey, docid); if (docid != TmoComm.login_docInfo.doc_id.ToString()) { dicData[doc_department.Name] = doc_department.Tag; } else { dicData.Remove(doc_department.Name); } dicData["doc_state"] = 0; dicData["input_time"] = DateTime.Now; return(base.BeforeSubmitData(dicData)); }
protected override void OnRowCellClick(DataRow dr, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e) { if (e.Column.Name == "gc_doc_function") //设置权限 { UCFunctionEditor edit = new UCFunctionEditor(); edit.Title = string.Format("设置健康师【{0}】权限", dr["doc_name"]); string doc_function = dr["doc_function"].ToString(); if (string.IsNullOrWhiteSpace(doc_function)) { DataTable dt = Tmo_FakeEntityClient.Instance.GetData("tmo_docgroup", new[] { "group_function" }, null, "group_id", dr["doc_group"].ToString()); if (TmoShare.DataTableIsNotEmpty(dt)) { doc_function = dt.Rows[0][0].ToString(); } } edit.EditValue = doc_function; if (edit.ShowDialog() == DialogResult.OK) {//设置权限 if (doc_function != edit.EditValue) { Dictionary <string, object> dic = new Dictionary <string, object>(); dic.Add("doc_function", edit.EditValue); bool suc = Tmo_FakeEntityClient.Instance.SubmitData(DBOperateType.Update, TableName, PrimaryKey, dr[PrimaryKey].ToString(), dic); if (!suc) { DXMessageBox.ShowError("权限设置失败,请重试!"); } else { GetData(); } } } edit.Dispose(); } base.OnRowCellClick(dr, e); }
protected override void OnDelClick(DataRow selectedRow) { if (Is_public == 1 && !TmoComm.login_docInfo.doc_function_list.Contains("funSaveActionPlanLib")) { DXMessageBox.ShowError("无法操作,您没有相关权限!", this); return; } if (Is_public == 2 && !TmoComm.login_docInfo.doc_function_list.Contains("funSaveSystemActionPlanLib")) { DXMessageBox.ShowError("无法操作,您没有相关权限!", this); return; } DXMessageBox.btnOKClick += (_sender, _e) => { bool del = Tmo_FakeEntityClient.Instance.DeleteData(TableName, PrimaryKey, selectedRow[PrimaryKey].ToString()); if (del) { DXMessageBox.Show("健康计划库删除成功!", true); GetData(); } }; DXMessageBox.ShowQuestion(string.Format("确定要删除该【{0}】健康计划库吗?", selectedRow.GetDataRowStringValue("aclb_title"))); }
void btnChangeDoc_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; string user_id = row.GetDataRowStringValue(PrimaryKey); UCChooseDoc chooseDoc = new UCChooseDoc(); DialogResult dr = chooseDoc.ShowDialog(this); if (dr == DialogResult.OK) { Dictionary <string, object> dic = new Dictionary <string, object>(); dic.Add("doc_id", chooseDoc.docInfo.doc_id); bool suc = Tmo_FakeEntityClient.Instance.SubmitData(DBOperateType.Update, TableName, PrimaryKey, user_id, dic); if (suc) { DXMessageBox.Show("该用户所属健康师成功更改为\n【" + chooseDoc.docInfo.doc_name + "】!", true); GetData(); } else { DXMessageBox.ShowError("所属健康师更改失败!"); } } chooseDoc.Dispose(); } }
void gridView1_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e) { DataRow dr = gridView1.GetDataRow(e.RowHandle); if (e.Column.Name == "del") { string isRisk = dr["isrisk"].ToString(); if (isRisk == "已评估") { DXMessageBox.Show("已评估问卷不能删除!", MessageIcon.Info, MessageButton.OK); } else { DialogResult dgResult = DXMessageBox.ShowQuestion("确定要删除吗?"); if (dgResult == DialogResult.OK) { ////此处写你的删除方法 string user_idstr = dr.GetDataRowStringValue("user_id"); int user_times = dr.GetDataRowIntValue("user_times"); bool isdel = TmoServiceClient.InvokeServerMethodT <bool>(funCode.DeleteQuestionnaires, user_idstr, user_times); if (isdel) { DXMessageBox.Show("删除成功!", true); GetData(); } else { DXMessageBox.ShowError("删除失败!", this); } } } } else if (e.Column.Name == "look_report") { //浏览问卷 Userinfo user = new Userinfo(); user.user_times = dr.GetDataRowIntValue("user_times"); user.user_id = dr.GetDataRowStringValue("user_id"); user.name = dr.GetDataRowStringValue("name"); user.gender = dr.GetDataRowStringValue("gender") == "男" ? 1 : 2; UCQuestionnaire questionnaire = new UCQuestionnaire(user); questionnaire.ShowDialog(this); questionnaire.Dispose(); GetData(); } else if (e.Column.Name == "lookImg") { //if(filename) FrmUp frmUpImg = new FrmUp(dr); frmUpImg.Enabled = true; frmUpImg.ShowDialog(); frmUpImg.Dispose(); } else if (e.Column.Name == "lookold") { FrmUpImg frmUpImg = new FrmUpImg(dr, true); frmUpImg.Enabled = true; frmUpImg.ShowDialog(); frmUpImg.Dispose(); //if(filename) } }
void btnNext_Click(object sender, EventArgs e) { bool pass = ValidateCurrentTabPage(); if (!pass) { return; } var tabPage = btnNext.Tag as XtraTabPage; if (tabPage != null) { //下一页 xtraTabControlMain.SelectedTabPage = tabPage; } else { //提交 DialogResult dr = DXMessageBox.ShowQuestion("确定要提交问卷吗?", this); if (dr != DialogResult.OK) { return; } this.ShowWaitingPanel(() => controlData.SubmitResult(), x => { List <tmo_questionnaire_category> suc = x as List <tmo_questionnaire_category>; if (suc != null) { if (suc.Any()) //加载剩下的问卷 { var qc = new UCQuestionnaireChoice(suc); qc.ShowDialog(this); var ids = qc.GetSelectedCategories().Select(y => y.qc_id).ToArray(); LoadQuestionnaire(ids); qc.Dispose(); } else { DXMessageBox.Show("问卷提交成功!", true); DialogResult result = DXMessageBox.ShowQuestion("问卷已经填写完毕,是否进行评估?", this); if (result == DialogResult.OK) { bool r = TmoServiceClient.InvokeServerMethodT <bool>(funCode.RiskNewReport, currentUser.user_id, controlData.Status.usertimes); if (r) { DXMessageBox.Show("问卷评估成功", true); } else { DXMessageBox.ShowError("问卷评估失败!", this); } } CloseForm(true); } } else { DXMessageBox.ShowWarning2("问卷提交失败!", this); } }, "正在提交问卷"); } }
void btnLogin_Click(object sender, EventArgs e) { if (!dxvalidation.Validate() || string.IsNullOrWhiteSpace(txtUid.Text)) { DXMessageBox.Show("用户名和密码不能为空!", MessageIcon.Info, MessageButton.OK); } else { string uidmd5 = DESEncrypt.Encrypt(txtUid.Text); string pwdmd5 = DESEncrypt.Encrypt(txtPwd.Text); uidmd5 = StringPlus.CompressString(uidmd5); pwdmd5 = StringPlus.CompressString(pwdmd5); try { this.loginPress.Show(); btnLogin.Enabled = btnCancel.Enabled = chkAutoLogin.Enabled = false; this.CrossThreadCallsSync(x => { this.loginPress.Hide(); btnLogin.Enabled = btnCancel.Enabled = chkAutoLogin.Enabled = true; string rtCode = x as string; switch (rtCode) { case "err_uid": DXMessageBox.ShowWarning("用户名不存在!"); txtUid.Focus(); break; case "err_pwd": DXMessageBox.ShowWarning("密码错误!"); txtPwd.Focus(); break; default: if (!string.IsNullOrWhiteSpace(rtCode) && rtCode.Length > 1) { #region 错误信息处理 if (rtCode.StartsWith("err_")) { DXMessageBox.ShowError(rtCode.Substring(4)); return; } #endregion #region 本地记住用户名和密码 if (chkAutoLogin.Checked) { ConfigHelper.UpdateConfig("u", uidmd5, true); ConfigHelper.UpdateConfig("p", pwdmd5, true); } #endregion DataTable dt = TmoShare.getDataTableFromXML(StringPlus.DecompressString(rtCode)); DataRow dr = dt.Rows[0]; //用户编号 用户姓名 Userinfo user = new Userinfo() { user_id = dr.GetDataRowStringValue("user_id"), name = dr.GetDataRowStringValue("name") }; TmoComm.login_userInfo = user; DXMessageBox.Show(string.Format("用户【{0}】登录成功!", TmoComm.login_userInfo.name), true); if (this.ParentForm != null) { this.ParentForm.DialogResult = DialogResult.OK; this.ParentForm.Close(); } } else { TmoShare.WriteLog("登录失败", "未知错误:返回值->" + rtCode); DXMessageBox.ShowError("未知错误!"); } break; } }, () => { try { WebServiceDLL.MonitorService service = new WebServiceDLL.MonitorService(); return(service.UserLogin(uidmd5, pwdmd5)); } catch { return("err_与服务器通信失败!请检查网络连接"); } }); } catch (Exception ex) { TmoShare.WriteLog("登录失败", ex); DXMessageBox.ShowError("与服务器通信失败!请检查网络连接"); } } }