Example #1
0
        internal bool PopulateFromReader(IDataReader reader)
        {
            if (reader.Read())
            {
                this.guid        = new Guid(reader["Guid"].ToString());
                this.siteGuid    = new Guid(reader["SiteGuid"].ToString());
                this.userGuid    = new Guid(reader["UserGuid"].ToString());
                this.moduleGuid  = new Guid(reader["ModuleGuid"].ToString());
                this.contentText = reader["ContentText"].ToString();
                this.customData  = reader["CustomData"].ToString();

                object val = reader["CustomReferenceNumber"];
                this.customReferenceNumber = val == DBNull.Value ? -1 : Convert.ToInt32(val);

                val = reader["CustomReferenceGuid"];
                this.customReferenceGuid = val == DBNull.Value ? Guid.Empty : new Guid(val.ToString());

                this.createdDateUtc = Convert.ToDateTime(reader["CreatedDateUtc"]);

                //val = reader["LastModUserGuid"];
                //this.lastModUserGuid = val == DBNull.Value ? null : (Guid?)new Guid(val.ToString());
                this.lastModUserGuid = new Guid(reader["LastModUserGuid"].ToString());

                //val = reader["LastModUtc"];
                //this.lastModUtc = val == DBNull.Value ? null : (DateTime?)DateTime.Parse(val.ToString());

                this.lastModUtc = Convert.ToDateTime(reader["LastModUtc"]);

                this.createdByUserLogin = reader["CreatedByUserLogin"].ToString();
                this.createdByUserName  = reader["CreatedByUserName"].ToString();

                this.recentActionByUserLogin = reader["RecentActionByUserLogin"].ToString();
                this.recentActionByUserName  = reader["RecentActionByUserName"].ToString();
                this.recentActionByUserEmail = reader["RecentActionByUserEmail"].ToString();

                string statusVal = reader["Status"].ToString();
                this.status = String.IsNullOrEmpty(statusVal)
                    ? ContentWorkflowStatus.None
                    : (ContentWorkflowStatus)Enum.Parse(typeof(ContentWorkflowStatus), statusVal);

                this.originalStatus = status;

                this.notes = reader["Notes"].ToString();

                //val = reader["RecentActionOn"];
                //this.recentActionOn = val == null ? null : (DateTime?)DateTime.Parse(val.ToString());
                if (reader["RecentActionOn"] != DBNull.Value)
                {
                    this.recentActionOn = Convert.ToDateTime(reader["RecentActionOn"]);
                }

                this.moduleTitle = reader["ModuleTitle"].ToString();

                return(true);
            }

            return(false);
        }
Example #2
0
        public bool RejectContentChanges(Guid rejectorGuid, string rejectionReason)
        {
            this.status          = ContentWorkflowStatus.ApprovalRejected;
            this.lastModUserGuid = rejectorGuid;
            this.lastModUtc      = DateTime.UtcNow;
            this.notes           = rejectionReason;
            return(Save());


            //return DBContentWorkflow.RejectContentChanges(moduleGuid, rejectorGuid, rejectionReason);
        }
