コード例 #1
0
 protected void ddlHl7Vaccine_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (ddlHl7Vaccine.SelectedIndex > 0)
     {
         int         id      = int.Parse(ddlHl7Vaccine.SelectedValue);
         Hl7Vaccines vaccine = Hl7Vaccines.GetHl7VaccinesById(id);
         txtName.Text = vaccine.Fullname;
         txtCode.Text = vaccine.Code;
     }
 }
コード例 #2
0
    protected void btnEdit_Click(object sender, EventArgs e)
    {
        try
        {
            if (Page.IsValid)
            {
                int    id  = -1;
                string _id = Request.QueryString["id"].ToString();
                int.TryParse(_id, out id);
                int userId = CurrentEnvironment.LoggedUser.Id;

                Hl7Vaccines o = Hl7Vaccines.GetHl7VaccinesById(id);

                o.CvxCode       = txtCvxCode.Text;
                o.Code          = txtCode.Text.Replace("'", @"''");
                o.Fullname      = txtFullname.Text.Replace("'", @"''");
                o.Notes         = txtNotes.Text.Replace("'", @"''");
                o.VaccineStatus = bool.Parse(rblVaccineStatus.SelectedValue);
                o.InternalId    = int.Parse(txtInternalId.Text);
                o.NonVaccine    = bool.Parse(rblNonVaccine.SelectedValue);
                o.UpdateDate    = DateTime.Parse(txtUpdateDate.Text);

                int i = Hl7Vaccines.Update(o);

                if (i > 0)
                {
                    lblSuccess.Visible = true;
                    lblWarning.Visible = false;
                    lblError.Visible   = false;
                    gvHl7Vaccines.DataBind();
                    ClearControls(this);
                }
                else
                {
                    lblSuccess.Visible = false;
                    lblWarning.Visible = true;
                    lblError.Visible   = false;
                }
            }
        }
        catch (Exception ex)
        {
            lblSuccess.Visible = false;
            lblWarning.Visible = false;
            lblError.Visible   = true;
        }
    }