private void okButton_Click(object sender, EventArgs e) { MainForm form = (MainForm)this.Owner; String billStyle = new Business.DictProcess().GetStyleByID(styleComboBox.SelectedValue.ToString()).Tables[0].Rows[0]["code"].ToString(); String[] styles = billStyle.Split(','); form.setBillStyle(styles); this.Close(); }
/// <summary> /// 保存数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSave_Click(object sender, EventArgs e) { if (!ValidateControls()) { MessageBox.Show("输入不能为空,请核查!"); return; } //获取form数据 string fmcard = this.tbMcard.Text.Trim(); string fname = this.tbName.Text.Trim(); string fidcard = this.tbIdcard.Text.Trim(); string finhosnum = this.tbInhosNum.Text.Trim(); string finhosorg = this.hdInhosOrg; string finhostype = this.cbInhosType.SelectedValue.ToString(); string finhosdept = this.hdInHosDept; string finhosdeptname = this.tbInhosDept.Text.Trim(); // DateTime finhosdate = this.dtInhos.Value; string finhosdate = this.dtInhos.Value.ToShortDateString(); string finhosstatus = this.cbInhosStatus.SelectedValue.ToString(); string finhosdia = this.hdInhosDia; string fouthosdia = this.hdOutHosDia; string fouthosdept = this.hdOutHosDept; // DateTime fouthosdate = this.dtOutHosp.Value; string fouthosdate = this.dtOutHosp.Value.ToShortDateString(); int finhosdays = (Convert.ToDateTime(fouthosdate) - Convert.ToDateTime(finhosdate)).Days + 1; string fouthosstatus = this.cbOutHospStatus.SelectedValue.ToString(); string fjzys = this.tbDoctor.Text.Trim(); string frcode = Util.Util.GetAppSetting("rcode"); //"@sdx", "@zyh", "@yljg", "@ylzh", "@name", "@idcard", "@jzlx", "@rysj", "@cysj", "@sjzyts", "@ryks", "@ryksname", "@cyks", "@cyksname", "@jzys", "@ryzt", "@cyzt", "@ryzd", "@cyzd" }; Hashtable ht = new Hashtable(); ht.Add("sdx", frcode); ht.Add("zyh", finhosnum); ht.Add("yljg", finhosorg); ht.Add("ylzh", fmcard); ht.Add("name", fname); ht.Add("idcard", fidcard); ht.Add("jzlx", finhostype); ht.Add("rysj", finhosdate); ht.Add("cysj", fouthosdate); ht.Add("sjzyts", finhosdays); ht.Add("ryks", finhosdept); ht.Add("cyks", fouthosdept); ht.Add("jzys", fjzys); ht.Add("ryzt", finhosstatus); ht.Add("cyzt", fouthosstatus); ht.Add("ryzd", finhosdia); ht.Add("cyzd", fouthosdia); //保存时添加guid,同时向父窗体guid赋值 string guid = Guid.NewGuid().ToString(); ht.Add("guid", guid); bool result = new Business.MainList().InsertZyjl(ht); if (result) { MessageBox.Show(this, "保存成功!", "保存提示", MessageBoxButtons.OK, MessageBoxIcon.Information); MainForm form = (MainForm)this.Owner; String billStyle = new Business.DictProcess().GetStyleByID(styleComboBox.SelectedValue.ToString()).Tables[0].Rows[0]["code"].ToString(); String[] styles = billStyle.Split(','); form.callBack(guid, fname, styles); this.DialogResult = DialogResult.OK; // this.Close(); } else { MessageBox.Show(this, "保存失败!", "保存提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } }