/// <summary> /// 保存按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void butContronl_Click(object sender, EventArgs e) { try { if (!dcHodily.Validate()) { return; } dcHodily.GetValue(holidayInfoEntity); String param = "?" + PackReflectionEntity <HolidayInfoEntity> .GetEntityToRequestParameters(holidayInfoEntity, true); String url = AppContext.AppConfig.serverUrl + "cms/holiday/save" + param; String data = HttpClass.httpPost(url); JObject objT = JObject.Parse(data); if (string.Compare(objT["state"].ToString(), "true", true) == 0) { MessageBoxUtils.Hint("保存成功!", MainForm); dcHodily.ClearValue(); groupBox1.Enabled = false; HolidaySettingList(1, pageControl1.PageSize); } else { MessageBoxUtils.Show(objT["message"].ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MainForm); } } catch (Exception ex) { MessageBoxUtils.Show(ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MainForm); Log4net.LogHelper.Error("节假日保存错误信息:" + ex.Message); } }
private void btnSave_Click(object sender, EventArgs e) { if (!dcClientVersion.Validate()) { return; } dcClientVersion.GetValue(clientVersion); if (serviceFilePath == null || serviceFilePath.Length == 0) { dcClientVersion.ShowError(teFileName, "请先上传文件"); return; } clientVersion.updateFilePath = serviceFilePath; String param = "?" + PackReflectionEntity <ClientVersionEntity> .GetEntityToRequestParameters(clientVersion); String url = AppContext.AppConfig.serverUrl + "sys/clientVersion/save" + param; this.DoWorkAsync(500, (o) => //耗时逻辑处理(此处不能操作UI控件,因为是在异步中) { String data = HttpClass.httpPost(url); return(data); }, null, (data) => //显示结果(此处用于对上面结果的处理,比如显示到界面上) { JObject objT = JObject.Parse(data.ToString()); if (string.Compare(objT["state"].ToString(), "true", true) == 0) { DialogResult = DialogResult.OK; } else { MessageBoxUtils.Show(objT["message"].ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, this); } }); }
public async Task ExportToExcel() { IsExporting = true; var saveFileDialog = new SaveFileDialog(); saveFileDialog.InitialDirectory = "C:"; saveFileDialog.Title = "Guardar"; saveFileDialog.FileName = "reporte"; saveFileDialog.DefaultExt = "xls"; saveFileDialog.Filter = "Excel Files|*.xls"; if (saveFileDialog.ShowDialog().Value) { try { await RequestService.Execute(() => { Export(saveFileDialog.FileName); }); } catch (Exception e) { MessageBoxUtils.Error(e.Message); } finally { IsExporting = false; } } }
private void btnRemove_Click(object sender, EventArgs e) { try { int patientId = SelectedId; DataRow dr = SelectedRow; if (patientId != 0 && dr != null) { int doctorId = (int)dr["DoctorId"]; if (doctorId == App.Instance.UserInfo.UserId) // if (App.Instance.UserInfo.HasWatching && App.Instance.UserInfo.Watching.HasPatient(patientId)) { if (MessageBoxUtils.Ask("¬ы уверены, что хотите удалить пациента " + patientId)) { using (WaitCursor wc = new WaitCursor()) { using (GmConnection conn = App.CreateConnection()) { Patient.SetStatus(conn, patientId, Status.Removed); } dr.Delete(); } } } else { MessageBox.Show("¬ы можете удал¤ть только своих пациентов."); } } } catch (Exception ex) { Log.Exception(ex); } }
private void repositoryItemButtonEdit2_Click(object sender, EventArgs e) { var selectedRow = gvRole.GetFocusedRow() as RoleEntity; if (selectedRow == null) { return; } if (MessageBoxUtils.Show("确定要删除吗?", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1, MainForm) == DialogResult.OK) { cmd.ShowOpaqueLayer(); String url = AppContext.AppConfig.serverUrl + "sys/sysRole/delete?id=" + selectedRow.id; this.DoWorkAsync(500, (o) => //耗时逻辑处理(此处不能操作UI控件,因为是在异步中) { String data = HttpClass.httpPost(url); return(data); }, null, (data) => //显示结果(此处用于对上面结果的处理,比如显示到界面上) { JObject objT = JObject.Parse(data.ToString()); if (string.Compare(objT["state"].ToString(), "true", true) == 0) { SearchData(); MessageBoxUtils.Hint("删除成功!", MainForm); } else { cmd.HideOpaqueLayer(); MessageBoxUtils.Show(objT["message"].ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MainForm); } }); } }
private void bw_RunWorkerGetNCDDocListCompleted(object sender, RunWorkerCompletedEventArgs e) { try { String data = e.Result as String; JObject objT = JObject.Parse(data); if (string.Compare(objT["state"].ToString(), "true", true) == 0) { List <DocInfoEntity> list = objT["result"].ToObject <List <DocInfoEntity> >(); this.gc_docInfoNCD.DataSource = list; } else { MessageBoxUtils.Show(objT["message"].ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MainForm); } } catch (Exception ex) { MessageBoxUtils.Show(ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MainForm); } finally { try { // 关闭加载提示框 //DevExpress.XtraSplashScreen.SplashScreenManager.CloseForm(); cmd.HideOpaqueLayer(); } catch { } } }
public bool StopDoctor(string hospitalId, string deptId, string clinicId, string doctorId, string isStop, string period) { bool IsStop = false; try { String url = AppContext.AppConfig.serverUrl + "sch/doctorSitting/openStop?hospitalId=" + hospitalId + "&deptId=" + deptId + "&clinicId=" + clinicId + "&doctorId=" + doctorId + "&isStop=" + isStop + "&period=" + period; String data = HttpClass.httpPost(url); JObject objT = JObject.Parse(data); if (string.Compare(objT["state"].ToString(), "true", true) == 0) { IsStop = true; } else { IsStop = false; MessageBoxUtils.Show(objT["message"].ToString(), MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1, null); } } catch (Exception ex) { Log4net.LogHelper.Info("叫号退出时设置当前医生停诊状态错误信息:" + ex.Message); } return(IsStop); }
private void repositoryItemButtonEdit2_Click(object sender, EventArgs e) { var selectedRow = gridView1.GetFocusedRow() as UserEntity; if (selectedRow == null) { return; } if (MessageBoxUtils.Show("确定要删除吗?", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1, MainForm) == DialogResult.OK) { String url = AppContext.AppConfig.serverUrl + "sys/sysUser/delete?id=" + selectedRow.id; String data = HttpClass.httpPost(url); JObject objT = JObject.Parse(data); if (string.Compare(objT["state"].ToString(), "true", true) == 0) { SearchData(1, pageControl1.PageSize); MessageBoxUtils.Hint("删除用户成功!", MainForm); } else { MessageBoxUtils.Show(objT["message"].ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MainForm); } } }
private void btnSave_Click(object sender, EventArgs e) { if (teUserName.Text.Length == 0) { MessageBoxUtils.Show("工号不能为空!", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, this); return; } if (tePassWord.Text.Length == 0) { MessageBoxUtils.Show("密码不能为空!", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, this); return; } param += "&userName="******"&passWord="******"sch/doctorScheduPlan/saveToMany?"; cmd.ShowOpaqueLayer(0.56f, "正在提交数据中"); this.DoWorkAsync(500, (o) => //耗时逻辑处理(此处不能操作UI控件,因为是在异步中) { String data = HttpClass.httpPost(url, param, 10); return(data); }, null, (r) => //显示结果(此处用于对上面结果的处理,比如显示到界面上) { JObject objT = JObject.Parse(r.ToString()); if (string.Compare(objT["state"].ToString(), "true", true) == 0) { cmd.HideOpaqueLayer(); DialogResult = DialogResult.OK; } else { cmd.HideOpaqueLayer(); MessageBoxUtils.Show(objT["message"].ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, this); } }); }
private void SearchData() { String url = AppContext.AppConfig.serverUrl + "sys/sysOffice/findAll"; this.DoWorkAsync(500, (o) => //耗时逻辑处理(此处不能操作UI控件,因为是在异步中) { String data = HttpClass.httpPost(url); return(data); }, null, (data) => //显示结果(此处用于对上面结果的处理,比如显示到界面上) { JObject objT = JObject.Parse(data.ToString()); if (string.Compare(objT["state"].ToString(), "true", true) == 0) { treeList1.DataSource = objT["result"].ToObject <List <OfficeEntity> >(); treeList1.KeyFieldName = "id"; //设置ID treeList1.ParentFieldName = "parentId"; //设置PreID treeList1.ExpandAll(); cmd.HideOpaqueLayer(); } else { cmd.HideOpaqueLayer(); MessageBoxUtils.Show(objT["message"].ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MainForm); } }); }
private void grid_bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { try { String data = e.Result as String; JObject objT = JObject.Parse(data); if (string.Compare(objT["state"].ToString(), "true", true) == 0) { gcUser.DataSource = objT["result"]["list"].ToObject <List <UserEntity> >(); pageControl1.setData(int.Parse(objT["result"]["count"].ToString()), int.Parse(objT["result"]["pageSize"].ToString()), int.Parse(objT["result"]["pageNo"].ToString())); } else { MessageBoxUtils.Show(objT["message"].ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MainForm); } } catch (Exception ex) { throw new Exception(ex.InnerException.Message); } finally { // 关闭加载提示框 //DevExpress.XtraSplashScreen.SplashScreenManager.CloseForm(); cmd.HideOpaqueLayer(); } }
private void bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { try { this.gvFinshPatient.ClearSorting();//清空排序 List <String> datas = e.Result as List <String>; if (datas.Count == 0) { return; } JObject objT = new JObject(); objT = JObject.Parse(datas[0]); if (string.Compare(objT["state"].ToString(), "true", true) == 0) { List <FinshPatientEntity> list = objT["result"].ToObject <List <FinshPatientEntity> >(); this.gcFinshPatient.DataSource = list; this.lab_count.Text = list.Count.ToString(); } else { MessageBoxUtils.Show(objT["message"].ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MainForm); return; } } catch (Exception ex) { MessageBoxUtils.Show(ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MainForm); } finally { // 关闭加载提示框 //DevExpress.XtraSplashScreen.SplashScreenManager.CloseForm(); cmd.HideOpaqueLayer(); } }
/// <summary> /// 获取当前科室医生 /// </summary> /// <param name="dept"></param> public void GetDoctorLue() { try { List <HospitalInfoEntity> doctorInfoEntity = new List <HospitalInfoEntity>(); // 查询医生下拉框数据 string url = AppContext.AppConfig.serverUrl + "cms/doctor/findAll?hospital.id=" + AppContext.Session.hospitalId + "&dept.id=" + treeDeptId.EditValue; String data = HttpClass.httpPost(url); JObject objT = JObject.Parse(data); if (string.Compare(objT["state"].ToString(), "true", true) == 0) { doctorInfoEntity = objT["result"].ToObject <List <HospitalInfoEntity> >(); doctorInfoEntity.Insert(0, new HospitalInfoEntity { id = "", name = "全部" }); lueDoctor.Properties.DataSource = doctorInfoEntity; lueDoctor.Properties.DisplayMember = "name"; lueDoctor.Properties.ValueMember = "id"; lueDoctor.ItemIndex = 0; } else { MessageBoxUtils.Show(objT["message"].ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MainForm); return; } } catch (Exception ex) { MessageBoxUtils.Show(ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MainForm); Log4net.LogHelper.Error("获取医生错误信息:" + ex.Message); } }
/// <summary> /// 节假日列表 /// </summary> /// <param name="pageNo">页码</param> /// <param name="pageSize">页数</param> public void HolidaySettingList(int pageNo, int pageSize) { try { String url = AppContext.AppConfig.serverUrl + "cms/holiday/list?pageNo=" + pageNo + "&pageSize=" + pageSize + "&hospital.id=" + AppContext.Session.hospitalId; String data = HttpClass.httpPost(url); JObject objT = JObject.Parse(data); if (string.Compare(objT["state"].ToString(), "true", true) == 0) { this.gc_Holiday.DataSource = objT["result"]["list"].ToObject <List <HolidayInfoEntity> >(); pageControl1.setData(int.Parse(objT["result"]["count"].ToString()), int.Parse(objT["result"]["pageSize"].ToString()), int.Parse(objT["result"]["pageNo"].ToString())); cmd.HideOpaqueLayer(); } else { MessageBoxUtils.Show(objT["message"].ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MainForm); cmd.HideOpaqueLayer(); } } catch (Exception ex) { cmd.HideOpaqueLayer(); MessageBoxUtils.Show(ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MainForm); Log4net.LogHelper.Error("获取节假日列表错误信息:" + ex.Message); } }
public void SearchData(bool flag, int pageNo, int pageSize) { var param = "?title=" + tbTitle.Text + "&&version=" + tbVersion.Text + "&&pageNo=" + pageNo + "&&pageSize=" + pageSize; var url = AppContext.AppConfig.serverUrl + "sys/clientVersion/list" + param; DoWorkAsync(0, (o) => { var data = HttpClass.httpPost(url); return(data); }, null, (r) => { cmd.HideOpaqueLayer(); var objT = JObject.Parse(r.ToString()); if (string.Compare(objT["state"].ToString(), "true", true) == 0) { gcDict.DataSource = objT["result"][0]["list"].ToObject <List <ClientVersionEntity> >(); pageControl1.setData(int.Parse(objT["result"][0]["count"].ToString()), int.Parse(objT["result"][0]["pageSize"].ToString()), int.Parse(objT["result"][0]["pageNo"].ToString())); } else { MessageBoxUtils.Show(objT["message"].ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MainForm); } }); }
public void SearchData(bool flag, int pageNo, int pageSize) { String type = ""; if (!lueType.EditValue.ToString().Equals("`")) { type = lueType.EditValue.ToString(); } String param = "?title=" + tbTitle.Text + "&&version=" + tbVersion.Text + "&&pageNo=" + pageNo + "&&pageSize=" + pageSize + "&&type=" + type; String url = AppContext.AppConfig.serverUrl + "sys/clientVersion/listTwo" + param; this.DoWorkAsync(0, (o) => //耗时逻辑处理(此处不能操作UI控件,因为是在异步中) { String data = HttpClass.httpPost(url); return(data); }, null, (r) => //显示结果(此处用于对上面结果的处理,比如显示到界面上) { cmd.HideOpaqueLayer(); JObject objT = JObject.Parse(r.ToString()); if (string.Compare(objT["state"].ToString(), "true", true) == 0) { gcDict.DataSource = objT["result"][0]["list"].ToObject <List <ClientVersionEntity> >(); pageControl1.setData(int.Parse(objT["result"][0]["count"].ToString()), int.Parse(objT["result"][0]["pageSize"].ToString()), int.Parse(objT["result"][0]["pageNo"].ToString())); } else { MessageBoxUtils.Show(objT["message"].ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MainForm); } }); }
private void btnDel_Click(object sender, EventArgs e) { var selectedRow = gridView1.GetFocusedRow() as ClientVersionEntity; if (selectedRow == null) { return; } if (MessageBoxUtils.Show("确定要删除吗?", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1, MainForm) == DialogResult.OK) { cmd.ShowOpaqueLayer(225, true); var param = "?id=" + selectedRow.id; var url = AppContext.AppConfig.serverUrl + "sys/clientVersion/delete" + param; DoWorkAsync(500, (o) => { var data = HttpClass.httpPost(url); return(data); }, null, (r) => { var objT = JObject.Parse(r.ToString()); if (string.Compare(objT["state"].ToString(), "true", true) == 0) { SearchData(false, pageControl1.CurrentPage, pageControl1.PageSize); MessageBoxUtils.Hint("删除成功!", MainForm); } else { MessageBoxUtils.Show(objT["message"].ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MainForm); } }); } }
private void btnSave_Click(object sender, EventArgs e) { List <SourceDataEntity> sourceDataList = gcSourceData.DataSource as List <SourceDataEntity>; String scheduSets = Newtonsoft.Json.JsonConvert.SerializeObject(sourceDataList); String param = "scheduSets=" + scheduSets; String url = AppContext.AppConfig.serverUrl + "sch/doctorScheduPlan/updateScheduList?" + param; cmd.ShowOpaqueLayer(); this.DoWorkAsync(0, (o) => //耗时逻辑处理(此处不能操作UI控件,因为是在异步中) { String data = HttpClass.httpPost(url); return(data); }, null, (data) => //显示结果(此处用于对上面结果的处理,比如显示到界面上) { JObject objT = JObject.Parse(data.ToString()); if (string.Compare(objT["state"].ToString(), "true", true) == 0) { cmd.HideOpaqueLayer(); DialogResult = DialogResult.OK; } else { cmd.HideOpaqueLayer(); MessageBoxUtils.Show(objT["message"].ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, this); return; } }); }
//异步下载 void DownLoadFile(object Args) { // 远程获取目标页面源码 try { string strTargetHtml = string.Empty; String[] args = Args as String[]; WebClient wc = new WebClient(); wc.DownloadFile(args[0], args[1]); wc.Dispose(); } catch (Exception e) { String Msg = e.Message; if (e.InnerException != null) { Msg = e.InnerException.Message; } Action action = () => { MessageBoxUtils.Hint(Msg, HintMessageBoxIcon.Error, this); }; Invoke(action); } finally { Action action = () => { cmd.HideOpaqueLayer(); }; Invoke(action); } }
private void lueHospital_EditValueChanged(object sender, EventArgs e) { if (lueHospital.EditValue == null || lueHospital.EditValue.ToString().Length == 0) { treeParentId.Properties.DataSource = null; return; } HospitalInfoEntity hospitalInfo = lueHospital.GetSelectedDataRow() as HospitalInfoEntity; //查询上级科室下拉框数据 String url = AppContext.AppConfig.serverUrl + "cms/dept/findAll?hospital.code=" + hospitalInfo.code;// +"&deptIds=" + AppContext.Session.deptIds; String data = HttpClass.httpPost(url); JObject objT = JObject.Parse(data); if (string.Compare(objT["state"].ToString(), "true", true) == 0) { List <DeptEntity> deptLsit = objT["result"].ToObject <List <DeptEntity> >(); DeptEntity dept = new DeptEntity(); dept.id = "0"; dept.name = "无"; deptLsit.Insert(0, dept); treeParentId.Properties.DataSource = deptLsit; treeParentId.Properties.TreeList.KeyFieldName = "id"; treeParentId.Properties.TreeList.ParentFieldName = "parentId"; treeParentId.Properties.DisplayMember = "name"; treeParentId.Properties.ValueMember = "id"; } else { MessageBoxUtils.Show(objT["message"].ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MainForm); return; } }
public void SearchData(int pageNo, int pageSize) { String param = "?name=" + tbName.Text + "&&description=" + tbDescription.Text + "&&pageNo=" + pageNo + "&&pageSize=" + pageSize; String url = AppContext.AppConfig.serverUrl + "sys/function/findAll" + param; this.DoWorkAsync(500, (o) => //耗时逻辑处理(此处不能操作UI控件,因为是在异步中) { String data = HttpClass.httpPost(url); return(data); }, null, (r) => //显示结果(此处用于对上面结果的处理,比如显示到界面上) { cmd.HideOpaqueLayer(); JObject objT = JObject.Parse(r.ToString()); if (string.Compare(objT["state"].ToString(), "true", true) == 0) { gcDict.DataSource = objT["result"]["list"].ToObject <List <FunctionEntity> >(); pageControl1.setData(int.Parse(objT["result"]["count"].ToString()), int.Parse(objT["result"]["pageSize"].ToString()), int.Parse(objT["result"]["pageNo"].ToString())); } else { MessageBoxUtils.Show(objT["message"].ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MainForm); } }); }
public bool OnAddCustomField(object argument) { CheckDisposed(); // Only allow adding custom fields when a single client is connected. if (Cache.NumberOfRemoteClients > 1 || (Cache.ProjectId.IsLocal && Cache.NumberOfRemoteClients > 0)) { MessageBoxUtils.Show(ParentForm, xWorksStrings.ksCustomFieldsCanNotBeAddedDueToRemoteClientsText, xWorksStrings.ksCustomFieldsCanNotBeAddedDueToRemoteClientsCaption, MessageBoxButtons.OK, MessageBoxIcon.Warning); return(true); } AddCustomFieldDlg.LocationType locationType = AddCustomFieldDlg.LocationType.Lexicon; string areaChoice = m_mediator.PropertyTable.GetStringProperty("areaChoice", string.Empty); switch (areaChoice) { case "lexicon": locationType = AddCustomFieldDlg.LocationType.Lexicon; break; case "notebook": locationType = AddCustomFieldDlg.LocationType.Notebook; break; } using (var dlg = new AddCustomFieldDlg(m_mediator, locationType)) dlg.ShowDialog(this); return(true); // handled }
/// ------------------------------------------------------------------------------------ /// <summary> /// Perform a restore of the project specified in the settings. /// </summary> /// <param name="progressDlg">The progress dialog.</param> /// <exception cref="IOException">File does not exist, or some such problem</exception> /// <exception cref="InvalidBackupFileException">XML deserialization problem or required /// files not found in zip file</exception> /// ------------------------------------------------------------------------------------ public void RestoreProject(IThreadedProgress progressDlg) { BackupFileSettings fileSettings = m_restoreSettings.Backup; fileSettings.Validate(); // Normally, this will already have been done, so this will do nothing. bool suppressConversion = false; //First of all, if the project exists and we are overwriting it, then make a copy of the project. That way //if the restoration fails part way through, we can put it back the way it was. if (Directory.Exists(m_restoreSettings.ProjectPath)) { // If the project already exists using the fwdata extension, either we're not sharing, // or it is a project for which sharing is suppressed. In any case we don't want to // convert the new project. suppressConversion = File.Exists(m_restoreSettings.FullProjectPath); CreateACopyOfTheProject(); } //When restoring a project, ensure all the normal folders are there even if some //of those folders had nothing from them in the backup. Directory.CreateDirectory(m_restoreSettings.ProjectPath); FdoCache.CreateProjectSubfolders(m_restoreSettings.ProjectPath); try { //Import from FW version 6.0 based on the file extension. string extension = Path.GetExtension(fileSettings.File).ToLowerInvariant(); if (extension == FwFileExtensions.ksFw60BackupFileExtension || extension == ".xml") { ImportFrom6_0Backup(fileSettings, progressDlg); } else //Restore from FW version 7.0 and newer backup. { RestoreFrom7_0AndNewerBackup(fileSettings); } } catch (Exception error) { if (error is IOException || error is InvalidBackupFileException || error is UnauthorizedAccessException) { CleanupAfterRestore(false); // ENHANCE: If/when we have the restore process using a progress dialog so that this code // runs in the progress dialog thread instead of the main thread, all message boxes should // be replaced with the ThreadHelper.ShowMessageBox() method so that they will be thread-safe. MessageBoxUtils.Show(null, error.Message, AppStrings.ksRestoreDidNotSucceed, MessageBoxButtons.OK, MessageBoxIcon.Information); } throw; } // switch to the desired backend (if it's in the projects directory...anything else stays XML for now). if (DirectoryFinder.IsSubFolderOfProjectsDirectory(m_restoreSettings.ProjectPath) && !suppressConversion) { ClientServerServices.Current.Local.ConvertToDb4oBackendIfNeeded(progressDlg, m_restoreSettings.FullProjectPath); } CleanupAfterRestore(true); }
private void RemoveBgImage() { try { TreeNode tn = tvItems.SelectedNode; if (tn != null) { BgImage bgImage = tn.Tag as BgImage; if (MessageBoxUtils.AskLocalized("_removeitems")) { tvItems.Nodes.Remove(tn); BgImages.Remove(bgImage); if (app.GetControlsAttr(ControlsAttr.AutoSave)) { using (Context context = Lib.GetContext()) bgImage.Remove(context); } if (OnBgImageRemoved != null) { OnBgImageRemoved(this, new BgImageEventArgs(bgImage)); } } } } catch (Exception ex) { Log.Exception(ex); } }
private void bw_RunWorkerGetPatientListCompleted(object sender, RunWorkerCompletedEventArgs e) { try { String data = e.Result as String; JObject objT = JObject.Parse(data); if (string.Compare(objT["state"].ToString(), "true", true) == 0) { List <BlackListPatientEntity> list = objT["result"]["list"].ToObject <List <BlackListPatientEntity> >(); this.gc_PatientList.DataSource = list; } else { MessageBoxUtils.Hint(objT["message"].ToString(), HintMessageBoxIcon.Error, MainForm); //MessageBox.Show(objT["message"].ToString()); } } catch (Exception ex) { //MessageBox.Show(ex.Message); throw new Exception(ex.InnerException.Message); } finally { try { // 关闭加载提示框 //DevExpress.XtraSplashScreen.SplashScreenManager.CloseForm(); cmd.HideOpaqueLayer(); } catch { } } }
private void gcDict_Click(object sender, EventArgs e) { var selectedRow = gridView1.GetFocusedRow() as ClientVersionEntity; if (selectedRow == null) { return; } var edit = new ClientVersionEdit(); edit.clientVersion = selectedRow; edit.Text = "版本修改"; if (edit.ShowDialog() == DialogResult.OK) { MessageBoxUtils.Hint("修改成功!", MainForm); DoWorkAsync(500, (o) => { Thread.Sleep(2700); return(null); }, null, (r) => { cmd.ShowOpaqueLayer(255, true); SearchData(true, pageControl1.CurrentPage, pageControl1.PageSize); }); } }
private void btnSave_Click(object sender, EventArgs e) { if (!dcMenu.Validate()) { return; } dcMenu.GetValue(menu); var index = treeParent.Properties.GetIndexByKeyValue(menu.parentId); List <MenuEntity> entityList = treeParent.Properties.TreeList.DataSource as List <MenuEntity>; menu.parentIds = entityList[index].parentIds + menu.parentId + ","; String param = PackReflectionEntity <MenuEntity> .GetEntityToRequestParameters(menu, true); cmd.ShowOpaqueLayer(); this.DoWorkAsync(500, (o) => //耗时逻辑处理(此处不能操作UI控件,因为是在异步中) { String data = HttpClass.httpPost(AppContext.AppConfig.serverUrl + "sys/sysMenu/save?" + param); return(data); }, null, (data) => //显示结果(此处用于对上面结果的处理,比如显示到界面上) { JObject objT = JObject.Parse(data.ToString()); cmd.HideOpaqueLayer(); if (string.Compare(objT["state"].ToString(), "true", true) == 0) { DialogResult = DialogResult.OK; } else { MessageBoxUtils.Show(objT["message"].ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, this); } }); }
private void gridView1_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e) { if (e.Column.Caption == "操作") { var selectedRow = gridView1.GetFocusedRow() as ClientVersionEntity; if (selectedRow == null) { return; } if (MessageBoxUtils.Show("确定要删除吗?", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1, MainForm) == DialogResult.OK) { cmd.ShowOpaqueLayer(225, true); var param = "?id=" + selectedRow.id; var url = AppContext.AppConfig.serverUrl + "sys/clientVersion/delete" + param; DoWorkAsync(500, (o) => { var data = HttpClass.httpPost(url); return(data); }, null, (r) => { var objT = JObject.Parse(r.ToString()); if (string.Compare(objT["state"].ToString(), "true", true) == 0) { SearchData(false, pageControl1.CurrentPage, pageControl1.PageSize); MessageBoxUtils.Hint("删除成功!", MainForm); } else { MessageBoxUtils.Show(objT["message"].ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MainForm); } }); } } else { var selectedRow = gridView1.GetFocusedRow() as ClientVersionEntity; if (selectedRow == null) { return; } var edit = new ClientVersionEdit(); edit.clientVersion = selectedRow; edit.Text = "版本修改"; if (edit.ShowDialog() == DialogResult.OK) { MessageBoxUtils.Hint("修改成功!", MainForm); DoWorkAsync(500, (o) => { Thread.Sleep(2700); return(null); }, null, (r) => { cmd.ShowOpaqueLayer(255, true); SearchData(true, pageControl1.CurrentPage, pageControl1.PageSize); }); } } }
/// <summary> /// 检查会话 12个小时一次(43200000秒) /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tmHeartbeat_Tick(object sender, EventArgs e) { tmHeartbeat.Enabled = false; var url = AppContext.AppConfig.serverUrl + "sys/sysUser/getCurrentDate"; DoWorkAsync(0, (o) => { var data = HttpClass.httpPost(url); return(data); }, null, (data) => { var objT = JObject.Parse(data.ToString()); if (string.Compare(objT["state"].ToString(), "true", true) == 0) { tmHeartbeat.Enabled = true; } else { if (MessageBoxUtils.Show(objT["message"].ToString(), MessageBoxButtons.OKCancel, new [] { "重新登录", "退出系统" }, this) == DialogResult.OK) { Application.Restart(); } else { Close(); } } }); }
/// <summary> /// 删除 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnDel_Click(object sender, EventArgs e) { try { var selectedRow = gv_Holiday.GetFocusedRow() as HolidayInfoEntity; if (selectedRow == null) { return; } //MessageBoxButtons messButton = MessageBoxButtons.OKCancel; DialogResult dr = MessageBoxUtils.Show("确定要删除吗?", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1, MainForm); if (dr == DialogResult.OK) { String param = "?id=" + selectedRow.id; String url = AppContext.AppConfig.serverUrl + "cms/holiday/delete" + param; String data = HttpClass.httpPost(url); JObject objT = JObject.Parse(data); if (string.Compare(objT["state"].ToString(), "true", true) == 0) { Xr.Common.MessageBoxUtils.Hint("删除成功", MainForm); HolidaySettingList(1, pageControl1.PageSize); this.dcHodily.ClearValue(); } else { MessageBoxUtils.Show(objT["message"].ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MainForm); } } } catch (Exception ex) { MessageBoxUtils.Show(ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MainForm); Log4net.LogHelper.Error("节假日修改错误信息:" + ex.Message); } }