public void SaveUpdateInfo(bool saveInfo) { try { int comID, unitID; bool isActive, isSMS; string strSQL; ExecuteSQL exec = new ExecuteSQL(); isActive = _chkOn.Checked ? true : false; isSMS = _ckOnSMS.Checked ? true : false; comID = int.Parse(Session["trkCompany"].ToString()); unitID = int.Parse(Request.QueryString["unitID"].ToString()); if (saveInfo) { strSQL = "insert into tblAlertRules(unitID, comID, email, phoneNumber, isSMS, isActive)" + " VALUES (" + unitID + "," + comID + ",'" + _txtNotificationEmails.Text.ToString() + "','" + _txtPhoneNumber.Text.Trim() + "','" + isSMS + "','" + isActive + "');"; } else { strSQL = "update tblAlertRules set email = '" + _txtNotificationEmails.Text.ToString() + "', phoneNumber = '" + _txtPhoneNumber.Text.Trim() + "', isSMS = '" + isSMS + "', isActive = '" + isActive + "' where unitID = " + unitID + " and comID = " + comID + ";"; } exec.ExecuteNonQuery(strSQL); _lblMessage.ForeColor = System.Drawing.Color.Green; if (saveInfo) { _lblMessage.Text = "Saved info successfully."; } else { _lblMessage.Text = "Updated info successfully."; } } catch (Exception ex) { Console.WriteLine("SaveUpdateInfo(): " + ex.Message.ToString()); _lblMessage.ForeColor = System.Drawing.Color.Red; _lblMessage.Text = "Could not save info."; } }