private void CreateLocationDropDownTelerik()
        {
            Telerik.Web.UI.RadToolBarItem item = RadToolBar1.FindItemByValue("Item1");
            if (item == null)
            {
                return;
            }
            DropDownList1 = (DropDownList)item.FindControl("PressSelector");
            if (DropDownList1 == null)
            {
                return;
            }

            string locationsallowed = (string)Application["LogLocations"];

            string[] loclist = locationsallowed.Split(',');
            foreach (string s in loclist)
            {
                DropDownList1.Items.Add(s);
            }

            if ((string)Session["SelectedLogLocation"] == "")
            {
                DropDownList1.SelectedIndex = 0;
            }
            else
            {
                DropDownList1.SelectedValue = (string)Session["SelectedLogLocation"];
            }
        }
 private void SetRadToolbarTooltip2(string buttonID, string text)
 {
     Telerik.Web.UI.RadToolBarItem item = RadToolBar2.FindItemByValue(buttonID);
     if (item == null)
     {
         return;
     }
     item.ToolTip = text;
 }
 private void SetRadToolbarEnable2(string buttonID, bool enable)
 {
     Telerik.Web.UI.RadToolBarItem item = RadToolBar2.FindItemByValue(buttonID);
     if (item == null)
     {
         return;
     }
     item.Enabled = enable;
 }
        /*private void PrintImage(int mastercopyseparationset)
         *      {
         *              //sImagePath = (string)Session["ImagePath"];
         *
         *              string im = Global.sVirtualPreviewFolder + "/" + mastercopyseparationset.ToString() + ".jpg";
         *
         *              Response.Redirect("PrintFrame.aspx?imagepath="+im);
         *      } */

        private void SetRadToolbarLabel(string buttonID, string text)
        {
            Telerik.Web.UI.RadToolBarItem item = RadToolBar1.FindItemByValue(buttonID);
            if (item == null)
            {
                return;
            }
            item.Text = text;
        }
 private void SetRadToolbarVisible(string buttonID, bool visible)
 {
     Telerik.Web.UI.RadToolBarItem item = RadToolBar1.FindItemByValue(buttonID);
     if (item == null)
     {
         return;
     }
     item.Visible = visible;
 }
        private void CreateDropDowns()
        {
            CCDBaccess db = new CCDBaccess();

            string errmsg = "";

            ArrayList al = db.GetPubDateList(GetCurrentPressIDList(), out errmsg);

            Telerik.Web.UI.RadToolBarItem item = RadToolBar1.FindItemByValue("Item1");
            if (item == null)
            {
                return;
            }
            DropDownList1 = (DropDownList)item.FindControl("PubDateFilter");

            string currentSelection = "";

            if (DropDownList1.Items.Count > 0)
            {
                currentSelection = DropDownList1.SelectedItem.Value;
            }
            DropDownList1.Items.Clear();

            DropDownList1.Items.Add(new ListItem("All", "All")); // 0
            foreach (DateTime dt in al)
            {
                DropDownList1.Items.Add(new ListItem(dt.ToShortDateString(), PubDate2String(dt))); // 0
            }

            string s = PubDate2String((DateTime)Session["PressRunPubDate"]);

            if (DropDownList1.Items.FindByValue(currentSelection) != null)
            {
                DropDownList1.SelectedValue = currentSelection;
            }
            else if (DropDownList1.Items.FindByValue(s) != null)
            {
                DropDownList1.SelectedValue = s;
            }
            else
            {
                DateTime t = (DateTime)Session["PressRunPubDate"];
                t = t.AddDays(-1);
                s = PubDate2String(t);
                if (DropDownList1.Items.FindByValue(s) != null)
                {
                    DropDownList1.SelectedValue = s;
                    Session["PressRunPubDate"]  = t;
                }
                else
                {
                    DropDownList1.SelectedIndex = 0;
                    Session["PressRunPubDate"]  = DateTime.MinValue;
                }
            }
        }
        private void DisplayPageName()
        {
            Telerik.Web.UI.RadToolBarItem item = RadToolBar1.FindItemByValue("Item3");
            if (item == null)
            {
                return;
            }
            Label lbl = (Label)item.FindControl("PageName");

            if (lbl == null)
            {
                return;
            }
            lbl.ForeColor = Color.Black;
            lbl.BackColor = Color.Transparent;

            Response.ContentEncoding              = Encoding.GetEncoding((string)Session["encoding"]);
            Thread.CurrentThread.CurrentCulture   = CultureInfo.CreateSpecificCulture((string)Session["language"]);
            Thread.CurrentThread.CurrentUICulture = new CultureInfo((string)Session["language"]);
            lbl.ForeColor = Color.Black;
            lbl.BackColor = Color.LightGray;
            string sApp = Global.rm.GetString("txtNoApprovalRequired");

            if ((int)Session["CurrentApprovalState"] == 0)
            {
                sApp          = Global.rm.GetString("txtNotApproved");
                lbl.BackColor = Color.Yellow;
            }
            else if ((int)Session["CurrentApprovalState"] == 1)
            {
                sApp          = Global.rm.GetString("txtApproved");
                lbl.BackColor = Color.LightGreen;
            }
            else if ((int)Session["CurrentApprovalState"] == 2)
            {
                sApp          = Global.rm.GetString("txtRejected");
                lbl.BackColor = Color.Red;
            }

            lbl.Text = Global.rm.GetString("txtPage") + " " + (string)Session["CurrentPageName"] + " - " + sApp;

            item = RadToolBar1.FindItemByValue("Item5");
            if (item == null)
            {
                return;
            }
            lbl           = (Label)item.FindControl("PageFormat");
            lbl.Text      = " " + (string)Session["CurrentPageFormat"] + " ";
            lbl.ForeColor = Color.White;
            lbl.BackColor = Color.Gray;
        }
