protected void btnRemove_Click(object sender, EventArgs e) { try { int id = -1; string _id = Request.QueryString["id"].ToString(); int.TryParse(_id, out id); int userId = CurrentEnvironment.LoggedUser.Id; int i = Hl7Manufacturers.Remove(id); if (i > 0) { lblSuccess.Visible = true; lblWarning.Visible = false; lblError.Visible = false; gvHl7Manufacturers.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; } }
protected void ddlHl7Manufacturer_SelectedIndexChanged(object sender, EventArgs e) { if (ddlHl7Manufacturer.SelectedIndex != 0) { Hl7Manufacturers o = Hl7Manufacturers.GetHl7ManufacturersById(int.Parse(ddlHl7Manufacturer.SelectedValue)); txtName.Text = o.Name; txtCode.Text = o.MvxCode; } }
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; Hl7Manufacturers o = Hl7Manufacturers.GetHl7ManufacturersById(id); o.MvxCode = txtMvxCode.Text; o.Name = txtName.Text.Replace("'", @"''"); o.Notes = txtNotes.Text.Replace("'", @"''"); o.IsActive = bool.Parse(rblIsActive.SelectedValue); o.LastUpdated = DateTime.Parse(txtLastUpdated.Text); o.InternalId = int.Parse(txtInternalId.Text); int i = Hl7Manufacturers.Update(o); if (i > 0) { lblSuccess.Visible = true; lblWarning.Visible = false; lblError.Visible = false; gvHl7Manufacturers.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; } }
protected void btnAdd_Click(object sender, EventArgs e) { try { if (Page.IsValid) { int userId = CurrentEnvironment.LoggedUser.Id; Hl7Manufacturers o = new Hl7Manufacturers(); o.MvxCode = txtMvxCode.Text; o.Name = txtName.Text.Replace("'", @"''"); o.Notes = txtNotes.Text.Replace("'", @"''"); o.IsActive = bool.Parse(rblIsActive.SelectedValue); o.LastUpdated = DateTime.Parse(txtLastUpdated.Text); o.InternalId = int.Parse(txtInternalId.Text); int i = Hl7Manufacturers.Insert(o); if (i > 0) { lblSuccess.Visible = true; lblWarning.Visible = false; lblError.Visible = false; gvHl7Manufacturers.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; } }