Esempio n. 1
0
        /// <summary>
        /// Fills the {0} from a OleIDataReader.
        /// </summary>
        public static void FillFromReader(DbContentRating dbContentRating, IDataReader r, int idOffset, int dataOffset)
        {
            dbContentRating.iD            = r.GetInt32(idOffset);
            dbContentRating.isSynced      = true;
            dbContentRating.isPlaceHolder = false;

            dbContentRating.createDate  = r.GetDateTime(0 + dataOffset);
            dbContentRating.modifyDate  = r.GetDateTime(1 + dataOffset);
            dbContentRating.name        = r.GetString(2 + dataOffset);
            dbContentRating.description = r.GetString(3 + dataOffset);
            dbContentRating.iconUrl     = r.GetString(4 + dataOffset);
            if (!r.IsDBNull(5 + dataOffset) && r.GetInt32(5 + dataOffset) > 0)
            {
                dbContentRating.requiredRole = GreyFoxRole.NewPlaceHolder(r.GetInt32(5 + dataOffset));
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Fills the {0} from a OleIDataReader.
        /// </summary>
        public static void FillFromReader(GreyFoxSetting greyFoxSetting, IDataReader r, int idOffset, int dataOffset)
        {
            greyFoxSetting.iD            = r.GetInt32(idOffset);
            greyFoxSetting.isSynced      = true;
            greyFoxSetting.isPlaceHolder = false;

            greyFoxSetting.name         = r.GetString(0 + dataOffset);
            greyFoxSetting.settingValue = r.GetString(1 + dataOffset);
            if (!r.IsDBNull(2 + dataOffset) && r.GetInt32(2 + dataOffset) > 0)
            {
                greyFoxSetting.parent = GreyFoxSetting.NewPlaceHolder(r.GetInt32(2 + dataOffset));
            }
            if (!r.IsDBNull(3 + dataOffset) && r.GetInt32(3 + dataOffset) > 0)
            {
                greyFoxSetting.modifyRole = GreyFoxRole.NewPlaceHolder(r.GetInt32(3 + dataOffset));
            }
            greyFoxSetting.isSystemSetting = r.GetBoolean(4 + dataOffset);
        }
Esempio n. 3
0
        protected void ok_Click(object sender, EventArgs e)
        {
            if (dbContentRatingID == 0)
            {
                obj = new DbContentRating();
            }
            else
            {
                obj = new DbContentRating(dbContentRatingID);
            }

            obj.Name        = tbName.Text;
            obj.Description = tbDescription.Text;
            obj.IconUrl     = tbIconUrl.Text;

            if (msRequiredRole.SelectedItem != null && msRequiredRole.SelectedItem.Value != "Null")
            {
                obj.RequiredRole = GreyFoxRole.NewPlaceHolder(
                    int.Parse(msRequiredRole.SelectedItem.Value));
            }
            else
            {
                obj.RequiredRole = null;
            }

            if (editOnAdd)
            {
                dbContentRatingID = obj.Save();
            }
            else
            {
                obj.Save();
            }

            if (resetOnAdd)
            {
                tbName.Text                  = string.Empty;
                tbDescription.Text           = string.Empty;
                tbIconUrl.Text               = string.Empty;
                msRequiredRole.SelectedIndex = 0;
            }

            OnUpdated(EventArgs.Empty);
        }
Esempio n. 4
0
        protected void ok_Click(object sender, EventArgs e)
        {
            if (greyFoxSettingID == 0)
            {
                obj = new GreyFoxSetting();
            }
            else
            {
                obj = new GreyFoxSetting(greyFoxSettingID);
            }

            obj.Name  = tbName.Text;
            obj.Value = tbValue.Text;

            if (msModifyRole.SelectedItem != null && msModifyRole.SelectedItem.Value != "Null")
            {
                obj.ModifyRole = GreyFoxRole.NewPlaceHolder(
                    int.Parse(msModifyRole.SelectedItem.Value));
            }
            else
            {
                obj.ModifyRole = null;
            }

            if (editOnAdd)
            {
                greyFoxSettingID = obj.Save();
            }
            else
            {
                obj.Save();
            }

            if (resetOnAdd)
            {
                tbName.Text  = string.Empty;
                tbValue.Text = string.Empty;
                msModifyRole.SelectedIndex = 0;
            }

            OnUpdated(EventArgs.Empty);
        }
Esempio n. 5
0
        /// <summary>
        /// Fills the {0} from a OleDbDataReader.
        /// </summary>
        public static void FillFromReader(GreyFoxSetting greyFoxSetting, OleDbDataReader r, int idOffset, int dataOffset)
        {
            greyFoxSetting.iD            = r.GetInt32(idOffset);
            greyFoxSetting.isSynced      = true;
            greyFoxSetting.isPlaceHolder = false;

            //
            // Parse Children From Database
            //
            if (!r.IsDBNull(0 + dataOffset) && r.GetInt32(0 + dataOffset) > 0)
            {
                greyFoxSetting.modifyRole = GreyFoxRole.NewPlaceHolder(r.GetInt32(0 + dataOffset));
            }

            //
            // Parse Fields From Database
            //
            greyFoxSetting.name  = r.GetString(1 + dataOffset);
            greyFoxSetting.value = r.GetString(2 + dataOffset);
        }
Esempio n. 6
0
        protected override void OnPreRender(EventArgs e)
        {
            if (loadFlag)
            {
                if (greyFoxRoleID > 0)
                {
                    obj  = new GreyFoxRole(greyFoxRoleID);
                    text = "Edit  - " + obj.ToString();
                }
                else if (greyFoxRoleID <= 0)
                {
                    obj  = new GreyFoxRole();
                    text = "Add ";
                }

                //
                // Set Field Entries
                //
                tbName.Text          = obj.Name;
                tbDescription.Text   = obj.Description;
                cbIsDisabled.Checked = obj.IsDisabled;
            }
        }
Esempio n. 7
0
        protected override void OnPreRender(EventArgs e)
        {
            if (loadFlag)
            {
                if (greyFoxRoleID != 0)
                {
                    obj = new GreyFoxRole(greyFoxRoleID);

                    tbName.Text          = obj.Name;
                    tbDescription.Text   = obj.Description;
                    cbIsDisabled.Checked = obj.IsDisabled;

                    tabstrip.SelectedTab = tabstrip.Tabs[0];

                    headerText.Text = Localization.Strings.Edit +
                                      Localization.PeopleStrings.Space +
                                      obj.Name;
                }
                else
                {
                    headerText.Text = Localization.Strings.Edit;
                }
            }
        }
Esempio n. 8
0
        /// <summary>
        /// Initializes the database with the necissary tables to support the content
        /// manager as well as creating a default content catalog and associated roles
        /// in the Amns.GreyFox user's database.
        /// </summary>
        /// <returns></returns>
        public void Install()
        {
            OleDbConnection  dbConnection = new OleDbConnection(dbConnectionString);
            OleDbCommand     dbCommand    = new OleDbCommand();
            OleDbTransaction dbTransaction;

            dbCommand.Connection = dbConnection;

            // Try to open database
            try
            {
                dbConnection.Open();
                dbTransaction = dbConnection.BeginTransaction();
            }
            catch (OleDbException e)
            {
                throw(new ContentManagerException(e.Message, e.ErrorCode));
            }

            // Try to create table to hold catalogs
            try
            {
                //
                dbCommand.CommandText = createCatalogTable;
                dbCommand.Transaction = dbTransaction;
                dbCommand.ExecuteNonQuery();

                GreyFoxRole authorRole = new GreyFoxRole(dbConnectionString);
                authorRole.Name        = "CMS/Author";
                authorRole.Description = "Default Author";
                authorRole.IsDisabled  = false;
                authorRole.Save();

                GreyFoxRole reviewerRole = new GreyFoxRole(dbConnectionString);
                reviewerRole.Name        = "CMS/Reviewer";
                reviewerRole.Description = "Default Reviewer";
                reviewerRole.IsDisabled  = false;
                reviewerRole.Save();

                GreyFoxRole editorRole = new GreyFoxRole(dbConnectionString);
                editorRole.Name        = "CMS/Editor";
                editorRole.Description = "Default CMS Editor";
                editorRole.IsDisabled  = false;
                editorRole.Save();

                GreyFoxRole publisherRole = new GreyFoxRole(dbConnectionString);
                publisherRole.Name        = "CMS/Publisher";
                publisherRole.Description = "Default CMS Publisher";
                publisherRole.IsDisabled  = false;

                GreyFoxRole adminRole = new GreyFoxRole(dbConnectionString);
                adminRole.Name        = "CMS/Admin";
                adminRole.Description = "Default CMS Administrator";
                adminRole.IsDisabled  = false;
                adminRole.Save();

                iD = createCatalog(dbCommand);

                dbTransaction.Commit();
                sync = true;
            }
            catch (OleDbException e)
            {
                iD = 0;
                dbTransaction.Rollback();
                throw(new ContentManagerException(e.Message + " SQL: " + sqlStatement, e.ErrorCode));
            }
            finally
            {
                dbConnection.Close();
            }

            Log.InsertGenericEvent(DateTime.Now.ToUniversalTime(), ContentLogEntryType.CatalogCreateSuccess, iD);
        }
Esempio n. 9
0
        protected void ok_Click(object sender, EventArgs e)
        {
            if (greyFoxUserID == 0)
            {
                obj = new GreyFoxUser();
            }
            else
            {
                obj = new GreyFoxUser(greyFoxUserID);
            }

            obj.UserName      = tbUserName.Text;
            obj.IsDisabled    = cbIsDisabled.Checked;
            obj.LoginDate     = DateTime.Parse(tbLoginDate.Text);
            obj.LoginCount    = int.Parse(tbLoginCount.Text);
            obj.LoginPassword = tbLoginPassword.Text;
            obj.ActivationID  = tbActivationID.Text;

            if (msContact.SelectedItem != null && msContact.SelectedItem.Value != "Null")
            {
                obj.Contact = GreyFoxContact.NewPlaceHolder("sysGlobal_Contacts",
                                                            int.Parse(msContact.SelectedItem.Value));
            }
            else
            {
                obj.Contact = null;
            }

            if (msRoles.IsChanged)
            {
                obj.Roles = new GreyFoxRoleCollection();
                foreach (ListItem i in msRoles.Items)
                {
                    if (i.Selected)
                    {
                        obj.Roles.Add(GreyFoxRole.NewPlaceHolder(int.Parse(i.Value)));
                    }
                }
            }

            if (editOnAdd)
            {
                greyFoxUserID = obj.Save();
            }
            else
            {
                obj.Save();
            }

            if (resetOnAdd)
            {
                tbUserName.Text         = string.Empty;
                cbIsDisabled.Checked    = false;
                tbLoginDate.Text        = DateTime.Now.ToString();
                tbLoginCount.Text       = string.Empty;
                tbLoginPassword.Text    = string.Empty;
                tbActivationID.Text     = string.Empty;
                msContact.SelectedIndex = 0;
            }

            OnUpdated(EventArgs.Empty);
        }