Example #3
0
        internal bool PopulateFromReader(IDataReader reader)
        {
            if (reader.Read())
            {
                this.guid = new Guid(reader["Guid"].ToString());
                this.siteGuid = new Guid(reader["SiteGuid"].ToString());
                this.userGuid = new Guid(reader["UserGuid"].ToString());
                this.moduleGuid = new Guid(reader["ModuleGuid"].ToString());
                this.contentText = reader["ContentText"].ToString();
                this.customData = reader["CustomData"].ToString();

                object val = reader["CustomReferenceNumber"];
                this.customReferenceNumber = val == DBNull.Value ? -1 : Convert.ToInt32(val);

                val = reader["CustomReferenceGuid"];
                this.customReferenceGuid = val == DBNull.Value ? Guid.Empty : new Guid(val.ToString());

                this.createdDateUtc = Convert.ToDateTime(reader["CreatedDateUtc"]);

                //val = reader["LastModUserGuid"];
                //this.lastModUserGuid = val == DBNull.Value ? null : (Guid?)new Guid(val.ToString());
                this.lastModUserGuid = new Guid(reader["LastModUserGuid"].ToString());

                //val = reader["LastModUtc"];
                //this.lastModUtc = val == DBNull.Value ? null : (DateTime?)DateTime.Parse(val.ToString());

                this.lastModUtc = Convert.ToDateTime(reader["LastModUtc"]);

                this.createdByUserLogin = reader["CreatedByUserLogin"].ToString();
                this.createdByUserName = reader["CreatedByUserName"].ToString();

                this.createdByUserFirstName = reader["CreatedByFirstName"].ToString();
                this.createdByUserLastName = reader["CreatedByLastName"].ToString();
                this.authorEmail = reader["CreatedByUserEmail"].ToString();
                this.authorAvatar = reader["CreatedByAvatar"].ToString();
                this.authorBio = reader["CreatedByAuthorBio"].ToString();
                this.authorUserId = Convert.ToInt32(reader["CreatedByUserID"]);

                this.lastModByUserLastName = reader["ModifiedByUserName"].ToString();
                this.lastModByUserFirstName = reader["ModifiedByFirstName"].ToString();
                this.lastModByUserLastName = reader["ModifiedByLastName"].ToString();

                this.recentActionByUserLogin = reader["RecentActionByUserLogin"].ToString();
                this.recentActionByUserName = reader["RecentActionByUserName"].ToString();
                this.recentActionByUserEmail = reader["RecentActionByUserEmail"].ToString();

                string statusVal = reader["Status"].ToString();
                this.status = String.IsNullOrEmpty(statusVal)
                    ? ContentWorkflowStatus.None
                    : (ContentWorkflowStatus)Enum.Parse(typeof(ContentWorkflowStatus), statusVal);

                this.originalStatus = status;

                this.notes = reader["Notes"].ToString();

                //val = reader["RecentActionOn"];
                //this.recentActionOn = val == null ? null : (DateTime?)DateTime.Parse(val.ToString());
                if (reader["RecentActionOn"] != DBNull.Value)
                {
                    this.recentActionOn = Convert.ToDateTime(reader["RecentActionOn"]);
                }

                this.moduleTitle = reader["ModuleTitle"].ToString();

                return true;
            }

            return false;
        }
Example #4
0
        public bool RejectContentChanges(Guid rejectorGuid, string rejectionReason)
        {
            this.status = ContentWorkflowStatus.ApprovalRejected;
            this.lastModUserGuid = rejectorGuid;
            this.lastModUtc = DateTime.UtcNow;
            this.notes = rejectionReason;
            return Save();

            //return DBContentWorkflow.RejectContentChanges(moduleGuid, rejectorGuid, rejectionReason);
        }
