protected void btnManageLinks_Click(object sender, EventArgs e) { int link_id = 0; medication_group_id = Convert.ToInt32(Request.QueryString["medicationGroupID"]); if (!String.IsNullOrEmpty(Convert.ToString(ddlLinks.SelectedValue))) { link_id = Convert.ToInt32(ddlLinks.SelectedValue); qSoc_MedicationLink link = new qSoc_MedicationLink(); link.ScopeID = Convert.ToInt32(Context.Items["ScopeID"]); link.Created = DateTime.Now; link.CreatedBy = Convert.ToInt32(Context.Items["UserID"]); link.LastModified = DateTime.Now; link.LastModifiedBy = Convert.ToInt32(Context.Items["UserID"]); link.Available = "Yes"; link.MarkAsDelete = 0; link.LinkID = link_id; link.MedicationGroupID = medication_group_id; link.MedicationType = "group"; link.OrderNum = 1; link.Insert(); Response.Redirect("medication-group-edit.aspx?medicationGroupID=" + medication_group_id); } else { lblMedicationLinksMessage.Text = " *** WARNING *** You must first select a link from the pull down list."; } }