private bool myDataGrid1_myKeyDown(ref System.Windows.Forms.Message msg, System.Windows.Forms.Keys keyData) { try { DataTable tb = (DataTable)this.myDataGrid1.DataSource; int nrow = this.myDataGrid1.CurrentCell.RowNumber; int ncol = this.myDataGrid1.CurrentCell.ColumnNumber; int nkey = Convert.ToInt32(keyData); string columnName = this.myDataGrid1.TableStyles[0].GridColumnStyles[ncol].HeaderText.Trim(); if (nrow > tb.Rows.Count - 1) { return(true); } //如果是名称列 if (columnName.Trim() == "名称" && nkey == 13) { string coltext = ""; DataGridTextBoxColumn txtCol = (DataGridTextBoxColumn)this.myDataGrid1.TableStyles[0].GridColumnStyles[ncol]; coltext = txtCol.TextBox.Text; if (coltext.Trim() == "") { return(true); } if (nrow >= tb.Rows.Count - 1) { DataRow row = tb.NewRow(); row["序号"] = nrow + 2; tb.Rows.Add(row); } tb.Rows[nrow]["名称"] = coltext; tb.Rows[nrow]["拼音码"] = PubStaticFun.GetPYWBM(coltext, 0); tb.Rows[nrow]["五笔码"] = PubStaticFun.GetPYWBM(coltext, 1); } //回车控制 //if (nkey==13 && columnName!="药品类型") if (nkey == 13 && columnName != "统领分类") { this.myDataGrid1.CurrentCell = new DataGridCell(nrow, ncol + 1); } //if (nkey==13 && columnName=="药品类型") if (nkey == 13 && (columnName == "统领分类" || columnName == "剂型大类")) { this.myDataGrid1.CurrentCell = new DataGridCell(nrow + 1, 1); } if (this.myDataGrid1.TableStyles[0].GridColumnStyles[ncol + 1].HeaderText.Trim() == "统领分类" || this.myDataGrid1.TableStyles[0].GridColumnStyles[ncol + 1].HeaderText.Trim() == "剂型大类") { cmbyplx.Focus(); } } catch (System.Exception err) { MessageBox.Show("错误" + err.Message); } return(false); }
private void toolStripButton1_Click(object sender, EventArgs e) { try { this.dataGridView1.EndEdit(); this.BindingContext[((DataTable)this.dataGridView1.DataSource)].EndCurrentEdit(); DataTable temp = ((DataTable)this.dataGridView1.DataSource); DataTable tt = temp.GetChanges(); DataTable tdel = temp.GetChanges(DataRowState.Deleted); this.dataGridView1.Rows.Count.ToString(); for (int i = 0; i < temp.Rows.Count; i++) { if (temp.Rows[i].RowState == DataRowState.Deleted) { continue; } if (temp.Rows[i]["delete_bit1"].ToString() == "false") { temp.Rows[i]["delete_bit"] = 0; } else { temp.Rows[i]["delete_bit"] = 1; } if (temp.Rows[i].RowState == DataRowState.Added) { temp.Rows[i]["delete_bit"] = 0; temp.Rows[i]["delete_bit1"] = "false"; } if (temp.Rows[i]["pym"].ToString().Trim() == "") { temp.Rows[i]["pym"] = PubStaticFun.GetPYWBM(temp.Rows[i]["name"].ToString().Trim(), 0); temp.Rows[i]["wbm"] = PubStaticFun.GetPYWBM(temp.Rows[i]["name"].ToString().Trim(), 1); } temp.Rows[i]["type"] = this.toolStripComboBox1.ComboBox.SelectedValue.ToString(); temp.Rows[i]["typename"] = this.toolStripComboBox1.ComboBox.Text.ToString(); if (temp.Rows[i]["name"].ToString().Trim() == "") { temp.Rows[i].Delete(); } } databaseupdate("select * from ss_ShblJcsj where 1=2", ((DataTable)this.dataGridView1.DataSource)); ((DataTable)this.dataGridView1.DataSource).AcceptChanges(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { FrmShblJcwh_Load(null, null); try { this.dataGridView1.CurrentCell = this.dataGridView1.Rows[this.dataGridView1.Rows.Count - 1].Cells[0]; } catch { } } }
public string DoInsertChange(int iStatus, DateTime importTime) { ; string strSql = ""; strSql = string.Format(@"insert into jc_gf_patrec_Change( id, ylzh, name, pym, wbm, gflx, qy, brlx, del_bit, cfsl_xz, cfslM_xz, je_xz, jcje_xz, zlje_xz,yje_xz, GRJB, RZQK, ZFBL, RDWBH, DWBH, RRYLB, RGRBH, SFZH, xb ,memo, DM,lxdh, csrq,GZSJ,DDYY1,DDYY2,DDYY3,bzsj,xzsj,ydsj,ydlb,drsj,cxsj,dr_bit,memo_1,memo_2,memo_3) VALUES('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}','{16}','{17}','{18}','{19}','{20}','{21}','{22}','{23}','{24}','{25}','{26}','{27}','{28}','{29}','{30}','{31}','{32}','{33}','{34}','{35}','{36}','{37}','{38}','{39}','{40}','{41}')", DDLH.Replace("'", "") + _strZone, DDLH.Replace("'", ""), RGRXM.Replace("'", ""), PubStaticFun.GetPYWBM(RGRXM.Replace("'", ""), 0), PubStaticFun.GetPYWBM(RGRXM.Replace("'", ""), 1), _strWhsGf, _strZone, _strYbjklx, "0", _cfsl, _cfslM, _jexz, _rJcje, _rZlje, _yjexz, RGRJB, RRZQK, RZFBL, RDWBH, DWBH, RRYLB, RGRBH, SFZH, RGRXB, BZ, "2", NXDH.Replace("'", ""), string.IsNullOrEmpty(RZSSJ.Trim()) ? "" : RZSSJ.Trim(), string.IsNullOrEmpty(RGZSJ.Trim()) ? "" : RGZSJ.Trim(), RDDY1, RDDY2, RDDY3, string.IsNullOrEmpty(RBZSJ.Trim()) ? "" : RBZSJ.Trim(), string.IsNullOrEmpty(RSZSJ.Trim()) ? "" : RSZSJ.Trim(), string.IsNullOrEmpty(BDSJ.Trim()) ? "" : BDSJ.Trim(), BDLB, importTime, importTime.ToString("yyyy-MM-dd HH:mm:ss"), iStatus, "", RGRJB, RRZQK ); return(strSql); }
public string DoInsert() { string strSql = ""; strSql = string.Format(@"insert into jc_gf_patrec( id, ylzh,ylzh1,ylzh2, name, pym, wbm, gflx, qy, brlx, del_bit, cfsl_xz, cfslM_xz, je_xz, jcje_xz, zlje_xz,yje_xz, GRJB, RZQK, ZFBL, RDWBH, DWBH, RRYLB, RGRBH, SFZH, xb ,memo, DM,lxdh, csrq,GZSJ,DDYY1,DDYY2,DDYY3,bzsj,xzsj,ydsj,ydlb,memo_1,memo_2,memo_3) VALUES('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}','{16}','{17}','{18}','{19}','{20}','{21}','{22}','{23}','{24}','{25}','{26}','{27}','{28}','{29}','{30}','{31}','{32}','{33}','{34}','{35}','{36}','{37}','{38}','{39}','{40}')", DDLH.Replace("'", "") + _strZone, DDLH.Replace("'", ""), DDLH.Replace("'", ""), DDLH.Replace("'", ""), RGRXM.Replace("'", ""), PubStaticFun.GetPYWBM(RGRXM.Replace("'", ""), 0), PubStaticFun.GetPYWBM(RGRXM.Replace("'", ""), 1), _strWhsGf, _strZone, _strYbjklx, "0", _cfsl, _cfslM, _jexz, _rJcje, _rZlje, _yjexz, RGRJB, RRZQK, RZFBL, RDWBH, DWBH, RRYLB, RGRBH, SFZH, RGRXB, BZ, "2", NXDH.Replace("'", ""), string.IsNullOrEmpty(RZSSJ.Trim()) ? "" : RZSSJ.Trim(), string.IsNullOrEmpty(RGZSJ.Trim()) ? "" : RGZSJ.Trim(), RDDY1, RDDY2, RDDY3, string.IsNullOrEmpty(RBZSJ.Trim()) ? "" : RBZSJ.Trim(), string.IsNullOrEmpty(RSZSJ.Trim()) ? "" : RSZSJ.Trim(), string.IsNullOrEmpty(BDSJ.Trim()) ? "" : BDSJ.Trim(), BDLB, "", RGRJB, RRZQK); //InstanceForm._database.DoCommand(strSql); return(strSql); }
private void textBox2_KeyPress_1(object sender, KeyPressEventArgs e) { if (e.KeyChar == '\r') { if ((sender as Control).Name == "textBox2") { this.textBox4.Text = PubStaticFun.GetPYWBM(this.textBox2.Text, 0); this.textBox5.Text = PubStaticFun.GetPYWBM(this.textBox2.Text, 1); } this.SelectNextControl((sender as TextBox), true, false, false, true); } }
private void dataGridView1_CellLeave(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= this.dataGridView1.Rows.Count - 1) { return; } try { this.dataGridView1.EndEdit(); this.BindingContext[((DataTable)this.dataGridView1.DataSource)].EndCurrentEdit(); if (e.ColumnIndex == 0) { this.dataGridView1.Rows[e.RowIndex].Cells["拼音码"].Value = PubStaticFun.GetPYWBM(this.dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString(), 0); this.dataGridView1.Rows[e.RowIndex].Cells["五笔码"].Value = PubStaticFun.GetPYWBM(this.dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString(), 1); } } catch { } }
/// <summary> /// 回车跳至下一个文本事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void GotoNext(object sender, KeyPressEventArgs e) { Control control = (Control)sender; if (e.KeyChar == 13) { switch (control.Name) { case "txtName": txtPym.Text = PubStaticFun.GetPYWBM(txtName.Text, 0); txtWbm.Text = PubStaticFun.GetPYWBM(txtName.Text, 1); this.SelectNextControl(control, true, false, true, true); break; default: this.SelectNextControl(control, true, false, true, true); break; } } }
private void button1_Click(object sender, EventArgs e) { if (this.textBox1.Text.Trim() == "") { MessageBox.Show("名称不能为空"); return; } string s1 = this.textBox1.Text.Trim(); string s2 = nr; string s3 = PubStaticFun.GetPYWBM(this.textBox1.Text, 0); string s4 = PubStaticFun.GetPYWBM(this.textBox1.Text, 1); string s5 = this.comboBox1.SelectedValue.ToString(); try { string sql = string.Format("insert into Jc_Jybs_Jc (name,context,pym,wmb,jclxid ) values ('{0}','{1}','{2}','{3}',{4} )", s1, s2, s3, s4, s5); FrmMdiMain.Database.DoCommand(sql); } catch { MessageBox.Show("对不起,只能保存500个汉字,请您修改后重新保存!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } this.Close(); }
private bool myDataGrid1_myKeyDown(ref System.Windows.Forms.Message msg, System.Windows.Forms.Keys keyData) { try { DataTable tb = (DataTable)this.myDataGrid1.DataSource; int nrow = this.myDataGrid1.CurrentCell.RowNumber; int ncol = this.myDataGrid1.CurrentCell.ColumnNumber; int nkey = Convert.ToInt32(keyData); string columnName = this.myDataGrid1.TableStyles[0].GridColumnStyles[ncol].HeaderText.Trim(); if (nrow > tb.Rows.Count - 1) { return(true); } // if (Convert.ToInt32(Convertor.IsNull(tb.Rows[nrow]["fid"].ToString(),"0"))==0) // { // tb.Rows[nrow]["所属上级编目"]=this.treeView1.SelectedNode.Text; // tb.Rows[nrow]["fid"]=this.treeView1.SelectedNode.Tag; // } if (columnName.Trim() == "名称" && nkey == 13) { string coltext = ""; DataGridTextBoxColumn txtCol = (DataGridTextBoxColumn)this.myDataGrid1.TableStyles[0].GridColumnStyles[ncol]; coltext = txtCol.TextBox.Text; if (coltext.Trim() == "") { return(true); } if (nrow >= tb.Rows.Count - 1) { // DataRow row=tb.NewRow(); // row["序号"]=nrow+2; // row["禁用"]=(short)0; // tb.Rows.Add(row); AddNewRow(tb, this.treeView1.SelectedNode); } tb.Rows[nrow]["名称"] = coltext; tb.Rows[nrow]["拼音码"] = PubStaticFun.GetPYWBM(coltext, 0); tb.Rows[nrow]["五笔码"] = PubStaticFun.GetPYWBM(coltext, 1); } if (nkey == 13 && columnName != "禁用") { this.myDataGrid1.CurrentCell = new DataGridCell(nrow, ncol + 1); } if (nkey == 13 && columnName == "禁用") { this.myDataGrid1.CurrentCell = new DataGridCell(nrow + 1, 2); } if (columnName.Trim() == "所属上级编目" && nkey != 13) { Point point = new Point(this.myDataGrid1.GetCellBounds(nrow, ncol).Left - 50, this.myDataGrid1.GetCellBounds(nrow, ncol).Top + this.myDataGrid1.Top + this.myDataGrid1.GetCellBounds(nrow, ncol).Height); this.treeView2.Location = point; this.treeView2.Visible = true; this.myDataGrid1.Enabled = false; } return(false); } catch (System.Exception err) { MessageBox.Show("错误" + err.Message); return(false); } }
public string DoUpdate() { string strSql = ""; strSql = string.Format(@"update [jc_gf_patrec] set [name] = '{0}', [pym] = '{1}', [wbm] = '{2}', [GRJB] = '{3}', [RZQK] = '{4}', [ZFBL] = '{5}', [RDWBH] = '{6}', [DWBH] = '{7}', [RRYLB] = '{8}', [RGRBH] = '{9}', [SFZH] = '{10}', [xb] = '{11}', [memo] = '{12}' , [lxdh] = '{13}', [csrq] = '{14}', [GZSJ] = '{15}', [DDYY1] = '{16}', [DDYY2] = '{17}', [DDYY3] = '{18}', [bzsj] = '{19}', [xzsj] = '{20}', [ydsj] = '{21}', [ydlb] = '{22}', [memo_1] = '{23}', [memo_2] = '{24}', [memo_3] = '{25}', [gflx] = '{26}' where ylzh= '{27}' and [qy] = '{28}'", RGRXM.Replace("'", ""), PubStaticFun.GetPYWBM(RGRXM.Replace("'", ""), 0), PubStaticFun.GetPYWBM(RGRXM.Replace("'", ""), 1), RGRJB, RRZQK, RZFBL, RDWBH, DWBH, RRYLB, RGRBH, SFZH, RGRXB, BZ, NXDH.Replace("'", ""), string.IsNullOrEmpty(RZSSJ.Trim()) ? "" : RZSSJ.Trim(), string.IsNullOrEmpty(RGZSJ.Trim()) ? "" : RGZSJ.Trim(), RDDY1, RDDY2, RDDY3, string.IsNullOrEmpty(RBZSJ.Trim()) ? "" : RBZSJ.Trim(), string.IsNullOrEmpty(RSZSJ.Trim()) ? "" : RSZSJ.Trim(), string.IsNullOrEmpty(BDSJ.Trim()) ? "" : BDSJ.Trim(), BDLB, "", RGRJB, RRZQK, _strWhsGf, DDLH, _strZone); return(strSql); }
public void btnSave_Click(object sender, EventArgs e) { try { string Context = ContextValue; string UserName = Convert.ToString(UserID); if (string.IsNullOrEmpty(txtname.Text)) { MessageBox.Show("请填写名称"); } else { string strSql = "insert into Jc_Jybs_Jc(name,context,djy,type,pym,wmb,ksdm) Values('" + txtname.Text + "','" + Context + "','" + UserName + "','0','" + PubStaticFun.GetPYWBM(txtname.Text, 0) + "','" + PubStaticFun.GetPYWBM(txtname.Text, 1) + "'," + ksdm + ")"; int i = InstanceForm.BDatabase.DoCommand(strSql); if (i > 0) { MessageBox.Show("保存成功"); this.Close(); } else { MessageBox.Show("保存失败"); } } } catch (System.Exception err) { MessageBox.Show("对不起,只能保存300个汉字,请您修改后重新保存!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private bool myDataGrid1_myKeyDown(ref System.Windows.Forms.Message msg, System.Windows.Forms.Keys keyData) { try { DataTable tb = (DataTable)this.myDataGrid1.DataSource; int nrow = this.myDataGrid1.CurrentCell.RowNumber; int ncol = this.myDataGrid1.CurrentCell.ColumnNumber; int nkey = Convert.ToInt32(keyData); string columnName = this.myDataGrid1.TableStyles[0].GridColumnStyles[ncol].HeaderText.Trim(); if (nrow > tb.Rows.Count - 1) { return(true); } string coltext = ""; DataGridTextBoxColumn txtCol = (DataGridTextBoxColumn)this.myDataGrid1.TableStyles[0].GridColumnStyles[ncol]; coltext = txtCol.TextBox.Text; //如果名称列 if (columnName.Trim() == "姓名" && nkey == 13) { if (coltext.Trim() == "") { return(true); } if (nrow >= tb.Rows.Count - 1) { DataRow row = tb.NewRow(); row["序号"] = nrow + 2; tb.Rows.Add(row); } tb.Rows[nrow]["姓名"] = coltext; tb.Rows[nrow]["拼音码"] = PubStaticFun.GetPYWBM(coltext, 0); tb.Rows[nrow]["五笔码"] = PubStaticFun.GetPYWBM(coltext, 1); } //如果是供货单位列 if (columnName.Trim() == "所属供货单位" && nkey == 32) { string[] GrdMappingName; int[] GrdWidth; string[] sfield; string ssql = ""; DataRow row; //Point point=new Point(this.Location.X+control.Location.X,this.Location.Y+control.Location.Y+control.Height*3 ); Point point = new Point(this.myDataGrid1.GetCellBounds(nrow, ncol).Left, this.myDataGrid1.GetCellBounds(nrow, ncol).Top + this.myDataGrid1.Top + this.myDataGrid1.GetCellBounds(nrow, ncol).Height); GrdMappingName = new string[] { "id", "行号", "供货商", "拼音码", "五笔码" }; GrdWidth = new int[] { 0, 50, 200, 100, 100 }; sfield = new string[] { "wbm", "pym", "", "", "" }; ssql = "select ID,0 rowno,ghdwmc,pym,wbm from yp_ghdw WHERE ID<>0 "; TrasenFrame.Forms.Fshowcard f1 = new TrasenFrame.Forms.Fshowcard(GrdMappingName, GrdWidth, sfield, FilterType.拼音, coltext.Trim(), ssql); f1.Location = point; f1.ShowDialog(this); row = f1.dataRow; if (row != null) { tb.Rows[nrow]["所属供货单位"] = row["ghdwmc"].ToString().Trim(); tb.Rows[nrow]["ghdwid"] = row["id"].ToString(); this.myDataGrid1.CurrentCell = new DataGridCell(nrow + 1, 1); return(false); } } if (nkey == 13 && columnName != "所属供货单位") { this.myDataGrid1.CurrentCell = new DataGridCell(nrow, ncol + 1); } if (nkey == 13 && columnName == "所属供货单位") { this.myDataGrid1.CurrentCell = new DataGridCell(nrow + 1, 1); } } catch (System.Exception err) { MessageBox.Show("错误" + err.Message); } return(false); }
private void btnSave_Click(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(txtZy.Text)) { MessageBox.Show("请输入病人职业!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); this.txtZy.Focus(); return; } if (string.IsNullOrEmpty(txtXzdz.Text)) { MessageBox.Show("请输入病人现地址!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); this.txtXzdz.Focus(); return; } if (string.IsNullOrEmpty(txtlxdh.Text)) { MessageBox.Show("请输入病人联系电话!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); this.txtlxdh.Focus(); return; } if (this.dtpFbrq.Value >= Convert.ToDateTime(txtGhsj.Text)) { MessageBox.Show("发病日期不能大于挂号时间"); this.dtpFbrq.Focus(); return; } FrmMdiMain.Database.BeginTransaction(); try { // modify by fangke 2014.11.18 FrmMdiMain.Database.DoCommand("delete mz_mzrz where blh='" + this.txtMzh.Text + "'"); string strSql = string.Format(@"INSERT INTO dbo.MZ_MZRZ (rzid,kahao,jzrq,blh,brxm , xb,csrq,zy,xzdz,jzxm , lxdh,tiwen,xueya,maibo,yxjb , fenji,fbrq,zdsj,lxbxjcs,cfz , crbyq,bgr,xinlv,huxi,ssy , yishi,MEWSdf,ksxt,xybhd,shenzhi , ryfs,fenqu,zhusu,brqx,sffr , bgrid,deptid,deleted,wbm,pym,ghsj,klx ) VALUES ( '{0}' , '{1}' , '{41}' , '{2}' , '{3}' , '{4}' ,'{5}' , '{6}' , '{7}' , '{8}' , '{9}' ,{10} , '{11}' , '{12}' , '{13}' , '{14}' , '{15}', '{16}' ,'{17}' , '{18}' , '{19}' , '{20}' , {21}, {22} , {23} , '{24}' , '{25}' , {26} ,'{27}' ,'{28}' , '{29}' , '{30}' , '{31}' ,'{32}' , '{33}' , {34}, {35}, {36} , '{37}' , '{38}' , '{39}' ,{40} )", Guid.NewGuid().ToString(), this.txtKh.Text, this.txtMzh.Text, txtBrxm.Text, cmbXb.Text, dtpCsrq.Value, this.txtZy.Tag, this.txtXzdz.Text, this.txtJzxm.Text, this.txtlxdh.Text, Convertor.IsNull(txtTw.Text, "0"), this.txtXy.Text, string.IsNullOrEmpty(txtMb.Text) ? "0" : txtMb.Text, txtYxjb.Text, cmbFj.SelectedValue, dtpFbrq.Value, txtZdsj.Text, txtLxbxjcs.Text, Convertor.IsNull(cmbCfz.SelectedValue, "0"), txtCrbyq.Text, txtBgr.Text, Convertor.IsNull(txtXinlv.Text, "0"), Convertor.IsNull(txtHuxi.Text, "0"), 0, txtYs.Text, Convertor.IsNull(txtMEWSdf.Text, "0"), Convertor.IsNull(txtKsxt.Text, "0"), txtXybhd.Text, txtShenzhi.Text, txtRyfs.Text, txtFenqu.Text, txtZhusu.Text, txtBbrqx.Text, Convertor.IsNull(txtSffr.SelectedValue, "0"), InstanceForm.BCurrentUser.EmployeeId, InstanceForm.BCurrentDept.DeptId, 0, PubStaticFun.GetPYWBM(this.txtBrxm.Text.Trim(), 1), PubStaticFun.GetPYWBM(this.txtBrxm.Text.Trim(), 0), txtGhsj.Text, 1, txtJzrq.Text); int i = FrmMdiMain.Database.DoCommand(strSql); if (i == 0) { throw new Exception("影响的行为0"); } FrmMdiMain.Database.CommitTransaction(); } catch (Exception ex) { FrmMdiMain.Database.RollbackTransaction(); throw ex; } this.DialogResult = DialogResult.OK; this.Close(); } catch (Exception ex) { MessageBox.Show("操作失败:" + Environment.NewLine + ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void txtGroupName_Leave(object sender, EventArgs e) { this.txtPyCode.Text = PubStaticFun.GetPYWBM(this.txtGroupName.Text.Trim(), 0); this.txtWbCode.Text = PubStaticFun.GetPYWBM(this.txtGroupName.Text.Trim(), 1); }
private void txtName_Leave(object sender, EventArgs e) { txtPYM.Text = PubStaticFun.GetPYWBM(txtName.Text, 0); txtWBM.Text = PubStaticFun.GetPYWBM(txtName.Text, 1); }
private void btnSol_Click(object sender, EventArgs e) { string strErr = ""; try { //DataGridViewRow dgr = dataGridView2.CurrentRow; //if (dgr == null) // return; string strZone = "44443"; //武汉市区域编码:此处写死 string strWhsGf = "21"; //武汉市区域编码:此处写死 string strYbjklx = "4444"; string strSql = ""; DataTable dt = dataGridView2.DataSource as DataTable; if (dt == null || dt.Rows.Count <= 0) { return; } dt.DefaultView.RowFilter = "cwxx='出错'"; foreach (DataRow dr in dt.Rows) { int iRet = DoValid(dr["ylzh"].ToString().Trim(), strZone); DoSetValueByDataRow(dr);//赋值给变量 //错误数据处理 if (iRet == 1) { //已存在则对比name,相同直接进行update操作,否则不update DataTable dtHis = DoGetPatientInfo(dr["ylzh"].ToString().Trim(), strZone); if (dtHis == null || dtHis.Rows.Count <= 0) { strErr += dr["ylzh"].ToString().Trim() + "\r"; continue; } DataRow drHis = dtHis.Rows[0]; //通过人员姓名判断是否同人 if (dr["RGRXM"].ToString().Trim().Equals(drHis["name"].ToString().Trim())) { strSql = string.Format(@"update [jc_gf_patrec] set [name] = '{0}', [pym] = '{1}', [wbm] = '{2}', [GRJB] = '{3}', [RZQK] = '{4}', [ZFBL] = '{5}', [RDWBH] = '{6}', [DWBH] = '{7}', [RRYLB] = '{8}', [RGRBH] = '{9}', [SFZH] = '{10}', [xb] = '{11}', [memo] = '{12}' , [lxdh] = '{13}', [csrq] = '{14}', [GZSJ] = '{15}', [DDYY1] = '{16}', [DDYY2] = '{17}', [DDYY3] = '{18}', [bzsj] = '{19}', [xzsj] = '{20}', [ydsj] = '{21}', [ydlb] = '{22}', [memo_1] = '{23}', [memo_2] = '{24}', [memo_3] = '{25}', [gflx] = '{26}' where ylzh= '{27}' and [qy] = '{28}'", RGRXM.Replace("'", ""), PubStaticFun.GetPYWBM(RGRXM.Replace("'", ""), 0), PubStaticFun.GetPYWBM(RGRXM.Replace("'", ""), 1), RGRJB, RRZQK, RZFBL, RDWBH, DWBH, RRYLB, RGRBH, SFZH, RGRXB, BZ, NXDH.Replace("'", ""), string.IsNullOrEmpty(RZSSJ.Trim()) ? "" : RZSSJ.Trim(), string.IsNullOrEmpty(RGZSJ.Trim()) ? "" : RGZSJ.Trim(), RDDY1, RDDY2, RDDY3, string.IsNullOrEmpty(RBZSJ.Trim()) ? "" : RBZSJ.Trim(), string.IsNullOrEmpty(RSZSJ.Trim()) ? "" : RSZSJ.Trim(), string.IsNullOrEmpty(BDSJ.Trim()) ? "" : BDSJ.Trim(), BDLB, "", RGRJB, RRZQK, strWhsGf, DDLH, strZone); InstanceForm._database.DoCommand(strSql); } else { strErr += dr["ylzh"].ToString().Trim() + "相同的医疗证号,不同姓名 \r"; continue; } } else if (iRet == 0) { strSql = string.Format(@"insert into jc_gf_patrec( id, ylzh,ylzh1,ylzh2, name, pym, wbm, gflx, qy, brlx, del_bit, cfsl_xz, cfslM_xz, je_xz, jcje_xz, zlje_xz,yje_xz, GRJB, RZQK, ZFBL, RDWBH, DWBH, RRYLB, RGRBH, SFZH, xb ,memo, DM,lxdh, csrq,GZSJ,DDYY1,DDYY2,DDYY3,bzsj,xzsj,ydsj,ydlb,memo_1,memo_2,memo_3) VALUES('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}','{16}','{17}','{18}','{19}','{20}','{21}','{22}','{23}','{24}','{25}','{26}','{27}','{28}','{29}','{30}','{31}','{32}','{33}','{34}','{35}','{36}','{37}','{38}','{39}','{40}')", DDLH.Replace("'", "") + strZone, DDLH.Replace("'", ""), DDLH.Replace("'", ""), DDLH.Replace("'", ""), RGRXM.Replace("'", ""), PubStaticFun.GetPYWBM(RGRXM.Replace("'", ""), 0), PubStaticFun.GetPYWBM(RGRXM.Replace("'", ""), 1), strWhsGf, strZone, strYbjklx, "0", _cfsl, _cfslM, _jexz, _rJcje, _rZlje, _yjexz, RGRJB, RRZQK, RZFBL, RDWBH, DWBH, RRYLB, RGRBH, SFZH, RGRXB, BZ, "2", NXDH.Replace("'", ""), string.IsNullOrEmpty(RZSSJ.Trim()) ? "" : RZSSJ.Trim(), string.IsNullOrEmpty(RGZSJ.Trim()) ? "" : RGZSJ.Trim(), RDDY1, RDDY2, RDDY3, string.IsNullOrEmpty(RBZSJ.Trim()) ? "" : RBZSJ.Trim(), string.IsNullOrEmpty(RSZSJ.Trim()) ? "" : RSZSJ.Trim(), string.IsNullOrEmpty(BDSJ.Trim()) ? "" : BDSJ.Trim(), BDLB, "", RGRJB, RRZQK); InstanceForm._database.DoCommand(strSql); } } strErr += " 其余成功!! \r"; MessageBox.Show(strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show(strErr + "\r" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
/// <summary> /// 保存 /// </summary> private int proSave() { int rows = -1; txt_PATHWAY_NAME.Tag = bIsPathWay ? "2;路径名称;1;0,100;" : "2;单病种名称;1;0,100;"; txt_PATHWAY_VERSION.Tag = "2;版本号;1;0,50;"; //ce_MIN_HOSPITAL_DAYS.Tag = "1;住院天数下线;1;0,5000;0;"; //ce_MAX_HOSPITAL_DAYS.Tag = "1;住院天数上线;1;0,5000;0;"; //ce_MIN_COST.Tag = "1;路径费用下线;1;0,90000000;2;"; //ce_MAX_COST.Tag = "1;路径费用上线;1;0,90000000;2;"; if (this.BindingContext[dt].Count > 0) { string strErr = PubFun.getCheckDataStr(paneMain); if (ce_MAX_HOSPITAL_DAYS.Value < ce_MIN_HOSPITAL_DAYS.Value) { strErr += CON_CRLF + "住院天数 上线:" + ce_MAX_HOSPITAL_DAYS.Value.ToString() + " 小于下线" + ce_MIN_HOSPITAL_DAYS.Value.ToString(); } if (ce_MAX_COST.Value < ce_MIN_COST.Value) { strErr += CON_CRLF + "住院天数 上线:" + ce_MAX_COST.Value.ToString() + " 小于下线" + ce_MIN_COST.Value.ToString(); } if (strErr.Trim() != "") { MsgBox.MsgShow(strErr); return(rows); } //System.Collections.ArrayList alSql = new System.Collections.ArrayList(); if (info_DLG.dlgKind != DbOpt.OpenWindowKind.Open) { lbl_id.EditValue = Guid.NewGuid(); lbl_CREATE_DATE.DateTime = DbOpt.GetSysDate(); lbl_EMP_ID_CREATE.Text = InstanceBaseForm.BCurrentUser.EmployeeId.ToString(); // //if (dt.Rows.Count == 0) //{ // DataRow r = dt.NewRow(); // //如果是打开 // r["pym"] = PubStaticFun.GetPYWBM(txt_PATHWAY_NAME.Text.Trim(), 1); // r["wbm"] = PubStaticFun.GetPYWBM(txt_PATHWAY_NAME.Text.Trim(), 1); // r["VERSION"] = txt_PATHWAY_VERSION.Text; // r["DEPTID"] = int.Parse(lookEditCmb2.TextValue.ToString()); // r["MIN_DAYS"] = ce_MIN_HOSPITAL_DAYS.EditValue; // r["MAX_DAYS"] = ce_MAX_HOSPITAL_DAYS.EditValue; // r["MIN_AMOUNT"] = ce_MIN_COST.EditValue; // r["MAX_AMOUNT"] = ce_MAX_COST.EditValue; // r["PATHWAY_ID"] = lbl_id.EditValue; // dt.Rows.Add(r); //} } else { lbl_UPDATE_DATE.DateTime = DbOpt.GetSysDate(); lbl_EMP_ID_UPDATE.Text = InstanceBaseForm.BCurrentUser.EmployeeId.ToString(); //txt_PATHWAY_VERSION.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", dt, "VERSION", true)); //lookEditCmb2.DataBindings.Add(new System.Windows.Forms.Binding("TextValue", dt, "DEPTID", true)); //ce_MIN_HOSPITAL_DAYS.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", dt, "MIN_DAYS", true)); //ce_MAX_HOSPITAL_DAYS.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", dt, "MAX_DAYS", true)); //ce_MIN_COST.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", dt, "MIN_AMOUNT", true)); //ce_MAX_COST.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", dt, "MAX_AMOUNT", true)); } //for (int i = 0; i < gridView1.RowCount; i++) //{ // dt_sybz.Rows[i]["PATHWAY_ID"] = lbl_id.EditValue; //} // update code pengy 2015.6.5 for (int i = 0; i < dt_sybz.Rows.Count; i++) { DataRowState state = dt_sybz.Rows[i].RowState; if (state != DataRowState.Deleted) { dt_sybz.Rows[i]["PATHWAY_ID"] = lbl_id.EditValue; } } ArrayList cmdList = new ArrayList(); txt_PATHWAY_NAME.Text = txt_PATHWAY_NAME.Text.Trim(); this.lbl_WBM.Text = PubStaticFun.GetPYWBM(txt_PATHWAY_NAME.Text.Trim(), 1); this.lbl_PYM.Text = PubStaticFun.GetPYWBM(txt_PATHWAY_NAME.Text.Trim(), 0); this.BindingContext[dt].EndCurrentEdit(); dt.Rows[0]["MONOCONDITION"] = bIsPathWay ? "0" : "1";//单病种 为 1 ,默认 为0 dt.Rows[0]["PATHWAY_ID"] = lbl_id.EditValue; //dt.Rows[0]["DEPTID"] = lookEditCmb2.TextValue; this.BindingContext[dt_sybz].EndCurrentEdit(); if (cmdList != null && cmdList.Count > 0) { rows = DbOpt.Update(new DataTable[] { dt, dt_sybz }, new string[] { sSql, sSql_sybz }, null, cmdList); } else { rows = DbOpt.Update(new DataTable[] { dt, dt_sybz }, new string[] { sSql, sSql_sybz }, null, null); } if (rows > -1) { dt.AcceptChanges(); info_DLG.pKey1 = lbl_id.Text; info_DLG.name = txt_PATHWAY_NAME.Text + "_" + txt_PATHWAY_VERSION.Text; info_DLG.dlgCs10 = "";//复制失效 //this.Text = "路径-" + info_DLG.name + " 信息"; dt_sybz.AcceptChanges(); gridControl1.Tag = dt_sybz.Copy(); this.setEnabledInAddOrOther(EventKind.barSave); this.setParentFormtxx(info_DLG); this.setEnable(EventKind.barSave); } } return(rows); }