public static int Update(int ID, bool Aktiv, int Site_FK, int Parent_ID, int Sort, bool IncludeInMenu, bool IsDeleted, bool IsDisabled, string PageName, string PageTitle, string Description, string Keywords, int Template_ID, int Category_ID, int LinkType_ID, string LinkUrl, int LinkPage_ID, string LinkTarget, DateTime OpenDate, DateTime ExpireDate)
        {
            InfositePages isp = InfositePages.GetInfositePages(ID);

            isp.Aktiv         = Aktiv;
            isp.Site_FK       = Site_FK;
            isp.Parent_ID     = Parent_ID;
            isp.Sort          = Sort;
            isp.IncludeInMenu = IncludeInMenu;
            isp.IsDeleted     = IsDeleted;
            isp.IsDisabled    = IsDisabled;
            isp.Forside       = false; // Forside
            isp.PageName      = PageName;
            isp.PageTitle     = PageTitle;
            isp.Description   = Description;
            isp.Keywords      = Keywords;
            isp.Template_ID   = Template_ID;
            isp.Category_ID   = Category_ID;
            isp.LinkType_ID   = LinkType_ID;
            isp.LinkUrl       = LinkUrl;
            isp.LinkPage_ID   = LinkPage_ID;
            isp.LinkTarget    = LinkTarget;
            isp.OpenDate      = OpenDate;
            isp.ExpireDate    = ExpireDate;
            return(Update(isp));
        }
        private static void PopulateInfositePages(SqlDataReader dr, InfositePages isp)
        {
            var with_1 = isp;

            with_1.ID            = System.Convert.ToInt32(dr.DBtoInt("ID"));
            with_1.Aktiv         = System.Convert.ToBoolean(dr.DBtoInt("Aktiv"));
            with_1.Site_FK       = System.Convert.ToInt32(dr.DBtoInt("Site_FK"));
            with_1.Parent_ID     = System.Convert.ToInt32(dr.DBtoInt("Parent_ID"));
            with_1.Sort          = System.Convert.ToInt32(dr.DBtoInt("Sort"));
            with_1.IncludeInMenu = System.Convert.ToBoolean(dr.DBtoBool("IncludeInMenu"));
            with_1.IsDeleted     = System.Convert.ToBoolean(dr.DBtoBool("IsDeleted"));
            with_1.IsDisabled    = System.Convert.ToBoolean(dr.DBtoBool("IsDisabled"));
            with_1.Forside       = System.Convert.ToBoolean(dr.DBtoBool("Forside"));
            with_1.PageName      = dr.DBtoString("PageName");
            with_1.PageTitle     = dr.DBtoString("PageTitle");
            with_1.Description   = dr.DBtoString("Description");
            with_1.Keywords      = dr.DBtoString("Keywords");
            with_1.Template_ID   = System.Convert.ToInt32(dr.DBtoInt("Template_ID"));
            with_1.Category_ID   = System.Convert.ToInt32(dr.DBtoInt("Category_ID"));
            with_1.LinkType_ID   = System.Convert.ToInt32(dr.DBtoInt("LinkType_ID"));
            with_1.LinkUrl       = dr.DBtoString("LinkUrl");
            with_1.LinkPage_ID   = System.Convert.ToInt32(dr.DBtoInt("LinkPage_ID"));
            with_1.LinkTarget    = dr.DBtoString("LinkTarget");
            with_1.OpenDate      = System.Convert.ToDateTime(dr.DBtoDate("OpenDate"));
            with_1.ExpireDate    = System.Convert.ToDateTime(dr.DBtoDate("ExpireDate"));
        }
        private static void PopulateDBwithInfositePages(DBAccess db, InfositePages po)
        {
            var with_1 = po;

            db.AddBoolean("@Aktiv", with_1.Aktiv);
            db.AddInt("Site_FK", with_1.Site_FK);
            db.AddInt("Parent_ID", with_1.Parent_ID);
            //	db.AddInt("Sort", .Sort)
            db.AddBoolean("@IncludeInMenu", with_1.IncludeInMenu);
            db.AddBoolean("@Forside", with_1.Forside);

            db.AddBoolean("@IsDisabled", with_1.IsDisabled);
            db.AddBoolean("@IsDeleted", with_1.IsDeleted);

            db.AddNVarChar("PageName", with_1.PageName, 50);
            db.AddNVarChar("PageTitle", with_1.PageTitle, 50);
            db.AddNVarChar("Description", with_1.Description, 250);
            db.AddNVarChar("Keywords", with_1.Keywords, 250);
            db.AddInt("Template_ID", with_1.Template_ID);
            db.AddInt("Category_ID", with_1.Category_ID);
            db.AddInt("LinkType_ID", with_1.LinkType_ID);
            db.AddNVarChar("LinkUrl", with_1.LinkUrl, 250);
            db.AddInt("LinkPage_ID", with_1.LinkPage_ID);
            db.AddNVarChar("LinkTarget", with_1.LinkTarget, 50);
            db.AddDateTime("OpenDate", with_1.OpenDate);
            db.AddDateTime("ExpireDate", with_1.ExpireDate);
            db.AddNVarChar("RettetAf", with_1.CurUser);
            db.AddNVarChar("RettetIP", with_1.CurIP);
        }
        public static int Update(InfositePages isp)
        {
            DBAccess db     = new DBAccess();
            var      with_1 = isp;

            PopulateDBwithInfositePages(db, isp);
            db.AddInt("ID", with_1.ID);
            int retval = db.ExecuteNonQuery("Co2Db_InfositePages_Update");

            return(retval);
        }
        public static int Insert(InfositePages isp)
        {
            DBAccess db = new DBAccess();

            PopulateDBwithInfositePages(db, isp);

            SqlParameter objParam = new SqlParameter("@ID", 0);

            objParam.Direction = ParameterDirection.Output;
            db.Parameters.Add(objParam);

            int retval = db.ExecuteNonQuery("Co2Db_InfositePages_Insert");

            if (retval == 1)
            {
                isp.ID = int.Parse(objParam.Value.ToString());
                return(isp.ID);
            }
            else
            {
                return(-1);
            }
        }
        public static InfositePages GetInfositePages(int ID)
        {
            DBAccess db = new DBAccess();

            //db.Parameters.Add(New SqlParameter("@ID", ID))
            db.AddInt("ID", ID);
            SqlDataReader dr = (SqlDataReader)(db.ExecuteReader("Co2Db_InfositePages_SelectOne"));

            if (dr.HasRows)
            {
                InfositePages isp = new InfositePages();
                while (dr.Read())
                {
                    PopulateInfositePages(dr, isp);
                }
                dr.Close();
                return(isp);
            }
            else
            {
                dr.Close();
                return(null);
            }
        }
 public static int MoveDown(InfositePages c)
 {
     return(MoveDown(c.ID));
 }
 public static int Delete(InfositePages isp)
 {
     return(Delete(isp.ID));
 }