Ejemplo n.º 1
0
        private void SaveContent()
        {
            if (!ContentChanged)
            {
                return;
            }

            String cID    = String.Empty;
            String sQuery = String.Concat("SELECT ContentID FROM [Employers] WHERE EmployerID = ", ddlEmployers.SelectedValue);
            String uQuery = "UPDATE [EmployerContent] SET ";

            try
            {
                using (BaseCCHData b = new BaseCCHData(sQuery, true))
                {
                    b.GetFrontEndData();
                    if (b.HasErrors)
                    {
                        throw new Exception("Error finding Content in database");
                    }
                    cID = b.Tables[0].Rows[0][0].ToString();
                }

                List <KeyValuePair <String, object> > l = Changes.Where(kvp => kvp.Value != null).ToList <KeyValuePair <String, object> >();
                l.ForEach(delegate(KeyValuePair <String, object> kvp)
                {
                    uQuery = String.Concat(uQuery, kvp.Key, " = '", kvp.Value, "'");
                    if (kvp.Key != l.Last().Key)
                    {
                        uQuery = String.Concat(uQuery, ", ");
                    }
                });
                if (cID == String.Empty)
                {
                    throw new Exception("Could not find content ID in the table");
                }
                uQuery = String.Concat(uQuery, " WHERE CMID = '", cID, "'");
                using (BaseCCHData b = new BaseCCHData(uQuery, true))
                {
                    b.PostFrontEndData();
                    if (b.HasErrors)
                    {
                        throw new Exception("Error updating content with changes");
                    }
                }
                this.feedback = feedback.Append("Changes Saved Successfully");
            }
            catch (Exception ex)
            {
            }
        }
Ejemplo n.º 2
0
        private void DisableCM()
        {
            String oldID           = String.Empty;
            String qUpdateEmpEntry = String.Concat(
                "UPDATE [Employers] SET ContentID = NULL OUTPUT Deleted.ContentID WHERE EmployerID = ", ddlEmployers.SelectedValue);
            String qRemCMEntry = "DELETE FROM [EmployerContent] WHERE CMID = '{0}'";

            try
            {
                using (BaseCCHData b = new BaseCCHData(qUpdateEmpEntry, true))
                {
                    b.GetFrontEndData();
                    if (b.HasErrors)
                    {
                        throw new Exception("Error  unlinking content from employer");
                    }
                    oldID = b.Tables[0].Rows[0][0].ToString();
                }
                if (oldID == String.Empty)
                {
                    throw new Exception("Could not find previous content ID");
                }
                using (BaseCCHData b = new BaseCCHData(String.Format(qRemCMEntry, oldID), true))
                {
                    b.PostFrontEndData();
                    if (b.HasErrors)
                    {
                        throw new Exception("Error removing old content from table");
                    }
                }
                this.feedback = feedback.Append(
                    String.Concat(
                        "Content Management Removed from ",
                        ddlEmployers.SelectedItem.Text,
                        " Successfully"));
            }
            catch (Exception ex)
            {
            }
        }
Ejemplo n.º 3
0
        private void EnableCM()
        {
            String newID       = Guid.NewGuid().ToString();
            String qAddCMEntry = String.Concat(
                "INSERT INTO [EmployerContent] (CMID, SSNOnly, HasOtherPeopleSection, HasNotificationSection, TandCVisible, CanSignIn, Canregister, InternalLogo, MemberIDFormat, ContactText, SpecialtyNetworkText, PastCareDisclaimerText, RxResultDisclaimerText, SpecialtyDrugDisclaimerText, OverrideRegisterButton, SCIQInMonth, SCIQUserEarnings, SCIQButtonText, SCIQDashboardName) ",  //  lam, 20130418, MSF-299
                "VALUES ('", newID, "', 1, 0, 0, 1, 0, 0, 0, '','','','','','',0,'','','','')");
            String qUpdateEmpEntry = String.Concat(
                "UPDATE [Employers] SET ContentID = '", newID, "' WHERE EmployerID = ", ddlEmployers.SelectedValue);

            try
            {
                using (BaseCCHData b = new BaseCCHData(qAddCMEntry, true))
                {
                    b.PostFrontEndData();
                    if (b.HasErrors)
                    {
                        throw new Exception("Error adding new entry to content management table");
                    }
                }
                using (BaseCCHData b = new BaseCCHData(qUpdateEmpEntry, true))
                {
                    b.PostFrontEndData();
                    if (b.HasErrors)
                    {
                        throw new Exception("Error updating employers with new content");
                    }
                }
                this.feedback = feedback.Append(
                    String.Concat("Content Management Added to ",
                                  ddlEmployers.SelectedItem.Text,
                                  " Successfully"));
            }
            catch (Exception ex)
            {
            }
        }
