コード例 #1
0
ファイル: MasterPageBLL.cs プロジェクト: vijaymca/Dotnet
        /// <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)
        {
            objMasterDAL = new MasterDAL();
            objCommonDAL = new CommonDAL();
            string[] strTemplateIds = null;
            string strTemplatemappingRowId = string.Empty;
            objMasterDAL.UpdateListEntry(siteURL, listEntry, listName, actionPerformed);
            if (listEntry.MasterPage.RowId > 0)
            {
                objMasterDAL.UpdateListAuditHistory(siteURL, listName, auditListName, listEntry.MasterPage.RowId, listEntry.MasterPage.Name,
                    userName, actionPerformed);
            }

            if (!string.IsNullOrEmpty(listEntry.MasterPage.Templates) && actionPerformed.Contains(AUDIT_ACTION_CREATION))
            {
                strTemplatemappingRowId = objMasterDAL.AddTemplateMasterPageMapping(siteURL, listEntry, TEMPLATEPAGESMAPPINGLIST);
                strTemplateIds = strTemplatemappingRowId.Split(';');
                if (strTemplateIds != null)
                {
                    for (int intIndex = 0; intIndex < strTemplateIds.Length - 1; intIndex++)
                    {
                        int intRowId = 0;
                        int.TryParse(strTemplateIds[intIndex], out intRowId);
                        objCommonDAL.UpdateListTemplateMappingAuditHistory(siteURL, TEMPLATEPAGESMAPPINGAUDITLIST, intRowId, userName, AUDIT_ACTION_CREATION);

                    }
                }
            }
        }
コード例 #2
0
ファイル: CommonBLL.cs プロジェクト: vijaymca/Dotnet
 /// <summary>
 /// Activates the List items
 /// </summary>
 /// <param name="siteURL">The site URL.</param>
 /// <param name="listName">Name of the list.</param>
 /// <param name="rowID">The row ID.</param>
 /// <param name="auditlistName">Name of the auditlist.</param>
 /// <param name="updatePageSequence">if set to <c>true</c> [update page sequence].</param>
 /// <param name="updateAuditHistory">if set to <c>true</c> [update audit history].</param>
 /// <returns>bool</returns>
 public bool ActivateListValues(string siteURL, string listName, int rowID, string auditlistName, bool updatePageSequence, bool updateAuditHistory)
 {
     objCommonDAL = new CommonDAL();
     objCommonUtility = new CommonUtility();
     objCommonDAL.ListStatusUpdate(siteURL, listName, rowID, NO, updatePageSequence);
     if (updateAuditHistory)
     {
         objCommonDAL.UpdateListAuditHistory(siteURL, auditlistName, rowID, objCommonUtility.GetUserName(), AUDIT_ACTION_ACTIVATE);
     }
     return true;
 }
コード例 #3
0
ファイル: ChapterBLL.cs プロジェクト: vijaymca/Dotnet
 /// <summary>
 /// Gets the collection of the Templates based on the asset.
 /// </summary>
 /// <param name="strSiteURL">Site URL.</param>
 /// <param name="listName">List Name.</param>
 /// <param name="strCAMLQuery">CAML Query.</param>
 /// <returns>Dictionary object.</returns>
 private Dictionary<string, string> GetTemplatesForAsset(string siteURL, string listName, string CAMLQuery)
 {
     Dictionary<string, string> listItemCollection = null;
     DataTable dtResultDatatable = null;
     CommonDAL objCommonDAL = new CommonDAL();
     dtResultDatatable = objCommonDAL.ReadList(siteURL, listName, CAMLQuery);
     if (dtResultDatatable != null && (dtResultDatatable.Rows.Count > 0))
     {
         listItemCollection = new Dictionary<string, string>();
         for (int rowIndex = 0; rowIndex < dtResultDatatable.Rows.Count; rowIndex++)
         {
             if (!listItemCollection.ContainsKey(Convert.ToString(dtResultDatatable.Rows[rowIndex]["ID"])))
             {
                 listItemCollection.Add(Convert.ToString(dtResultDatatable.Rows[rowIndex]["ID"]), Convert.ToString(dtResultDatatable.Rows[rowIndex]["Title"]));
             }
         }
     }
     if (dtResultDatatable != null)
     {
         dtResultDatatable.Dispose();
     }
     return listItemCollection;
 }
コード例 #4
0
ファイル: WellBookBLL.cs プロジェクト: vijaymca/Dotnet
        /// <summary>
        /// Gets the onwers of the team.
        /// </summary>
        /// <param name="siteURL">Site URL.</param>
        /// <param name="listName">List Name.</param>
        /// <param name="queryString">CAML Query.</param>     
        /// <returns>Dictionary object</returns>
        public Dictionary<string, string> GetOwnerForTeam(string siteURL, string listName, string CAMLQuery)
        {
            Dictionary<string, string> listItemCollection = null;
            DataTable dtResultDatatable = null;
            DataTable dtUserDetails = null;
            string strcamlQuery = string.Empty;
            StringBuilder strTeamId = new StringBuilder();
            objCommonDAL = new CommonDAL();
            dtResultDatatable = objCommonDAL.ReadList(siteURL, listName, CAMLQuery);
            if (dtResultDatatable != null && dtResultDatatable.Rows.Count > 0)
            {
                strcamlQuery = @"<Where><Eq><FieldRef Name='Team_ID' />
                 <Value Type='Number'>" + (Convert.ToString(dtResultDatatable.Rows[0]["Team_ID"])) + "</Value></Eq></Where>";
                dtResultDatatable = objCommonDAL.ReadList(siteURL, DWBTEAMSTAFF,
                   strcamlQuery);

                if (dtResultDatatable != null && dtResultDatatable.Rows.Count > 0)
                {
                    for (int intRowIndex = 0; intRowIndex < dtResultDatatable.Rows.Count; intRowIndex++)
                    {
                        strTeamId.Append(Convert.ToString(dtResultDatatable.Rows[intRowIndex]["User_ID"]));
                        strTeamId.Append(";");
                    }
                    objCommonBLL = new CommonBLL();
                    strcamlQuery = objCommonBLL.CreateCAMLQuery(strTeamId.ToString(), IDCOLUMN, IDCOLUMNTYPE, "DWBUserName");
                    dtUserDetails = objCommonDAL.ReadList(siteURL, DWBUSER, strcamlQuery);
                    listItemCollection = new Dictionary<string, string>();
                    for (int intRowIndex = 0; intRowIndex < dtUserDetails.Rows.Count; intRowIndex++)
                    {
                        if (!listItemCollection.ContainsKey(Convert.ToString(dtResultDatatable.Rows[intRowIndex]["ID"])))
                        {
                            listItemCollection.Add(Convert.ToString(dtUserDetails.Rows[intRowIndex][IDCOLUMN]), Convert.ToString(dtUserDetails.Rows[intRowIndex]["Windows_User_ID"]));
                        }
                    }
                }

            }
            if (dtResultDatatable != null)
            {
                dtResultDatatable.Dispose();
            }
            if (dtUserDetails != null)
            {
                dtUserDetails.Dispose();
            }
            return listItemCollection;
        }
コード例 #5
0
ファイル: ChapterBLL.cs プロジェクト: vijaymca/Dotnet
        /// <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();
                     }
                }
            }
        }
