protected void btnSave_Click(object sender, EventArgs e) { bool check = false; try { initialDataBLL initialData = new initialDataBLL(); initialData.ElementDataName = txtbxElementName.Text.Trim(); initialData.ElementDataDescp = txtbxDescription.Text.Trim(); initialData.ElementGroupId = ddlGroup.SelectedValue; if (btnSave.Text != "Update") { if (initialData.checkDuplicateLookupData()) { check = true; check = true; // MyAlertBox("Data has been saved successfully!!"); initialData.SaveLookUpElementData(); string message = " <span class='actionTopic'>" + " Data Saved Successfully as Id: " + initialData.ElementDataId.ToString() + "</span>."; MyAlertBox( "var callbackOk = function () { window.location = \"/a/initialdata/initialDataElement.aspx\"; }; SuccessAlert(\"" + "Process Succeed" + "\", \"" + message + "\", \"\");"); } else { msgbox.Visible = true; msgTitleLabel.Text = "Duplicate Data"; msgTitleLabel.Text = "This Group is already Added."; } } else { initialData.ElementDataId = hdbFieldId.Value; initialData.ElementDataName = txtbxElementName.Text; initialData.ElementGroupId = ddlGroup.SelectedValue.ToString(); initialData.ElementDataDescp = txtbxDescription.Text; initialData.UpdateLookUpElementData(); btnSave.Text = "Save"; string message = " <span class='actionTopic'>" + " Data Updated Successfully of Id: " + initialData.ElementDataId.ToString() + "</span>."; MyAlertBox( "var callbackOk = function () { window.location = \"/a/initialdata/initialDataElement.aspx\"; }; SuccessAlert(\"" + "Process Succeed" + "\", \"" + message + "\", \"\");"); txtbxElementName.Text = ""; txtbxDescription.Text = ""; ddlGroup.SelectedIndex = 0; } if (check == false) { MyAlertBox("Data save failed!!"); } getElementDataList(); } catch (Exception) { throw; } }
private bool checkDuplicateElementData(initialDataBLL initialData) { bool status = false; try { status = initialData.checkDuplicateLookupData(); } catch (Exception) { //throw; } return status; }