private void label3_Click(object sender, EventArgs e)//单击要修改的计量单位,显示combobox备选框 { if (rowMetric.RName != null) { rowMetric.RName.cbbPName.Visible = false; rowMetric.RName.lblPName.Visible = true; rowMetric.RName.cbbPNameEnabled = false; } lblPName.Visible = false; cbbPName.Visible = true; cbbPName.Enabled = true; rowMetric.RName = this; }
public void FormMetric_Load(object sender, EventArgs e) { label3.Parent = this.pictureBox1; label1.Parent = this.pictureBox1; lblAdd.Parent = this.pictureBox1; label2.Parent = this.pictureBox2; Pic_Min.Parent = this.pictureBox1; Panel_Close.Parent = this.pictureBox1; try { if (UserID == null || UserID == "") { UserID = "00000000000000000000000000000000000000000000000"; } if (GetPivasLimit.Instance.Limit(UserID, "PivasDMetric")) { DataSet nm = new DataSet(); label3.Text = ""; string str1 = "select DEmployeeName from DEmployee where DEMployeeID = " + UserID + ""; nm = db.GetPIVAsDB(str1); label3.Text = nm.Tables[0].Rows[0][0].ToString(); StringBuilder str = new StringBuilder(); str.Append("select D.MetricCode,D.MetricName,DU.ChineseName,DU.EnglishName,D.UnitID from DMetric D "); str.Append("left join kd0100..DMetrologyUnit DU on D.UnitID=DU.UnitID order by MetricCode"); ds = db.GetPIVAsDB(str.ToString()); showdata(ds); for (int i = 0; i < flpMetric.Controls.Count; i++) { rowMetric ro = (rowMetric)flpMetric.Controls[i]; ro.show(); } } else { MessageBox.Show("您没有操作权限,请与管理员联系!"); this.Dispose(); } } catch (System.Exception ex) { MessageBox.Show(ex.Message); } }
private void showdata(DataSet Metric) //加载用户控件 { try { DataTable dt = Metric.Tables[0]; for (int i = 0; i < dt.Rows.Count; i++) { rowMetric row = new rowMetric(); row.Name = "rowM" + i.ToString(); row.add(dt.Rows[i]); flpMetric.Controls.Add(row); } } catch (System.Exception ex) { MessageBox.Show(ex.Message); } }
private void delete_Click(object sender, EventArgs e)//删除剂量单位 { try { deleteMetric form = new deleteMetric(); Oldid = lblID.Text.ToString(); oldcode = lblCode.Text.ToString(); oldname = lblName.Text.ToString(); PName = cbbPName.Text.ToString(); RName = this; if (form.ShowDialog(this) == DialogResult.OK) { this.Dispose(); } } catch (System.Exception ex) { MessageBox.Show(ex.Message); } }