コード例 #6
0
ファイル: WellBookChapterDAL.cs プロジェクト: vijaymca/Dotnet
        /// <summary>
        /// Updates the list entry.
        /// </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>
        /// <returns>ID of the Chapter Page Created.</returns>
        /// <exception cref="">Handled in calling method.</exception>
        internal string AddChapterMasterPageMapping(string siteURL, ListEntry listEntry, string listName, string auditListtname, string username, string actionPerformed)
        {
            SPList list;
            SPListItem objListItem;
            int intRowId = 0;
            StringBuilder strTemplatePageMappingRowId = new StringBuilder();
            SPSecurity.RunWithElevatedPrivileges(delegate()
            {
                using (SPSite site = new SPSite(siteURL))
                {
                    using (SPWeb web = site.OpenWeb())
                    {
                        web.AllowUnsafeUpdates = true;
                        list = web.Lists[listName];
                        objCommonDAL = new CommonDAL();

                        string strCAMLQuery = string.Empty;
                        string strViewFields = string.Empty;
                        string strBookTeamID = string.Empty;
                        string strPageOwner = string.Empty;
                        string strUserID = string.Empty;
                        DataTable dtTeamStaff = null;
                        DataTable dtBook = null;
                        DataTable dtUser = null;
                        if (listEntry != null)
                        {
                            /// Get the Team of the book
                            if (listEntry.ChapterDetails != null)
                            {
                                strCAMLQuery = @"<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + listEntry.ChapterDetails.BookID.ToString() + "</Value></Eq></Where>";
                                strViewFields =@"<FieldRef Name='ID' /><FieldRef Name='Team' /><FieldRef Name='Team_ID' />";
                                dtBook = objCommonDAL.ReadList(siteURL, DWBBOOKLIST, strCAMLQuery, strViewFields);
                                if (dtBook != null && dtBook.Rows.Count > 0)
                                {
                                    strBookTeamID = Convert.ToString(dtBook.Rows[0]["Team_ID"]);
                                }
                            }

                            for (int i = 0; i < listEntry.ChapterPagesMapping.Count; i++)
                            {
                                strPageOwner = string.Empty;
                                objListItem = list.Items.Add();
                                objListItem["Master_Page_ID"] = listEntry.ChapterPagesMapping[i].MasterPageID;
                                objListItem["Page_Actual_Name"] = listEntry.ChapterPagesMapping[i].PageActualName;
                                objListItem["Page_Name"] = listEntry.ChapterPagesMapping[i].PageName;

                                objListItem["Discipline"] = listEntry.ChapterPagesMapping[i].Discipline;
                                objListItem["Chapter_ID"] = listEntry.ChapterDetails.RowID;
                                objListItem["Asset_Type"] = listEntry.ChapterPagesMapping[i].AssetType;
                                if (!string.IsNullOrEmpty(listEntry.ChapterPagesMapping[i].Empty))
                                    objListItem["Empty"] = listEntry.ChapterPagesMapping[i].Empty;
                                objListItem["Page_Sequence"] = listEntry.ChapterPagesMapping[i].PageSequence;
                                if (!string.IsNullOrEmpty(listEntry.ChapterPagesMapping[i].SignOffStatus))
                                {
                                    objListItem["Sign_Off_Status"] = listEntry.ChapterPagesMapping[i].SignOffStatus;
                                }
                                objListItem["Standard_Operating_Procedure"] = listEntry.ChapterPagesMapping[i].StandardOperatingProc;
                                objListItem["Connection_Type"] = listEntry.ChapterPagesMapping[i].ConnectionType;
                                if (!string.IsNullOrEmpty(listEntry.ChapterPagesMapping[i].PageURL))
                                {
                                    objListItem["Page_URL"] = listEntry.ChapterPagesMapping[i].PageURL;
                                }
                                strCAMLQuery = string.Empty;
                                strViewFields = string.Empty;
                                /// Retrieve the User with Rank =1 for the selected Team(Book) and Discipline(MasterPage) , "DWB Team Staff" and  assign to "Owner" column
                                if (!string.IsNullOrEmpty(strBookTeamID) && !string.IsNullOrEmpty(listEntry.ChapterPagesMapping[i].Discipline))
                                {
                                    strCAMLQuery = @"<OrderBy><FieldRef Name='User_Rank' Ascending='TRUE' /></OrderBy><Where><And><And><Eq><FieldRef Name='Team_ID' /><Value Type='Number'>" + strBookTeamID + "</Value></Eq><Eq><FieldRef Name='Discipline' /><Value Type='Text'>" + listEntry.ChapterPagesMapping[i].Discipline + "</Value></Eq></And><Eq><FieldRef Name='User_Rank' /><Value Type='Number'>" + "1" + "</Value></Eq></And></Where>";
                                    strViewFields = @"<FieldRef Name='ID' /><FieldRef Name='Team_ID' /><FieldRef Name='Discipline' /><FieldRef Name='User_Rank' /><FieldRef Name='User_ID' /><FieldRef Name='Title' />";
                                    dtTeamStaff = objCommonDAL.ReadList(siteURL, DWBTEAMSTAFFLIST, strCAMLQuery, strViewFields);
                                }
                                if (dtTeamStaff != null && dtTeamStaff.Rows.Count > 0)
                                {
                                    strUserID = Convert.ToString(dtTeamStaff.Rows[0]["User_ID"]);
                                    strCAMLQuery = @"<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + strUserID + "</Value></Eq></Where>";
                                    strViewFields = @"<FieldRef Name='ID' /><FieldRef Name='Windows_User_ID' />";
                                    dtUser = objCommonDAL.ReadList(siteURL, DWBUSERLIST, strCAMLQuery, strViewFields);
                                    if (dtUser != null && dtUser.Rows.Count > 0)
                                    {
                                        strPageOwner = dtUser.Rows[0]["Windows_User_ID"].ToString();
                                    }
                                }
                                if (!string.IsNullOrEmpty(strPageOwner))
                                {
                                    objListItem["Owner"] = strPageOwner;
                                }
                                else /// If no user with Rank =1 or no user for the selected discipline available, assign the Master Page Owner to "Owner" column
                                {
                                    objListItem["Owner"] = listEntry.ChapterPagesMapping[i].PageOwner;
                                }
                                objListItem.Update();
                                int.TryParse(Convert.ToString(objListItem["ID"]), out intRowId);
                                listEntry.ChapterPagesMapping[i].RowId = intRowId;
                                objCommonDAL.UpdateListAuditHistory(siteURL, auditListtname, intRowId, username, actionPerformed);

                            }
                        }

                        web.AllowUnsafeUpdates = false;
                        if (dtBook != null)
                        {
                            dtBook.Dispose();
                        }
                        if (dtTeamStaff != null)
                        {
                            dtTeamStaff.Dispose();
                        }
                        if (dtUser != null)
                        {
                            dtUser.Dispose();
                        }
                    }
                }
            });

            return strTemplatePageMappingRowId.ToString();
        }
コード例 #7
0
ファイル: WellBookChapterDAL.cs プロジェクト: vijaymca/Dotnet
        /// <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);
                        }
                    }
                }
            });
        }
コード例 #8
0
ファイル: WellBookChapterDAL.cs プロジェクト: vijaymca/Dotnet
        /// <summary>
        /// Gets the Chapter Details.
        /// </summary>
        /// <param name="parentSiteUrl">Site URL.</param>
        /// <param name="listName">List Name.</param>
        /// <param name="queryString">CAML Query.</param>
        /// <returns>ListEntry Object.</returns>
        /// <exception cref="">Handled in calling method.</exception>
        internal ListEntry GetChapterDetails(string siteURL, string listName, string queryString)
        {
            ListEntry objListEntry = null;
            DataTable objListItems = null;
            DataRow objListRow;
            int intTemplateId = 0;
            int intBookId = 0;
            ChapterDetails objChapterDetails = null;
            try
            {
                objCommonDAL = new CommonDAL();
                objListItems = objCommonDAL.ReadList(siteURL, listName, queryString);

                if (objListItems != null)
                {
                    objListEntry = new ListEntry();
                    objChapterDetails = new ChapterDetails();
                    for (int index = 0; index < objListItems.Rows.Count; index++)
                    {
                        objListRow = objListItems.Rows[index];
                        objChapterDetails.ChapterTitle = objListRow["Title"].ToString();
                        objChapterDetails.AssetValue = Convert.ToString(objListRow["Asset_Value"]);
                        objChapterDetails.Country = Convert.ToString(objListRow["Country"]);
                        objChapterDetails.Criteria = Convert.ToString(objListRow["Criteria"]);
                        objChapterDetails.ColumnName = Convert.ToString(objListRow["Column_Name"]);
                        if (objListRow["Chapter_Sequence"] != DBNull.Value)
                        {
                            objChapterDetails.ChapterSequence = Convert.ToInt32(objListRow["Chapter_Sequence"]);
                        }
                        int.TryParse(Convert.ToString(objListRow["Book_ID"]), out intBookId);
                        objChapterDetails.BookID = intBookId;
                        objChapterDetails.AssetType = Convert.ToString(objListRow["Asset_Type"]);
                        objChapterDetails.ChapterDescription = Convert.ToString(objListRow["Chapter_Description"]);
                        int.TryParse(Convert.ToString(objListRow["Template_ID"]), out intTemplateId);
                        objChapterDetails.TemplateID = intTemplateId;
                        objChapterDetails.Terminated = Convert.ToString(objListRow["Terminate_Status"]);

                        objListEntry.ChapterDetails = objChapterDetails;
                    }
                }
                return objListEntry;
            }
            finally
            {
                if (objListItems != null)
                    objListItems.Dispose();
            }
        }
コード例 #9
0
ファイル: WellBookChapterDAL.cs プロジェクト: vijaymca/Dotnet
        /// <summary>
        /// Updates comments for Well Book Page.
        /// </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="listEntry">ListEntry object contains the Comments.</param>
        /// <param name="actionPerformed">Audit action.</param>
        /// <returns>True/False</returns>
        /// <exception cref="">Handled in calling method.</exception>
        internal bool UpdateComments(string siteURL, string listName, string auditListName, ListEntry listEntry, string actionPerformed)
        {
            SPList list;
            SPListItem objListItem;
            SPFieldLookupValue lookupField;
            bool blnUpdateSuccess = false;
            SPSecurity.RunWithElevatedPrivileges(delegate()
            {
                using (SPSite site = new SPSite(siteURL))
                {
                    using (SPWeb web = site.OpenWeb())
                    {
                        web.AllowUnsafeUpdates = true;
                        list = web.Lists[listName];
                        if (string.Compare(AUDIT_ACTION_COMMENT_ADDED, actionPerformed, true) == 0)
                        {
                            if (listEntry != null && listEntry.PageComments != null)
                            {
                                objListItem = list.Items.Add();
                                objListItem["Page_ID"] = Convert.ToInt32(listEntry.PageComments.PageID);
                                objListItem["UserName"] = listEntry.PageComments.UserName;
                                objListItem["Comment"] = listEntry.PageComments.Comments;
                                /// Lookup column
                                if (!string.IsNullOrEmpty(listEntry.PageComments.DisciplineID))
                                {
                                    lookupField = new SPFieldLookupValue(listEntry.PageComments.DisciplineID);
                                    objListItem["Discipline"] = lookupField;
                                }
                                objListItem["Shared"] = listEntry.PageComments.ShareComments;
                                objListItem.Update();

                                objCommonDAL = new CommonDAL();
                                objCommonDAL.UpdateListAuditHistory(siteURL, auditListName, Int32.Parse(listEntry.PageComments.PageID), listEntry.PageComments.UserName, actionPerformed);
                                blnUpdateSuccess = true;
                            }
                        }
                        web.AllowUnsafeUpdates = false;
                    }
                }
            });
               return blnUpdateSuccess;
        }