Example #5
0
        /// <summary>
        /// Returns a DataSet with a page ContentWorkflow items and their related pagesettings info
        /// </summary>
        /// <param name="siteGuid"></param>
        /// <param name="status"></param>
        /// <param name="pageNumber"></param>
        /// <param name="pageSize"></param>
        /// <param name="totalPages"></param>
        /// <returns></returns>
        public static DataSet GetPageOfWorkflowsWithPageInfo(Guid siteGuid, ContentWorkflowStatus status, int pageNumber, int pageSize, out int totalPages)
        {
            DataSet dataSet = new DataSet();

            DataTable workFlowsTable = GetEmptyTable();
            using (IDataReader reader = DBContentWorkflow.GetPage(
                                    siteGuid,
                                    status.ToString(),
                                    pageNumber,
                                    pageSize,
                                    out totalPages))
            {
                while (reader.Read())
                {
                    DataRow row = workFlowsTable.NewRow();

                    row["Guid"] = new Guid(reader["Guid"].ToString());
                    row["SiteGuid"] = new Guid(reader["SiteGuid"].ToString());
                    row["UserGuid"] = new Guid(reader["UserGuid"].ToString());
                    row["LastModUserGuid"] = new Guid(reader["LastModUserGuid"].ToString());
                    row["ModuleGuid"] = new Guid(reader["ModuleGuid"].ToString());
                    row["CustomReferenceGuid"] = new Guid(reader["CustomReferenceGuid"].ToString());
                    row["ModuleID"] = Convert.ToInt32(reader["ModuleID"]);
                    row["ModuleTitle"] = reader["ModuleTitle"];

                    row["ContentText"] = reader["ContentText"];
                    row["CustomData"] = reader["CustomData"];
                    row["CustomReferenceNumber"] = Convert.ToInt32(reader["CustomReferenceNumber"]);
                    row["CreatedDateUtc"] = Convert.ToDateTime(reader["CreatedDateUtc"]);
                    row["LastModUtc"] = Convert.ToDateTime(reader["LastModUtc"]);
                    row["CreatedByUserLogin"] = reader["CreatedByUserLogin"];
                    row["CreatedByUserName"] = reader["CreatedByUserName"];
                    row["RecentActionByUserLogin"] = reader["RecentActionByUserLogin"];
                    row["RecentActionByUserName"] = reader["RecentActionByUserName"];
                    row["RecentActionByUserEmail"] = reader["RecentActionByUserEmail"];
                    row["Status"] = reader["Status"];
                    row["Notes"] = reader["Notes"];
                    if (reader["RecentActionOn"] != DBNull.Value)
                    {
                        row["RecentActionOn"] = Convert.ToDateTime(reader["RecentActionOn"]);
                    }
                    else
                    {
                        row["RecentActionOn"] = DateTime.UtcNow;
                    }

                    workFlowsTable.Rows.Add(row);

                }

            }

            DataTable pageInfoTable = GetEmptyPageInfoTable();

            using (IDataReader reader = DBContentWorkflow.GetPageInfoForPage(
                                    siteGuid,
                                    status.ToString(),
                                    pageNumber,
                                    pageSize))
            {
                while (reader.Read())
                {
                    DataRow row = pageInfoTable.NewRow();
                    int pageId = Convert.ToInt32(reader["PageID"]);
                    row["PageID"] = pageId;
                    row["PageGuid"] = new Guid(reader["PageGuid"].ToString());
                    row["WorkflowGuid"] = new Guid(reader["WorkflowGuid"].ToString());
                    row["PageName"] = reader["PageName"];
                    bool useUrl = Convert.ToBoolean(reader["UseUrl"]);

                    if (useUrl)
                    {
                        row["PageUrl"] = reader["PageUrl"];
                    }
                    else
                    {
                        row["PageUrl"] = "~/Default.aspx?pageid=" + pageId.ToString(CultureInfo.InvariantCulture);
                    }

                    pageInfoTable.Rows.Add(row);

                }

            }

            workFlowsTable.TableName = "WorkFlows";
            dataSet.Tables.Add(workFlowsTable);

            pageInfoTable.TableName = "PageInfo";
            dataSet.Tables.Add(pageInfoTable);

            // create a relationship
            dataSet.Relations.Add("workflowPages",
                dataSet.Tables["WorkFlows"].Columns["Guid"],
                dataSet.Tables["PageInfo"].Columns["WorkflowGuid"]);

            return dataSet;
        }