Example #8
0
        protected void EntityDocumentHistoryGrid_OnItemCommand(Object sender, Telerik.Web.UI.GridCommandEventArgs eventArgs)
        {
            if (MercuryApplication == null)
            {
                return;
            }

            Telerik.Web.UI.RadToolBar EnterFormToolbar;

            String hrefLocation = String.Empty;

            switch (eventArgs.CommandName)
            {
            case "SendCorrespondence":

                hrefLocation = "/Application/Actions/SendCorrespondence.aspx?EntityId=" + Entity.Id.ToString();

                Response.Redirect(hrefLocation, true);

                break;

            case "EnterReceivedForm":

                EnterFormToolbar = (Telerik.Web.UI.RadToolBar)eventArgs.Item.FindControl("EntityDocumentToolbar");

                if (EnterFormToolbar != null)
                {
                    Telerik.Web.UI.RadToolBarItem toolbarItem = EnterFormToolbar.Items.FindItemByValue("EnterReceivedFormToolbarButton");

                    Telerik.Web.UI.RadComboBox FormSelection = (Telerik.Web.UI.RadComboBox)toolbarItem.FindControl("FormSelection");

                    if (!String.IsNullOrEmpty(FormSelection.SelectedValue))
                    {
                        hrefLocation = "/Application/Forms/FormDataEntry/FormDataEntry.aspx?EntityCorrespondenceId=0&FormId=" + FormSelection.SelectedValue + "&EntityId=" + Entity.Id.ToString();

                        Response.Redirect(hrefLocation, true);
                    }
                }

                break;

            default:

                System.Diagnostics.Debug.WriteLine("MemberMetricsGrid_OnItemCommand: " + eventArgs.CommandSource + " " + eventArgs.CommandName + " (" + eventArgs.CommandArgument + ")");

                break;
            }

            return;
        }
        private void SetRadToolbarTooltip(string buttonID, string labelID, string text)
        {
            Telerik.Web.UI.RadToolBarItem item = RadToolBar1.FindItemByValue(buttonID);
            if (item == null)
            {
                return;
            }
            Label label = (Label)item.FindControl(labelID);

            if (label == null)
            {
                return;
            }
            label.ToolTip = text;
        }
        private string GetCommentBox()
        {
            string commentbox = "";

            Telerik.Web.UI.RadToolBarItem item1 = RadToolBar1.FindItemByValue("Item4");
            if (item1 == null)
            {
                return("");
            }

            TextBox txt = (TextBox)item1.FindControl("Comment");

            if (txt != null)
            {
                commentbox = txt.Text;
            }

            return(commentbox);
        }