コード例 #10
0
ファイル: WellBookBLL.cs プロジェクト: vijaymca/Dotnet
        /// <summary>
        /// Sends the email to user on print.
        /// </summary>
        /// <param name="results">The results.</param>
        /// <param name="parentSiteURL">The parent site URL.</param>
        /// <param name="strAddress">The STR address.</param>
        /// <param name="contextForMail">The context for mail.</param>
        public void SendEmailToUserOnPrint(string results, string parentSiteURL, string strAddress, SPContext contextForMail)
        {
            DataTable dtPrintChapterDetails = null;
            ActiveDirectoryService objADS = null;
            try
            {
                try
                {
                    objADS = new ActiveDirectoryService();
                }
                catch (Exception)
                {
                    objADS = new ActiveDirectoryService(contextForMail);
                }
                dtPrintChapterDetails = new DataTable();
                CommonUtility objUtility = new CommonUtility();
                objCommonDAL = new CommonDAL();
                string strToMailID = string.Empty;
                string strAccessLink = string.Empty;
                string strMessage = string.Empty;

                string strCamlQuery = @"<Where><Eq><FieldRef Name='RequestID' /><Value Type='Text'>" + results + "</Value></Eq></Where>";
                dtPrintChapterDetails = objCommonDAL.GetChapterPrintDetails(strCamlQuery, parentSiteURL, "DWB Chapter Print Details");

                if (dtPrintChapterDetails != null && dtPrintChapterDetails.Rows.Count > 0)
                {
                    /// Loop through the values in Chapter Print Details list.
                    foreach (DataRow dtRow in dtPrintChapterDetails.Rows)
                    {
                        try
                        {
                            strToMailID = objADS.GetEmailID(dtRow["UserName"].ToString());
                        }
                        catch (Exception)
                        {
                        }
                        strAccessLink = parentSiteURL + "/Pages/eWBPDFViewer.aspx?mode=chapter&requestID=" + results;

                        objUtility.SendMailforPrintUpdate(strToMailID, strAccessLink, parentSiteURL, strAddress, contextForMail);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (dtPrintChapterDetails != null)
                    dtPrintChapterDetails.Dispose();
            }
        }
コード例 #11
0
ファイル: WellBookBLL.cs プロジェクト: vijaymca/Dotnet
        /// <summary>
        /// Add Books as favorites         
        /// </summary>
        /// <param name="siteUrl">Site URL.</param>                   
        /// <param name="favBookIds">Books IDs separated by ;</param>        
        /// <param name="listName">List Name.</param>  
        /// <param name="username">User ID</param>
        /// <param name="addToFavourite">True if Add to Favourites. False if Remove from Favorites.</param>
        public void AddToFavorites(string siteURL, string favBookIds, string listName, string username, bool addToFavourite)
        {
            objWellBookDAL = new WellBookDAL();

            Dictionary<string, string> listItemCollection = null;
            if (favBookIds.Length != 0)
            {

                listItemCollection = new Dictionary<string, string>();

                string strCAMLQuery = "<Where><Eq><FieldRef Name='Windows_User_ID' /><Value Type='Text'>" + username + "</Value></Eq></Where>";
                if (addToFavourite)
                {
                    listItemCollection.Add("FavoriteBooks", favBookIds);

                    WellBookDAL.UpdateListItemCollectionValues(siteURL, listName, strCAMLQuery, listItemCollection);
                }
                else
                {
                    /// Read the FavoriteBooks value from DWB User list
                    /// Remove the Book Ids in favBookIds
                    /// Update the FavoriteBooks in DWB User list with the new value
                    objCommonDAL = new CommonDAL();
                    DataTable dtUser = objCommonDAL.ReadList(siteURL, listName, strCAMLQuery);
                    if (dtUser != null && dtUser.Rows.Count > 0)
                    {
                        string strExistingFavouriteBooks = Convert.ToString(dtUser.Rows[0]["FavoriteBooks"]);
                        if (!string.IsNullOrEmpty(strExistingFavouriteBooks))
                        {
                            string[] strBookIds = favBookIds.Split(";".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                            for (int intIndex = 0; intIndex < strBookIds.Length; intIndex++)
                            {
                                if (strExistingFavouriteBooks.Contains(";" + strBookIds[intIndex] + ";"))
                                {
                                    strExistingFavouriteBooks = strExistingFavouriteBooks.Remove(strExistingFavouriteBooks.IndexOf(";" + strBookIds[intIndex] + ";"), strBookIds[intIndex].Length + 1);
                                    if (strExistingFavouriteBooks.Length == 1 && (string.Compare(strExistingFavouriteBooks, ";")) == 0)
                                    {
                                        strExistingFavouriteBooks = string.Empty;
                                    }
                                }
                            }

                            listItemCollection.Add("FavoriteBooks", strExistingFavouriteBooks);
                            WellBookDAL.UpdateListItemCollectionValues(siteURL, listName, strCAMLQuery, listItemCollection);
                        }
                    }
                }

            }
        }
コード例 #12
0
ファイル: WellBookBLL.cs プロジェクト: vijaymca/Dotnet
        /// <summary>
        /// To Get TypeIII Pages for selected Book
        /// Added By: Praveena  
        /// Date:16/09/2010
        /// Reason: For module Add additional attributes to change page owner table
        /// </summary>
        /// <param name="siteURL"></param>
        /// <param name="bookId"></param>
        /// <param name="terminated"></param>
        /// <returns></returns>
        public DataTable GetTypeIIIPagesForBook(string siteURL, string bookId, string terminated)
        {
            DataTable dtResult = null;
            objCommonDAL = new CommonDAL();
            objCommonBLL = new CommonBLL();
            StringBuilder strChapterId = new StringBuilder();
            string strCamlQuery = @"<Where><And><Eq><FieldRef Name='Book_ID' />
            <Value Type='Number'> " + bookId + "</Value></Eq><Eq><FieldRef Name='Terminate_Status' /><Value Type='Choice'>" + terminated + "</Value></Eq></And></Where>";
            dtResult = objCommonDAL.ReadList(siteURL, DWBCHAPTERLIST, strCamlQuery);
            if (dtResult != null && dtResult.Rows.Count > 0)
            {
                for (int intRowIndex = 0; intRowIndex < dtResult.Rows.Count; intRowIndex++)
                {
                    strChapterId.Append(Convert.ToString(dtResult.Rows[intRowIndex][IDCOLUMN]));
                    strChapterId.Append(";");
                }
                strCamlQuery = objCommonBLL.CreateCamlQueryWithoutWhere(strChapterId.ToString(), "Chapter_ID", "Number");
                strChapterId.Remove(0, strChapterId.Length);
                strChapterId.Append(strCamlQuery);
                strChapterId.Append("<Eq><FieldRef Name='Connection_Type' /><Value Type='Text'>3 - User Defined Document</Value></Eq></And>");
                strChapterId.Append("<Eq><FieldRef Name='Terminate_Status' /><Value Type='Choice'>" + terminated + "</Value></Eq></And></Where>");
                strChapterId.Insert(0, "<Where><And><And>");
                dtResult = objCommonDAL.ReadList(siteURL, CHAPTERPAGESMAPPINGLIST, strChapterId.ToString());

            }

            return dtResult;
        }
コード例 #13
0
ファイル: WellBookBLL.cs プロジェクト: vijaymca/Dotnet
        /// <summary>
        /// Publishe the Well book and updates the list item.
        /// </summary>
        /// <param name="siteURL">The site URL.</param>
        /// <param name="listName">Name of the list.</param>
        /// <param name="rowId">The row id.</param>
        public void PublishWellBook(string siteURL, string listName, int rowId)
        {
            objWellBookDAL = new WellBookDAL();
            objCommonDAL = new CommonDAL();
            objCommonBLL = new CommonBLL();
            DataTable dtResultTable = null;
            int intListItemRowId = 0;
            StringBuilder strID = new StringBuilder();
            string strCAMlQueryforPageId = string.Empty;
            Dictionary<string, string> listItemCollection = null;
            string strCamlQuery = string.Empty;

            listItemCollection = new Dictionary<string, string>();
            listItemCollection.Add("Sign_Off_Status", "No");
            /// Updating Sign_Off_Status column value to "No" in DWB Books list.
            objWellBookDAL.UpdateListItemValue(siteURL, listName, rowId, listItemCollection);

            strCamlQuery = "<Where><Eq><FieldRef Name='Book_ID' /><Value Type='Number'>" +
                  rowId.ToString() + "</Value></Eq></Where>";
            dtResultTable = objCommonDAL.ReadList(siteURL, DWBCHAPTERLIST, strCamlQuery);
            if (dtResultTable != null && dtResultTable.Rows.Count > 0)
            {
                for (int i = 0; i < dtResultTable.Rows.Count; i++)
                {
                    strID.Append(Convert.ToString(dtResultTable.Rows[i][IDCOLUMN]));
                    strID.Append(";");
                }
            }
            else
            {
                //the book does not have any chapters
                return;
            }

            /// Updating Sign_Off_Status column value to "No" in DWB Chapter Pages Mapping list.

            ///Build CAML Query to get all pages in the selected Book
            strCamlQuery = objCommonBLL.CreateCAMLQuery(strID.ToString(), "Chapter_ID", "Number");
            dtResultTable = objCommonDAL.ReadList(siteURL, CHAPTERPAGESMAPPINGLIST, strCamlQuery);
            strID.Remove(0, strID.Length);
            if (dtResultTable != null && dtResultTable.Rows.Count > 0)
            {
                listItemCollection.Clear();
                listItemCollection.Add("Sign_Off_Status", "No");
                for (int intRowIndex = 0; intRowIndex < dtResultTable.Rows.Count; intRowIndex++)
                {
                    int.TryParse(Convert.ToString(dtResultTable.Rows[intRowIndex][IDCOLUMN]), out intListItemRowId);
                    /// Updating Sign_Off_Status column value to "No" in DWB Chapter Pages Mapping list.
                    objWellBookDAL.UpdateListItemValue(siteURL, CHAPTERPAGESMAPPINGLIST, intListItemRowId, listItemCollection);
                    strID.Append(intListItemRowId.ToString());
                    strID.Append(";");

                }
            }

            /// Delete Comments for All Books Pages
            strCAMlQueryforPageId = objCommonBLL.CreateCAMLQuery(strID.ToString(), "Page_ID", "Number");
            objCommonDAL.DeleteAuditTrail(siteURL, DWBCOMMENT, strCAMlQueryforPageId);

            /// Delete audit trail of the Book.
            strCamlQuery = @"<Where><Eq><FieldRef Name='Master_ID' /><Value Type='Number'>" + rowId.ToString() + "</Value></Eq></Where>";
            objCommonDAL.DeleteAuditTrail(siteURL, DWBWELLBOOKAUDITLIST, strCamlQuery);

            if (dtResultTable != null)
            {
                dtResultTable.Dispose();
            }
        }
コード例 #14
0
ファイル: WellBookBLL.cs プロジェクト: vijaymca/Dotnet
        /// <summary>
        /// Get Pages for the selected Owner
        /// Modified By: Praveena  
        /// Date:03/09/2010
        /// Reason: For module Add additional attributes to change page owner table
        /// </summary>
        /// <param name="siteURL">Site URL.</param>
        /// <param name="listName">List Name.</param>
        /// <param name="queryString">CAML Query.</param>     
        /// <param name="username">Windows User ID of the selected Owner</param>
        /// <returns>DataTable</returns>
        public DataTable GetPagesForOwner(string siteURL, string listName, string CAMLQuery, string username, string pageName, string terminatedStatus, System.Text.StringBuilder chapterNames)
        {
            string strViewFields = string.Empty;
            strViewFields = @"<FieldRef Name='ID' /><FieldRef Name='Title' />";
            DataTable dtResultDatatable = null;
            DataView dvresultdataview = null;
            string strCAMLQuery = string.Empty;
            StringBuilder strChapterId = new StringBuilder();
            Dictionary<string, string> listItemCollection = null;
            objCommonDAL = new CommonDAL();
            dtResultDatatable = objCommonDAL.ReadList(siteURL, listName, CAMLQuery, strViewFields);
            if (dtResultDatatable != null && dtResultDatatable.Rows.Count > 0)
            {
                listItemCollection = new Dictionary<string, string>();
                for (int intRowIndex = 0; intRowIndex < dtResultDatatable.Rows.Count; intRowIndex++)
                {
                    strChapterId.Append(Convert.ToString(dtResultDatatable.Rows[intRowIndex][IDCOLUMN]));
                    strChapterId.Append(";");
                    if ((!listItemCollection.ContainsValue(Convert.ToString(dtResultDatatable.Rows[intRowIndex][TITLECOLUMN]))
                        && (!string.IsNullOrEmpty(Convert.ToString(dtResultDatatable.Rows[intRowIndex][TITLECOLUMN])))))
                    {
                        listItemCollection.Add(Convert.ToString(dtResultDatatable.Rows[intRowIndex][IDCOLUMN]), Convert.ToString(dtResultDatatable.Rows[intRowIndex][TITLECOLUMN]));
                    }
                }
                objCommonBLL = new CommonBLL();
                strCAMLQuery = objCommonBLL.CreateCAMLQuery(strChapterId.ToString(), CHAPTERIDCOLUMN, "Number");
                strViewFields = "<FieldRef Name='Connection_Type' /><FieldRef Name='Page_Name' /><FieldRef Name='Discipline' /><FieldRef Name='Owner' /><FieldRef Name='Empty' /><FieldRef Name='Sign_Off_Status' /><FieldRef Name='Chapter_ID' /><FieldRef Name='Terminate_Status' />";
                dtResultDatatable = objCommonDAL.ReadList(siteURL, CHAPTERPAGESMAPPINGLIST,
                   strCAMLQuery, strViewFields);

                if (dtResultDatatable != null && dtResultDatatable.Rows.Count > 0)
                {
                    Dictionary<string, string> ChapterDetails = listItemCollection;
                    DataColumn dcChapterName = dtResultDatatable.Columns.Add(CHAPTERNAMECOLUMN, typeof(string));
                    string str = string.Empty;
                    foreach (DataRow dtRow in dtResultDatatable.Rows)
                    {
                        if (ChapterDetails.ContainsKey(dtRow[CHAPTERIDCOLUMN].ToString()))
                        {
                            ChapterDetails.TryGetValue(dtRow[CHAPTERIDCOLUMN].ToString(), out str);
                            dtRow[CHAPTERNAMECOLUMN] = str;
                        }
                    }
                    dvresultdataview = dtResultDatatable.DefaultView;
                    //to apply filters to dataview
                    dvresultdataview = ApplyFilters(dvresultdataview, username, pageName, chapterNames, terminatedStatus);
                }
            }
            if (dvresultdataview != null)
            {
                return dvresultdataview.Table;
            }
            else
            {
                return dtResultDatatable;
            }
        }
コード例 #15
0
ファイル: WellBookBLL.cs プロジェクト: vijaymca/Dotnet
        /// <summary>
        /// Gets the owners list
        /// </summary>
        /// <param name="siteURL">Site URL.</param>
        /// <param name="listName">List Name.</param>
        /// <param name="queryString">CAML Query.</param>     
        /// <returns>Dictionary Object.</returns>
        public Dictionary<string, string> GetPageOwnerList(string siteURL, string listName, string CAMLQuery)
        {
            Dictionary<string, string> listItemCollection = null;
            DataTable dtResultDatatable = null;
            string strCAMLQuery = string.Empty;
            StringBuilder strChapterId = new StringBuilder();
            objCommonDAL = new CommonDAL();
            string strViewFields = string.Empty;
            strViewFields = @"<FieldRef Name='ID' />";
            dtResultDatatable = objCommonDAL.ReadList(siteURL, listName, CAMLQuery, strViewFields);

            if (dtResultDatatable != null && dtResultDatatable.Rows.Count > 0)
            {
                for (int intRowIndex = 0; intRowIndex < dtResultDatatable.Rows.Count; intRowIndex++)
                {
                    strChapterId.Append(Convert.ToString(dtResultDatatable.Rows[intRowIndex][IDCOLUMN]));
                    strChapterId.Append(";");
                }
                objCommonBLL = new CommonBLL();
                strCAMLQuery = objCommonBLL.CreateCAMLQuery(strChapterId.ToString(), "Chapter_ID", "Number", "Owner");
                if (string.IsNullOrEmpty(CAMLQuery))
                    return listItemCollection;
                dtResultDatatable = objCommonDAL.ReadList(siteURL, CHAPTERPAGESMAPPINGLIST, strCAMLQuery);
                if (dtResultDatatable != null && dtResultDatatable.Rows.Count > 0)
                {
                    listItemCollection = new Dictionary<string, string>();

                    for (int intRowIndex = 0; intRowIndex < dtResultDatatable.Rows.Count; intRowIndex++)
                    {

                        if ((!listItemCollection.ContainsValue(Convert.ToString(dtResultDatatable.Rows[intRowIndex]["Owner"]))
                            && (!string.IsNullOrEmpty(Convert.ToString(dtResultDatatable.Rows[intRowIndex]["Owner"])))))
                        {
                            listItemCollection.Add(Convert.ToString(dtResultDatatable.Rows[intRowIndex][IDCOLUMN]), Convert.ToString(dtResultDatatable.Rows[intRowIndex]["Owner"]));
                        }
                    }
                }

            }
            if (dtResultDatatable != null)
            {
                dtResultDatatable.Dispose();
            }
            return listItemCollection;
        }
コード例 #16
0
ファイル: WellBookBLL.cs プロジェクト: vijaymca/Dotnet
        /// <summary>
        /// Gets the PageNames List
        /// Added By: Praveena  
        /// Date:03/09/2010
        /// Reason: For module Add additional attributes to change page owner table
        /// </summary>
        /// <param name="siteURL">Site URL.</param>
        /// <param name="listName">List Name.</param>
        /// <param name="queryString">CAML Query.</param>     
        /// <returns>Dictionary Object.</returns>
        public Dictionary<string, string> GetPageNamesList(string siteURL, string listName, string CAMLQuery)
        {
            Dictionary<string, string> listItemCollection = null;
            DataTable dtResultDatatable = null;
            string strCAMLQuery = string.Empty;
            StringBuilder strChapterId = new StringBuilder();
            objCommonDAL = new CommonDAL();
            string strViewFields = string.Empty;
            strViewFields = @"<FieldRef Name='ID' />";

            //Get the chapter details
            dtResultDatatable = objCommonDAL.ReadList(siteURL, listName, CAMLQuery, strViewFields);
            if (dtResultDatatable != null && dtResultDatatable.Rows.Count > 0)
            {
                for (int intRowIndex = 0; intRowIndex < dtResultDatatable.Rows.Count; intRowIndex++)
                {
                    strChapterId.Append(Convert.ToString(dtResultDatatable.Rows[intRowIndex][IDCOLUMN]));
                    strChapterId.Append(";");
                }
                objCommonBLL = new CommonBLL();
                strCAMLQuery = objCommonBLL.CreateCAMLQuery(strChapterId.ToString(), "Chapter_ID", "Number");
                if (string.IsNullOrEmpty(CAMLQuery))
                    return listItemCollection;

                strViewFields = @"<FieldRef Name='Page_Name' /><FieldRef Name='Discipline' />";

                //Get the Page details by passing chapter Ids
                dtResultDatatable = objCommonDAL.ReadList(siteURL, CHAPTERPAGESMAPPINGLIST, strCAMLQuery, strViewFields);
                if (dtResultDatatable != null && dtResultDatatable.Rows.Count > 0)
                {
                    listItemCollection = new Dictionary<string, string>();
                    DataView dvResult = dtResultDatatable.DefaultView;

                    //PageName and Discipline are store into the dictionary collection.
                    dtResultDatatable = dvResult.ToTable(true, "Page_Name", "Discipline");
                    for (int intRowIndex = 0; intRowIndex < dtResultDatatable.Rows.Count; intRowIndex++)
                    {
                        if ((!listItemCollection.ContainsKey(Convert.ToString(dtResultDatatable.Rows[intRowIndex][PAGENAMECOLUMN]))) &&
                             (!string.IsNullOrEmpty(Convert.ToString(dtResultDatatable.Rows[intRowIndex][PAGENAMECOLUMN]))) &&
                             (!string.IsNullOrEmpty(Convert.ToString(dtResultDatatable.Rows[intRowIndex][DISCIPLINECOLUMN]))))
                        {
                            listItemCollection.Add(Convert.ToString(dtResultDatatable.Rows[intRowIndex][PAGENAMECOLUMN]), Convert.ToString(dtResultDatatable.Rows[intRowIndex][DISCIPLINECOLUMN]));
                        }
                    }
                }
            }
            if (dtResultDatatable != null)
            {
                dtResultDatatable.Dispose();
            }
            return listItemCollection;
        }
コード例 #17
0
ファイル: ChapterBLL.cs プロジェクト: vijaymca/Dotnet
 /// <summary>
 /// Gets the teams for the Users
 /// </summary>
 /// <param name="siteURL">The site URL.</param>
 /// <param name="username">The username.</param>
 /// <returns></returns>
 public DataTable GetAssetTeams(string siteURL, string username)
 {
     string strViewFields = "<FieldRef Name='Team' />";
     string strCamlQuery = @"<Where><Eq><FieldRef Name='Windows_User_ID' /> <Value Type='Text'>" + username + " </Value></Eq></Where>";
     objCommonDAL = new CommonDAL();
     return objCommonDAL.ReadList(siteURL, DWBUSER, strCamlQuery, strViewFields);
 }
コード例 #18
0
ファイル: WellBookBLL.cs プロジェクト: vijaymca/Dotnet
        /// <summary>
        /// Sets the book detail data object.
        /// </summary>
        public BookInfo SetBookDetailDataObject(string siteURL, string bookID, string action, bool bookSelected, PrintOptions objPrintOptions)
        {
            string strCamlQuery = string.Empty;
            string strViewFields = string.Empty;
            DataTable dtBooks = null;
            DataRow objDataRow;
            BookInfo objBookInfo = null;
            try
            {
                objCommonDAL = new CommonDAL();
                objBookInfo = new BookInfo();
                objBookInfo.BookID = bookID;
                strCamlQuery = @"<Where><And><Eq><FieldRef Name='ID' /><Value Type='Number'>" +
                    bookID + "</Value></Eq><Eq><FieldRef Name='Terminate_Status' /><Value Type='Choice'>No</Value></Eq></And></Where>";
                strViewFields = @"<FieldRef Name='ID' /><FieldRef Name='Title' /><FieldRef Name='Owner' /><FieldRef Name='Team_ID' />";
                dtBooks = objCommonDAL.ReadList(siteURL, DWBBOOKLIST, strCamlQuery, strViewFields);
                for (int intIndex = 0; intIndex < dtBooks.Rows.Count; intIndex++)
                {
                    objDataRow = dtBooks.Rows[intIndex];
                    objBookInfo.BookName = objDataRow[TITLECOLUMN].ToString();
                    objBookInfo.BookOwner = objDataRow["Owner"].ToString();
                    objBookInfo.BookTeamID = objDataRow["Team_ID"].ToString();
                    objBookInfo.Action = action;
                    objBookInfo.IsPrintable = true;
                    objBookInfo.IsTOCApplicatble = objPrintOptions.IncludeTOC;
                    if (bookSelected)
                    {
                        objBookInfo.Chapters = SetChapterDetail(siteURL, bookID, action);
                        int intPageCount = 0;
                        if (objBookInfo.Chapters != null && objBookInfo.Chapters.Count > 0)
                        {
                            foreach (ChapterInfo objChapterInfo in objBookInfo.Chapters)
                            {
                                intPageCount += objChapterInfo.PageInfo.Count;
                            }
                            intPageCount += objBookInfo.Chapters.Count;
                        }
                        objBookInfo.PageCount = intPageCount;
                    }

                    objBookInfo.IsStoryBoardApplicable = objPrintOptions.IncludeStoryBoard;
                    objBookInfo.IsPageTitleApplicable = objPrintOptions.IncludePageTitle;
                    objBookInfo.IsBookTitleApplicable = objPrintOptions.IncludeBookTitle;
                }
            }
            catch (Exception)
            {
                throw;
            }
            if (dtBooks != null)
            {
                dtBooks.Dispose();
            }
            return objBookInfo;
        }
コード例 #19
0
ファイル: WellBookChapterDAL.cs プロジェクト: vijaymca/Dotnet
        /// <summary>
        /// Adds the Pages to the Chapter Directly.
        /// </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>
        /// <returns>ID of the Chapter Page Created.</returns>
        /// <exception cref="">Handled in calling method.</exception>
        internal string AddPageToChapter(string siteURL, ListEntry listEntry, string listName, string auditListtname, string username, string actionPerformed)
        {
            string strPageID = string.Empty;
            SPList list;
            SPListItem objListItem;
            int intRowId = 0;
            int intPageSequence = 0;
            DataTable dtlistItem = null;
            int intMappingRowId = 0;
            DataView dtDataView = null;
            SPQuery query;
            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];
                            objCommonDAL = new CommonDAL();
                            for (int i = 0; i < listEntry.ChapterPagesMapping.Count; i++)
                            {
                                objListItem = list.Items.Add();
                                objListItem["Master_Page_ID"] = listEntry.ChapterPagesMapping[i].MasterPageID;
                                objListItem["Page_Actual_Name"] = listEntry.ChapterPagesMapping[i].PageActualName;
                                objListItem["Page_Name"] = listEntry.ChapterPagesMapping[i].PageName;
                                objListItem["Owner"] = listEntry.ChapterPagesMapping[i].PageOwner;
                                objListItem["Discipline"] = listEntry.ChapterPagesMapping[i].Discipline;
                                objListItem["Chapter_ID"] = listEntry.ChapterDetails.RowID;
                                objListItem["Asset_Type"] = listEntry.ChapterPagesMapping[i].AssetType;
                                if (!string.IsNullOrEmpty(listEntry.ChapterPagesMapping[i].Empty))
                                    objListItem["Empty"] = listEntry.ChapterPagesMapping[i].Empty;
                                objListItem["Page_Sequence"] = listEntry.ChapterPagesMapping[i].PageSequence;
                                if (!string.IsNullOrEmpty(listEntry.ChapterPagesMapping[i].SignOffStatus))
                                {
                                    objListItem["Sign_Off_Status"] = listEntry.ChapterPagesMapping[i].SignOffStatus;
                                }
                                objListItem["Connection_Type"] = listEntry.ChapterPagesMapping[i].ConnectionType;
                                objListItem["Standard_Operating_Procedure"] = listEntry.ChapterPagesMapping[i].StandardOperatingProc;
                                if (!string.IsNullOrEmpty(listEntry.ChapterPagesMapping[i].PageURL))
                                {
                                    objListItem["Page_URL"] = listEntry.ChapterPagesMapping[i].PageURL;
                                }
                                objListItem.Update();
                                /// Assing the Item ID to return
                                strPageID = Convert.ToString(objListItem["ID"]);

                                int.TryParse(Convert.ToString(objListItem["ID"]), out intRowId);
                                listEntry.ChapterPagesMapping[i].RowId = intRowId;
                                strCamlQuery = @"<Where><Eq><FieldRef Name='Chapter_ID' /><Value Type='Number'>" + listEntry.ChapterDetails.RowID + "</Value></Eq></Where>";
                                query = new SPQuery();
                                query.Query = strCamlQuery;
                                query.ViewFields = @"<FieldRef Name='Chapter_ID' /><FieldRef Name='ID' /><FieldRef Name='Page_Sequence' />";
                                dtlistItem = list.GetItems(query).GetDataTable();
                                if (dtlistItem != null && dtlistItem.Rows.Count > 0)
                                {
                                    dtDataView = dtlistItem.DefaultView;
                                    dtDataView.Sort = "Page_Sequence asc";
                                    for (int j = 0; j < dtDataView.Count; j++)
                                    {
                                        intPageSequence = intPageSequence + 10;
                                        intMappingRowId = (int)dtDataView[j]["ID"];
                                        if (intMappingRowId != intRowId)
                                        {
                                            objListItem = list.GetItemById(intMappingRowId);
                                            objListItem["Page_Sequence"] = intPageSequence;

                                            objListItem.Update();
                                        }
                                    }
                                }
                                objCommonDAL.UpdateListAuditHistory(siteURL, auditListtname, intRowId, username, actionPerformed);

                            }

                            web.AllowUnsafeUpdates = false;
                        }

                    }
                });
            }
            finally
            {
                if (dtlistItem != null) dtlistItem.Dispose();
            }
            return strPageID;
        }
