private void SaveCheckedMenuItem_Click(object sender, System.EventArgs e) { FileServer fs; string filename; try { //Get file name. if (MySaveFileDialog.ShowDialog() == DialogResult.Cancel) { return; } filename = MySaveFileDialog.FileName; //Save file. base.FindForm().Cursor = Cursors.WaitCursor; fs = new FileServer(); fs.SaveFile(GetListAsString(false), filename); base.FindForm().Cursor = Cursors.Default; } catch (Exception ex) { MessageManager.ShowError(ex, "Unable to save checked items.", base.FindForm()); } }
private void MyBottonWrite_Click(object sender, EventArgs e) { for (int i = 1; i < int.Parse(MyTextBoxStripes.Text) + 1; i++) { if (color) { bw = HexConverter(MyColorDialogFill.Color); } else { bw = HexConverter(MyColorDialogFill2.Color); } MySVGcontent = MySVGcontent + "<rect x=\"" + (i * (double.Parse(MyTextBoxWidth.Text) / int.Parse(MyTextBoxStripes.Text))).ToString(CultureInfo.CreateSpecificCulture("en-GB")) + "mm\" y=\"10mm\" height=\"100mm\" width=\"" + ((double.Parse(MyTextBoxWidth.Text) / int.Parse(MyTextBoxStripes.Text))).ToString(CultureInfo.CreateSpecificCulture("en-GB")) + "mm\" style=\"stroke:" + bw + "; stroke-width:0.1mm; fill: " + bw + " \"/> \n\r"; color = !color; } MySVGcontent = MySVGcontent + "<rect x=\"" + (1 * (double.Parse(MyTextBoxWidth.Text) / int.Parse(MyTextBoxStripes.Text))).ToString(CultureInfo.CreateSpecificCulture("en-GB")) + "mm\" y=\"10mm\" height=\"100mm\" width=\"" + ((double.Parse(MyTextBoxWidth.Text))).ToString(CultureInfo.CreateSpecificCulture("en-GB")) + "mm\" style=\"stroke:#000000; stroke-width:0.1mm; fill: none \"/> \n\r"; MySVG = MySVGstart + MySVGcontent + MySVGend; MySaveFileDialog.ShowDialog(); if (MySaveFileDialog.FileName != "") { path = Path.GetFullPath(MySaveFileDialog.FileName); File.WriteAllText(path, MySVG); } }
private void SaveSelectionMenuItem_Click(object sender, System.EventArgs e) { FileServer fs; string filename; try { //Get file name. if (MySaveFileDialog.ShowDialog() == DialogResult.Cancel) { return; } filename = MySaveFileDialog.FileName; if (MyParentForm != null) { MyParentForm.Cursor = Cursors.WaitCursor; } //Save file. fs = new FileServer(); fs.SaveFile(GetListAsString(false, true), filename); if (MyParentForm != null) { MyParentForm.Cursor = Cursors.Default; } } catch (Exception ex) { MessageManager.ShowError(ex, "Unable to save selected items.", MyParentForm); } }
private void SaveButton_Click(object sender, EventArgs e) { string filename; FileServer fs; try { if (MySaveFileDialog.ShowDialog(this) != DialogResult.OK) { return; } filename = MySaveFileDialog.FileName; fs = new FileServer(); this.Cursor = Cursors.WaitCursor; fs.SaveFile(MainTextBox.Text, filename); this.Cursor = Cursors.Default; } catch (Exception ex) { MessageManager.ShowError(ex, "Error when saving file.", this); } finally { this.Cursor = Cursors.Default; } }
/// <summary> /// 保存结果报告 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SaveReportToolStripMenuItem_Click(object sender, EventArgs e) { MySaveFileDialog.InitialDirectory = Application.StartupPath; MySaveFileDialog.Filter = "txt file(*.txt)|*.txt"; // 文件类型过滤器设置为txt文件 if (MySaveFileDialog.ShowDialog() == DialogResult.OK) { File.WriteAllText(MySaveFileDialog.FileName, ReportTextBox.Text); } }
public void Export(GridControl gc) { string filename = MySaveFileDialog.Show(); if (!string.IsNullOrEmpty(filename)) { gc.ExportToXlsx(filename); } }
private void exportToolStripMenuItem_Click(object sender, EventArgs e) { MySaveFileDialog.ShowDialog(); if (MySaveFileDialog.FileName == "") { return; } var filePath = MySaveFileDialog.FileName; ExportToFile(filePath); }
//2:保存文件 private void SaveLabel_Click(object sender, System.EventArgs e) { MySaveFileDialog.Filter = this.MyOenFileDialog.Filter; MySaveFileDialog.CreatePrompt = true; MySaveFileDialog.OverwritePrompt = true; MySaveFileDialog.RestoreDirectory = true; if (MySaveFileDialog.ShowDialog() == DialogResult.OK) { ResultLabel.Text = "你要保存的文件为\n" + MySaveFileDialog.FileName; } }
private void MyButtonOpenFolder_Click(object sender, EventArgs e) { if (MySaveFileDialog.FileName.Length == 0) { MySaveFileDialog.FileName = "default.txt"; } if (MySaveFileDialog.ShowDialog() == DialogResult.OK) { MyTextBoxSelectedPath.Text = MySaveFileDialog.FileName; } }
private void SaveTableToolStripMenuItem_Click(object sender, EventArgs e) { if (DataTableGridView.Rows.Count == 0) { MessageBox.Show("没有可以导出的数据", "无数据", MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1); return; } MySaveFileDialog.InitialDirectory = Application.StartupPath; MySaveFileDialog.Filter = "txt file(*.txt)|*.txt"; MySaveFileDialog.RestoreDirectory = true; if (MySaveFileDialog.ShowDialog() == DialogResult.OK) { String datatable = FileHelperUtil.DataToTxt(DataTableGridView); File.WriteAllText(MySaveFileDialog.FileName, datatable); MessageBox.Show("保存成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); } }
public void Init() { //单击查询按钮 sbQuery.Click += (s, e) => { SimpleButton sb = s as SimpleButton; DataTable dt = new DrugTJManager().Get(lueDrug.EditValue == null?"":lueDrug.Text, deBegin.Text + " 00:00:00", deEnd.Text + " 23:59:59"); gridControl1.DataSource = dt; }; //单击更新按钮 sbRefresh.Click += (s, e) => { DataTable dt01 = ExcelHelper.ImportExceltoDt(@"C:\1.xls"); DataTable dt02 = ExcelHelper.ImportExceltoDt(@"C:\2.xls"); DateTime minTime01 = Convert.ToDateTime(dt01.Compute("min([发药时间])", "true")); DateTime minTime02 = Convert.ToDateTime(dt02.Compute("min([发/退药时间])", "true")); DateTime?maxTime01 = new FyByPatientManager().GetMaxTime(); maxTime01 = maxTime01 == null ? DateTime.MinValue : maxTime01; DateTime?maxTime02 = new FyByDrugManager().GetMaxTime(); maxTime02 = maxTime02 == null ? DateTime.MinValue : maxTime02; //if (minTime01 <= maxTime01 || minTime02 <= maxTime02) //{ // MessageBox.Show("为防止有数据遗漏,请重新导入数据"); // return; //} List <fybypatient> li01 = DataTableToModel.ToListModel <fybypatient>(dt01).Where(item => item.fytime > maxTime01).ToList(); List <fybydrug> li02 = DataTableToModel.ToListModel <fybydrug>(dt02).Where(item => item.fytime > maxTime02).ToList(); int count01 = new FyByPatientManager().Insert(li01); int count02 = new FyByDrugManager().Insert(li02); MessageBox.Show($"成功更新表数据为{count01},{count02}"); string maxT = new FyByPatientManager().GetMaxTime().ToString(); xtraTabControl2.CustomHeaderButtons[0].Caption = $"更新时间为:{maxT}"; }; xtraTabControl1.CustomHeaderButtonClick += (s, e) => { if (e.Button.Caption == "导出数据") { //gridView1.ExportToXlsx(@"C:\Users\Administrator\Desktop\yytj.xlsx"); string filename = MySaveFileDialog.Show(); if (!string.IsNullOrEmpty(filename)) { gridView1.ExportToXlsx(filename); } } else if (e.Button.Caption == "展开") { gridView1.ExpandAllGroups(); e.Button.Caption = "收缩"; } else if (e.Button.Caption == "收缩") { gridView1.CollapseAllGroups(); e.Button.Caption = "展开"; } }; gridView1.RowCellClick += (s, e) => { DataRow dr = gridView1.GetDataRow(e.RowHandle); string doctor = dr["doctor"].ToString(); string code = dr["code"].ToString(); string drug = dr["name"].ToString(); string spci = dr["spci"].ToString(); string unitprice = dr["unitprice"].ToString(); string quantity = dr["quantity"].ToString(); xtraTabControl2.TabPages[0].Text = $"医生用药明细 [{code},{drug},{spci},{unitprice},{quantity}]"; gridControl2.DataSource = new FyByPatientManager().GetListByCondition(deBegin.Text + " 00:00:00", deEnd.Text + " 23:59:59", doctor, code).OrderBy(item => item.fytime); }; DateTime?maxTime = new FyByPatientManager().GetMaxTime(); maxTime = maxTime == null ? DateTime.MinValue : maxTime; string mt = maxTime.ToString(); xtraTabControl2.CustomHeaderButtons[0].Caption = $"更新时间为:{mt}"; deBegin.EditValue = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1); deEnd.EditValue = DateTime.Now; lueDrug.Properties.DataSource = SqlHelper.ExecuteTable("select distinct name 名称,searchcode 搜索码 from drug"); lueDrug.EditValue = ""; lueDrug.Properties.DisplayMember = "名称"; lueDrug.Properties.ValueMember = "名称"; }
public ChufangControl() { InitializeComponent(); FFVM = mvvmContext.GetViewModel <FyFormViewModel>(); mvvmContext.SetBinding(this.deBegin, e => e.Text, "BeginTime"); mvvmContext.SetBinding(this.deEnd, e => e.Text, "EndTime"); mvvmContext.SetBinding(this.teDoctor, e => e.EditValue, "Doctor"); mvvmContext.SetBinding(this.tePatient, e => e.EditValue, "Patient"); mvvmContext.SetBinding(this.gridControl1, e => e.DataSource, "cfhead"); mvvmContext.SetBinding(this.gridControl2, e => e.DataSource, "Dv"); mvvmContext.SetBinding(this.gridControl3, e => e.DataSource, "CfDetailList"); mvvmContext.SetBinding(this.gridControl4, e => e.DataSource, "HzByDoctor"); mvvmContext.SetBinding(this.tsUnique, e => e.IsOn, "IsAll"); mvvmContext.SetBinding(gridControl5, e => e.DataSource, "JSDT"); // mvvmContext.SetBinding(this.xtraTabControl1.CustomHeaderButtons[0], e => e.Enabled, "IsEnable"); mvvmContext.BindCommand <FyFormViewModel>(this.sbQuery, x => x.Query()); // mvvmContext.SetBinding(this.cbeDate, e => e.Text, "SelectDate"); mvvmContext.SetBinding(this.lblTotlprice, e => e.Text, "Huizong"); mvvmContext.WithEvent <FyFormViewModel, CustomHeaderButtonEventArgs>(xtraTabControl1, "CustomHeaderButtonClick") .EventToCommand(x => x.Refresh(), args => args.Button.Caption == "同步数据"); mvvmContext.WithEvent <FyFormViewModel, CustomHeaderButtonEventArgs>(xtraTabControl1, "CustomHeaderButtonClick") .EventToCommand(x => x.DeleteRow(), args => args.Button.Caption == "删除选中记录"); mvvmContext.WithEvent <FyFormViewModel, CustomHeaderButtonEventArgs>(xtraTabControl1, "CustomHeaderButtonClick") .EventToCommand(x => x.Print(), args => args.Button.Caption == "打印处方封面"); mvvmContext.WithEvent <FyFormViewModel, CustomHeaderButtonEventArgs>(xtraTabControl1, "CustomHeaderButtonClick") .EventToCommand(x => x.Export(this.gridControl1), cs => this.gridControl1, args => args.Button.Caption == "导出处方"); mvvmContext.WithEvent <FyFormViewModel, CustomHeaderButtonEventArgs>(xtraTabControl1, "CustomHeaderButtonClick") .EventToCommand(x => x.Export(this.gridControl2), cs => this.gridControl2, args => args.Button.Caption == "导出汇总"); mvvmContext.WithEvent <FyFormViewModel, RowClickEventArgs>(gridView1, "RowClick") .EventToCommand(x => x.ShowHistory(), args => args.Clicks == 2); mvvmContext.WithEvent <FyFormViewModel, CustomHeaderButtonEventArgs>(xtraTabControl2, "CustomHeaderButtonClick") .EventToCommand(x => x.ShowHistory(), args => args.Button.Caption == "查看历史处方"); mvvmContext.WithEvent <FyFormViewModel, FocusedRowChangedEventArgs>(gridView1, "FocusedRowChanged") .EventToCommand(x => x.ChangeRow(gridView1), args => gridView1); groupControl3.CustomButtonClick += (s, e) => { string caption = e.Button.Properties.Caption; if (caption == "删除选中记录") { FFVM.DeleteRow(); } else if (caption == "打印处方封面") { FFVM.Print(); } else if (caption == "导出处方") { FFVM.Export(gridControl1); } }; Init(); this.toggleSwitch1_Toggled(this.tsAll, new EventArgs()); // layoutControlItem1.Enabled = layoutControlItem2.Enabled = false; groupControl2.CustomButtonChecked += (s, e) => { bandedGridView1.ExpandAllGroups(); }; groupControl2.CustomButtonUnchecked += (s, e) => { bandedGridView1.CollapseAllGroups(); }; groupControl2.CustomButtonClick += (s, e) => { if (e.Button.Properties.Caption == "导出数据") { string filename = MySaveFileDialog.Show(); if (!string.IsNullOrEmpty(filename)) { bandedGridView1.ExportToXlsx(filename); } ; } }; popupMenu1.Manager.ItemClick += (s, e) => { FFVM.SelectDate = e.Item.Caption; }; dropDownButton1.DropDownControl = this.popupMenu1; xtraTabControl3.CustomHeaderButtonClick += (s, e) => { string caption = e.Button.Caption; if (caption == "精神药品") { xtraTabPage6.Text = "精神药品"; FFVM.GetJS(); } else if (caption == "麻醉药品") { xtraTabPage6.Text = "麻醉药品"; FFVM.GetMZ(); } }; }