Exemple #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                if (dataGridView1.SelectedRows.Count == 0)
                {
                    MessageBox.Show("请选中要删除的行!!!");
                }

                item                  = new ItemDamageCount.Class.Item();
                item.Id               = dataGridView1.SelectedRows[0].Cells["ID"].Value.ToString();
                item.Drugcode         = dataGridView1.SelectedRows[0].Cells["Drugcode"].Value.ToString();
                item.Drugname         = dataGridView1.SelectedRows[0].Cells["Drugname"].Value.ToString();
                item.Spec             = dataGridView1.SelectedRows[0].Cells["Spec"].Value.ToString();
                item.Count            = Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["Count"].Value.ToString());
                item.Money            = dataGridView1.SelectedRows[0].Cells["Money"].Value.ToString();
                item.Reason           = dataGridView1.SelectedRows[0].Cells["Reason"].Value.ToString();
                item.Responsibilityid = dataGridView1.SelectedRows[0].Cells["Responsibilityid"].Value.ToString();
                item.Responsibilityer = dataGridView1.SelectedRows[0].Cells["Responsibilityer"].Value.ToString();
                item.Reportid         = dataGridView1.SelectedRows[0].Cells["Reportid"].Value.ToString();
                item.Reporter         = dataGridView1.SelectedRows[0].Cells["Reporter"].Value.ToString();
                item.Damagetime       = dataGridView1.SelectedRows[0].Cells["Damagetime"].Value.ToString();
                item.Date             = dataGridView1.SelectedRows[0].Cells["Date"].Value.ToString();

                sel.DeleteItem(item);
                DgvLoad();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemple #2
0
        private void DgvLoad()
        {
            ds = new DataSet();
            LI = new List <ItemDamageCount.Class.Item>();
            ds = sel.SelectRemarkByDate(dateTimePicker2.Value.ToShortDateString(), dateTimePicker3.Value.ToShortDateString());

            foreach (DataRow r in ds.Tables[0].Rows)
            {
                item                  = new ItemDamageCount.Class.Item();
                item.Id               = r["ID"].ToString();
                item.Drugcode         = r["Drugcode"].ToString();
                item.Drugname         = r["Drugname"].ToString();
                item.Spec             = r["Spec"].ToString();
                item.Count            = Convert.ToInt32(r["Count"].ToString());
                item.Money            = r["Money"].ToString();
                item.Reason           = r["Reason"].ToString();
                item.Responsibilityid = r["Responsibilityid"].ToString();
                item.Responsibilityer = r["Responsibilityer"].ToString();
                item.Reportid         = r["Reportid"].ToString();
                item.Reporter         = r["Reporter"].ToString();
                item.Damagetime       = r["Damagetime"].ToString();
                item.Date             = r["Date"].ToString();

                LI.Add(item);
            }

            dataGridView1.DataSource = LI;
        }
Exemple #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtDrug.Text == null || txtDrug.Text == "")
                {
                    lblWarn.Text      = "药品不能为空";
                    lblWarn.ForeColor = Color.Red;
                }
                else
                {
                    item                  = new ItemDamageCount.Class.Item();
                    item.Drugcode         = txtDrug.Tag.ToString();
                    item.Drugname         = txtDrug.Text;
                    item.Spec             = cbSpec.Text;
                    item.Count            = Convert.ToInt32(txtCount.Text);
                    item.Money            = txtMoney.Text;
                    item.Reason           = cbReason.Text;
                    item.Responsibilityid = txtRespons.Tag.ToString();
                    item.Responsibilityer = txtRespons.Text;
                    item.Reportid         = txtReport.Tag.ToString();
                    item.Reporter         = txtReport.Text;
                    item.Damagetime       = dateTimePicker1.Value.ToShortDateString();
                    item.Date             = DateTime.Now.ToString("yyyy/MM/dd hh:mm:ss");
                    sel = new ItemDamageCount.Dao.sql();

                    lblWarn.Text      = sel.InsertRemark(item);
                    lblWarn.ForeColor = SystemColors.ControlText;

                    DgvLoad();
                }
            }
            catch (Exception ex)
            {
                lblWarn.Text      = ex.Message;
                lblWarn.ForeColor = Color.Red;
            }
        }