コード例 #20
0
ファイル: WellBookBLL.cs プロジェクト: vijaymca/Dotnet
        /// <summary>
        /// Returns the array of selected Page Info objects.
        /// </summary>
        /// <param name="siteUrl">Site URL.</param>
        /// <param name="pageIds">PageIDs concatenated with "|".</param>
        /// <param name="chapterActualAssetValue">Actual Asset Value of Chapter.</param>
        /// <param name="columnName">Column Name of the Chapter.</param>
        /// <returns>ArrayList of PageInfo objects.</returns>
        public ArrayList SetSelectedPageInfo(string siteURL, string pageIds, string chapterActualAssetValue, string columnName)
        {
            /// Split the pageIds with "|" as splitter
            /// Format the CAML Query for the selected Pages
            /// Assign values to PageInfo object and add to Array list
            ArrayList arlPageInfo = null;
            PageInfo objPageInfo = null;
            string strCAMLQuery = string.Empty;
            string strViewFields = string.Empty;
            DataTable dtChapterPages = null;
            DataTable dtDocumentDetails = null;

            string strConnectionType = string.Empty;
            string strPageURL = string.Empty;
            string[] strConnectionTypeSplit = null;
            int intConnectionType = 0;
            if (!string.IsNullOrEmpty(pageIds) && pageIds.Length > 0)
            {
                objCommonBLL = new CommonBLL();
                strCAMLQuery = objCommonBLL.CreateCAMLQuery(pageIds, IDCOLUMN, IDCOLUMNTYPE);
                if (!string.IsNullOrEmpty(strCAMLQuery))
                {
                    strCAMLQuery = strCAMLQuery.Insert(0, "<OrderBy><FieldRef Name='Page_Sequence' Ascending='True'/></OrderBy>");
                }
                strViewFields = @"<FieldRef Name='Page_Sequence' /><FieldRef Name='ID' /><FieldRef Name='Title' /><FieldRef Name='Terminate_Status' /><FieldRef Name='Chapter_ID' /><FieldRef Name='Page_Name' /><FieldRef Name='Page_Actual_Name' /><FieldRef Name='Page_URL' /><FieldRef Name='Owner' /><FieldRef Name='Connection_Type' /><FieldRef Name='Sign_Off_Status' /><FieldRef Name='Asset_Type' />";
                objCommonDAL = new CommonDAL();
                dtChapterPages = objCommonDAL.ReadList(siteURL, CHAPTERPAGESMAPPINGLIST, strCAMLQuery, strViewFields);
                if (dtChapterPages != null && dtChapterPages.Rows.Count > 0)
                {
                    arlPageInfo = new ArrayList();
                    foreach (DataRow objDataRow in dtChapterPages.Rows)
                    {
                        objPageInfo = new PageInfo();
                        objPageInfo.PageID = objDataRow[IDCOLUMN].ToString();
                        objPageInfo.PageTitle = objDataRow["Page_Name"].ToString();
                        objPageInfo.PageActualName = objDataRow["Page_Actual_Name"].ToString();
                        objPageInfo.PageURL = objDataRow["Page_URL"].ToString();
                        if (objDataRow["Owner"] != null || objDataRow["Owner"] != DBNull.Value)
                        {
                            objPageInfo.PageOwner = objDataRow["Owner"].ToString();
                        }
                        strConnectionType = string.Empty;
                        strConnectionTypeSplit = null;
                        strConnectionType = objDataRow["Connection_Type"].ToString();
                        strConnectionTypeSplit = strConnectionType.Split("-".ToCharArray());
                        intConnectionType = 0;
                        if (strConnectionTypeSplit != null && strConnectionTypeSplit.Length > 0)
                        {
                            int.TryParse(strConnectionTypeSplit[0], out intConnectionType);
                        }
                        objPageInfo.ConnectionType = intConnectionType;
                        objPageInfo.SignOffStatus = objDataRow["Sign_Off_Status"].ToString();
                        objPageInfo.AssetType = objDataRow["Asset_Type"].ToString();
                        /// If connection type == 1, assign below properties
                        if (intConnectionType == 1)
                        {
                            objPageInfo.ActualAssetValue = chapterActualAssetValue;
                            objPageInfo.ColumnName = columnName;
                            /// Based on page URL assign "WellHistory/WellBoreHeader/Pre-Prod RFT"
                            /// DWBWellHistoryReport.aspx
                            /// DWBPreProductionRFT.aspx
                            /// DWBWellboreHeader.aspx
                            strPageURL = string.Empty;
                            strPageURL = objDataRow["Page_URL"].ToString();
                            if (string.Compare(strPageURL, "DWBWellHistoryReport.aspx", true) == 0)
                            {
                                objPageInfo.ReportName = WELLHISTORYREPORTNAME;
                            }
                            else if (string.Compare(strPageURL, "DWBPreProductionRFT.aspx", true) == 0)
                            {
                                objPageInfo.ReportName = PREPRODRFTREPORTNAME;
                            }
                            else if (string.Compare(strPageURL, "DWBWellboreHeader.aspx", true) == 0)
                            {
                                objPageInfo.ReportName = WELLBOREHEADERREPORTNAME;
                            }
                            else if (string.Compare(strPageURL, "WellSummary.aspx", true) == 0)
                            {
                                objPageInfo.ReportName = WELLSUMMARYRREPORTNAME;
                            }
                        }

                        //Added by Praveena for module "Add Last Updated date"
                        strCAMLQuery = objCommonBLL.CreateCAMLQuery(pageIds, "PageID", "Number");
                        strViewFields = @"<FieldRef Name='PageID' /><FieldRef Name='Modified' />";
                        if (intConnectionType == 3)
                        {
                            dtDocumentDetails = objCommonBLL.ReadList(siteURL, USERDEFINEDDOCUMENTLIST, strCAMLQuery, strViewFields);
                        }
                        else if (intConnectionType == 2)
                        {
                            dtDocumentDetails = objCommonBLL.ReadList(siteURL, PUBLISHEDDOCUMENTLIST, strCAMLQuery, strViewFields);
                        }
                        if (dtDocumentDetails != null && dtDocumentDetails.Rows.Count > 0)
                        {
                            foreach (DataRow dtRow in dtDocumentDetails.Rows)
                            {
                                objPageInfo.LastUpdatedDate = GetDateTime(dtRow["Modified"].ToString());
                            }
                        }

                        arlPageInfo.Add(objPageInfo);
                    }
                }
            }
            if (dtChapterPages != null)
            {
                dtChapterPages.Dispose();
            }
            return arlPageInfo;
        }
