private void SaveData(string portId) { BLL.DBInteraction dbinteract = new BLL.DBInteraction(); bool isedit = portId != "-1" ? true : false; if (!isedit) { // if (dbinteract.GetPort(-1, txtPortCode.Text.Trim(), "").Tables[0].Rows.Count > 0) if (!dbinteract.IsUnique("DSR.dbo.mstPort", "PortCode", txtPortCode.Text.Trim())) { GeneralFunctions.RegisterAlertScript(this, "Port Code must be unique. The given code has already been used for another port. Please try with another one."); return; } } int result = dbinteract.AddEditPort(_userId, Convert.ToInt32(portId), txtPortName.Text.Trim().ToUpper(), txtPortCode.Text.Trim().ToUpper(), ddlICD.SelectedIndex == 0 ? false : true, txtPortAddressee.Text.ToUpper(), txtAdd1.Text.ToUpper(), txtAdd2.Text.ToUpper(), txtExportPort.Text.ToUpper(), isedit); if (result > 0) { Response.Redirect("~/MasterModule/ManagePort.aspx"); } else { GeneralFunctions.RegisterAlertScript(this, "Error Occured"); } }