private void SetRadToolbarChecked2(string buttonID, bool check)
 {
     Telerik.Web.UI.RadToolBarButton item = (Telerik.Web.UI.RadToolBarButton)RadToolBar2.FindItemByValue(buttonID);
     if (item == null)
     {
         return;
     }
     item.Checked = check;
 }
 private void SetRadToolbarVisible2(string buttonID, bool visible)
 {
     Telerik.Web.UI.RadToolBarButton item = (Telerik.Web.UI.RadToolBarButton)RadToolBar2.FindItemByValue(buttonID);
     if (item == null)
     {
         return;
     }
     item.Visible = visible;
 }
        protected void CarePlanToolbar_OnButtonClick(Object sender, Telerik.Web.UI.RadToolBarEventArgs e)
        {
            Telerik.Web.UI.RadToolBarButton button = (Telerik.Web.UI.RadToolBarButton)e.Item;

            if (button == null)
            {
                return;
            }


            switch (button.Text)
            {
            case "View by Problem Statement":

                CarePlanViewMode.Text = "ProblemStatement";

                button.Text = "View by Care Plan";


                MemberCaseCarePlanListView.Visible = (CarePlanViewMode.Text == "CarePlan");

                ProblemClassListView.Visible = (CarePlanViewMode.Text == "ProblemStatement");

                ProblemClassListView.Rebind();

                break;

            case "View by Care Plan":

                CarePlanViewMode.Text = "CarePlan";

                button.Text = "View by Problem Statement";


                MemberCaseCarePlanListView.Visible = (CarePlanViewMode.Text == "CarePlan");

                ProblemClassListView.Visible = (CarePlanViewMode.Text == "ProblemStatement");

                MemberCaseCarePlanListView.Rebind();

                break;

            default: break;
            }

            return;
        }
Esempio n. 4
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            if (!IsPostBack)
            {
                SetLanguage();
                Telerik.Web.UI.RadToolBarButton item = (Telerik.Web.UI.RadToolBarButton)RadToolBar1.FindItemByValue("HideOld");
                if (item != null)
                {
                    item.Checked = (bool)Session["HideOld"];
                }


                if ((bool)Application["ShowCustomMenu"] && (bool)Session["IsAdmin"])
                {
                    item = (Telerik.Web.UI.RadToolBarButton)RadToolBar1.FindItemByValue("CustomMenu");
                    if (item != null)
                    {
                        item.Visible = true;
                        item.Text    = (string)Application["ShowCustomMenuName"];
                    }
                }
                RefreshPubDateFilter();

                /* bool setPressRunDate = false;
                 * if (Session["PubDateFilter"] == null)
                 *   setPressRunDate = true;
                 * else if ((DateTime)Session["PubDateFilter"] == DateTime.MinValue)
                 *   setPressRunDate = true;
                 *
                 * if (Session["PubDateFilter"] != null)
                 * {
                 *   ArrayList alFilterList = (ArrayList)Session["PubDateFilter"];
                 *   if (alFilterList != null)
                 *   {
                 *       foreach ()
                 *   }
                 *   DateTime tToday = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 0, 0, 0);
                 *   if (DateTime.Now.Hour > 5)
                 *       Session["PressRunPubDate"] = tToday.AddDays(1);
                 *   else
                 *       Session["PressRunPubDate"] = tToday;
                 * }*/
            }
        }
Esempio n. 5
0
        protected void RadToolBar1_ButtonClick(object sender, Telerik.Web.UI.RadToolBarEventArgs e)
        {
            if (e.Item.Value == "HideOld")
            {
                Telerik.Web.UI.RadToolBarButton btn = (Telerik.Web.UI.RadToolBarButton)e.Item;
                if (btn != null)
                {
                    Session["HideOld"] = btn.Checked;
                }
                Session["PubDateFilter"] = ((bool)Session["HideOld"]) ? DateTime.MaxValue : DateTime.MinValue;
                updateTreeMenu           = true;
                Session["RefreshTree"]   = true;
            }

            if (e.Item.Value == "CustomMenu")
            {
                doPopupCustomWindow();
            }
        }
Esempio n. 6
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            if ((string)Session["UserName"] == null)
            {
                Response.Redirect("~/SessionTimeout.htm");
            }

            if ((string)Session["UserName"] == "")
            {
                Response.Redirect("/Denied.htm");
            }

            if (!Page.IsPostBack)
            {
                SetLanguage();

                Telerik.Web.UI.RadToolBarButton item = (Telerik.Web.UI.RadToolBarButton)RadToolBar1.FindItemByValue("SendMail");
                if (item != null)
                {
                    item.Checked = (bool)Session["SendMail"];
                    item.Visible = (bool)Session["SendMail"];
                }
                item = (Telerik.Web.UI.RadToolBarButton)RadToolBar1.FindItemByValue("Mask");
                if (item != null)
                {
                    item.Visible = (bool)Application["ThumbnailShowMask"];
                }

                PrepareZoom((int)Session["CurrentCopySeparationSet"], (int)Session["CurrentCopySeparationSet2"],
                            (string)Session["CurrentPageName"], (string)Session["CurrentPageName2"], (int)Session["CurrentApprovalState"]);
            }
            if ((bool)Application["NoCache"])
            {
                Response.AppendHeader("cache-control", "private");
                Response.AppendHeader("pragma", "no-cache");
                Response.AppendHeader("expires", "Fri, 30 Oct 1998 14:19:41 GMT");
                Response.CacheControl = "Private";
                Response.Cache.SetNoStore();
            }
        }
        protected void RadToolBar1_ButtonClick(object sender, Telerik.Web.UI.RadToolBarEventArgs e)
        {
            string commentbox = GetCommentBox();

            Telerik.Web.UI.RadToolBarButton item = (Telerik.Web.UI.RadToolBarButton)RadToolBar2.FindItemByValue("SendMail");
            if (item != null)
            {
                Session["SendMail"] = item.Checked;
            }



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

            /*	if (e.Button.Key == "Print") {
             *              PrintImage((int)Session["CurrentCopySeparationSet"]);
             *      } */

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

                if (db.UpdateApproval((string)Session["UserName"], nCurrentCopySeparationSet, 1, commentbox, out errmsg) == false)
                {
                    //lblError.Text = "Could not update approve status - "+errmsg;
                }
                else
                {
                    Session["CurrentApprovalState"] = 1;
                    DisplayPageName();
                }

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

                if ((bool)Session["CloseZoomAfterApprove"])
                {
                    if ((bool)Application["UseChannels"])
                    {
                        Response.Redirect("ThumbnailViewChannels.aspx");
                    }
                    else
                    {
                        Response.Redirect("Thumbnailview2.aspx");
                    }
                }
            }



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

                CCDBaccess db = new CCDBaccess();

                if (db.UpdateApproval((string)Session["UserName"], nCurrentCopySeparationSet, 2, commentbox, out errmsg) == false)
                {
                    //lblError.Text = "Could not update approve status - "+errmsg;
                }
                else
                {
                    Session["CurrentApprovalState"] = 2;
                    DisplayPageName();

                    if ((bool)Session["LogDisapprove"])
                    {
                        if ((bool)Session["SetCommentOnDisapproval"] == true)
                        {
                            db.UpdateApproveLog(nCurrentCopySeparationSet, 1, false, commentbox, (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 " + Session["UserName"] + "\n\n Page " + pagename + "\n\nComment: " + commentbox;
                            mailNew.Body = mailBody;
                            client.Send(mailNew);
                        }
                        catch                         //(System.Web.HttpException ehttp)
                        {
                            //lblError.Text = "Error sending email: Cannot reach server or your e-mail address was rejected ("+ ehttp.Message+")";
                            //	return;
                        }
                    }
                }
                if ((bool)Session["CloseZoomAfterApprove"])
                {
                    if ((bool)Application["UseChannels"])
                    {
                        Response.Redirect("ThumbnailViewChannels.aspx?Refresh=2");
                    }
                    else
                    {
                        Response.Redirect("Thumbnailview2.aspx?Refresh=2");
                    }
                }
            }

            if (e.Item.Value == "Close")
            {
                if ((bool)Application["UseChannels"])
                {
                    Response.Redirect("ThumbnailViewChannels.aspx?Refresh=2");
                }
                else
                {
                    Response.Redirect("Thumbnailview2.aspx?Refresh=2");
                }
            }
        }
        protected void InitializeToolbar()
        {
            if (Member == null)
            {
                return;
            }


            #region Member Actions

            MercuryApplication.WorkTeamsForSession(false);  // CLEAR CACHE OF SESSION WORK TEAMS

            List <Client.Core.Work.Workflow> workflowsAvailable = MercuryApplication.WorkflowsAvailable(true);

            if (workflowsAvailable.Count == 0)
            {
                workflowsAvailable = MercuryApplication.WorkflowsAvailable(false);
            }

            foreach (Client.Core.Work.Workflow currentWorkflow in workflowsAvailable)
            {
                Boolean isGrantedPermission = false;

                Boolean isDeniedPermission = ((!currentWorkflow.Visible) || (!currentWorkflow.Enabled) || (currentWorkflow.EntityType != Mercury.Server.Application.EntityType.Member));

                if (!isDeniedPermission)
                {
                    if (currentWorkflow.Application == null)
                    {
                        currentWorkflow.Application = MercuryApplication;
                    }

                    isGrantedPermission = currentWorkflow.SessionGrantedPermission;
                }

                if ((isGrantedPermission) && (!isDeniedPermission))
                {
                    MemberActionSelection.Items.Add(new Telerik.Web.UI.RadComboBoxItem(currentWorkflow.Name, currentWorkflow.Id.ToString()));
                }
            }

            if (MemberActionSelection.Items.Count == 0)
            {
                MemberActionSelection.Items.Add(new Telerik.Web.UI.RadComboBoxItem("** No Action Available", String.Empty));

                MemberActionGo.Enabled = false;
            }

            #endregion


            Telerik.Web.UI.RadToolBarButton buttonContact = (Telerik.Web.UI.RadToolBarButton)MemberProfileToolbar.Items.FindItemByValue("Contact");

            buttonContact.Enabled = MercuryApplication.HasEnvironmentPermission(Mercury.Server.EnvironmentPermissions.MemberActionContact);

            buttonContact.NavigateUrl = "/Application/Actions/EntityContact.aspx?EntityId=" + Member.EntityId.ToString();


            Telerik.Web.UI.RadToolBarButton buttonSendCorrespondence = (Telerik.Web.UI.RadToolBarButton)MemberProfileToolbar.Items.FindItemByValue("SendCorrespondence");

            buttonSendCorrespondence.Enabled = MercuryApplication.HasEnvironmentPermission(Mercury.Server.EnvironmentPermissions.MemberActionSendCorrespondence);

            buttonSendCorrespondence.NavigateUrl = "/Application/Actions/EntitySendCorrespondence.aspx?EntityId=" + Member.EntityId.ToString();


            Telerik.Web.UI.RadToolBarButton buttonNote = (Telerik.Web.UI.RadToolBarButton)MemberProfileToolbar.Items.FindItemByValue("CreateNote");

            buttonNote.Enabled = MercuryApplication.HasEnvironmentPermission(Mercury.Server.EnvironmentPermissions.MemberNoteAdd);

            buttonNote.NavigateUrl = "/Application/Actions/EntityNote.aspx?EntityId=" + Member.EntityId.ToString();

            Telerik.Web.UI.RadToolBarButton buttonAddress = (Telerik.Web.UI.RadToolBarButton)MemberProfileToolbar.Items.FindItemByValue("CreateAddress");

            buttonAddress.Enabled = MercuryApplication.HasEnvironmentPermission(Mercury.Server.EnvironmentPermissions.MemberAddressManage);

            buttonAddress.NavigateUrl = "/Application/Actions/EntityAddress.aspx?EntityId=" + Member.EntityId.ToString();

            return;
        }
Esempio n. 9
0
        private void PrepareZoom(int masterCopySeparationSetLeft, int masterCopySeparationSetRight, string pageNameLeft, string pageNameRight, int approve)
        {
            Session["CurrentPageName"]           = pageNameLeft;
            Session["CurrentPageName2"]          = pageNameRight;
            Session["CurrentCopySeparationSet"]  = masterCopySeparationSetLeft;
            Session["CurrentCopySeparationSet2"] = masterCopySeparationSetRight;
            Session["CurrentApprovalState"]      = approve;
            Session["ImagePath"]     = "";
            Session["ImagePathMask"] = "";
            Session["RealImagePath"] = "";
            Session["HasTiles"]      = false;

            DisplayPageName();

            string     currentComment = "";
            int        publicationID  = 0;
            DateTime   pubDate        = DateTime.MinValue;
            bool       hasMask        = false;
            bool       hasTiles       = false;
            string     errmsg         = "";
            CCDBaccess db             = new CCDBaccess();

            db.GetComment(masterCopySeparationSetLeft > 0 ? masterCopySeparationSetLeft : masterCopySeparationSetRight, out currentComment, out publicationID, out pubDate, out errmsg);
            if ((bool)Application["SetCommentInPrePollPageTable"])
            {
                currentComment = db.GetPrePollMessage(masterCopySeparationSetLeft > 0 ? masterCopySeparationSetLeft : masterCopySeparationSetRight, 350, out errmsg);
            }

            /*Session["CurrentComment"] = (bool)Session["SetCommentOnDisapproval"] ? currentComment : "";
             * Infragistics.WebUI.UltraWebToolbar.TBTextBox commentbox = (Infragistics.WebUI.UltraWebToolbar.TBTextBox)UltraWebToolbar1.Items.FromKey("Comment");
             * if (commentbox != null)
             *  commentbox.Text = currentComment;
             */
            if ((bool)Application["ThumbnailShowMask"])
            {
                hasMask = db.HasMask(masterCopySeparationSetLeft > 0 ? masterCopySeparationSetLeft : masterCopySeparationSetRight, out errmsg);
            }

            string realPath    = "";
            string virtualPath = "";

            if (Globals.HasTileFolderReadview(masterCopySeparationSetLeft, masterCopySeparationSetRight, publicationID, pubDate, false, ref realPath, ref virtualPath))
            {
                hasTiles             = true;
                Session["ImagePath"] = virtualPath;
                Session["HasTiles"]  = true;
            }

            if (hasMask)
            {
                if (Globals.HasTileFolderReadview(masterCopySeparationSetLeft, masterCopySeparationSetRight, publicationID, pubDate, true, ref realPath, ref virtualPath))
                {
                    Session["ImagePathMask"] = virtualPath;
                }
            }



            string folderToTest = Global.sRealReadViewImageFolder + "\\" + masterCopySeparationSetLeft.ToString() + "_" + masterCopySeparationSetRight.ToString() + "\\";

            if (hasTiles == false)
            {
                if (Globals.HasPreviewReadview(masterCopySeparationSetLeft, masterCopySeparationSetRight, publicationID, pubDate, false, ref realPath, ref virtualPath))
                {
                    Session["ImagePath"] = virtualPath;
                }
                if (hasMask)
                {
                    if (Globals.HasPreviewReadview(masterCopySeparationSetLeft, masterCopySeparationSetRight, publicationID, pubDate, true, ref realPath, ref virtualPath))
                    {
                        Session["ImagePathMask"] = virtualPath;
                    }
                }
            }

            if ((string)Session["ImagePath"] == "")
            {
                // Display error message..
                return;
            }

            Telerik.Web.UI.RadToolBarButton maskbutton = (Telerik.Web.UI.RadToolBarButton)RadToolBar1.FindItemByValue("Mask");
            if (maskbutton != null)
            {
                maskbutton.Visible = hasMask && (string)Session["ImagePathMask"] != "" && (bool)Application["ThumbnailShowMask"];
            }


            if ((string)Session["ImagePath"] != "")
            {
                Session["RealImagePath"] = realPath;    // For mail attachment only
            }
            // Finally - set the global sImagePath var used by flash module

            sImagePath = (string)Session["ImagePath"];

            // Default to CMYK if missing file(s)
            if ((string)Session["ShowSep"] == "MASK" && (string)Session["ImagePathMask"] == "")
            {
                Session["ShowSep"] = "CMYK";
            }



            printimagepath = (string)Session["ShowSep"] == "MASK" ?
                             Global.sVirtualImageFolder + "/" + masterCopySeparationSetLeft.ToString() + "_" + masterCopySeparationSetRight.ToString() + "_mask.jpg" :
                             Global.sVirtualImageFolder + "/" + masterCopySeparationSetLeft.ToString() + "_" + masterCopySeparationSetRight.ToString() + ".jpg";


            if ((bool)Application["LogUserAccess"] == true)
            {
                LogUserView(masterCopySeparationSetLeft > 0 ? masterCopySeparationSetLeft : masterCopySeparationSetRight, (string)Session["UserName"]);
            }


            maskbutton.Checked = false;
            if (hasTiles && (string)Session["ShowSep"] == "MASK")
            {
                simpleFlash        = 0;
                sImagePath         = (string)Session["ImagePathMask"] + "/";
                maskbutton.Checked = true;
                return;
            }
            if (hasTiles && (string)Session["ShowSep"] == "CMYK")
            {
                simpleFlash = 0;
                sImagePath += "/";
                return;
            }

            // All other images are shown without tiles
            simpleFlash = 1;
            sImagePath += ".jpg";
        }