Example #6
0
        /// <summary>
        /// Returns a DataSet with a page ContentWorkflow items and their related pagesettings info
        /// </summary>
        /// <param name="siteGuid"></param>
        /// <param name="status"></param>
        /// <param name="pageNumber"></param>
        /// <param name="pageSize"></param>
        /// <param name="totalPages"></param>
        /// <returns></returns>
        public static DataSet GetPageOfWorkflowsWithPageInfo(Guid siteGuid, ContentWorkflowStatus status, int pageNumber, int pageSize, out int totalPages)
        {
            DataSet dataSet = new DataSet();

            DataTable workFlowsTable = GetEmptyTable();

            using (IDataReader reader = DBContentWorkflow.GetPage(
                       siteGuid,
                       status.ToString(),
                       pageNumber,
                       pageSize,
                       out totalPages))
            {
                while (reader.Read())
                {
                    DataRow row = workFlowsTable.NewRow();

                    row["Guid"]                = new Guid(reader["Guid"].ToString());
                    row["SiteGuid"]            = new Guid(reader["SiteGuid"].ToString());
                    row["UserGuid"]            = new Guid(reader["UserGuid"].ToString());
                    row["LastModUserGuid"]     = new Guid(reader["LastModUserGuid"].ToString());
                    row["ModuleGuid"]          = new Guid(reader["ModuleGuid"].ToString());
                    row["CustomReferenceGuid"] = new Guid(reader["CustomReferenceGuid"].ToString());
                    row["ModuleID"]            = Convert.ToInt32(reader["ModuleID"]);
                    row["ModuleTitle"]         = reader["ModuleTitle"];

                    row["ContentText"]             = reader["ContentText"];
                    row["CustomData"]              = reader["CustomData"];
                    row["CustomReferenceNumber"]   = Convert.ToInt32(reader["CustomReferenceNumber"]);
                    row["CreatedDateUtc"]          = Convert.ToDateTime(reader["CreatedDateUtc"]);
                    row["LastModUtc"]              = Convert.ToDateTime(reader["LastModUtc"]);
                    row["CreatedByUserLogin"]      = reader["CreatedByUserLogin"];
                    row["CreatedByUserName"]       = reader["CreatedByUserName"];
                    row["RecentActionByUserLogin"] = reader["RecentActionByUserLogin"];
                    row["RecentActionByUserName"]  = reader["RecentActionByUserName"];
                    row["RecentActionByUserEmail"] = reader["RecentActionByUserEmail"];
                    row["Status"] = reader["Status"];
                    row["Notes"]  = reader["Notes"];
                    if (reader["RecentActionOn"] != DBNull.Value)
                    {
                        row["RecentActionOn"] = Convert.ToDateTime(reader["RecentActionOn"]);
                    }
                    else
                    {
                        row["RecentActionOn"] = DateTime.UtcNow;
                    }

                    workFlowsTable.Rows.Add(row);
                }
            }

            DataTable pageInfoTable = GetEmptyPageInfoTable();

            using (IDataReader reader = DBContentWorkflow.GetPageInfoForPage(
                       siteGuid,
                       status.ToString(),
                       pageNumber,
                       pageSize))
            {
                while (reader.Read())
                {
                    DataRow row    = pageInfoTable.NewRow();
                    int     pageId = Convert.ToInt32(reader["PageID"]);
                    row["PageID"]       = pageId;
                    row["PageGuid"]     = new Guid(reader["PageGuid"].ToString());
                    row["WorkflowGuid"] = new Guid(reader["WorkflowGuid"].ToString());
                    row["PageName"]     = reader["PageName"];
                    bool useUrl = Convert.ToBoolean(reader["UseUrl"]);

                    if (useUrl)
                    {
                        row["PageUrl"] = reader["PageUrl"];
                    }
                    else
                    {
                        row["PageUrl"] = "~/Default.aspx?pageid=" + pageId.ToString(CultureInfo.InvariantCulture);
                    }

                    pageInfoTable.Rows.Add(row);
                }
            }

            workFlowsTable.TableName = "WorkFlows";
            dataSet.Tables.Add(workFlowsTable);

            pageInfoTable.TableName = "PageInfo";
            dataSet.Tables.Add(pageInfoTable);

            // create a relationship
            dataSet.Relations.Add("workflowPages",
                                  dataSet.Tables["WorkFlows"].Columns["Guid"],
                                  dataSet.Tables["PageInfo"].Columns["WorkflowGuid"]);



            return(dataSet);
        }