Ejemplo n.º 1
0
 protected void ChangePassword_ServerClick(object sender, EventArgs e)
 {
     Telerik.Web.UI.RadWindowManager windowManager = new Telerik.Web.UI.RadWindowManager();
     Telerik.Web.UI.RadWindow        widnow1       = new Telerik.Web.UI.RadWindow();
     // Set the window properties
     widnow1.NavigateUrl       = "~/CommonUI/ChangeTeacherPassword.aspx";
     widnow1.ID                = "RadWindow1";
     widnow1.VisibleOnPageLoad = true; // Set this property to True for showing window from code
     windowManager.Windows.Add(widnow1);
     this.form1.Controls.Add(widnow1);
 }
        private void DataGrid1_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            DataGrid1.SelectedIndex = e.Item.ItemIndex;

            if (e.CommandName == "Hold" || e.CommandName == "Go")
            {
                if ((bool)Session["MayRelease"] == false)
                {
                    lblError.Text      = "You do not have rights to hold/release products";
                    lblError.ForeColor = Color.OrangeRed;
                    return;
                }
                string Press = e.Item.Cells[PRESSRUN_FIELD_PRESS].Text;

                int m = Press.IndexOf('(');
                if (m != -1)
                {
                    Press = Press.Substring(0, m);
                }
                Press = Press.Trim();

                DateTime dt          = String2PubDate(e.Item.Cells[PRESSRUN_FIELD_PUBDATE].Text);
                string   Publication = e.Item.Cells[PRESSRUN_FIELD_PUBLICATION].Text;
                string   Edition     = e.Item.Cells[PRESSRUN_FIELD_EDITION].Text;
                string   Section     = e.Item.Cells[PRESSRUN_FIELD_SECTION].Text;

                CCDBaccess db = new CCDBaccess();

                string errmsg = "";
                if (e.CommandName == "Go")
                {
                    if (db.ApproveAll(Globals.GetIDFromName("PublicationNameCache", Publication), dt, Globals.GetIDFromName("EditionNameCache", Edition), Globals.GetIDFromName("SectionNameCache", Section), (string)Session["Username"], "Bulk approval", true, out errmsg) == false)
                    {
                        lblError.Text      = errmsg;
                        lblError.ForeColor = Color.Red;
                    }
                    else
                    {
                        DoDataBind();
                    }
                }
                else if (db.UnApproveAll(Globals.GetIDFromName("PublicationNameCache", Publication), dt, Globals.GetIDFromName("EditionNameCache", Edition), Globals.GetIDFromName("SectionNameCache", Section), (string)Session["Username"], "Bulk approval", true, out errmsg) == false)
                {
                    lblError.Text      = errmsg;
                    lblError.ForeColor = Color.Red;
                }
                else
                {
                    DoDataBind();
                }
            }
            else if (e.CommandName == "Retransmit")
            {
                int    nNextIndex = 1;
                string Press      = Press = e.Item.Cells[nNextIndex++].Text;

                int m = Press.IndexOf("(");
                if (m != -1)
                {
                    Press = Press.Substring(0, m).Trim();
                }
                nNextIndex += 1;               // Skip state


                DateTime dt          = String2PubDate(e.Item.Cells[nNextIndex++].Text);
                string   Publication = e.Item.Cells[nNextIndex++].Text;
                string   Edition     = e.Item.Cells[nNextIndex++].Text;
                string   Section     = e.Item.Cells[nNextIndex++].Text;
                nNextIndex++;                 // skip input
                nNextIndex++;                 // skip approved
                nNextIndex++;                 // skip output
                string channeList = e.Item.Cells[nNextIndex++].Text;

                string    channelIDList = "";
                string [] sch           = channeList.Split(',');
                foreach (string ch in sch)
                {
                    int nch = Globals.GetIDFromName("ChannelNameCache", ch);
                    if (nch > 0)
                    {
                        if (channelIDList != "")
                        {
                            channelIDList += ",";
                        }
                        channelIDList += nch.ToString();
                    }
                }
                CCDBaccess db = new CCDBaccess();

                string errmsg         = "";
                int    nPublicationID = Globals.GetIDFromName("PublicationNameCache", Publication);
                int    nPressID       = Globals.GetIDFromName("PressNameCache", Press);

                int nProductionID = db.GetProductionID(ref nPressID, nPublicationID, dt, Globals.GetIDFromName("EditionNameCache", Edition), out errmsg);

/*				if (db.RetransmitAll(Globals.GetIDFromName("PublicationNameCache",Publication),
 *                                                                      dt,
 *                                                                      Globals.GetIDFromName("EditionNameCache",Edition),
 *                                                                      Globals.GetIDFromName("SectionNameCache",Section), out errmsg) == false)
 *                              {
 *                                      lblError.Text = errmsg;
 *                                      lblError.ForeColor = Color.Red;
 *                              }
 */
                prioString = "\"RetransmitChannels.aspx?MasterCopySeparationSet=0&Channels=" + channelIDList + "&ProductionID=" + nProductionID.ToString() + "&PublicationID=" + nPublicationID.ToString() + "\"";

                Telerik.Web.UI.RadWindow mywindow = GetRadWindow("radWindowRetransmitChannels");
                mywindow.NavigateUrl = "RetransmitChannels.aspx?Channels=" + channelIDList + "&ProductionID=" + nProductionID.ToString() + "&PublicationID=" + nPublicationID.ToString() + "&MasterCopySeparationSet=0";

                mywindow.VisibleOnPageLoad = true;


                DoDataBind();
            }
            else if (e.CommandName == "ChangeChannels")
            {
                if ((bool)Session["MayRelease"] == false)
                {
                    lblError.Text      = "You do not have rights to change channels";
                    lblError.ForeColor = Color.OrangeRed;
                    return;
                }

                int    nNextIndex = 1;
                string Press      = e.Item.Cells[nNextIndex++].Text;

                int m = Press.IndexOf("(");
                if (m != -1)
                {
                    Press = Press.Substring(0, m).Trim();
                }



                nNextIndex += 1;               // Skip state

                DateTime dt          = String2PubDate(e.Item.Cells[nNextIndex++].Text);
                string   Publication = e.Item.Cells[nNextIndex++].Text;
                string   Edition     = e.Item.Cells[nNextIndex++].Text;
                string   Section     = e.Item.Cells[nNextIndex++].Text;
                nNextIndex++;                 // skip input
                nNextIndex++;                 // skip approved
                nNextIndex++;                 // skip output
                string channeList = e.Item.Cells[nNextIndex++].Text;

                string    channelIDList = "";
                string [] sch           = channeList.Split(',');
                foreach (string ch in sch)
                {
                    int nch = Globals.GetIDFromName("ChannelNameCache", ch);
                    if (nch > 0)
                    {
                        if (channelIDList != "")
                        {
                            channelIDList += ",";
                        }
                        channelIDList += nch.ToString();
                    }
                }
                //doPopupPrio = true;
                CCDBaccess db     = new CCDBaccess();
                string     errmsg = "";

                int nPublicationID = Globals.GetIDFromName("PublicationNameCache", Publication);
                int nPressID       = Globals.GetIDFromName("PressNameCache", Press);
                int nProductionID  = db.GetProductionID(ref nPressID,
                                                        nPublicationID, dt, Globals.GetIDFromName("EditionNameCache", Edition), out errmsg);
                prioString = "\"ChangeChannels.aspx?MasterCopySeparationSet=0&Channels=" + channelIDList + "&ProductionID=" + nProductionID.ToString() + "&PublicationID=" + nPublicationID.ToString() + "\"";

                Telerik.Web.UI.RadWindow mywindow = GetRadWindow("radWindowChannels");
                mywindow.NavigateUrl = "ChangeChannels.aspx?Channels=" + channelIDList + "&ProductionID=" + nProductionID.ToString() + "&PublicationID=" + nPublicationID.ToString() + "&MasterCopySeparationSet=0";

                mywindow.VisibleOnPageLoad = true;

                DoDataBind();
            }
        }
        protected void RadToolBar1_ButtonClick(object sender, Telerik.Web.UI.RadToolBarEventArgs e)
        {
            string errmsg = "";

            if (e.Item.Value == "Forward")
            {
                // Are we at the end already?
                if ((int)Session["CurrentCopyFlatSeparationSet"] == 0)
                {
                    PrepareZoom((int)Session["CurrentCopyFlatSeparationSet"]);
                    return;
                }

                CCDBaccess db = new CCDBaccess();

                nCurrentCopyFlatSeparationSet = db.GetNextFlat((int)Session["CurrentCopyFlatSeparationSet"], out errmsg);

                if (nCurrentCopyFlatSeparationSet == 0)
                {
                    PrepareZoom((int)Session["CurrentCopyFlatSeparationSet"]);
                    return;
                }

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


                PrepareZoom(nCurrentCopyFlatSeparationSet);
            }


            if (e.Item.Value == "Backward")
            {
                // Are we at the front already?
                if ((int)Session["CurrentCopyFlatSeparationSet"] == 0)
                {
                    PrepareZoom((int)Session["CurrentCopyFlatSeparationSet"]);
                    return;
                }

                CCDBaccess db = new CCDBaccess();

                nCurrentCopyFlatSeparationSet = db.GetPreviousFlat((int)Session["CurrentCopyFlatSeparationSet"], out errmsg);
                if (nCurrentCopyFlatSeparationSet == 0)
                {
                    PrepareZoom((int)Session["CurrentCopyFlatSeparationSet"]);
                    return;
                }

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


                PrepareZoom(nCurrentCopyFlatSeparationSet);
            }

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

                nCurrentCopyFlatSeparationSet = (int)Session["CurrentCopyFlatSeparationSet"];
                if (nCurrentCopyFlatSeparationSet > 0)
                {
                    db.UpdateCopyFlatHold(nCurrentCopyFlatSeparationSet, 0, 0, out errmsg);
                }

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

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

                nCurrentCopyFlatSeparationSet = (int)Session["CurrentCopyFlatSeparationSet"];
                if (nCurrentCopyFlatSeparationSet > 0)
                {
                    db.UpdateFlatApproval((string)Session["UserName"], nCurrentCopyFlatSeparationSet, 1, out errmsg);
                }

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

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

                nCurrentCopyFlatSeparationSet = (int)Session["CurrentCopyFlatSeparationSet"];
                if (nCurrentCopyFlatSeparationSet > 0)
                {
                    db.UpdateFlatApproval((string)Session["UserName"], nCurrentCopyFlatSeparationSet, 2, out errmsg);
                }

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

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

                nCurrentCopyFlatSeparationSet = (int)Session["CurrentCopyFlatSeparationSet"];
                if (nCurrentCopyFlatSeparationSet > 0)
                {
                    db.UpdateCopyFlatHold(nCurrentCopyFlatSeparationSet, 0, 4, out errmsg);
                }

                if ((bool)Session["CloseZoomAfterApprove"])
                {
                    if ((bool)Application["SimpleFlatView"])
                    {
                        Response.Redirect("Flatview3.aspx");
                    }
                    else
                    {
                        Response.Redirect("Flatview2.aspx");
                    }
                }
            }
            if (e.Item.Value == "ReleaseSpecial")
            {
                if ((bool)Session["MayRelease"] == false)
                {
                    return;
                }
                CCDBaccess db = new CCDBaccess();

                nCurrentCopyFlatSeparationSet = (int)Session["CurrentCopyFlatSeparationSet"];
                if (nCurrentCopyFlatSeparationSet > 0)
                {
                    Telerik.Web.UI.RadWindow mywindow = RadWindowManager1.Windows[0]; // "radWindowReleaseLocations"
                    mywindow.NavigateUrl = "ReleasePresses.aspx?CopyFlatSeparationSet=" + nCurrentCopyFlatSeparationSet.ToString();

                    mywindow.VisibleOnPageLoad = true;
                }
            }

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

                nCurrentCopyFlatSeparationSet = (int)Session["CurrentCopyFlatSeparationSet"];

                if (nCurrentCopyFlatSeparationSet > 0)
                {
                    db.UpdateCopyFlatHold(nCurrentCopyFlatSeparationSet, 1, 0, out errmsg);
                }

                if ((bool)Session["CloseZoomAfterApprove"])
                {
                    if ((bool)Application["SimpleFlatView"])
                    {
                        Response.Redirect("Flatview3.aspx");
                    }
                    else
                    {
                        Response.Redirect("Flatview2.aspx");
                    }
                }
            }

            if (e.Item.Value == "Close")
            {
                if ((bool)Application["SimpleFlatView"])
                {
                    Response.Redirect("Flatview3.aspx");
                }
                else
                {
                    Response.Redirect("Flatview2.aspx");
                }
            }

            if (e.Item.Value == "CMYK" || e.Item.Value == "C" || e.Item.Value == "M" || e.Item.Value == "Y" || e.Item.Value == "K" ||
                e.Item.Value == "CZ" || e.Item.Value == "MZ" || e.Item.Value == "YZ" || e.Item.Value == "KZ" || e.Item.Value == "Dns")
            {
                Session["ShowSep"] = e.Item.Value.ToUpper();
                PrepareZoom((int)Session["CurrentCopyFlatSeparationSet"]);
            }
        }
        private void DataGrid1_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            DataGrid1.SelectedIndex = e.Item.ItemIndex;

            if (e.CommandName == "Hold" || e.CommandName == "Go")
            {
                if ((bool)Session["MayRelease"] == false)
                {
                    lblError.Text      = "You do not have rights to hold/release products";
                    lblError.ForeColor = Color.OrangeRed;
                    return;
                }
                string Press = e.Item.Cells[PRESSRUN_FIELD_PRESS].Text;

                int m = Press.IndexOf('(');
                if (m != -1)
                {
                    Press = Press.Substring(0, m);
                }
                Press = Press.Trim();

                DateTime dt          = String2PubDate(e.Item.Cells[PRESSRUN_FIELD_PUBDATE].Text);
                string   Publication = e.Item.Cells[PRESSRUN_FIELD_PUBLICATION].Text;
                string   Edition     = e.Item.Cells[PRESSRUN_FIELD_EDITION].Text;
                string   Section     = e.Item.Cells[PRESSRUN_FIELD_SECTION].Text;

                CCDBaccess db = new CCDBaccess();

                string errmsg = "";
                if (db.UpdateProductionHold(e.CommandName == "Hold" ? 1: 0, Press, Publication, dt, "", Edition, Section, out errmsg) == false)
                {
                    lblError.Text      = errmsg;
                    lblError.ForeColor = Color.Red;
                }
                else
                {
                    DoDataBind();
                }
            }
            else if (e.CommandName == "Priority")
            {
                if ((bool)Session["MayRelease"] == false)
                {
                    lblError.Text      = "You do not have rights to change priority";
                    lblError.ForeColor = Color.OrangeRed;
                    return;
                }

                string Press = e.Item.Cells[PRESSRUN_FIELD_PRESS].Text;
                int    m     = Press.IndexOf('(');
                if (m != -1)
                {
                    Press = Press.Substring(0, m);
                }
                Press = Press.Trim();

                //				DateTime dt = String2PubDate(e.Item.Cells[nNextIndex++].Text);
                string sPubDate    = e.Item.Cells[PRESSRUN_FIELD_PUBDATE].Text;
                string Publication = e.Item.Cells[PRESSRUN_FIELD_PUBLICATION].Text;
                string Edition     = e.Item.Cells[PRESSRUN_FIELD_EDITION].Text;
                string Section     = e.Item.Cells[PRESSRUN_FIELD_SECTION].Text;
                string sPrio       = e.Item.Cells[PRESSRUN_FIELD_PRIORITY].Text;

                Telerik.Web.UI.RadWindow mywindow = GetRadWindow("radWindowPriority");
                mywindow.Title = Global.rm.GetString("txtPriority");

                mywindow.NavigateUrl = "ChangePriority.aspx?Priority=" + sPrio + "&Press=" + Press + "&Publication=" + Publication + "&PubDate=" + sPubDate + "&Issue=1&Edition=" + Edition + "&Section=" + Section;

                mywindow.VisibleOnPageLoad = true;
            }
            else if (e.CommandName == "Reprocess")
            {
                string Press = e.Item.Cells[PRESSRUN_FIELD_PRESS].Text;
                int    m     = Press.IndexOf('(');
                if (m != -1)
                {
                    Press = Press.Substring(0, m);
                }
                Press = Press.Trim();

                string sPubDate     = e.Item.Cells[PRESSRUN_FIELD_PUBDATE].Text;
                string Publication  = e.Item.Cells[PRESSRUN_FIELD_PUBLICATION].Text;
                string Edition      = e.Item.Cells[PRESSRUN_FIELD_EDITION].Text;
                string Section      = e.Item.Cells[PRESSRUN_FIELD_SECTION].Text;
                int    nPreflightID = Globals.GetIDFromName("PreflightSetupNamesCache", e.Item.Cells[PRESSRUN_FIELD_PRESETUP].Text);
                int    nInksaveID   = Globals.GetIDFromName("InksaveSetupNamesCache", e.Item.Cells[PRESSRUN_FIELD_INKSETUP].Text);
                int    nRipSetupID  = Globals.GetIDFromName("RipSetupNamesCache", e.Item.Cells[PRESSRUN_FIELD_RIPSETUP].Text);
                int    ID           = nRipSetupID + (nPreflightID << 8) + (nInksaveID << 16);

                Telerik.Web.UI.RadWindow mywindow = GetRadWindow("radWindowReprocess");
                mywindow.Title = Global.rm.GetString("txtReprocessPages");

                mywindow.NavigateUrl = "ReprocessPressRun.aspx?Press=" + Press + "&Publication=" + Publication + "&PubDate=" + sPubDate + "&Issue=1&Edition=" + Edition + "&Section=" + Section + "&RipSetup=" + ID.ToString();

                mywindow.VisibleOnPageLoad = true;
            }
        }