Example #11
0
        private void DisplayPageName()
        {
            Telerik.Web.UI.RadToolBarItem item = RadToolBar1.FindItemByValue("Item3");
            if (item == null)
            {
                return;
            }
            Label lbl = (Label)item.FindControl("PageName");

            lbl.ForeColor = Color.Black;
            lbl.BackColor = Color.Transparent;
            string sApp = Global.rm.GetString("txtNoApprovalRequired");

            if ((int)Session["CurrentApprovalState"] == 0)
            {
                sApp          = Global.rm.GetString("txtNotApproved");
                lbl.BackColor = Color.Yellow;
            }
            else if ((int)Session["CurrentApprovalState"] == 1)
            {
                sApp          = Global.rm.GetString("txtApproved");
                lbl.BackColor = Color.LightGreen;
            }
            else if ((int)Session["CurrentApprovalState"] == 2)
            {
                sApp          = Global.rm.GetString("txtRejected");
                lbl.BackColor = Color.Red;
            }

            if ((string)Session["CurrentPageName"] == "0")
            {
                lbl.Text = "     " + (string)Session["CurrentPageName2"] + " - " + sApp;
            }
            else if ((string)Session["CurrentPageName2"] == "0")
            {
                lbl.Text = (string)Session["CurrentPageName"] + "     " + " - " + sApp;
            }
            else
            {
                lbl.Text = (string)Session["CurrentPageName"] + " & " + (string)Session["CurrentPageName2"] + " - " + sApp;
            }
        }
        private void SetCommentBox(string comment)
        {
            Telerik.Web.UI.RadToolBarItem item1 = RadToolBar1.FindItemByValue("Item4");
            if (item1 == null)
            {
                return;
            }

            TextBox txt = (TextBox)item1.FindControl("Comment");

            if (txt != null)
            {
                txt.Text = comment;
                if (comment != "")
                {
                    txt.BackColor = Color.Yellow;
                }
                else
                {
                    txt.BackColor = Color.White;
                }
            }
        }
Example #13
0
        private void RefreshPubDateFilter()
        {
            string     allString     = Global.rm.GetString("txtAll");
            string     weekString    = Global.rm.GetString("txtWeek");
            string     hideOldString = Global.rm.GetString("txtHideOld");
            CCDBaccess db            = new CCDBaccess();

            string    errmsg       = "";
            ArrayList weekList     = new ArrayList();
            ArrayList weekListDate = new ArrayList();


            ArrayList al = db.GetPubDateList(GetCurrentPressIDList(), false, ref weekList, ref weekListDate, out errmsg);

            Telerik.Web.UI.RadToolBarItem item = RadToolBar1.FindItemByValue("Item1");
            if (item == null)
            {
                return;
            }
            DropDownList DropDownList1 = (DropDownList)item.FindControl("PubDateFilter");

            string currentSelection = "";

            if (DropDownList1.Items.Count > 0)
            {
                currentSelection = DropDownList1.SelectedItem.Value;
            }
            DropDownList1.Items.Clear();

            DropDownList1.Items.Add(new ListItem(allString, "All"));          // 0
            DropDownList1.Items.Add(new ListItem(hideOldString, "Hide old")); // 1

            if ((bool)Application["ShowWeeknumberInTreeFilter"] == false)
            {
                foreach (DateTime dt in al)
                {
                    DropDownList1.Items.Add(new ListItem(LocalDateFormat(dt), PubDate2String(dt)));
                }
            }
            else
            {
                //foreach (int w in weekList)
                for (int i = 0; i < weekList.Count; i++)
                {
                    DropDownList1.Items.Add(new ListItem(string.Format("{0} {1:00}", weekString, weekList[i]), PubDate2String((DateTime)weekListDate[i])));
                }
            }

            string s = PubDate2String((DateTime)Session["PubDateFilter"]);

            if (DropDownList1.Items.FindByValue(currentSelection) != null)
            {
                DropDownList1.SelectedValue = currentSelection;
            }
            else if (DropDownList1.Items.FindByValue(s) != null)
            {
                DropDownList1.SelectedValue = s;
            }
            else
            {
                DateTime t = (DateTime)Session["PubDateFilter"];
                t = t.AddDays(-1);
                s = PubDate2String(t);
                if (DropDownList1.Items.FindByValue(s) != null)
                {
                    DropDownList1.SelectedValue = s;
                    Session["PubDateFilter"]    = t;
                }
                else
                {
                    DropDownList1.SelectedIndex = 0;
                    Session["PubDateFilter"]    = ((bool)Session["HideOld"]) ? DateTime.MaxValue : DateTime.MinValue;
                }
            }
        }