Esempio n. 10
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"]);
            }
        }
        protected void InitializeToolbar()
        {
            if (Provider == null)
            {
                return;
            }


            #region Provider Actions

            // TODO: UPDATE V2

            //foreach (Client.Core.Work.Workflow currentWorkflow in MercuryApplication.WorkflowsAvailable (true)) {

            //    if (currentWorkflow.Enabled) {

            //        if (currentWorkflow.EntityType == Mercury.Server.Application.EntityType.Provider) {

            //            if (currentWorkflow.SessionHasPermission ()) {

            //                ProviderActionSelection.Items.Add (new Telerik.Web.UI.RadComboBoxItem (currentWorkflow.Name, currentWorkflow.Id.ToString ()));

            //            }

            //        }

            //    }

            //}

            if (ProviderActionSelection.Items.Count == 0)
            {
                ProviderActionSelection.Items.Add(new Telerik.Web.UI.RadComboBoxItem("** No Action Available", String.Empty));

                ProviderActionGo.Enabled = false;
            }

            #endregion


            Telerik.Web.UI.RadToolBarButton buttonContact = (Telerik.Web.UI.RadToolBarButton)ProviderProfileToolbar.Items.FindItemByValue("Contact");

            buttonContact.Enabled = MercuryApplication.HasEnvironmentPermission(Mercury.Server.EnvironmentPermissions.ProviderActionContact);

            buttonContact.NavigateUrl = "/Application/Actions/EntityContact.aspx?EntityId=" + Provider.EntityId.ToString();


            Telerik.Web.UI.RadToolBarButton buttonSendCorrespondence = (Telerik.Web.UI.RadToolBarButton)ProviderProfileToolbar.Items.FindItemByValue("SendCorrespondence");

            buttonSendCorrespondence.Enabled = MercuryApplication.HasEnvironmentPermission(Mercury.Server.EnvironmentPermissions.ProviderActionSendCorrespondence);

            buttonSendCorrespondence.NavigateUrl = "/Application/Actions/EntitySendCorrespondence.aspx?EntityId=" + Provider.EntityId.ToString();


            Telerik.Web.UI.RadToolBarButton buttonNote = (Telerik.Web.UI.RadToolBarButton)ProviderProfileToolbar.Items.FindItemByValue("CreateNote");

            buttonNote.Enabled = MercuryApplication.HasEnvironmentPermission(Mercury.Server.EnvironmentPermissions.ProviderNoteAdd);

            buttonNote.NavigateUrl = "/Application/Actions/EntityNote.aspx?EntityId=" + Provider.EntityId.ToString();


            Telerik.Web.UI.RadToolBarButton buttonAddress = (Telerik.Web.UI.RadToolBarButton)ProviderProfileToolbar.Items.FindItemByValue("CreateAddress");

            buttonAddress.Enabled = MercuryApplication.HasEnvironmentPermission(Mercury.Server.EnvironmentPermissions.ProviderAddressManage);

            buttonAddress.NavigateUrl = "/Application/Actions/EntityAddress.aspx?EntityId=" + Provider.EntityId.ToString();

            return;
        }