コード例 #21
0
ファイル: WellBookChapterDAL.cs プロジェクト: vijaymca/Dotnet
        /// <summary>
        /// Gets the Master Page Information from ChapterPage mapping List based on the CAML Query.
        /// </summary>
        /// <param name="parentSiteUrl">Site URL.</param>
        /// <param name="listName">List Name.</param>
        /// <param name="queryString">CAML Query.</param>
        /// <returns>ListEntry object.</returns>
        /// <exception cref="">Handled in calling method.</exception>
        internal ListEntry SetChapterPage(string siteURL, string listName, string queryString)
        {
            ListEntry objListEntry = null;
            DataTable objListItems = null;
            DataRow objListRow;
            int intRowId = 0;
            MasterPageDetails objMasterpage = null;
            ChapterDetails objChapterDetails = null;
            try
            {
                objCommonDAL = new CommonDAL();
                objListItems = objCommonDAL.ReadList(siteURL, listName, queryString);

                if (objListItems != null)
                {
                    objListEntry = new ListEntry();
                    objMasterpage = new MasterPageDetails();
                    for (int index = 0; index < objListItems.Rows.Count; index++)
                    {
                        objListRow = objListItems.Rows[index];
                        objMasterpage.Name = Convert.ToString(objListRow["Page_Name"]);
                        objMasterpage.TemplateTitle = Convert.ToString(objListRow["Page_Actual_Name"]);
                        if (objListRow["Page_Sequence"] != DBNull.Value)
                        {
                            objMasterpage.PageSequence = Convert.ToInt32(objListRow["Page_Sequence"]);
                        }
                        objMasterpage.SOP = Convert.ToString(objListRow["Standard_Operating_Procedure"]);
                        objMasterpage.AssetType = Convert.ToString(objListRow["Asset_Type"]);
                        objMasterpage.ConnectionType = Convert.ToString(objListRow["Connection_Type"]);
                        objMasterpage.SignOffDiscipline = Convert.ToString(objListRow["Discipline"]);
                        objChapterDetails = new ChapterDetails();
                        int.TryParse(Convert.ToString(objListRow["Chapter_ID"]), out  intRowId);
                        objChapterDetails.RowID = intRowId;
                        int.TryParse(Convert.ToString(objListRow["ID"]), out  intRowId);
                        objMasterpage.RowId = intRowId;
                        objListEntry.ChapterDetails = objChapterDetails;
                        objListEntry.MasterPage = objMasterpage;
                    }
                }
                return objListEntry;
            }
            finally
            {
                if (objListItems != null)
                    objListItems.Dispose();
            }
        }