Example #14
0
        protected void EntityDocumentHistoryGrid_OnNeedDataSource(Object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs eventArgs)
        {
            if (MercuryApplication == null)
            {
                return;
            }

            System.Data.DataTable dataTable = EntityDocumentHistoryGrid_DataTable;


            switch (eventArgs.RebindReason)
            {
            case Telerik.Web.UI.GridRebindReason.InitialLoad:

                #region Initialize Grid

                EntityDocumentHistoryGrid_Count = 0;

                EntityDocumentHistoryGrid_CurrentPage = 0;

                EntityDocumentHistoryGrid_PageSize = 10;


                EntityDocumentHistoryGrid.CurrentPageIndex = EntityDocumentHistoryGrid_CurrentPage;

                EntityDocumentHistoryGrid.PageSize = EntityDocumentHistoryGrid_PageSize;

                EntityDocumentHistoryGrid.VirtualItemCount = EntityDocumentHistoryGrid_Count;

                #endregion

                break;

            case Telerik.Web.UI.GridRebindReason.PostbackViewStateNotPersisted:

                #region Restore Grid State

                if (EntityDocumentHistoryGrid_CurrentPage >= 0)
                {
                    EntityDocumentHistoryGrid.CurrentPageIndex = EntityDocumentHistoryGrid_CurrentPage;
                }

                EntityDocumentHistoryGrid.PageSize = EntityDocumentHistoryGrid_PageSize;

                EntityDocumentHistoryGrid.VirtualItemCount = EntityDocumentHistoryGrid_Count;


                if (EntityDocumentToolbar != null)
                {
                    Telerik.Web.UI.RadToolBarItem toolbarItem = EntityDocumentToolbar.Items.FindItemByValue("EnterReceivedFormToolbarButton");

                    Telerik.Web.UI.RadComboBox FormSelection = (Telerik.Web.UI.RadComboBox)toolbarItem.FindControl("FormSelection");

                    if (FormSelection != null)
                    {
                        FormSelection_SelectedValue = FormSelection.SelectedValue;
                    }
                }

                #endregion

                break;

            case Telerik.Web.UI.GridRebindReason.ExplicitRebind:

            case Telerik.Web.UI.GridRebindReason.PostBackEvent:

                #region Rebind Grid

                if (Entity == null)
                {
                    dataTable.Rows.Clear();
                }

                else
                {
                    if (EntityDocumentHistoryGrid_Count == 0)
                    {
                        EntityDocumentHistoryGrid_Count = Convert.ToInt32(MercuryApplication.EntityDocumentsGetCount(Entity.Id));

                        EntityDocumentHistoryGrid.VirtualItemCount = Convert.ToInt32(EntityDocumentHistoryGrid_Count);
                    }

                    if (!pageSizeChanged)
                    {
                        EntityDocumentHistoryGrid_PageSize = EntityDocumentHistoryGrid.PageSize;
                    }

                    else
                    {
                        EntityDocumentHistoryGrid.PageSize = EntityDocumentHistoryGrid_PageSize;

                        pageSizeChanged = false;
                    }


                    EntityDocumentHistoryGrid_CurrentPage = EntityDocumentHistoryGrid.CurrentPageIndex;

                    dataTable.Rows.Clear();

                    List <Mercury.Server.Application.EntityDocumentDataView> entityDocuments;

                    Int32 initialRow = EntityDocumentHistoryGrid.CurrentPageIndex * EntityDocumentHistoryGrid.PageSize + 1;

                    entityDocuments = MercuryApplication.EntityDocumentsGetByPage(Entity.Id, initialRow, EntityDocumentHistoryGrid.PageSize);

                    foreach (Mercury.Server.Application.EntityDocumentDataView currentDocument in entityDocuments)
                    {
                        #region Create Data Row

                        String detail = String.Empty;

                        String markSent = "&nbsp";

                        String markReceived = "&nbsp";

                        String markReturned = "&nbsp";

                        String automation = "&nbsp";

                        String relatedEntity = String.Empty;


                        if (currentDocument.DocumentType == "Correspondence")
                        {
                            Client.Core.Reference.Correspondence correspondence = MercuryApplication.CorrespondenceGet(currentDocument.DocumentId, true);


                            if ((currentDocument.HasImage) || (correspondence.Content.Count > 0))
                            {
                                detail = "<a href=\"javascript:void(0);\" onclick=\"javascript:window.open ('/Application/Common/Image.aspx?ObjectType=EntityCorrespondence&ObjectId=" + currentDocument.EntityDocumentId.ToString() + "&Render=true', '_blank', 'toolbar=0, location=0, directories=0, status=1, menubar=0, scrollbars=1, resizable=1');\"><img src=\"/Images/Common16/Document.png\" border=\"0\" /></a>";
                            }


                            if (currentDocument.SentDate.HasValue)
                            {
                                markSent = currentDocument.SentDate.Value.ToString("MM/dd/yyyy");

                                if (currentDocument.ReturnedDate.HasValue)
                                {
                                    markReturned = currentDocument.ReturnedDate.Value.ToString("MM/dd/yyyy");
                                }

                                else if ((!currentDocument.ReceivedDate.HasValue) && (correspondence != null))
                                {
                                    markReturned = " <a href=\"javascript:Correspondence_MarkReturned (" + currentDocument.EntityDocumentId.ToString() + ", '" + correspondence.Name + "', '" + currentDocument.SentDate.Value.ToString("MM/dd/yyyy") + "')\" title=\"Mark the correspondence as returned as undeliverable.\">(mark returned)</a>";
                                }
                            }

                            else
                            {
                                markSent = " <a href=\"javascript:Correspondence_MarkSent (" + currentDocument.EntityDocumentId.ToString() + ", '" + correspondence.Name + "', '" + currentDocument.ReadyToSendDate.Value.ToString("MM/dd/yyyy") + "')\">(mark sent)</a>";
                            }


                            // MCM-1175: Received Date was not visible unless the sent date had a value. This was not true for

                            // inbound correspondence only. Moved the received date setter outside.

                            if (currentDocument.ReceivedDate.HasValue)
                            {
                                markReceived = currentDocument.ReceivedDate.Value.ToString("MM/dd/yyyy");
                            }

                            // ALLOW DATA ENTRY ON THOSE OUTBOUND CORRESPONDENCE THAT HAVE BEEN SENT

                            else if ((currentDocument.SentDate.HasValue) && (!currentDocument.ReturnedDate.HasValue) && (correspondence.FormId != 0) && (currentDocument.EntityFormId == 0))
                            {
                                markReceived = " <a href=\"/Application/Forms/FormDataEntry/FormDataEntry.aspx?EntityCorrespondenceId=" + currentDocument.EntityDocumentId.ToString() + "&formid=" + correspondence.FormId.ToString() + "\">(received - data enter)</a>";
                            }


                            // TODO: MOVE AUTOMATION INTO THE DATA VIEW

                            Client.Core.Entity.EntityCorrespondence entityCorrespondence = MercuryApplication.EntityCorrespondenceGet(currentDocument.EntityDocumentId, true);

                            if (entityCorrespondence != null)
                            {
                                String automationTitle = ((entityCorrespondence.AutomationDate.HasValue) ? "[" + entityCorrespondence.AutomationDate.Value.ToString("MM/dd/yyyy") + "] " : String.Empty);

                                automationTitle += entityCorrespondence.AutomationStatus.ToString();

                                automationTitle += (!String.IsNullOrWhiteSpace(entityCorrespondence.AutomationException)) ? ": " + entityCorrespondence.AutomationException : String.Empty;

                                automation = "<span title=\"" + automationTitle + "\"><img src=\"/Images/Common16/Automation" + entityCorrespondence.AutomationStatus.ToString() + ".png\" /></span>";
                            }


                            if (entityCorrespondence.RelatedEntity != null)
                            {
                                relatedEntity = entityCorrespondence.RelatedEntity.Name;

                                switch (entityCorrespondence.RelatedEntity.EntityType)
                                {
                                case Mercury.Server.Application.EntityType.Member:

                                    relatedEntity = CommonFunctions.MemberProfileAnchor(entityCorrespondence.RelatedEntityId, relatedEntity).Replace("MemberId=", "EntityId=");

                                    break;

                                case Mercury.Server.Application.EntityType.Provider:

                                    relatedEntity = CommonFunctions.ProviderProfileAnchor(entityCorrespondence.RelatedEntityId, relatedEntity).Replace("ProviderId=", "EntityId=");

                                    break;
                                }
                            }
                        }

                        dataTable.Rows.Add(

                            detail,

                            currentDocument.DocumentType,

                            currentDocument.EntityDocumentId.ToString(),

                            currentDocument.DocumentId.ToString(),

                            currentDocument.EntityId.ToString(),

                            (currentDocument.DocumentType == "Form") ? CommonFunctions.FormAnchor(currentDocument.EntityDocumentId, currentDocument.Name) : currentDocument.Name,

                            String.Format("{0:0.00######}", currentDocument.Version),

                            ((currentDocument.ContactType != Mercury.Server.Application.EntityContactType.NotSpecified) ? Mercury.Server.CommonFunctions.EnumerationToString(currentDocument.ContactType) : String.Empty),

                            (currentDocument.ReadyToSendDate.HasValue) ? currentDocument.ReadyToSendDate.Value.ToString("MM/dd/yyyy") : "&nbsp",

                            markSent,

                            markReceived,

                            markReturned,

                            relatedEntity,

                            automation,

                            currentDocument.CreateAccountInfo.ActionDate.ToString(),

                            currentDocument.CreateAccountInfo.UserAccountName,

                            currentDocument.ModifiedAccountInfo.ActionDate.ToString(),

                            currentDocument.ModifiedAccountInfo.UserAccountName

                            );

                        #endregion
                    }
                }

                break;

                #endregion

            default:

                System.Diagnostics.Debug.WriteLine(eventArgs.RebindReason + " [" + eventArgs.IsFromDetailTable.ToString() + "]");

                break;
            }


            EntityDocumentHistoryGrid_DataTable = dataTable;

            EntityDocumentHistoryGrid.DataSource = EntityDocumentHistoryGrid_DataTable;

            return;
        }
