protected void btnDelete_Click(object sender, EventArgs e) { // make sure that the message is not used in any active rules qCom_SMSMessage message = new qCom_SMSMessage(Convert.ToInt32(Request.QueryString["smsMessageID"])); var rules = qCom_SMSMessageRule.GetMessageRuleByAnySMSMessageURI(message.MessageURI); if (rules.SMSMessageRuleID > 0) { lblMessageBottom.Text = "*** WARNING: This message cannot be deleted since it is being used in active rules. ***"; } else { message.Available = "No"; message.MarkAsDelete = 1; message.Update(); if (!String.IsNullOrEmpty(Request.QueryString["campaignID"])) { Response.Redirect("sms-messages-list.aspx?campaignID=" + Request.QueryString["campaignID"]); } else { Response.Redirect("sms-messages-list.aspx"); } } }
protected void btnDelete_Click(object sender, EventArgs e) { // make sure that the message is not used in any active rules qCom_SMSMessage message = new qCom_SMSMessage(Convert.ToInt32(Request.QueryString["smsMessageID"])); var rules = qCom_SMSMessageRule.GetMessageRuleByAnySMSMessageURI(message.MessageURI); if (rules.SMSMessageRuleID > 0) { lblMessageBottom.Text = "*** WARNING: This message cannot be deleted since it is being used in active rules. ***"; } else { message.Available = "No"; message.MarkAsDelete = 1; message.Update(); if (!String.IsNullOrEmpty(Request.QueryString["campaignID"])) Response.Redirect("sms-messages-list.aspx?campaignID=" + Request.QueryString["campaignID"]); else Response.Redirect("sms-messages-list.aspx"); } }
protected void btnSave_OnClick(object sender, EventArgs e) { Page.Validate("form"); if (Page.IsValid) { int sms_message_id = (string.IsNullOrEmpty(Request.QueryString["smsMessageID"])) ? 0 : Convert.ToInt32(Request.QueryString["smsMessageID"]); int curr_message_id = 0; int scopeID = Convert.ToInt32(Context.Items["ScopeID"]); int user_id = Convert.ToInt32(Context.Items["UserID"]); if (sms_message_id > 0) { lblTitle.Text = "Edit Message"; qCom_SMSMessage message = new qCom_SMSMessage(sms_message_id); message.LastModified = DateTime.Now; message.LastModifiedby = user_id; message.MarkAsDelete = 0; message.MessageURI = txtURI.Text; message.MessageText = txtMessage.Text; if (!String.IsNullOrEmpty(ddlCampaigns.SelectedValue)) { message.CampaignID = Convert.ToInt32(ddlCampaigns.SelectedValue); } if (!String.IsNullOrEmpty(ddlLanguages.SelectedValue)) { message.LanguageID = Convert.ToInt32(ddlLanguages.SelectedValue); } message.DayInCampaign = Convert.ToInt32(txtDayInCampaign.Text); message.Update(); lblMessage.Text = "*** Message Successfully Saved at " + DateTime.Now + " ***"; } else { qCom_SMSMessage message = new qCom_SMSMessage(); message.ScopeID = scopeID; message.Available = "Yes"; message.Created = DateTime.Now; message.CreatedBy = user_id; message.LastModified = DateTime.Now; message.LastModifiedby = user_id; message.MarkAsDelete = 0; message.MessageURI = txtURI.Text; message.MessageText = txtMessage.Text; if (!String.IsNullOrEmpty(ddlCampaigns.SelectedValue)) { message.CampaignID = Convert.ToInt32(ddlCampaigns.SelectedValue); } if (!String.IsNullOrEmpty(ddlLanguages.SelectedValue)) { message.LanguageID = Convert.ToInt32(ddlLanguages.SelectedValue); } message.DayInCampaign = Convert.ToInt32(txtDayInCampaign.Text); message.Insert(); curr_message_id = message.SMSMessageID; if (!String.IsNullOrEmpty(Request.QueryString["campaignID"])) { Response.Redirect("sms-message-edit.aspx?smsMessageID=" + curr_message_id + "&campaignID=" + Request.QueryString["campaignID"]); } else { Response.Redirect("sms-message-edit.aspx?smsMessageID=" + curr_message_id); } } } }
protected void btnSave_OnClick(object sender, EventArgs e) { Page.Validate("form"); if (Page.IsValid) { int sms_message_id = (string.IsNullOrEmpty(Request.QueryString["smsMessageID"])) ? 0 : Convert.ToInt32(Request.QueryString["smsMessageID"]); int curr_message_id = 0; int scopeID = Convert.ToInt32(Context.Items["ScopeID"]); int user_id = Convert.ToInt32(Context.Items["UserID"]); if (sms_message_id > 0) { lblTitle.Text = "Edit Message"; qCom_SMSMessage message = new qCom_SMSMessage(sms_message_id); message.LastModified = DateTime.Now; message.LastModifiedby = user_id; message.MarkAsDelete = 0; message.MessageURI = txtURI.Text; message.MessageText = txtMessage.Text; if (!String.IsNullOrEmpty(ddlCampaigns.SelectedValue)) message.CampaignID = Convert.ToInt32(ddlCampaigns.SelectedValue); if (!String.IsNullOrEmpty(ddlLanguages.SelectedValue)) message.LanguageID = Convert.ToInt32(ddlLanguages.SelectedValue); message.DayInCampaign = Convert.ToInt32(txtDayInCampaign.Text); message.Update(); lblMessage.Text = "*** Message Successfully Saved at " + DateTime.Now + " ***"; } else { qCom_SMSMessage message = new qCom_SMSMessage(); message.ScopeID = scopeID; message.Available = "Yes"; message.Created = DateTime.Now; message.CreatedBy = user_id; message.LastModified = DateTime.Now; message.LastModifiedby = user_id; message.MarkAsDelete = 0; message.MessageURI = txtURI.Text; message.MessageText = txtMessage.Text; if (!String.IsNullOrEmpty(ddlCampaigns.SelectedValue)) message.CampaignID = Convert.ToInt32(ddlCampaigns.SelectedValue); if (!String.IsNullOrEmpty(ddlLanguages.SelectedValue)) message.LanguageID = Convert.ToInt32(ddlLanguages.SelectedValue); message.DayInCampaign = Convert.ToInt32(txtDayInCampaign.Text); message.Insert(); curr_message_id = message.SMSMessageID; if (!String.IsNullOrEmpty(Request.QueryString["campaignID"])) Response.Redirect("sms-message-edit.aspx?smsMessageID=" + curr_message_id + "&campaignID=" + Request.QueryString["campaignID"]); else Response.Redirect("sms-message-edit.aspx?smsMessageID=" + curr_message_id); } } }