private void ManualModification(RadGridView dgv_02, RadGridView dgv_01) { if (dgv_02.CurrentRow.Cells["number"].Value != null && !CnasUtilityTools.IsNumeric(dgv_02.CurrentRow.Cells["number"].Value.ToString())) { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("InputNum", EnumPromptMessage.warning, new string[] { dgv_02.CurrentRow.Cells["ca_name"].Value.ToString() }), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); dgv_02.CurrentRow.Cells["number"].Value = _itemNum; return; } if (dgv_02.CurrentRow != null && dgv_02.CurrentCell != null) { string value = Convert.ToString(dgv_02.CurrentCell.Value); if (value == "0" || string.IsNullOrEmpty(value)) { //输入为空或者0时 dgv_02.Rows.Remove(dgv_02.CurrentRow); } } }
/// <summary> /// 验证数据是否完整 /// </summary> /// <returns></returns> public string ValidateData() { string result = string.Empty; if (string.IsNullOrEmpty(packUserTxt.Text) || packUserTxt.Tag == null) { result = PromptMessageXmlHelper.Instance.GetPromptMessage("fillpackUser", EnumPromptMessage.warning); MessageBox.Show(result, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return(result); } if (string.IsNullOrEmpty(cfmUserTxt.Text) || cfmUserTxt.Tag == null) { result = PromptMessageXmlHelper.Instance.GetPromptMessage("fillcfmUser", EnumPromptMessage.warning); MessageBox.Show(result, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return(result); } if (string.IsNullOrEmpty(genNumTxt.Text) || !CnasUtilityTools.IsNumeric(genNumTxt.Text)) { result = PromptMessageXmlHelper.Instance.GetPromptMessage("genNumvalid", EnumPromptMessage.warning); MessageBox.Show(result, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return(result); } return(result); }
private void but_ok_Click(object sender, EventArgs e) { if (tb_name.Text.Trim() == "") { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("fillname", EnumPromptMessage.warning, new string[] { "供应商" }), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (this.cb_type.Text == "") { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("filltype", EnumPromptMessage.warning, new string[] { "供应商" }), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } //如果价格不为null,则表示需要验证输入的值是否正确 if (!string.IsNullOrEmpty(tb_tele.Text)) { //如果用户输入的值不为正整数,则提示用户 if (!CnasUtilityTools.IsNumeric(tb_tele.Text)) { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("inputformat", EnumPromptMessage.warning, new string[] { "电话", "130****1234" }), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } if (!string.IsNullOrEmpty(tb_postcode.Text)) { //如果用户输入的值不为正整数,则提示用户 if (!CnasUtilityTools.IsNumeric(tb_postcode.Text)) { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("inputformat", EnumPromptMessage.warning, new string[] { "邮政编号", "520000" }), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } if (!string.IsNullOrEmpty(tb_email.Text)) { //如果用户输入的值不为邮箱,则提示用户 if (!CnasUtilityTools.IsEmail(tb_email.Text)) { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("inputformat", EnumPromptMessage.warning, new string[] { "邮箱", "*****@*****.**" }), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } if (!string.IsNullOrEmpty(tb_website.Text)) { //如果用户输入的值不为网址,则提示用户 if (!CnasUtilityTools.IsWeb(tb_website.Text)) { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("inputformat", EnumPromptMessage.warning, new string[] { "网址", "http://www.baidu.com" }), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } try { CnasRemotCall reCnasRemotCall = new CnasRemotCall(); DataTable getdt = reCnasRemotCall.RemotInterface.SelectData("HCS-vender-sec002", null); //31 if (Strselectid == "") //增加 { #region 判断名字是否存在 if (getdt != null) { int ii = getdt.Rows.Count; if (ii <= 0) { return; } for (int i = 0; i < ii; i++) { if (getdt.Rows[i]["v_name"].ToString().Trim() != null) { if (tb_name.Text.Trim().ToString() == getdt.Rows[i]["v_name"].ToString().Trim()) { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("namerepetition", EnumPromptMessage.warning, new string[] { "供应商" }), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } } } #endregion SortedList sltmp = new SortedList(); SortedList sltmp01 = new SortedList(); sltmp.Add(1, tb_name.Text.Trim()); sltmp.Add(2, tb_contact.Text.Trim()); sltmp.Add(3, tb_address.Text.Trim()); sltmp.Add(4, sl_type[cb_type.Text.Trim()].ToString()); sltmp.Add(5, tb_tele.Text.Trim()); sltmp.Add(6, tb_postcode.Text.Trim()); sltmp.Add(7, tb_email.Text.Trim()); sltmp.Add(8, tb_website.Text.Trim()); sltmp.Add(9, ""); if (chb_insvender.Checked == true) { sltmp.Add(10, "1"); } else { sltmp.Add(10, "0"); } sltmp01.Add(1, sltmp); type02 = sl_type[cb_type.Text.Trim()].ToString(); //CnasRemotCall reCnasRemotCall = new CnasRemotCall(); string strtmp = reCnasRemotCall.RemotInterface.CheckUPData(1, "HCS-vender-add001", sltmp01, null); int recint = reCnasRemotCall.RemotInterface.UPData(1, "HCS-vender-add001", sltmp01, null); if (recint > -1) { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("addsuccessful", EnumPromptMessage.warning, new string[] { "供应商" }), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } } else//修改 { #region 判断名字是否存在 if (this.tb_name.Text.Trim() != Strselectname) { if (getdt != null) { int ii = getdt.Rows.Count; if (ii <= 0) { return; } for (int i = 0; i < ii; i++) { if (getdt.Rows[i]["v_name"].ToString().Trim() != null) { if (tb_name.Text.Trim().ToString() == getdt.Rows[i]["v_name"].ToString().Trim()) { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("namerepetition", EnumPromptMessage.warning, new string[] { "供应商" }), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } } } } #endregion SortedList sltmp = new SortedList(); SortedList sltmp01 = new SortedList(); sltmp01.Add(1, tb_name.Text.Trim()); sltmp01.Add(2, tb_contact.Text.Trim()); sltmp01.Add(3, tb_address.Text.Trim()); sltmp01.Add(4, cb_type.Text.Substring(0, 1)); sltmp01.Add(5, tb_tele.Text.Trim()); sltmp01.Add(6, tb_postcode.Text.Trim()); sltmp01.Add(7, tb_email.Text.Trim()); sltmp01.Add(8, tb_website.Text.Trim()); if (chb_insvender.Checked == true) { sltmp01.Add(9, "1"); } else { sltmp01.Add(9, "0"); } sltmp01.Add(10, Strselectid); sltmp.Add(1, sltmp01); type02 = sl_type[cb_type.Text.Trim()].ToString(); CnasRemotCall reCnasRemotCall_01 = new CnasRemotCall(); //string sql = reCnasRemotCall.RemotInterface.CheckUPData(1, "HCS-vender-up001", sltmp, null); int recint = reCnasRemotCall_01.RemotInterface.UPData(1, "HCS-vender-up001", sltmp, null); if (recint > -1) { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("updatesuccessful", EnumPromptMessage.warning, new string[] { "供应商" }), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } } } catch (Exception ex) { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("unknowerror", EnumPromptMessage.error, new string[] { ex.Message }), "错误信息", MessageBoxButtons.OK, MessageBoxIcon.Error); this.Close(); } }
/// <summary> /// 保存数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void but_ok_Click(object sender, EventArgs e) { if (this.tb_name.Text.Trim() == "") { MessageBox.Show("请填写塑封机流程名称。", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (this.cb_program.SelectedItem == null) { MessageBox.Show("请选择塑封程序。", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (this.cb_type.SelectedItem == null) { MessageBox.Show("请选择塑封类型。", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (this.tb_run_temp.Text.Trim() != "") { //如果用户输入的值不为正整数,则提示用户 if (!CnasUtilityTools.IsNumeric(tb_run_temp.Text)) { MessageBox.Show("温度输入的格式不正确,请输入正整数。", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } try { CnasRemotCall reCnasRemotCall = new CnasRemotCall(); SortedList sttemp01 = new SortedList(); sttemp01.Add(1, Washer_id); DataTable getdt = reCnasRemotCall.RemotInterface.SelectData("HCS-plasticenvelop-deviceprogram-sec001", sttemp01); //91 if (Strselectid == "") //增加 { #region 判断这台塑封机的塑封程序是否重复 if (getdt != null) { int ii = getdt.Rows.Count; if (ii <= 0) { return; } for (int i = 0; i < ii; i++) { if (getdt.Rows[i]["p_id"].ToString() != null) { if (sl_type_01.GetKey(sl_type_01.IndexOfValue(cb_program.Text.Trim())).ToString() == getdt.Rows[i]["p_id"].ToString().Trim()) { MessageBox.Show("塑封程序已存在。", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } } } #endregion #region 判断名字是否重复 if (getdt != null) { int ii = getdt.Rows.Count; if (ii <= 0) { return; } for (int i = 0; i < ii; i++) { if (getdt.Rows[i]["dp_name"].ToString() != null) { if (sl_type_01.GetKey(sl_type_01.IndexOfValue(cb_program.Text.Trim())).ToString() == getdt.Rows[i]["dp_name"].ToString().Trim()) { MessageBox.Show("流程名称已存在。", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } } } #endregion SortedList sltmp = new SortedList(); SortedList sltmp01 = new SortedList(); sltmp.Add(1, tb_name.Text.Trim()); sltmp.Add(2, tb_barcode.Text.Trim()); sltmp.Add(3, sl_type_01.GetKey(sl_type_01.IndexOfValue(cb_program.Text.Trim())).ToString()); sltmp.Add(4, cb_type.Text.Trim().Substring(0, 1)); sltmp.Add(5, tb_run_temp.Text.Trim()); sltmp.Add(6, tb_run_speed.Text.Trim()); sltmp.Add(7, tb_run_stress.Text.Trim()); sltmp.Add(8, tb_remarks.Text.Trim()); sltmp.Add(9, Washer_id); sltmp01.Add(1, sltmp); string strtmp = reCnasRemotCall.RemotInterface.CheckUPData(1, "HCS-plasticenvelop-deviceprogram-add001", sltmp01, null); int recint = reCnasRemotCall.RemotInterface.UPData(1, "HCS-plasticenvelop-deviceprogram-add001", sltmp01, null); if (recint > -1) { MessageBox.Show("恭喜你,增加成功。", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } } else { if (cb_program.Text.Trim() != Program_name)//如果清洗程序被改变执行 { #region 判断这台塑封机的塑封程序是否重复 if (getdt != null) { int ii = getdt.Rows.Count; if (ii <= 0) { return; } for (int i = 0; i < ii; i++) { if (getdt.Rows[i]["p_id"].ToString() != null) { if (sl_type_01.GetKey(sl_type_01.IndexOfValue(cb_program.Text.Trim())).ToString() == getdt.Rows[i]["p_id"].ToString().Trim()) { MessageBox.Show("塑封程序已存在。", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } } } #endregion } #region 判断名字是否存在 if (getdt != null) { int ii = getdt.Rows.Count; if (ii <= 0) { return; } for (int i = 0; i < ii; i++) { if (getdt.Rows[i]["dp_name"].ToString() != null) { if (sl_type_01.GetKey(sl_type_01.IndexOfValue(cb_program.Text.Trim())).ToString() == getdt.Rows[i]["dp_name"].ToString().Trim()) { MessageBox.Show("流程名称已存在。", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } } } #endregion SortedList sltmp = new SortedList(); SortedList sltmp01 = new SortedList(); sltmp01.Add(1, tb_name.Text.Trim()); sltmp01.Add(2, sl_type_01.GetKey(sl_type_01.IndexOfValue(cb_program.Text.Trim()))); sltmp01.Add(3, cb_type.Text.Trim().Substring(0, 1)); sltmp01.Add(4, tb_run_temp.Text.Trim()); sltmp01.Add(5, tb_run_speed.Text.Trim()); sltmp01.Add(6, tb_run_stress.Text.Trim()); sltmp01.Add(7, tb_remarks.Text.Trim()); sltmp01.Add(8, Strselectid); sltmp.Add(1, sltmp01); // string sql = reCnasRemotCall.RemotInterface.CheckUPData(1, "HCS-plasticenvelop-deviceprogram-up001", sltmp, null); int recint = reCnasRemotCall.RemotInterface.UPData(1, "HCS-plasticenvelop-deviceprogram-up001", sltmp, null); if (recint > -1) { MessageBox.Show("恭喜你,修改成功。", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } } } catch (Exception ex) { MessageBox.Show("出现未知错误:" + ex.Message + ",请联系管理员。", "错误信息", MessageBoxButtons.OK, MessageBoxIcon.Error); this.Close(); } }
/// <summary> /// 用于点击修改时对dgv_01与dgv_02的修改 /// </summary> /// <param name="dgv_02"></param> /// <param name="dgv_01"></param> private void ManualModification(RadGridView dgv_02, RadGridView dgv_01) { if (dgv_02.CurrentRow.Cells["current_count"].Value != null && !CnasUtilityTools.IsNumeric(dgv_02.CurrentRow.Cells["current_count"].Value.ToString())) { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("InputNum", EnumPromptMessage.warning, new string[] { dgv_02.CurrentRow.Cells["ca_name"].Value.ToString() }), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); dgv_02.CurrentRow.Cells["current_count"].Value = _itemNum; return; } if (dgv_02.CurrentRow != null && dgv_02.CurrentCell != null) { string value = Convert.ToString(dgv_02.CurrentCell.Value); if (value == "0" || string.IsNullOrEmpty(value)) { //输入为空或者0时 //移出表2数据,并把表二原本数据搬到表1上 if (dgv_01.RowCount == 0) { addRows(dgv_02, dgv_01); } else { int a = 0;//用于验证是否给表1添加新一行数据 int CurrentNum = 0; for (int k = 0; k < dgv_01.RowCount; k++) { try { CurrentNum = int.Parse(dgv_02.CurrentRow.Cells["current_count"].Value.ToString()); } catch { CurrentNum = 0; //MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("InputNum", EnumPromptMessage.warning, new string[] { dgv_02.CurrentRow.Cells["ca_name"].Value.ToString() }), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); //return; } if (dgv_02.CurrentRow.Cells["id"].Value.ToString() == dgv_01.Rows[k].Cells["id"].Value.ToString()) { dgv_01.Rows[k].Cells["current_count"].Value = _itemNum - CurrentNum + int.Parse(dgv_01.Rows[k].Cells["current_count"].Value.ToString()); dgv_02.Rows.Remove(dgv_02.CurrentRow); } else { a++; } } if (a == dgv_01.RowCount)//相等则说明没有相同的 { addRows(dgv_02, dgv_01); } } } else { if (int.Parse(dgv_02.CurrentRow.Cells["current_count"].Value.ToString()) < 0 || int.Parse(dgv_02.CurrentRow.Cells["current_count"].Value.ToString()) > _itemNum) { dgv_02.CurrentRow.Cells["current_count"].Value = _itemNum; return; } int CurrentNum = 0; try { CurrentNum = int.Parse(dgv_02.CurrentRow.Cells["current_count"].Value.ToString()); } catch { CurrentNum = 0; } //输入的不是0或空值时 bool ifNewRows = true; for (int k = 0; k < dgv_01.RowCount; k++) { if (dgv_02.CurrentRow.Cells["id"].Value.ToString() == dgv_01.Rows[k].Cells["id"].Value.ToString()) { dgv_01.Rows[k].Cells["current_count"].Value = _itemNum - CurrentNum + int.Parse(dgv_01.Rows[k].Cells["current_count"].Value.ToString()); ifNewRows = false; } } if (ifNewRows)//判断是否需要新填一行数据 { if (_itemNum - CurrentNum != 0) { GridViewRowInfo newRow = dgv_01.Rows.AddNew(); newRow.Cells[0].Value = dgv_02.CurrentRow.Cells[0].Value; newRow.Cells[1].Value = dgv_02.CurrentRow.Cells[1].Value; newRow.Cells[2].Value = dgv_02.CurrentRow.Cells[2].Value; newRow.Cells[3].Value = dgv_02.CurrentRow.Cells[3].Value; newRow.Cells[5].Value = dgv_02.CurrentRow.Cells[5].Value; newRow.Cells[4].Value = _itemNum - CurrentNum; newRow.Tag = dgv_02.CurrentRow.Tag; } } // dgv_02.Rows.Remove(dgv_02.CurrentRow); } } }
private void but_ok_Click_1(object sender, EventArgs e) { #region 验证 if (this.tb_name.Text.Trim() == "") { MessageBox.Show("请填写灭菌流程名称。", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (this.cb_program.Text.Trim() == "") { MessageBox.Show("请选择灭菌程序。", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (tb_run_time.Text.Trim() == "") { MessageBox.Show("请填写运行时间。", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (this.cb_type.SelectedItem == null) { MessageBox.Show("请选择灭菌类型。", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } //如果运行时间不为null,则表示需要验证输入的值是否正确 if (!string.IsNullOrEmpty(tb_run_time.Text)) { //如果用户输入的值不为正整数,则提示用户 if (!CnasUtilityTools.IsNumeric(tb_run_time.Text)) { MessageBox.Show("运行时间输入的格式不正确,请输入正整数。", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } #endregion CnasRemotCall reCnasRemotCall = new CnasRemotCall(); SortedList sttemp01 = new SortedList(); sttemp01.Add(1, Sterilizer_id); //string ggg = reCnasRemotCall.RemotInterface.CheckSelectData("HCS-sterilizer-deviceprogram-sec001", sttemp01); getdt = reCnasRemotCall.RemotInterface.SelectData("HCS-sterilizer-deviceprogram-sec001", sttemp01); try { if (Strselectid == "")//增加 { #region 判断这台灭菌器的灭菌程序是否重复 if (getdt != null) { int ii = getdt.Rows.Count; if (ii <= 0) { return; } for (int i = 0; i < ii; i++) { if (getdt.Rows[i]["p_id"].ToString() != null) { if (sl_ProgramType.GetKey(sl_ProgramType.IndexOfValue(cb_program.Text.Trim())).ToString() == getdt.Rows[i]["p_id"].ToString().Trim()) { MessageBox.Show("灭菌程序已存在。", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } } } #endregion #region 判断流程名字是否重复 if (getdt != null) { int ii = getdt.Rows.Count; if (ii < 0) { return; } for (int i = 0; i < ii; i++) { if (getdt.Rows[i]["dp_name"].ToString() != null) { if (tb_name.Text.Trim().ToString() == getdt.Rows[i]["dp_name"].ToString().Trim()) { MessageBox.Show("流程名称已存在。", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } } } #endregion SortedList sltmp = new SortedList(); SortedList sltmp01 = new SortedList(); sltmp.Add(1, sl_ProgramType.GetKey(sl_ProgramType.IndexOfValue(cb_program.Text.Trim())).ToString()); sltmp.Add(2, tb_barcode.Text.Trim()); sltmp.Add(3, tb_name.Text.Trim()); sltmp.Add(4, cb_type.Text.Trim().Substring(0, 1)); sltmp.Add(5, tb_run_time.Text.Trim()); sltmp.Add(6, tb_remarks.Text.Trim()); sltmp.Add(7, Sterilizer_id); sltmp01.Add(1, sltmp); int recint = reCnasRemotCall.RemotInterface.UPData(1, "HCS-sterilizer-deviceprogram-add001", sltmp01, null); if (recint > -1) { MessageBox.Show("恭喜你,增加成功。", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } } else { if (cb_program.Text.Trim() != program_name)//如果灭菌程序被改变执行 { #region 判断这台灭菌器的灭菌程序是否重复 if (getdt != null) { int ii = getdt.Rows.Count; if (ii <= 0) { return; } for (int i = 0; i < ii; i++) { if (getdt.Rows[i]["p_id"].ToString() != null) { if (sl_ProgramType.GetKey(sl_ProgramType.IndexOfValue(cb_program.Text.Trim())).ToString() == getdt.Rows[i]["p_id"].ToString().Trim()) { MessageBox.Show("灭菌程序已存在。", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } } } } #endregion #region 判断流程名字是否存在 if (this.tb_name.Text.Trim() != Strselectname) { if (getdt != null) { int ii = getdt.Rows.Count; if (ii <= 0) { return; } for (int i = 0; i < ii; i++) { if (getdt.Rows[i]["dp_name"].ToString() != null) { if (tb_name.Text.Trim().ToString() == getdt.Rows[i]["dp_name"].ToString().Trim()) { MessageBox.Show("流程名称已存在。", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } } } } #endregion SortedList sltmp = new SortedList(); SortedList sltmp01 = new SortedList(); sltmp01.Add(1, tb_name.Text.Trim()); sltmp01.Add(2, sl_ProgramType.GetKey(sl_ProgramType.IndexOfValue(cb_program.Text.Trim()))); sltmp01.Add(3, cb_type.Text.Trim().Substring(0, 1)); sltmp01.Add(4, tb_run_time.Text.Trim()); sltmp01.Add(5, tb_remarks.Text.Trim()); sltmp01.Add(6, Strselectid); sltmp.Add(1, sltmp01); int recint = reCnasRemotCall.RemotInterface.UPData(1, "HCS-sterilizer-deviceprogram-up001", sltmp, null); if (recint > -1) { MessageBox.Show("恭喜你,修改成功。", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } } } catch (Exception ex) { MessageBox.Show("出现未知错误:" + ex.Message + ",请联系管理员。", "错误信息", MessageBoxButtons.OK, MessageBoxIcon.Error); this.Close(); } }
private void but_OK_Click_1(object sender, EventArgs e) { if (this.tb_program.Text.Trim() == "") { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("fillname", EnumPromptMessage.warning, new string[] { "灭菌程序" }), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (this.cb_type.Text == "") { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("filltype", EnumPromptMessage.warning, new string[] { "灭菌" }), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (tb_run_time.Text.Trim() == "") { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("fillruntime", EnumPromptMessage.warning), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (this.tb_upper_level.Text.Trim() == "") { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("fillhightemperature", EnumPromptMessage.warning), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (!string.IsNullOrEmpty(tb_upper_level.Text)) { //如果用户输入的值不为正整数,则提示用户 if (!CnasUtilityTools.IsNumeric(tb_upper_level.Text)) { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("inputformat", EnumPromptMessage.warning, new string[] { "温度上限", "123整数" }), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } if (this.tb_lower_level.Text.Trim() == "") { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("filllowtemperature", EnumPromptMessage.warning), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (!string.IsNullOrEmpty(tb_lower_level.Text)) { //如果用户输入的值不为正整数,则提示用户 if (!CnasUtilityTools.IsNumeric(tb_lower_level.Text)) { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("inputformat", EnumPromptMessage.warning, new string[] { "温度下限", "123整数" }), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } if (int.Parse(tb_lower_level.Text) > int.Parse(tb_upper_level.Text)) { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("tempestimation", EnumPromptMessage.warning), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } try { if (Strselectid == "")//增加 { SortedList sltmp = new SortedList(); SortedList sltmp01 = new SortedList(); sltmp.Add(1, tb_program.Text.Trim()); sltmp.Add(2, tb_barcode.Text.Trim()); sltmp.Add(3, cb_type.Text.Substring(0, 1)); sltmp.Add(4, tb_run_time.Text.Trim()); sltmp.Add(5, tb_remarks.Text.Trim()); sltmp.Add(6, tb_upper_level.Text.Trim()); sltmp.Add(7, tb_lower_level.Text.Trim()); sltmp01.Add(1, sltmp); CnasRemotCall reCnasRemotCall = new CnasRemotCall(); #region 判断名字是否存在 DataTable getdt = reCnasRemotCall.RemotInterface.SelectData("HCS-sterilizer-program-sec002", null);//49 if (getdt != null) { DataRow[] getdt_01 = getdt.Select(); foreach (DataRow dr in getdt_01) { if (tb_program.Text.Trim().ToString() == dr["pr_name"].ToString().Trim()) { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("namerepetition", EnumPromptMessage.warning, new string[] { "灭菌程序" }), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } } #endregion int recint = reCnasRemotCall.RemotInterface.UPData(1, "HCS-sterilizer-program-add001", sltmp01, null); if (recint > -1) { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("addsuccessful", EnumPromptMessage.warning, new string[] { "灭菌程序" }), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } } else { #region 判断程序名字是否重复 CnasRemotCall reCnasRemotCall = new CnasRemotCall(); if (tb_program.Text.Trim() != Strselectname) { DataTable getdt = reCnasRemotCall.RemotInterface.SelectData("HCS-sterilizer-program-sec001", null); if (getdt != null) { DataRow[] getdt_01 = getdt.Select(); foreach (DataRow dr in getdt_01) { if (tb_program.Text.Trim().ToString() == dr["pr_name"].ToString().Trim()) { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("namerepetition", EnumPromptMessage.warning, new string[] { "灭菌程序" }), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } } } #endregion SortedList sltmp = new SortedList(); SortedList sltmp01 = new SortedList(); sltmp01.Add(1, tb_program.Text.Trim()); sltmp01.Add(2, tb_upper_level.Text.Trim()); sltmp01.Add(3, tb_lower_level.Text.Trim()); sltmp01.Add(4, cb_type.Text.Substring(0, 1)); sltmp01.Add(5, tb_run_time.Text.Trim()); sltmp01.Add(6, tb_remarks.Text.Trim()); sltmp01.Add(7, Strselectid); sltmp.Add(1, sltmp01); string sql = reCnasRemotCall.RemotInterface.CheckUPData(1, "HCS-sterilizer-program-up001", sltmp, null); int recint = reCnasRemotCall.RemotInterface.UPData(1, "HCS-sterilizer-program-up001", sltmp, null); if (recint > -1) { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("updatesuccessful", EnumPromptMessage.warning, new string[] { "灭菌程序" }), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } } } catch (Exception ex) { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("unknowerror", EnumPromptMessage.error, new string[] { ex.Message }), "错误信息", MessageBoxButtons.OK, MessageBoxIcon.Error); this.Close(); } }
private void but_ok_Click(object sender, EventArgs e) { if (this.tb_name.Text.Trim() == "") { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("fillname", EnumPromptMessage.warning, new string[] { "客户" }), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (this.cb_type.Text == null) { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("filltype", EnumPromptMessage.warning, new string[] { "医院" }), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (!string.IsNullOrEmpty(tb_telephone.Text)) { //如果用户输入的值不为正整数,则提示用户 if (!CnasUtilityTools.IsNumeric(tb_telephone.Text)) { MessageBox.Show("联系电话输入的格式不正确,请输入正整数。", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } if (!string.IsNullOrEmpty(tb_mail.Text)) { //如果用户输入的值不为邮箱,则提示用户 if (!CnasUtilityTools.IsEmail(tb_mail.Text)) { MessageBox.Show("电子邮箱输入的格式不正确,请输入正确格式,如:[email protected]。", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } if (tb_mail.Text.Trim() == null) { tb_mail.Text = ""; } if (tb_telephone.Text.Trim() == null) { tb_mail.Text = ""; } if (tb_contacts.Text.Trim() == null) { tb_mail.Text = ""; } CnasRemotCall reCnasRemotCall = new CnasRemotCall(); SortedList sttemp01 = new SortedList(); sttemp01.Add(1, CnasBaseData.SystemID); DataTable getdt = reCnasRemotCall.RemotInterface.SelectData("HCS-customer-sec001", sttemp01); try { if (Strselectid == "")//insert data { #region 判断名字是否存在 //39 if (getdt != null) { int ii = getdt.Rows.Count; if (ii <= 0) { return; } for (int i = 0; i < ii; i++) { if (getdt.Rows[i]["cu_name"].ToString().Trim() != null) { if (tb_name.Text.Trim().ToString() == getdt.Rows[i]["cu_name"].ToString().Trim()) { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("namerepetition", EnumPromptMessage.warning, new string[] { "医院" }), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } } } #endregion SortedList sltmp = new SortedList(); SortedList sltmp01 = new SortedList(); sltmp01.Add(1, tb_name.Text.Trim()); sltmp01.Add(2, tb_barcode.Text.Trim()); sltmp01.Add(3, tb_address.Text.Trim()); sltmp01.Add(4, cb_type.Text.Trim().Substring(0, 1)); sltmp01.Add(5, tb_contacts.Text.Trim()); sltmp01.Add(6, tb_telephone.Text.Trim()); sltmp01.Add(7, tb_mail.Text.Trim()); sltmp01.Add(8, CnasBaseData.SystemID); sltmp.Add(1, sltmp01); //string str = reCnasRemotCall.RemotInterface.CheckUPData(1, "HCS-customer-add001", sltmp, null); int recint = reCnasRemotCall.RemotInterface.UPData(1, "HCS-customer-add001", sltmp, null); if (recint > -1) { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("addsuccessful", EnumPromptMessage.warning, new string[] { "客户" }), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } } else//update date { #region 判断名字是否存在 if (this.tb_name.Text.Trim() != Strselectname) { if (getdt != null) { int ii = getdt.Rows.Count; if (ii <= 0) { return; } for (int i = 0; i < ii; i++) { if (getdt.Rows[i]["cu_name"].ToString().Trim() != null) { if (tb_name.Text.Trim().ToString() == getdt.Rows[i]["cu_name"].ToString().Trim()) { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("namerepetition", EnumPromptMessage.warning, new string[] { "医院" }), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } } } } #endregion SortedList sltmp = new SortedList(); SortedList sltmp01 = new SortedList(); sltmp01.Add(1, tb_name.Text.Trim()); sltmp01.Add(2, tb_address.Text.Trim()); sltmp01.Add(3, cb_type.Text.Trim().Substring(0, 1)); sltmp01.Add(4, tb_contacts.Text.Trim()); sltmp01.Add(5, tb_telephone.Text.Trim()); sltmp01.Add(6, tb_mail.Text.Trim()); sltmp01.Add(7, Strselectid); sltmp.Add(1, sltmp01); //CnasRemotCall reCnasRemotCall = new CnasRemotCall(); string str = reCnasRemotCall.RemotInterface.CheckUPData(1, "HCS-customer-up001", sltmp, null); int recint = reCnasRemotCall.RemotInterface.UPData(1, "HCS-customer-up001", sltmp, null); if (recint > -1) { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("updatesuccessful", EnumPromptMessage.warning, new string[] { "客户" }), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } } } catch (Exception ex) { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("unknowerror", EnumPromptMessage.warning, new string[] { ex.Message }), "错误信息", MessageBoxButtons.OK, MessageBoxIcon.Error); this.Close(); } }
/// <summary> /// "确定"按钮触发事件 /// </summary> private void but_ok_Click_1(object sender, EventArgs e) { #region 验证 if (tb_name.Text.Trim() == "") { MessageBox.Show("请输入敷料包名称。", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (cb_material.Text.Trim() == "") { MessageBox.Show("请选择包装材料。", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (cb_customer.Text.Trim() == "") { MessageBox.Show("请选择客户。", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (tb_size.Text.Trim() == "") { tb_size.Text = ""; } if (cb_cost_center.Text.Trim() == "") { MessageBox.Show("请选择成本中心。", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (cb_str.Text.Trim() == "") { MessageBox.Show("请选择灭菌程序。", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (!string.IsNullOrEmpty(tb_weight.Text)) { //如果用户输入的值不为正整数,则提示用户 if (!CnasUtilityTools.IsNumeric(tb_weight.Text)) { MessageBox.Show("重量输入的格式不正确,请输入正整数。", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } if (!string.IsNullOrEmpty(tb_price.Text)) { //如果用户输入的值不为正整数,则提示用户 if (!CnasUtilityTools.IsNumeric(tb_price.Text)) { MessageBox.Show("衣物数量输入的格式不正确,请输入正整数。", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } if (tb_stu.Text.Trim() == "") { tb_stu.Text = "0"; } if (tb_price.Text.Trim() == "") { tb_price.Text = "NULL"; } if (tb_weight.Text.Trim() == "") { tb_weight.Text = "NULL"; } #endregion CnasRemotCall reCnasRemotCall = new CnasRemotCall(); SortedList sttmp02 = new SortedList(); sttmp02.Add(1, CnasBaseData.SystemID); DataTable getdt = reCnasRemotCall.RemotInterface.SelectData("HCS-dressing-set-sec001", sttmp02); try { if (Selectid == "") { #region 判断名字是否重复 if (getdt != null) { int ii = getdt.Rows.Count; if (ii <= 0) { return; } for (int i = 0; i < ii; i++) { if (getdt.Rows[i]["ca_name"].ToString().Trim() != null) { if (tb_name.Text.Trim().ToString() == getdt.Rows[i]["ca_name"].ToString().Trim()) { MessageBox.Show("敷料包名称已存在。", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } } } #endregion SortedList sltmp = new SortedList(); SortedList sltmp01 = new SortedList(); sltmp.Add(1, tb_name.Text.Trim()); //名字 sltmp.Add(2, tb_barcode.Text.Trim()); //条码 sltmp.Add(3, sl_material.GetKey(sl_material.IndexOfValue(cb_material.Text.Trim()))); //打包材料 sltmp.Add(4, tb_price.Text.Trim()); //价格 sltmp.Add(6, sl_costcenter.GetKey(sl_costcenter.IndexOfValue(cb_cost_center.Text.Trim()))); //成本中心 sltmp.Add(5, sl_customer_01.GetKey(sl_customer_01.IndexOfValue(cb_customer.Text.Trim()))); //顾客 sltmp.Add(7, tb_weight.Text.Trim()); //重量 sltmp.Add(8, sl_str.GetKey(sl_str.IndexOfValue(cb_str.Text.Trim()))); //灭菌类型 sltmp.Add(9, tb_size.Text.Trim()); //大小 sltmp.Add(10, tb_remarks.Text.Trim()); //备注 sltmp.Add(11, CnasBaseData.SystemID); sltmp01.Add(1, sltmp); string strtmp = reCnasRemotCall.RemotInterface.CheckUPData(1, "HCS-dressing-set-add001", sltmp01, null); int recint = reCnasRemotCall.RemotInterface.UPData(1, "HCS-dressing-set-add001", sltmp01, null); if (recint > -1) { MessageBox.Show("恭喜你,增加成功。", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } } else { #region 判断名字是否重复 if (tb_name.Text.Trim() != Selectname) { if (getdt != null) { int ii = getdt.Rows.Count; if (ii <= 0) { return; } for (int i = 0; i < ii; i++) { if (getdt.Rows[i]["ca_name"].ToString().Trim() != null) { if (tb_name.Text.Trim().ToString() == getdt.Rows[i]["ca_name"].ToString().Trim()) { MessageBox.Show("敷料包名称已存在。", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } } } } #endregion SortedList sltmp = new SortedList(); SortedList sltmp01 = new SortedList(); sltmp.Add(1, tb_name.Text.Trim()); //名字 sltmp.Add(2, sl_material.GetKey(sl_material.IndexOfValue(cb_material.Text.Trim()))); //打包材料 sltmp.Add(3, tb_price.Text.Trim()); //价格 sltmp.Add(5, sl_costcenter.GetKey(sl_costcenter.IndexOfValue(cb_cost_center.Text.Trim()))); //成本中心 sltmp.Add(4, sl_customer_01.GetKey(sl_customer_01.IndexOfValue(cb_customer.Text.Trim()))); //顾客 sltmp.Add(6, tb_weight.Text.Trim()); //重量 sltmp.Add(7, sl_str.GetKey(sl_str.IndexOfValue(cb_str.Text.Trim()))); //灭菌类型 sltmp.Add(8, tb_size.Text.Trim()); //大小 sltmp.Add(9, tb_remarks.Text.Trim()); //备注 sltmp.Add(10, Selectid); sltmp01.Add(1, sltmp); //string strtmp = reCnasRemotCall.RemotInterface.CheckUPData(1, "HCS-dressing-set-up001", sltmp01, null); int recint = reCnasRemotCall.RemotInterface.UPData(1, "HCS-dressing-set-up001", sltmp01, null); if (recint > -1) { MessageBox.Show("恭喜你,修改成功。", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } } } catch (Exception ex) { MessageBox.Show("出现未知错误:" + ex.Message + ",请联系管理员。", "错误信息", MessageBoxButtons.OK, MessageBoxIcon.Error); this.Close(); } }
private void but_ok_Click(object sender, EventArgs e) { #region 验证 if (tb_name.Text.Trim() == "") { MessageBox.Show("请输入衣物名称。", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (cb_type.Text.Trim() == "") { MessageBox.Show("请选择衣类型。", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } //如果数量不为null,则表示需要验证输入的值是否正确 if (!string.IsNullOrEmpty(tb_count.Text)) { //如果用户输入的值不为正整数,则提示用户 if (!CnasUtilityTools.IsNumeric(tb_count.Text)) { MessageBox.Show("衣物数量输入的格式不正确,请输入正整数。", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } if (tb_count.Text.Trim() == "") { tb_count.Text = "NULL"; } #endregion try { if (Strselectid == "")//增加 { #region 判断名字是否重复 CnasRemotCall reCnasRemotCall = new CnasRemotCall(); SortedList sltmp02 = new SortedList(); sltmp02.Add(1, Instrument_id); DataTable getdt = reCnasRemotCall.RemotInterface.SelectData("HCS-dressing-info-sec001", sltmp02);//49 if (getdt != null) { int ii = getdt.Rows.Count; if (ii <= 0) { return; } for (int i = 0; i < ii; i++) { if (getdt.Rows[i]["dre_name"].ToString().Trim() != null) { if (tb_name.Text.Trim().ToString() == getdt.Rows[i]["dre_name"].ToString().Trim()) { MessageBox.Show("敷料衣物名称已存在。", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } } } #endregion SortedList sltmp = new SortedList(); SortedList sltmp01 = new SortedList(); sltmp.Add(1, Instrument_id); sltmp.Add(2, tb_name.Text.Trim()); sltmp.Add(3, tb_count.Text.Trim()); sltmp.Add(4, cb_type.Text.Trim().Substring(0, 1)); sltmp.Add(5, tb_remarks.Text.Trim()); sltmp01.Add(1, sltmp); string ggg = reCnasRemotCall.RemotInterface.CheckUPData(1, "HCS-dressing-info-add001", sltmp01, null); int recint = reCnasRemotCall.RemotInterface.UPData(1, "HCS-dressing-info-add001", sltmp01, null); if (recint > -1) { MessageBox.Show("恭喜你,增加成功。", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } } else { #region 判断名字是否已经存在 CnasRemotCall reCnasRemotCall = new CnasRemotCall(); if (tb_name.Text.Trim() != Strselectname) { DataTable getdt01 = reCnasRemotCall.RemotInterface.SelectData("HCS-dressing-info-sec002", null); if (getdt01 != null) { int aa = getdt01.Rows.Count; if (aa <= 0) { return; } for (int i = 0; i < aa; i++) { if (getdt01.Rows[i]["dre_name"].ToString().Trim() != null) { if (tb_name.Text.Trim().ToString() == getdt01.Rows[i]["dre_name"].ToString().Trim()) { MessageBox.Show("敷料衣物名称已存在。", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } } } } #endregion SortedList sttmp01 = new SortedList(); SortedList sttmp = new SortedList(); sttmp01.Add(1, tb_name.Text.Trim()); sttmp01.Add(2, tb_count.Text.Trim()); sttmp01.Add(3, cb_type.Text.Trim().Substring(0, 1)); sttmp01.Add(4, tb_remarks.Text.Trim()); sttmp01.Add(5, Strselectid); sttmp.Add(1, sttmp01); string dg = reCnasRemotCall.RemotInterface.CheckUPData(1, "HCS-dressing-info-up001", sttmp, null); int recent = reCnasRemotCall.RemotInterface.UPData(1, "HCS-dressing-info-up001", sttmp, null); if (recent > -1) { MessageBox.Show("恭喜你,修改成功。", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } } } catch (Exception ex) { MessageBox.Show("出现未知错误:" + ex.Message + ",请联系管理员。", "错误信息", MessageBoxButtons.OK, MessageBoxIcon.Error); this.Close(); } }