Example #15
0
        protected void RadToolBar1_ButtonClick(object sender, Telerik.Web.UI.RadToolBarEventArgs e)
        {
            Telerik.Web.UI.RadToolBarButton item1 = (Telerik.Web.UI.RadToolBarButton)RadToolBar1.FindItemByValue("SendMail");
            if (item1 != null)
            {
                Session["SendMail"] = item1.Checked;
            }


            string comment = GetCommentBox();

            Telerik.Web.UI.RadToolBarItem item = RadToolBar1.FindItemByValue("Item3");
            if (item == null)
            {
                return;
            }
            Label lbl = (Label)item.FindControl("PageName");

            string errmsg = "";

            if (e.Item.Value == "Forward")
            {
                // Are we at the end already?
                if ((int)Session["CurrentCopySeparationSet2"] == 0)
                {
                    PrepareZoom((int)Session["CurrentCopySeparationSet"], (int)Session["CurrentCopySeparationSet2"],
                                (string)Session["CurrentPageName"], (string)Session["CurrentPageName2"], (int)Session["CurrentApprovalState"]);

                    return;
                }

                CCDBaccess db = new CCDBaccess();

                string sPageNameLeft = "";
                int    nApproveLeft  = 0;
                nCurrentCopySeparationSet = db.GetReadviewNextPage((int)Session["CurrentCopySeparationSet2"], out sPageNameLeft, out nApproveLeft, out errmsg);

                string sPageNameRight = "";
                int    nApproveRight  = 1;
                nCurrentCopySeparationSet2 = db.GetReadviewNextPage(nCurrentCopySeparationSet, out sPageNameRight, out nApproveRight, out errmsg);

                if (nCurrentCopySeparationSet == 0 && nCurrentCopySeparationSet2 == 0)
                {
                    PrepareZoom((int)Session["CurrentCopySeparationSet"], (int)Session["CurrentCopySeparationSet2"],
                                (string)Session["CurrentPageName"], (string)Session["CurrentPageName2"], (int)Session["CurrentApprovalState"]);
                    return;
                }

                if ((string)Session["ShowSep"] != "CMYK" && (string)Session["ShowSep"] != "MASK")
                {
                    Session["ShowSep"] = "CMYK";
                }

                PrepareZoom(nCurrentCopySeparationSet, nCurrentCopySeparationSet2, sPageNameLeft, sPageNameRight, nCurrentCopySeparationSet > 0 ? nApproveLeft : nApproveRight);
            }


            if (e.Item.Value == "Backward")
            {
                // Are we at the front already?
                if ((int)Session["CurrentCopySeparationSet"] == 0)
                {
                    PrepareZoom((int)Session["CurrentCopySeparationSet"], (int)Session["CurrentCopySeparationSet2"],
                                (string)Session["CurrentPageName"], (string)Session["CurrentPageName2"], (int)Session["CurrentApprovalState"]);
                    return;
                }
                CCDBaccess db = new CCDBaccess();

                string sPageNameLeft  = "";
                int    nApproveLeft   = 0;
                string sPageNameRight = "";
                int    nApproveRight  = 1;

                nCurrentCopySeparationSet2 = db.GetReadviewPrevPage((int)Session["CurrentCopySeparationSet"], out sPageNameRight, out nApproveRight, out errmsg);
                nCurrentCopySeparationSet  = db.GetReadviewPrevPage(nCurrentCopySeparationSet2, out sPageNameLeft, out nApproveLeft, out errmsg);
                if (nCurrentCopySeparationSet == 0 && nCurrentCopySeparationSet2 == 0)
                {
                    PrepareZoom((int)Session["CurrentCopySeparationSet"], (int)Session["CurrentCopySeparationSet2"],
                                (string)Session["CurrentPageName"], (string)Session["CurrentPageName2"], (int)Session["CurrentApprovalState"]);
                    return;
                }

                if ((string)Session["ShowSep"] != "CMYK" && (string)Session["ShowSep"] != "MASK")
                {
                    Session["ShowSep"] = "CMYK";
                }

                PrepareZoom(nCurrentCopySeparationSet, nCurrentCopySeparationSet2, sPageNameLeft, sPageNameRight, nCurrentCopySeparationSet > 0 ? nApproveLeft : nApproveRight);
            }

            if (e.Item.Value == "Approve")
            {
                if ((bool)Session["MayApprove"] == false)
                {
                    return;
                }
                CCDBaccess db = new CCDBaccess();

                nCurrentCopySeparationSet  = (int)Session["CurrentCopySeparationSet"];
                nCurrentCopySeparationSet2 = (int)Session["CurrentCopySeparationSet2"];

                if (nCurrentCopySeparationSet > 0)
                {
                    if (db.UpdateApproval((string)Session["UserName"], nCurrentCopySeparationSet, 1, out errmsg) == false)
                    {
                        lbl.Text = "Could not update approve status";
                    }
                    else
                    {
                        Session["CurrentApprovalState"] = 1;
                        lbl.Text = "Page " + (string)Session["CurrentPageName"] + " is currently APPROVED";
                    }
                }

                if (nCurrentCopySeparationSet2 > 0)
                {
                    if (db.UpdateApproval((string)Session["UserName"], nCurrentCopySeparationSet2, 1, out errmsg) == false)
                    {
                        lbl.Text = "Could not update approve status";
                    }
                    else
                    {
                        Session["CurrentApprovalState"] = 1;
                        lbl.Text = "Page " + (string)Session["CurrentPageName"] + " is currently APPROVED";
                    }
                }

                if ((bool)Session["LogApprove"])
                {
                    if (nCurrentCopySeparationSet > 0)
                    {
                        db.UpdateApproveLog(nCurrentCopySeparationSet, 1, true, "", (string)Session["UserName"], out errmsg);
                    }
                    if (nCurrentCopySeparationSet2 > 0)
                    {
                        db.UpdateApproveLog(nCurrentCopySeparationSet2, 1, true, "", (string)Session["UserName"], out errmsg);
                    }
                }

                if ((bool)Session["CloseZoomAfterApprove"])
                {
                    Response.Redirect("ReadView.aspx");
                }
            }

            if (e.Item.Value == "Disapprove")
            {
                if ((bool)Session["MayApprove"] == false)
                {
                    return;
                }
                CCDBaccess db = new CCDBaccess();

                nCurrentCopySeparationSet  = (int)Session["CurrentCopySeparationSet"];
                nCurrentCopySeparationSet2 = (int)Session["CurrentCopySeparationSet2"];

                if (nCurrentCopySeparationSet > 0)
                {
                    if (db.UpdateApproval((string)Session["UserName"], nCurrentCopySeparationSet, 2, out errmsg) == false)
                    {
                        lbl.Text = "Could not update approve status";
                    }
                    else
                    {
                        Session["CurrentApprovalState"] = 2;
                        lbl.Text = "Page " + (string)Session["CurrentPageName"] + " is currently REJECTED";

                        if ((bool)Session["LogDisapprove"])
                        {
                            db.UpdateApproveLog(nCurrentCopySeparationSet, 1, false, comment, (string)Session["UserName"], out errmsg);
                        }
                        if ((bool)Session["SendMail"])
                        {
                            try
                            {
                                SmtpClient  client = new SmtpClient((string)ConfigurationManager.AppSettings["SMTPServer"]);
                                MailAddress cc     = new MailAddress((string)ConfigurationManager.AppSettings["MailCC"]);

                                MailMessage mailNew = new MailMessage((string)ConfigurationManager.AppSettings["MailFrom"], (string)ConfigurationManager.AppSettings["MailTo"]);
                                mailNew.CC.Add((string)ConfigurationManager.AppSettings["MailCC"]);
                                mailNew.Subject = (string)ConfigurationManager.AppSettings["MailSubject"];
                                mailNew.Attachments.Add(new Attachment((string)Session["RealImagePath"]));

                                DateTime tPubDate = (DateTime)Session["SelectedPubDate"];

                                string pagename = (string)Session["SelectedPublication"] + "-" + (string)Session["SelectedSection"] + "-" + (string)Session["SelectedEdition"] + "-" + (string)Session["CurrentPageName"];

                                string mailBody = "The following page was rejected by user " + (string)Session["UserName"] + "\n\n Page " + pagename + "\n\nComment: " + comment;
                                mailNew.Body = mailBody;
                                client.Send(mailNew);
                            }
                            catch // (System.Web.HttpException ehttp)
                            {
                            }
                        }
                    }
                }
                if (nCurrentCopySeparationSet2 > 0)
                {
                    if (db.UpdateApproval((string)Session["UserName"], nCurrentCopySeparationSet2, 2, out errmsg) == false)
                    {
                        lbl.Text = "Could not update approve status";
                    }
                    else
                    {
                        Session["CurrentApprovalState"] = 2;
                        lbl.Text = "Page " + (string)Session["CurrentPageName2"] + " is currently REJECTED";

                        if ((bool)Session["LogDisapprove"])
                        {
                            db.UpdateApproveLog(nCurrentCopySeparationSet2, 1, false, comment, (string)Session["UserName"], out errmsg);
                        }
                        if ((bool)Session["SendMail"])
                        {
                            try
                            {
                                // MailMessage mailNew = (MailMessage)Session["CurrentMail"];
                                SmtpClient client = new SmtpClient((string)ConfigurationManager.AppSettings["SMTPServer"]);

                                MailAddress cc = new MailAddress((string)ConfigurationManager.AppSettings["MailCC"]);

                                MailMessage mailNew = new MailMessage((string)ConfigurationManager.AppSettings["MailFrom"], (string)ConfigurationManager.AppSettings["MailTo"]);
                                mailNew.CC.Add((string)ConfigurationManager.AppSettings["MailCC"]);
                                mailNew.Subject = (string)ConfigurationManager.AppSettings["MailSubject"];

                                mailNew.Attachments.Add(new Attachment((string)Session["RealImagePath"]));

                                DateTime tPubDate = (DateTime)Session["SelectedPubDate"];

                                string pagename = (string)Session["SelectedPublication"] + "-" + (string)Session["SelectedSection"] + "-" + (string)Session["SelectedEdition"] + "-" + (string)Session["CurrentPageName2"];

                                string mailBody = "The following page was rejected by user " + (string)Session["UserName"] + "\n\n Page " + pagename + "\n\nComment: " + comment;
                                mailNew.Body = mailBody;
                                client.Send(mailNew);
                            }
                            catch // (System.Web.HttpException ehttp)
                            {
                            }
                        }
                    }
                }
                if ((bool)Session["CloseZoomAfterApprove"])
                {
                    Response.Redirect("ReadView.aspx");
                }
            }

            if (e.Item.Value == "Close")
            {
                Response.Redirect("ReadView.aspx");
            }

            if (e.Item.Value == "CMYK" || e.Item.Value == "Mask")
            {
                Session["ShowSep"] = e.Item.Value.ToUpper();
                PrepareZoom((int)Session["CurrentCopySeparationSet"], (int)Session["CurrentCopySeparationSet2"],
                            (string)Session["CurrentPageName"], (string)Session["CurrentPageName2"], (int)Session["CurrentApprovalState"]);
            }
        }