Пример #1
0
        protected void bntApply_Click(object sender, EventArgs e)
        {
            int publicationID = Session["SelectedPublication"] != null?Globals.GetIDFromName("PublicationNameCache", (string)Session["SelectedPublication"]) : 0;

            DateTime pubDate    = Session["SelectedPubDate"] != null ? (DateTime)Session["SelectedPubDate"] : DateTime.MinValue;
            int      nEditionID = Globals.GetIDFromName("EditionNameCache", (string)Session["SelectedEdition"]);
            int      nSectionID = Globals.GetIDFromName("SectionNameCache", (string)Session["SelectedSection"]);

            string     errmsg = "";
            CCDBaccess db     = new CCDBaccess();

            db.ApproveAll(publicationID, pubDate, nEditionID, nSectionID, (string)Session["Username"], txtComment.Text, (bool)Session["LogApprove"], out errmsg);

            InjectScript.Text = "<script>RefreshParentPage()</" + "script>";
        }
        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();
            }
        }