コード例 #22
0
ファイル: ChapterBLL.cs プロジェクト: vijaymca/Dotnet
        /// <summary>
        /// Gets the active master pages for the chapters
        /// </summary>
        /// <param name="siteURL">The site URL.</param>
        /// <param name="chapterId">Chapter ID.</param>
        /// <param name="masterPageListName">Name of the master page list.</param>
        /// <param name="chapterpageListName">Name of the chapterpage list.</param>
        /// <param name="chapterListName">Name of the chapter list.</param>
        /// <returns>DataTable.</returns>
        public DataTable GetMasterPagesForChapter(string siteURL, string chapterId, string masterPageListName, string chapterpageListName, string chapterListName)
        {
            DataTable dtResultTable = null;
            StringBuilder strMasterPageId = new StringBuilder();
            objCommonDAL = new CommonDAL();
            string strAssetType = string.Empty;
            string strCamlQuery = @"<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + chapterId + "</Value></Eq></Where>";
            dtResultTable = objCommonDAL.ReadList(siteURL, chapterListName, strCamlQuery);
            if (dtResultTable == null && dtResultTable.Rows.Count < 1)
            {
                return dtResultTable;
            }
            else
            {
                strAssetType = Convert.ToString(dtResultTable.Rows[0]["Asset_Type"]);
                strCamlQuery = @"<Where><And><Eq><FieldRef Name='Chapter_ID' /><Value Type='Number'>" + chapterId + "</Value></Eq><Eq><FieldRef Name='Terminate_Status' /><Value Type='Choice'>No</Value></Eq></And></Where>";
                dtResultTable = objCommonDAL.ReadList(siteURL, chapterpageListName, strCamlQuery);
                if (dtResultTable == null && dtResultTable.Rows.Count < 1)
                {
                    return dtResultTable;
                }
                else
                {
                    for (int i = 0; i < dtResultTable.Rows.Count; i++)
                    {
                        strMasterPageId.Append(Convert.ToString(dtResultTable.Rows[i]["Master_Page_ID"]));
                        strMasterPageId.Append(";");
                    }

                    strCamlQuery = this.CreateCAMLQueryForNot(strMasterPageId.ToString(), "ID", "Counter");
                    strMasterPageId.Remove(0, strMasterPageId.Length);
                    strMasterPageId.Append(strCamlQuery);
                    if (string.IsNullOrEmpty(strCamlQuery))
                    {
                        strMasterPageId.Append("<Eq><FieldRef Name='Asset_Type' /><Value Type='Lookup'>" + strAssetType + "</Value></Eq>");
                        strMasterPageId.Append("<Eq><FieldRef Name='Terminate_Status' /><Value Type='Choice'>No</Value></Eq></And></Where>");
                        strMasterPageId.Insert(0, "<OrderBy><FieldRef Name='Page_Sequence' Ascending='True'/></OrderBy><Where><And>");
                    }
                    else
                    {
                        strMasterPageId.Append("<Eq><FieldRef Name='Asset_Type' /><Value Type='Lookup'>" + strAssetType + "</Value></Eq></And>");
                        strMasterPageId.Append("<Eq><FieldRef Name='Terminate_Status' /><Value Type='Choice'>No</Value></Eq></And></Where>");
                        strMasterPageId.Insert(0, "<OrderBy><FieldRef Name='Page_Sequence' Ascending='True'/></OrderBy><Where><And><And>");
                    }
                    dtResultTable = objCommonDAL.ReadList(siteURL, masterPageListName, strMasterPageId.ToString());
                }
            }
            return dtResultTable;
        }