Ejemplo n.º 4
0
        private void SaveContent()
        {
            if (!ContentChanged) return;

            String cID = String.Empty;
            String sQuery = String.Concat("SELECT ContentID FROM [Employers] WHERE EmployerID = ", ddlEmployers.SelectedValue);
            String uQuery = "UPDATE [EmployerContent] SET ";
            try
            {
                using (BaseCCHData b = new BaseCCHData(sQuery, true))
                {
                    b.GetFrontEndData();
                    if (b.HasErrors) throw new Exception("Error finding Content in database");
                    cID = b.Tables[0].Rows[0][0].ToString();
                }

                List<KeyValuePair<String, object>> l = Changes.Where(kvp => kvp.Value != null).ToList<KeyValuePair<String, object>>();
                l.ForEach(delegate(KeyValuePair<String, object> kvp)
                {
                    uQuery = String.Concat(uQuery, kvp.Key, " = '", kvp.Value, "'");
                    if (kvp.Key != l.Last().Key) uQuery = String.Concat(uQuery, ", ");
                });
                if (cID == String.Empty) throw new Exception("Could not find content ID in the table");
                uQuery = String.Concat(uQuery, " WHERE CMID = '", cID, "'");
                using (BaseCCHData b = new BaseCCHData(uQuery, true))
                {
                    b.PostFrontEndData();
                    if (b.HasErrors) throw new Exception("Error updating content with changes");
                }
                this.feedback = feedback.Append("Changes Saved Successfully");
            }
            catch (Exception ex)
            {
            }
        }
Ejemplo n.º 5
0
        private void EnableCM()
        {
            String newID = Guid.NewGuid().ToString();
            String qAddCMEntry = String.Concat(
                "INSERT INTO [EmployerContent] (CMID, SSNOnly, HasOtherPeopleSection, HasNotificationSection, TandCVisible, CanSignIn, Canregister, InternalLogo, MemberIDFormat, ContactText, SpecialtyNetworkText, PastCareDisclaimerText, RxResultDisclaimerText, SpecialtyDrugDisclaimerText, OverrideRegisterButton, SCIQInMonth, SCIQUserEarnings, SCIQButtonText, SCIQDashboardName) ",  //  lam, 20130418, MSF-299
                "VALUES ('", newID, "', 1, 0, 0, 1, 0, 0, 0, '','','','','','',0,'','','','')");
            String qUpdateEmpEntry = String.Concat(
                "UPDATE [Employers] SET ContentID = '", newID, "' WHERE EmployerID = ", ddlEmployers.SelectedValue);

            try
            {
                using (BaseCCHData b = new BaseCCHData(qAddCMEntry, true))
                {
                    b.PostFrontEndData();
                    if (b.HasErrors) throw new Exception("Error adding new entry to content management table");
                }
                using (BaseCCHData b = new BaseCCHData(qUpdateEmpEntry, true))
                {
                    b.PostFrontEndData();
                    if (b.HasErrors) throw new Exception("Error updating employers with new content");
                }
                this.feedback = feedback.Append(
                    String.Concat("Content Management Added to ",
                        ddlEmployers.SelectedItem.Text,
                        " Successfully"));
            }
            catch (Exception ex)
            {
            }
        }
Ejemplo n.º 6
0
        private void DisableCM()
        {
            String oldID = String.Empty;
            String qUpdateEmpEntry = String.Concat(
                "UPDATE [Employers] SET ContentID = NULL OUTPUT Deleted.ContentID WHERE EmployerID = ", ddlEmployers.SelectedValue);
            String qRemCMEntry = "DELETE FROM [EmployerContent] WHERE CMID = '{0}'";

            try
            {
                using (BaseCCHData b = new BaseCCHData(qUpdateEmpEntry, true))
                {
                    b.GetFrontEndData();
                    if (b.HasErrors) throw new Exception("Error  unlinking content from employer");
                    oldID = b.Tables[0].Rows[0][0].ToString();
                }
                if (oldID == String.Empty) throw new Exception("Could not find previous content ID");
                using (BaseCCHData b = new BaseCCHData(String.Format(qRemCMEntry, oldID), true))
                {
                    b.PostFrontEndData();
                    if (b.HasErrors) throw new Exception("Error removing old content from table");
                }
                this.feedback = feedback.Append(
                    String.Concat(
                        "Content Management Removed from ",
                        ddlEmployers.SelectedItem.Text,
                        " Successfully"));
            }
            catch (Exception ex)
            {
            }
        }