Пример #1
0
        /// <summary>
        /// Gets the well book summary.
        /// </summary>
        /// <param name="BookID">The book ID.</param>
        /// <returns></returns>
        protected DataTable GetWellBookSummary(string BookID)
        {
            DataView dvResultView = null;
            DataTable dtPageOwner = null;
            int intTotal = 0;
            int intSignOff = 0;
            int intNotSignOff = 0;
            int intEmpty = 0;
            int intFooterTotal = 0;
            int intFooterSignOff = 0;
            int intFooterNotSignOff = 0;
            int intFooterEmpty = 0;
            string strValue = string.Empty;
            DataTable dtBookSummary = null;
            StringBuilder strChapterId = new StringBuilder();
            DataRow drSummaryRow;
            string strCamlQuery = string.Empty;
            string strViewFields = string.Empty;
            if (!string.IsNullOrEmpty(BookID))
            {
                strCamlQuery = @"<Where><Eq><FieldRef Name='Book_ID'/><Value Type='Counter'>" + BookID + "</Value></Eq></Where>";
                strViewFields = @"<FieldRef Name='ID'/>";
                objCommonBLL = new CommonBLL();
                DataTable dtresult = objCommonBLL.ReadList(strParentSiteURL, DWBCHAPTERLIST, strCamlQuery);
                if (dtresult != null && dtresult.Rows.Count > 0)
                {
                    intFooterEmpty = 0;
                    intFooterNotSignOff = 0;
                    intFooterSignOff = 0;
                    intFooterTotal = 0;

                    objWellBookBLL = new WellBookBLL();
                    dtresult = objWellBookBLL.GetPagesForBook(strParentSiteURL, BookID, "No");
                    if (dtresult != null && dtresult.Rows.Count > 0)
                    {
                        dvResultView = dtresult.DefaultView;
                        if (dvResultView != null && dvResultView.Count > 0)
                        {
                            dtPageOwner = dvResultView.ToTable(true, "Owner");
                        }
                    }
                    if (dtPageOwner != null && dtPageOwner.Rows.Count > 0)
                    {
                        dtBookSummary = GetSummaryTable();
                        for (int intRowIndex = 0; intRowIndex < dtPageOwner.Rows.Count; intRowIndex++)
                        {
                            intTotal = 0;
                            intSignOff = 0;
                            intNotSignOff = 0;
                            intEmpty = 0;
                            dvResultView.RowFilter = "Owner ='" + Convert.ToString(dtPageOwner.Rows[intRowIndex]["Owner"]) + "'";
                            for (int intViewIndex = 0; intViewIndex < dvResultView.Count; intViewIndex++)
                            {
                                intTotal = intTotal + 1;
                                strValue = Convert.ToString(dvResultView[intViewIndex][EMPTYCOLUMN]);
                                if (strValue.Equals("Yes"))
                                {
                                    intEmpty = intEmpty + 1;

                                }
                                strValue = Convert.ToString(dvResultView[intViewIndex]["Sign_Off_Status"]);
                                if (strValue.Equals("Yes"))
                                {
                                    intSignOff = intSignOff + 1;

                                }
                                else
                                {
                                    intNotSignOff = intNotSignOff + 1;
                                }

                            }
                            drSummaryRow = dtBookSummary.NewRow();
                            drSummaryRow["Page_Owner"] = Convert.ToString(dtPageOwner.Rows[intRowIndex]["Owner"]);
                            drSummaryRow[TOTALCOLUMN] = intTotal;
                            drSummaryRow["Signed_Off"] = intSignOff;
                            drSummaryRow["NotSigned_Off"] = intNotSignOff;
                            drSummaryRow[EMPTYCOLUMN] = intEmpty;
                            dtBookSummary.Rows.Add(drSummaryRow);
                            intFooterTotal = intFooterTotal + intTotal;
                            intFooterSignOff = intFooterSignOff + intSignOff;
                            intFooterNotSignOff = intFooterNotSignOff + intNotSignOff;
                            intFooterEmpty = intFooterEmpty + intEmpty;
                        }
                        drSummaryRow = dtBookSummary.NewRow();
                        drSummaryRow["Page_Owner"] = TOTALCOLUMN;
                        drSummaryRow[TOTALCOLUMN] = intFooterTotal;
                        drSummaryRow["Signed_Off"] = intFooterSignOff;
                        drSummaryRow["NotSigned_Off"] = intFooterNotSignOff;
                        drSummaryRow[EMPTYCOLUMN] = intFooterEmpty;
                        dtBookSummary.Rows.Add(drSummaryRow);

                    }
                }
                if (dtPageOwner != null)
                {
                    dtPageOwner.Dispose();
                }
                if (dtresult != null)
                {
                    dtresult.Dispose();
                }
            }
            return dtBookSummary;
        }
Пример #2
0
        /// <summary>
        /// Added By Gopinath
        /// Date : 27/11/2010
        /// Reason : PageOwner exists any of chapter list and pages print button should dispaly.
        /// </summary>
        /// <param name="BookID"></param>
        /// <returns></returns>
        protected bool CheckPageOwnerInBookList(string BookID)
        {
            DataView dvResultView = null;
            DataTable dtPageOwner = null;
            DataTable dtBookSummary = null;
            StringBuilder strChapterId = new StringBuilder();
            DataRow drSummaryRow;
            string strCamlQuery = string.Empty;
            string strViewFields = string.Empty;
            string strCurrentUserName = string.Empty;
            bool blnCurrentPOExists = false;

            if (!string.IsNullOrEmpty(BookID))
            {
                strCamlQuery = @"<Where><Eq><FieldRef Name='Book_ID'/><Value Type='Counter'>" + BookID + "</Value></Eq></Where>";
                strViewFields = @"<FieldRef Name='ID'/>";
                objCommonBLL = new CommonBLL();
                DataTable dtresult = objCommonBLL.ReadList(strParentSiteURL, DWBCHAPTERLIST, strCamlQuery);

                //Check for chapterIDs
                if (dtresult != null && dtresult.Rows.Count > 0)
                {
                    objWellBookBLL = new WellBookBLL();
                    dtresult = objWellBookBLL.GetPagesForBook(strParentSiteURL, BookID, "No");

                    if (dtresult != null && dtresult.Rows.Count > 0)
                    {
                        dvResultView = dtresult.DefaultView;
                        if (dvResultView != null && dvResultView.Count > 0)
                        {
                            dtPageOwner = dvResultView.ToTable(true, "Owner");
                        }
                    }
                    if (dtPageOwner != null && dtPageOwner.Rows.Count > 0)
                    {
                        strCurrentUserName = GetUserName();

                        foreach (DataRow drRow in dtPageOwner.Rows)
                        {
                            //if(drRow["Owner"].ToString()
                            if (string.Compare(drRow["Owner"].ToString(), strCurrentUserName, true)==0)
                            {
                                blnCurrentPOExists = true;
                                break;
                            }
                        }
                    }
                }
                if (dtPageOwner != null)
                {
                    dtPageOwner.Dispose();
                }
                if (dtresult != null)
                {
                    dtresult.Dispose();
                }
            }

            return blnCurrentPOExists;
        }