コード例 #23
0
ファイル: WellBookChapterDAL.cs プロジェクト: vijaymca/Dotnet
        /// <summary>
        /// Updates the list entry.
        /// </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>
        /// <returns>ID of the Chapter Created/Updated.</returns>
        /// <exception cref="">Handled in calling method.</exception>
        internal string UpdateListEntry(string siteURL, ListEntry listEntry, string listName, string auditListName, string userName, string actionPerformed)
        {
            SPList list;
            SPQuery query;
            SPListItem objListItem;
            SPListItemCollection objListItemCollection;
            SPFieldLookupValue lookupField;
            int intPageSequence = 10;
            int intListItemId = 0;
            string strListGuid = string.Empty;
            StringBuilder sbMethodBuilder = new StringBuilder();

            string strChapterID = string.Empty;
            string strBatch = string.Empty;
            string strBatchFormat = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
              "<ows:Batch OnError=\"Return\">{0}</ows:Batch>";

            string strMethodFormat = "<Method ID=\"{0}\">" +
             "<SetList>{1}</SetList>" +
             "<SetVar Name=\"Cmd\">Save</SetVar>" +
             "<SetVar Name=\"ID\">{2}</SetVar>" +
             "<SetVar Name=\"urn:schemas-microsoft-com:office:office#Chapter_Sequence\">{3}</SetVar>" +
            "</Method>";

            SPSecurity.RunWithElevatedPrivileges(delegate()
            {
                using (SPSite site = new SPSite(siteURL))
                {
                    using (SPWeb web = site.OpenWeb())
                    {
                        web.AllowUnsafeUpdates = true;
                        list = web.Lists[listName];

                        query = new SPQuery();
                        strListGuid = list.ID.ToString();
                        objListItem = list.Items.Add();
                        if (string.Equals(actionPerformed, AUDIT_ACTION_UPDATION))
                        {
                            objListItem = list.GetItemById(listEntry.ChapterDetails.RowID);
                        }
                        objListItem["Title"] = listEntry.ChapterDetails.ChapterTitle;
                        objListItem["Asset_Value"] = listEntry.ChapterDetails.AssetValue;
                        objListItem["Actual_Asset_Value"] = listEntry.ChapterDetails.ActualAssetValue;
                        objListItem["Country"] = listEntry.ChapterDetails.Country;
                        objListItem["Criteria"] = listEntry.ChapterDetails.Criteria;
                        objListItem["Column_Name"] = listEntry.ChapterDetails.ColumnName;
                        objListItem["Book_ID"] = listEntry.ChapterDetails.BookID;
                        if (!string.IsNullOrEmpty(listEntry.ChapterDetails.AssetType))
                        {
                            lookupField = new SPFieldLookupValue(Convert.ToInt32(listEntry.ChapterDetails.AssetType), "");
                            objListItem["Asset_Type"] = lookupField;
                        }

                        objListItem["Chapter_Description"] = listEntry.ChapterDetails.ChapterDescription;
                        objListItem["Template_ID"] = listEntry.ChapterDetails.TemplateID;

                        if (!string.IsNullOrEmpty(listEntry.ChapterDetails.Terminated))
                        {
                            objListItem["Terminate_Status"] = listEntry.ChapterDetails.Terminated;
                        }

                        objListItem.Update();
                        strChapterID = objListItem["ID"].ToString();
                        listEntry.ChapterDetails.RowID = int.Parse(objListItem["ID"].ToString());
                        string strNoOfActiveChapters = string.Empty;
                        if (string.Equals(actionPerformed, AUDIT_ACTION_CREATION))
                        {
                            query.Query = @"<OrderBy><FieldRef Name='Chapter_Sequence' /></OrderBy><Where><And><Eq><FieldRef Name='Terminate_Status' /><Value Type='Choice'>No</Value></Eq><Eq><FieldRef Name='Book_ID' /><Value Type='Number'>" + listEntry.ChapterDetails.BookID.ToString() + "</Value></Eq></And></Where>";
                            objListItemCollection = list.GetItems(query);

                            if (objListItemCollection != null && objListItemCollection.Count > 0)
                            {
                                strNoOfActiveChapters = objListItemCollection.Count.ToString();

                                for (int intIndex = 0; intIndex < objListItemCollection.Count; intIndex++)
                                {
                                    int.TryParse(Convert.ToString(objListItemCollection[intIndex]["ID"]), out intListItemId);
                                    if (intListItemId != listEntry.ChapterDetails.RowID)
                                    {
                                        intPageSequence = intPageSequence + 10;
                                        sbMethodBuilder.AppendFormat(strMethodFormat, intListItemId, strListGuid, intListItemId, intPageSequence);
                                    }
                                    else
                                    {
                                        sbMethodBuilder.AppendFormat(strMethodFormat, intListItemId, strListGuid, intListItemId, 10);

                                    }
                                }
                                strBatch = string.Format(strBatchFormat, sbMethodBuilder.ToString());
                                web.ProcessBatchData(strBatch);
                            }
                            objCommonDAL = new CommonDAL();
                            /// Update the DWB Books list with no of active chapters
                            objCommonDAL.UpdateNoOfActiveChapters(siteURL, DWBBOOKLIST, listEntry.ChapterDetails.BookID.ToString(), strNoOfActiveChapters.ToString());
                        }

                        web.AllowUnsafeUpdates = false;
                        objCommonDAL = new CommonDAL();

                        objCommonDAL.UpdateListAuditHistory(siteURL, auditListName, listEntry.ChapterDetails.RowID, userName, actionPerformed);

                    }
                }
            });
            return strChapterID;
        }
コード例 #24
0
ファイル: MasterPageBLL.cs プロジェクト: vijaymca/Dotnet
 /// <summary>
 /// Updates the Page sequence
 /// </summary>
 /// <param name="parentSiteUrl">The parent site URL.</param>
 /// <param name="listName">Name of the list.</param>
 /// <param name="strAuditListName">Name of the STR audit list.</param>
 /// <param name="dvUpdateListitems">The dv update listitems.</param>
 /// <param name="actionPerformed">The action performed.</param>
 public void UpdatepageSequence(string parentSiteUrl, string listName, string strAuditListName,
     DataView dvUpdateListitems, string actionPerformed)
 {
     objCommonDAL = new CommonDAL();
     objMasterDAL = new MasterDAL();
     objCommonDAL.UpdateSequence(parentSiteUrl, listName, dvUpdateListitems, "Page_Sequence");
     if (dvUpdateListitems != null && dvUpdateListitems.Count > 0)
     {
         for (int intIndex = 0; intIndex < dvUpdateListitems.Count; intIndex++)
         {
             objMasterDAL.UpdateListAuditHistory(parentSiteUrl, listName, strAuditListName,
                 int.Parse(dvUpdateListitems[intIndex]["ID"].ToString()), string.Empty, Environment.UserName, actionPerformed);
         }
     }
 }
コード例 #25
0
ファイル: WellBookChapterDAL.cs プロジェクト: vijaymca/Dotnet
        /// <summary>
        /// Updates the Narrative for Book Page.
        /// </summary>
        /// <param name="parentSiteUrl">Site URL.</param>
        /// <param name="listName">List Name.</param>
        /// <param name="auditListName"></param>
        /// <param name="camlQuery">CAML Query.</param>
        /// <param name="pageID">Page ID.</param>
        /// <param name="narrative">Narrative.</param>
        /// <param name="userName">User Name.</param>
        /// <exception cref="">Handled in calling method.</exception>
        internal void UpdateNarrative(string siteURL, string listName, string auditListName, string camlQuery, string pageID, string narrative, string userName)
        {
            SPList list;
            SPQuery query;
            SPListItemCollection objListItems;

            SPSecurity.RunWithElevatedPrivileges(delegate()
            {
                using (SPSite site = new SPSite(siteURL))
                {
                    using (SPWeb web = site.OpenWeb())
                    {
                        web.AllowUnsafeUpdates = true;
                        list = web.Lists[listName];
                        query = new SPQuery();
                        query.Query = camlQuery;
                        objListItems = list.GetItems(query);

                        if (objListItems.Count > 1)
                        {
                            foreach (SPListItem objListItem in objListItems)
                            {
                                objListItem["Narrative"] = narrative;
                                objListItem["Page_ID"] = Convert.ToInt32(pageID);
                                objListItem.Update();
                            }
                        }
                        else
                        {
                            SPListItem objListItem = list.Items.Add();
                            objListItem["Narrative"] = narrative;
                            objListItem["Page_ID"] = Convert.ToInt32(pageID);
                            objListItem.Update();
                        }

                        objCommonDAL = new CommonDAL();
                        objCommonDAL.UpdateListAuditHistory(siteURL, auditListName, Convert.ToInt32(pageID), userName, "9");
                        web.AllowUnsafeUpdates = false;
                    }
                }
            });
        }
コード例 #26
0
ファイル: WellBookBLL.cs プロジェクト: vijaymca/Dotnet
 /// <summary>
 /// Get Pages for the Selected Book
 /// </summary>
 /// <param name="strParentSiteUrl">Site URL.</param>
 /// <param name="listName">List Name.</param>
 /// <param name="strCamlQuery">CAML Query.</param>     
 /// <returns>ListEntry object</returns>
 public ListEntry GetBookPages(string siteURL, string listName, string CAMLQuery)
 {
     ListEntry objListEntry = null;
     DataTable dtResultTable = null;
     objWellBookChapterDAL = new WellBookChapterDAL();
     objCommonDAL = new CommonDAL();
     string strcamlQuery = string.Empty;
     int intRowId = 0;
     objListEntry = objWellBookChapterDAL.SetChapterPage(siteURL, listName, CAMLQuery);
     strcamlQuery = @"<Where><Eq><FieldRef Name='ID' />
          <Value Type='Counter'>" + Convert.ToString(objListEntry.ChapterDetails.RowID) + "</Value></Eq></Where>";
     dtResultTable = objCommonDAL.ReadList(siteURL, DWBCHAPTERLIST,
        strcamlQuery);
     if (dtResultTable != null && dtResultTable.Rows.Count > 0)
     {
         int.TryParse(Convert.ToString(dtResultTable.Rows[0]["Book_ID"]), out intRowId);
         objListEntry.ChapterDetails.BookID = intRowId;
         objListEntry.ChapterDetails.ChapterTitle = Convert.ToString(dtResultTable.Rows[0][TITLECOLUMN]);
     }
     if (dtResultTable != null)
     {
         dtResultTable.Dispose();
     }
     return objListEntry;
 }
コード例 #27
0
ファイル: ChapterBLL.cs プロジェクト: vijaymca/Dotnet
        /// <summary>
        /// Get the Owners for the chapter page
        /// for the team.
        /// Retrieves the users with Discipline form DWB Team Staff list.
        /// User belong to the team which owns the book are retrieved.
        /// </summary>
        /// <param name="siteURL">The site URL.</param>
        /// <param name="chapterId">Chapter ID.</param>
        /// <param name="chapterListName">Name of the chapter list.</param>
        /// <param name="bookListName">Name of the book list.</param>
        /// <param name="teamStaffListName">Name of the team staff list.</param>
        /// <returns>Data Table.</returns>
        public DataTable GetOwnersForChapterPage(string siteURL, string chapterId, string chapterListName, string bookListName, string teamStaffListName)
        {
            /// This method retrives the list of users with Discipline from DWB Team Staff list using below logic.
            /// Get all users with Team ID = ID of the team which owns the Book to which the pages are getting added.
            DataTable dtResultTable = null;
            string strBookId = string.Empty;
            string strTeamId = string.Empty;

            string strCamlQuery = @"<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + chapterId + "</Value></Eq></Where>";
            objCommonDAL = new CommonDAL();
            dtResultTable = objCommonDAL.ReadList(siteURL, chapterListName, strCamlQuery);
            if (dtResultTable == null && dtResultTable.Rows.Count < 1)
            {
                return dtResultTable;
            }
            else
            {
                strBookId = Convert.ToString(dtResultTable.Rows[0]["Book_ID"]);
                strCamlQuery = @"<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + strBookId + "</Value></Eq></Where>";

                dtResultTable = objCommonDAL.ReadList(siteURL, bookListName, strCamlQuery);
                if (dtResultTable == null && dtResultTable.Rows.Count < 1)
                {
                    return dtResultTable;
                }
                else
                {
                    strTeamId = Convert.ToString(dtResultTable.Rows[0]["Team_ID"]);
                    strCamlQuery = @"<Where><Eq><FieldRef Name='Team_ID' /><Value Type='Number'>" + strTeamId + "</Value></Eq></Where>";
                    dtResultTable = objCommonDAL.ReadList(siteURL, teamStaffListName, strCamlQuery);
                }
            }
            return dtResultTable;
        }
コード例 #28
0
ファイル: WellBookBLL.cs プロジェクト: vijaymca/Dotnet
 /// <summary>
 /// Get List Details
 /// </summary>
 /// <param name="siteURL">Site URL.</param>
 /// <param name="listName">List Name.</param>
 /// <param name="queryString">CAML Query.</param>
 /// <returns>DataTable</returns>
 public DataTable GetListDetails(string siteURL, string listName, string CAMLQuery)
 {
     objCommonDAL = new CommonDAL();
     return objCommonDAL.ReadList(siteURL, listName, CAMLQuery);
 }
コード例 #29
0
ファイル: PDFListVwrBLL.cs プロジェクト: vijaymca/Dotnet
 /// <summary>
 /// Gets the SP files.
 /// </summary>
 /// <param name="strContext">The STR context.</param>
 /// <param name="strLibraryName">Name of the STR library.</param>
 /// <param name="intBookId">The int book id.</param>
 /// <returns>DataTable</returns>
 public DataTable GetSPFiles(string context, string libraryName,int bookId)
 {
     objCommonDAL = new CommonDAL();
       return objCommonDAL.ReadLibrary(context, libraryName, bookId);
 }
コード例 #30
0
ファイル: ChapterBLL.cs プロジェクト: vijaymca/Dotnet
        /// <summary>
        /// Updates the Page sequence
        /// </summary>
        /// <param name="parentSiteUrl">Site URL.</param>
        /// <param name="listName">List Name.</param>
        /// <param name="auditListName">Name of the audit list.</param>
        /// <param name="dvUpdateListitems">DataView.</param>
        /// <param name="actionPerformed">Audit Action ID.</param>
        /// <param name="userName">Name of the user.</param>
        public void UpdateChapterSequence(string parentSiteUrl, string listName, string auditListName,
            DataView dvUpdateListitems, string actionPerformed, string userName)
        {
            objCommonDAL = new CommonDAL();

            objCommonDAL.UpdateSequence(parentSiteUrl, listName, dvUpdateListitems, "Chapter_Sequence");
            if (dvUpdateListitems != null && dvUpdateListitems.Count > 0)
            {
                for (int rowIndex = 0; rowIndex < dvUpdateListitems.Count; rowIndex++)
                {
                    objCommonDAL.UpdateListAuditHistory(parentSiteUrl, auditListName,
                        int.Parse(dvUpdateListitems[rowIndex]["ID"].ToString()), userName, actionPerformed);
                }
            }
            if (dvUpdateListitems != null)
                dvUpdateListitems.Dispose();
        }