Ejemplo n.º 1
0
        /// <summary>
        /// Updates the story board information of the page into the the sharepoint list
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void BtnSave_Click(object sender, EventArgs e)
        {
            string strSource = string.Empty;
            string strApplicationPage = string.Empty;
            string strApplicationTemplate = string.Empty;

            try
            {
                TreeNodeSelection objTreeNodeSelection = null;
                objTreeNodeSelection = (TreeNodeSelection)HttpContext.Current.Session[SESSIONWEBPARTPROPERTIES];
                if (objTreeNodeSelection != null)
                {
                    PageID = objTreeNodeSelection.PageID;
                }
                StoryBoard objPageStoryBoard = new StoryBoard();
                objPageStoryBoard.PageId = Convert.ToInt32(PageID);
                objPageStoryBoard.ApplicationPage = txtApplicationGeneratingPage.Text.Trim();
                objPageStoryBoard.ApplicationTemplate = txtApplicationTemplate.Text.Trim();
                objPageStoryBoard.CreatedBy = txtCreatedBy.Text.Trim();
                objPageStoryBoard.CreationDate = txtCreationDate.Text.Trim();
                objPageStoryBoard.Discipline = txtDiscipline.Text.Trim();
                objPageStoryBoard.MasterPageName = txtMasterPageName.Text.Trim();
                objPageStoryBoard.PageOwner = txtPageOwner.Text.Trim();
                objPageStoryBoard.PageTitle = txtPageTitle.Text.Trim();
                objPageStoryBoard.PageType = txtPageType.Text.Trim();
                objPageStoryBoard.SOP = txtSOP.Text.Trim();
                objPageStoryBoard.Source = txtSource.Text.Trim();

                UpdateStoryBoard(DWBSTORYBOARD, CHAPTERPAGESMAPPINGAUDITLIST, PageID, objPageStoryBoard, AUDITACTIONSTORYBOARDUPDATED);
            }
            catch (WebException webEx)
            {
                CommonUtility.HandleException(strParentSiteURL, webEx);
            }
            catch (Exception Ex)
            {
                CommonUtility.HandleException(strParentSiteURL, Ex);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Add page to the chapter
        /// </summary>
        /// <param name="siteURL">The site URL.</param>
        /// <param name="objListentry">ListEntry object.</param>
        /// <param name="listName">Name of the list.</param>
        /// <param name="auditListName">Name of the audit list.</param>
        /// <param name="username">Windows User ID.</param>
        /// <param name="actionPerformed">Audit Action ID</param>
        public void AddPageToChapters(string siteURL, ListEntry objListentry, string listName, string auditListName, string username, string actionPerformed)
        {
            objWellBookChapterDAL = new WellBookChapterDAL();
            string strPageID = objWellBookChapterDAL.AddPageToChapter(siteURL, objListentry, listName, auditListName, username, actionPerformed);

            if (!string.IsNullOrEmpty(strPageID) && objListentry != null && objListentry.ChapterPagesMapping != null)
            {
                StoryBoard objStoryBoard = new StoryBoard();
                objStoryBoard.PageId = Int32.Parse(strPageID);
                objStoryBoard.PageOwner = objListentry.ChapterPagesMapping[0].PageOwner;
                objStoryBoard.PageType = objListentry.ChapterPagesMapping[0].AssetType;
                objStoryBoard.SOP = objListentry.ChapterPagesMapping[0].StandardOperatingProc;
                objStoryBoard.PageTitle = objListentry.ChapterPagesMapping[0].PageName;
                objStoryBoard.Discipline = objListentry.ChapterPagesMapping[0].Discipline;
                objStoryBoard.ConnectionType = objListentry.ChapterPagesMapping[0].ConnectionType;
                objStoryBoard.MasterPageName = objListentry.ChapterPagesMapping[0].PageActualName;
                objStoryBoard.CreatedBy = objListentry.ChapterPagesMapping[0].Created_By;
                objStoryBoard.CreationDate = objListentry.ChapterPagesMapping[0].Created_Date;

                string strCAMLQuery = @"<Where><Eq><FieldRef Name='Page_ID' /><Value Type='Number'>" + strPageID + "</Value></Eq></Where>";
                objWellBookChapterDAL.UpdateStoryBoard(siteURL, DWBSTORYBOARD, CHAPTERPAGESMAPPINGAUDITLIST, strCAMLQuery, strPageID, objStoryBoard, actionPerformed, username);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Updates the Story board.
        /// </summary>
        /// <param name="parentSiteURL">The site URL.</param>
        /// <param name="listName">Name of the list.</param>
        /// <param name="auditListName">Audit List Name.</param>
        /// <param name="camlQuery">CAML Query.</param>
        /// <param name="pageID">Page ID.</param>
        /// <param name="pageStoryBoard">StoryBoard object.</param>
        /// <param name="actionPerformed">Audit action.</param>
        /// <param name="userName">User Name.</param>
        /// <exception cref="">Handled in calling method.</exception>
        internal void UpdateStoryBoard(string siteURL, string listName, string auditListName, string camlQuery, string pageID, StoryBoard pageStoryBoard, string actionPerformed, string userName)
        {
            SPList list;
            SPListItem objListItem;
            SPQuery spQuery = null;
            SPListItemCollection objListItemCollection = null;
            SPSecurity.RunWithElevatedPrivileges(delegate()
            {
                using (SPSite site = new SPSite(siteURL))
                {
                    using (SPWeb web = site.OpenWeb())
                    {
                        web.AllowUnsafeUpdates = true;
                        list = web.Lists[listName];
                        spQuery = new SPQuery();
                        spQuery.Query = camlQuery;

                        objListItemCollection = list.GetItems(spQuery);
                        if (objListItemCollection.Count > 0)
                        {
                            objListItem = objListItemCollection[0];
                        }
                        else
                        {
                            objListItem = list.Items.Add();
                        }
                        if (pageStoryBoard.PageId > 0)
                            objListItem["Page_ID"] = pageStoryBoard.PageId;
                        if (!string.IsNullOrEmpty(pageStoryBoard.PageTitle))
                            objListItem["Page_Title"] = pageStoryBoard.PageTitle;
                        if (!string.IsNullOrEmpty(pageStoryBoard.ConnectionType))
                            objListItem["Connection_Type"] = pageStoryBoard.ConnectionType;
                        if (!string.IsNullOrEmpty(pageStoryBoard.Source))
                            objListItem["Source"] = pageStoryBoard.Source;
                        if (!string.IsNullOrEmpty(pageStoryBoard.Discipline))
                            objListItem["Discipline"] = pageStoryBoard.Discipline;
                        if (!string.IsNullOrEmpty(pageStoryBoard.MasterPageName))
                            objListItem["Master_Page"] = pageStoryBoard.MasterPageName;
                        if (!string.IsNullOrEmpty(pageStoryBoard.ApplicationTemplate))
                            objListItem["Application_Template"] = pageStoryBoard.ApplicationTemplate;
                        if (!string.IsNullOrEmpty(pageStoryBoard.ApplicationPage))
                            objListItem["Application_Page"] = pageStoryBoard.ApplicationPage;
                        if (!string.IsNullOrEmpty(pageStoryBoard.SOP))
                            objListItem["SOP"] = pageStoryBoard.SOP;
                        if (!string.IsNullOrEmpty(pageStoryBoard.CreatedBy))
                            objListItem["Created_By"] = pageStoryBoard.CreatedBy;
                        if (!string.IsNullOrEmpty(pageStoryBoard.CreationDate))
                            objListItem["Creation_Date"] = Convert.ToDateTime(pageStoryBoard.CreationDate).ToString("yyyy-MM-ddTHH:mm:ssZ");
                        if (!string.IsNullOrEmpty(pageStoryBoard.PageOwner))
                            objListItem["Page_Owner"] = pageStoryBoard.PageOwner;
                        if (!string.IsNullOrEmpty(pageStoryBoard.PageType))
                            objListItem["Page_Type"] = pageStoryBoard.PageType;
                        objListItem.Update();
                        web.AllowUnsafeUpdates = false;
                        if (string.Compare(actionPerformed, AUDIT_ACTION_STORYBOARD_UPDATED, true) == 0)
                        {
                            objCommonDAL = new CommonDAL();
                            objCommonDAL.UpdateListAuditHistory(siteURL, auditListName, Convert.ToInt32(pageID), userName, actionPerformed);
                        }
                    }
                }
            });
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Updates the Story Board
 /// </summary>
 /// <param name="parentSiteURL">Site URL.</param>
 /// <param name="listName">List Name.</param>
 /// <param name="auditListName">Audit List Name.</param>
 /// <param name="camlQuery">CAML Query.</param>
 /// <param name="pageID">Page ID.</param>
 /// <param name="pageStoryBoard">StoryBoard object.</param>
 /// <param name="userName">Windows User ID.</param>
 /// <param name="actionPerformed">Audit Action ID.</param>
 public void UpdateStoryBoard(string parentSiteURL, string listName, string auditListName, string camlQuery, string pageID, StoryBoard pageStoryBoard, string userName, string actionPerformed)
 {
     objWellBookChapterDAL = new WellBookChapterDAL();
     objWellBookChapterDAL.UpdateStoryBoard(parentSiteURL, listName, auditListName, camlQuery, pageID, pageStoryBoard, actionPerformed, userName);
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Updates the list entry.
        /// </summary>
        /// <param name="siteURL">The site URL.</param>
        /// <param name="listEntry">The list entry.</param>
        /// <param name="auditListName">Name of the audit list.</param>
        /// <param name="listName">Name of the list.</param>
        /// <param name="userName">Name of the user.</param>
        /// <param name="actionPerformed">The action performed.</param>
        public void UpdateListEntry(string siteURL, ListEntry listEntry, string auditListName, string listName, string userName, string actionPerformed)
        {
            objWellBookChapterDAL = new WellBookChapterDAL();
            objCommonDAL = new CommonDAL();

            string strChapterID = objWellBookChapterDAL.UpdateListEntry(siteURL, listEntry, listName, auditListName, userName, actionPerformed);
            if (listEntry != null && listEntry.ChapterPagesMapping != null)
            {
                if (listEntry.ChapterPagesMapping.Count > 0 && actionPerformed.Contains(AUDIT_ACTION_CREATION))
                {
                    objWellBookChapterDAL.AddChapterMasterPageMapping(siteURL, listEntry, CHAPTERPAGESMAPPINGLIST, CHAPTERPAGESMAPPINGAUDITLIST, userName, actionPerformed);

                     string strCAMLQuery = string.Empty;
                     DataTable dtChapterPages = null;
                     DataTable dtMasterPage = null;
                     DataTable dtTemplate = null;
                     string strViewFields = string.Empty;
                     int intMasterPageID;
                     if (!string.IsNullOrEmpty(strChapterID))
                     {
                         strCAMLQuery = @"<Where><Eq><FieldRef Name='Chapter_ID'/><Value Type='Number'>" + strChapterID + "</Value></Eq></Where>";
                         dtChapterPages = objCommonDAL.ReadList(siteURL, CHAPTERPAGESMAPPINGLIST, strCAMLQuery);
                     }
                    if (dtChapterPages != null && dtChapterPages.Rows.Count > 0)
                     {
                         foreach (DataRow dtRow in dtChapterPages.Rows)
                         {
                             StoryBoard objStoryBoard = new StoryBoard();
                             objStoryBoard.PageId = Int32.Parse(dtRow["ID"].ToString());
                             objStoryBoard.PageOwner = dtRow["Owner"].ToString();
                             objStoryBoard.PageType = dtRow["Asset_Type"].ToString();
                             objStoryBoard.SOP = dtRow["Standard_Operating_Procedure"].ToString();
                             objStoryBoard.PageTitle = dtRow["Page_Actual_Name"].ToString();
                             objStoryBoard.Discipline = dtRow["Discipline"].ToString();
                             objStoryBoard.ConnectionType = dtRow["Connection_Type"].ToString();

                             intMasterPageID = Int32.Parse(dtRow["Master_Page_ID"].ToString());
                             strCAMLQuery = string.Empty;

                             strCAMLQuery = @"<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + intMasterPageID.ToString() + "</Value></Eq></Where>";
                             strViewFields = @"<FieldRef Name='ID'/><FieldRef Name='Master_Page_ID'/>";
                             dtTemplate = objCommonDAL.ReadList(siteURL, DWBTEMPLATEPAGESLIST, strCAMLQuery, strViewFields);
                             if (dtTemplate != null && dtTemplate.Rows.Count > 0)
                             {
                                 intMasterPageID = Int32.Parse(dtTemplate.Rows[0]["Master_Page_ID"].ToString());
                             }

                             strCAMLQuery = @"<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + intMasterPageID.ToString() + "</Value></Eq></Where>";
                             strViewFields = @"<FieldRef Name='ID'/><FieldRef Name='Page_Owner'/><FieldRef Name='Created'/><FieldRef Name='Title'/>";
                             dtMasterPage = objCommonDAL.ReadList(siteURL, DWBMASTERPAGESLIST, strCAMLQuery, strViewFields);

                             if (dtMasterPage != null && dtMasterPage.Rows.Count > 0)
                             {
                                 objStoryBoard.MasterPageName = dtMasterPage.Rows[0]["Title"].ToString();
                                 objStoryBoard.CreatedBy = dtMasterPage.Rows[0]["Page_Owner"].ToString();
                                 objStoryBoard.CreationDate = dtMasterPage.Rows[0]["Created"].ToString();
                             }
                             strCAMLQuery = string.Empty;
                             strCAMLQuery = @"<Where><Eq><FieldRef Name='Page_ID' /><Value Type='Number'>" + objStoryBoard.PageId.ToString() + "</Value></Eq></Where>";
                             objWellBookChapterDAL.UpdateStoryBoard(siteURL, DWBSTORYBOARD, CHAPTERPAGESMAPPINGAUDITLIST, strCAMLQuery, objStoryBoard.PageId.ToString(), objStoryBoard, actionPerformed, userName);
                         }
                     }
                     if (dtChapterPages != null)
                     {
                         dtChapterPages.Dispose();
                     }
                     if (dtMasterPage != null)
                     {
                         dtMasterPage.Dispose();
                     }
                }
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Updates the Pages details in a Well Book.
        /// </summary>
        /// <param name="siteURL">The site URL.</param>
        /// <param name="listEntry">The list entry.</param>
        /// <param name="listName">Name of the list.</param>
        /// <param name="auditListName">Audit List Name.</param>
        /// <param name="userName">User Name.</param>
        /// <param name="actionPerformed">Audit Action.</param>
        /// <exception cref="">Handled in calling method.</exception>
        internal void UpdateBookPage(string siteURL, ListEntry listEntry, string listName, string auditListName, string userName, string actionPerformed)
        {
            SPList list;
            SPListItem objListItem;
            DataTable dtlistItem = null;
            int intId = 0;
            int intRowId = 0;
            int intPageSequence = 0;
            DataView dvResultView;
            SPQuery query = null;
            string strCAMLQuery = string.Empty;
            try
            {
                SPSecurity.RunWithElevatedPrivileges(delegate()
                {
                    using (SPSite site = new SPSite(siteURL))
                    {
                        using (SPWeb web = site.OpenWeb())
                        {
                            web.AllowUnsafeUpdates = true;
                            list = web.Lists[listName];
                            objListItem = list.Items.Add();
                            if (string.Equals(actionPerformed, AUDIT_ACTION_UPDATION))
                            {
                                objListItem = list.GetItemById(listEntry.MasterPage.RowId);
                            }
                            objListItem["Page_Name"] = listEntry.MasterPage.Name;
                            objListItem["Page_Actual_Name"] = listEntry.MasterPage.TemplateTitle;
                            objListItem["Page_Sequence"] = listEntry.MasterPage.PageSequence;
                            objListItem["Standard_Operating_Procedure"] = listEntry.MasterPage.SOP;
                            objListItem["Discipline"] = listEntry.MasterPage.SignOffDiscipline;
                            objListItem.Update();
                            int.TryParse((objListItem["ID"].ToString()), out intId);
                            listEntry.MasterPage.RowId = intId;
                            /// start
                            query = new SPQuery();
                            query.Query = @"<Where><And><Eq><FieldRef Name='Terminate_Status' />
              <Value Type='Choice'>No</Value></Eq><Eq><FieldRef Name='Chapter_ID' />
              <Value Type='Number'>" + Convert.ToString(objListItem["Chapter_ID"]) + "</Value></Eq></And></Where>";
                            dtlistItem = list.GetItems(query).GetDataTable();
                            if (dtlistItem != null && dtlistItem.Rows.Count > 0)
                            {
                                dvResultView = dtlistItem.DefaultView;
                                dvResultView.Sort = "Page_Sequence asc";
                                for (int intIndex = 0; intIndex < dvResultView.Count; intIndex++)
                                {
                                    intPageSequence = intPageSequence + 10;
                                    intRowId = (int)dvResultView[intIndex]["ID"];
                                    objListItem = list.GetItemById(intRowId);
                                    objListItem["Page_Sequence"] = intPageSequence;

                                    objListItem.Update();
                                }
                            }
                            /// end
                            web.AllowUnsafeUpdates = false;
                            objCommonDAL = new CommonDAL();
                            objCommonDAL.UpdateListAuditHistory(siteURL, auditListName, listEntry.MasterPage.RowId, userName, actionPerformed);
                            /// Update the values to StoryBoard list
                            WellBookChapterDAL objWellBookChapterDAL = new WellBookChapterDAL();
                            StoryBoard objStoryBoard = new StoryBoard();
                            objListItem = list.GetItemById(listEntry.MasterPage.RowId);

                            if (objListItem != null)
                            {
                                objStoryBoard.PageId = Int32.Parse(Convert.ToString(objListItem["ID"]));
                                objStoryBoard.SOP = Convert.ToString(objListItem["Standard_Operating_Procedure"]);
                                objStoryBoard.PageTitle = Convert.ToString(objListItem["Page_Actual_Name"]);
                                objStoryBoard.Discipline = Convert.ToString(objListItem["Discipline"]);

                                strCAMLQuery = string.Empty;
                                strCAMLQuery = @"<Where><Eq><FieldRef Name='Page_ID' /><Value Type='Number'>" + objStoryBoard.PageId.ToString() + "</Value></Eq></Where>";
                                objWellBookChapterDAL.UpdateStoryBoard(siteURL, DWBSTORYBOARD, CHAPTERPAGESMAPPINGAUDITLIST, strCAMLQuery, objStoryBoard.PageId.ToString(), objStoryBoard, actionPerformed, userName);
                            }
                        }
                    }
                });
            }
            finally
            {
                if (dtlistItem != null) dtlistItem.Dispose();
            }
        }