/// <summary> /// 修改 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void rbtn_edit_Click(object sender, EventArgs e) { SortedList slindata = new SortedList(); try { slindata.Add("id", dgv_01.SelectedRows[0].Cells["id"].Value); slindata.Add("v_name", dgv_01.SelectedRows[0].Cells["v_name"].Value); slindata.Add("contact_name", dgv_01.SelectedRows[0].Cells["contact_name"].Value); slindata.Add("vender_type", sl_type01.GetKey(sl_type01.IndexOfValue(dgv_01.SelectedRows[0].Cells["vender_type"].Value))); slindata.Add("v_address", dgv_01.SelectedRows[0].Cells["v_address"].Value); slindata.Add("v_telephone", dgv_01.SelectedRows[0].Cells["v_telephone"].Value); slindata.Add("v_postcode", dgv_01.SelectedRows[0].Cells["v_postcode"].Value); slindata.Add("v_email", dgv_01.SelectedRows[0].Cells["v_email"].Value); slindata.Add("v_website", dgv_01.SelectedRows[0].Cells["v_website"].Value); HCSCM_vender_manage_new hcsm = new HCSCM_vender_manage_new(slindata); //获取一个值,指是否在Windows任务栏中显示窗体。 hcsm.ShowInTaskbar = false; hcsm.ShowDialog(); if (hcsm.type02 != "") { Loaddata(hcsm.type02); int inrec = sl_type01.IndexOfKey(hcsm.type02); this.cb_type.Text = sl_type01.GetKey(inrec) + ":" + sl_type01.GetByIndex(inrec); //this.cb_type.Text = sl_type01[hcsm.type02].ToString(); } } catch { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("choicechange", EnumPromptMessage.warning, new string[] { "修改", "供应商" }), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// 新建 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void rbtn_new_Click(object sender, EventArgs e) { HCSCM_vender_manage_new hcsm = new HCSCM_vender_manage_new(null); //获取一个值,指是否在Windows任务栏中显示窗体。 hcsm.ShowInTaskbar = false; hcsm.ShowDialog(); if (hcsm.type02 != "")//判断是否选择厂商类型 { Loaddata(hcsm.type02); int inrec = sl_type01.IndexOfKey(hcsm.type02);//这个key位置的索引 this.cb_type.Text = sl_type01.GetKey(inrec) + ":" + sl_type01.GetByIndex(inrec); } }
private void but_edit_Click(object sender, EventArgs e) { if (this.dgv_01.SelectedRows.Count <= 0) { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("choicechange", EnumPromptMessage.warning, new string[] { "修改", "供应商" }), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } int selectedIndex = dgv_01.Rows.IndexOf(dgv_01.SelectedRows[0]); SortedList slindata = new SortedList(); try { slindata.Add("id", dgv_01.SelectedRows[0].Cells["id"].Value == null ? string.Empty : dgv_01.SelectedRows[0].Cells["id"].Value); slindata.Add("v_name", dgv_01.SelectedRows[0].Cells["v_name"].Value == null ? string.Empty : dgv_01.SelectedRows[0].Cells["v_name"].Value); slindata.Add("contact_name", dgv_01.SelectedRows[0].Cells["contact_name"].Value == null ? string.Empty : dgv_01.SelectedRows[0].Cells["contact_name"].Value); slindata.Add("vender_type", sl_type01.GetKey(sl_type01.IndexOfValue(dgv_01.SelectedRows[0].Cells["vender_type"].Value))); slindata.Add("v_address", dgv_01.SelectedRows[0].Cells["v_address"].Value == null ? string.Empty : dgv_01.SelectedRows[0].Cells["v_address"].Value); slindata.Add("v_telephone", dgv_01.SelectedRows[0].Cells["v_telephone"].Value == null ? string.Empty : dgv_01.SelectedRows[0].Cells["v_telephone"].Value); slindata.Add("v_postcode", dgv_01.SelectedRows[0].Cells["v_postcode"].Value == null ? string.Empty : dgv_01.SelectedRows[0].Cells["v_postcode"].Value); slindata.Add("v_email", dgv_01.SelectedRows[0].Cells["v_email"].Value == null ? string.Empty : dgv_01.SelectedRows[0].Cells["v_email"].Value); slindata.Add("v_website", dgv_01.SelectedRows[0].Cells["v_website"].Value == null ? string.Empty : dgv_01.SelectedRows[0].Cells["v_website"].Value); slindata.Add("insvender", dgv_01.SelectedRows[0].Cells["insVender"].Value.ToString() == "否" ? 0 : 1); HCSCM_vender_manage_new hcsm = new HCSCM_vender_manage_new(slindata); //获取一个值,指是否在Windows任务栏中显示窗体。 hcsm.ShowInTaskbar = false; hcsm.ShowDialog(); if (tb_suchen.Text == string.Empty) { if (hcsm.type02 != "") { int inrec = sl_type01.IndexOfKey(hcsm.type02); this.cb_type.Text = sl_type01.GetKey(inrec) + ":" + sl_type01.GetByIndex(inrec); Loaddata(hcsm.type02); } } else { GetData(); } if (dgv_01.Rows.Count > selectedIndex) { dgv_01.CurrentRow = dgv_01.Rows[selectedIndex]; } } catch (Exception ex) { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("unknowerror", EnumPromptMessage.warning, new string[] { ex.Message }), "错误信息", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } }