コード例 #1
0
        private void but_new_Click(object sender, EventArgs e)
        {
            HCSCM_sterilizer_device_new hcsm = new HCSCM_sterilizer_device_new(null, getdt);

            //获取一个值,指是否在Windows任务栏中显示窗体。
            hcsm.ShowInTaskbar = false;
            hcsm.ShowDialog();
            Loaddata();
            if (dgv_01.Rows.Count > 0)
            {
                dgv_01.CurrentRow = dgv_01.Rows[dgv_01.RowCount - 1];
            }
        }
コード例 #2
0
        //修改
        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);
                slindata.Add("ca_name", dgv_01.SelectedRows[0].Cells["ca_name"].Value);
                slindata.Add("bar_code", dgv_01.SelectedRows[0].Cells["bar_code"].Value);
                slindata.Add("ca_model", dgv_01.SelectedRows[0].Cells["ca_model"].Value);
                slindata.Add("ca_vender", sl_VenderType.GetKey(sl_VenderType.IndexOfValue(dgv_01.SelectedRows[0].Cells["ca_vender"].Value)));
                slindata.Add("sales_id", sl_SalesType.GetKey(sl_SalesType.IndexOfValue(dgv_01.SelectedRows[0].Cells["sales_id"].Value)));
                if (dgv_01.SelectedRows[0].Cells["price"].Value != null)
                {
                    slindata.Add("price", double.Parse(dgv_01.SelectedRows[0].Cells["price"].Value.ToString().Substring(1)));
                }
                else
                {
                    slindata.Add("price", "");
                }

                slindata.Add("ca_remarks", dgv_01.SelectedRows[0].Cells["ca_remarks"].Value);
                slindata.Add("bd_test_time", dgv_01.SelectedRows[0].Cells["bd_test_time"].Value);
                slindata.Add("if_bdtest", dgv_01.SelectedRows[0].Cells["if_bdtest"].Value);
                slindata.Add("std_stu", dgv_01.SelectedRows[0].Cells["std_stu"].Value);
                slindata.Add("min_stu", dgv_01.SelectedRows[0].Cells["min_stu"].Value);
                slindata.Add("max_stu", dgv_01.SelectedRows[0].Cells["max_stu"].Value);

                HCSCM_sterilizer_device_new hcsm = new HCSCM_sterilizer_device_new(slindata, getdt);
                //获取一个值,指是否在Windows任务栏中显示窗体。
                hcsm.ShowInTaskbar = false;
                hcsm.ShowDialog();
                Loaddata();
                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);
            }
        }