protected void btnAdd_Click(object sender, EventArgs e) { try { CMSBL cmsBL = new CMSBL(); int returnNumber = -1; int sortNumber = -1; string outlineName = txtOutlineName.Text.Replace("'", "''"); string outlineRemark = txtOutlineRemark.Text.Replace("'", "''"); sortNumber = cmsBL.GetDuplicateOutlineSort(hdnSiteID.Value, ddlSortNumber.SelectedValue); if (sortNumber == 0) { if (lblTitle.Text == "Add Outline") { returnNumber = cmsBL.GetDuplicateOutline(hdnSiteID.Value, outlineName); if (returnNumber == 0) { returnNumber = cmsBL.CreateOutline(hdnSiteID.Value, outlineName, outlineRemark, ddlSortNumber.SelectedValue, "Y", _userName); } } else if (lblTitle.Text == "Update Outline") { returnNumber = cmsBL.UpdateOutline(hdnSiteID.Value, hdnPageID.Value, outlineName, outlineRemark, ddlSortNumber.SelectedValue, _userName); } } if (returnNumber == 1) { if (lblTitle.Text == "Add Outline") { lblMessage.Text = "Successfully added the new Outline."; } else { lblMessage.Text = "Successfully updated the Outline."; } lblMessage.ForeColor = System.Drawing.Color.Green; } else if (returnNumber == 10) { lblMessage.Text = "Outline already exist."; lblMessage.ForeColor = System.Drawing.Color.Red; } else if (sortNumber == 10) { lblMessage.Text = "Sort Number already exist."; lblMessage.ForeColor = System.Drawing.Color.Red; } else { if (lblTitle.Text == "Add Outline") { lblMessage.Text = "Outline Not Added."; } else { lblMessage.Text = "Outline Not Updated."; } lblMessage.ForeColor = System.Drawing.Color.Red; } } catch (Exception ex) { } }