Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (Context.Handler is Home)
                {
                    this.PreviousPage = (Home)Context.Handler;
                }

                if (PreviousPage != null)
                {
                    if ((String.Compare(PreviousPage.AppRelativeVirtualPath, "~/Home.aspx", true) != 0) ||
                        !(PreviousPage is Home))
                    {
                        this.mySearch = ((Search)Session[PubEntAdminManager.strSearchCriteria]);
                        this.lblSearchCriteria.Text = this.mySearch.SearchCriteriaDisplay;
                        this.BindData(this.mySearch.PUBIDs);
                    }
                    else//from home
                    {
                        Session.Remove(PubEntAdminManager.strSearchCriteria);
                        this.lblSearchCriteria.Text = this.CaptureSearchCriteria();
                        this.BindData_(null);
                    }
                }
                else
                {
                    this.mySearch = ((Search)Session[PubEntAdminManager.strSearchCriteria]);
                    this.lblSearchCriteria.Text = this.mySearch.SearchCriteriaDisplay;
                    this.BindData(this.mySearch.PUBIDs);
                }

                if (PubEntAdminManager.TamperProof)
                {
                    this.hyplnkRefSrch1.NavigateUrl = this.hyplnkRefSrch2.NavigateUrl =
                        PubEntAdminManager.EncodedURLWithQS("Home.aspx", "action=refine");
                }
                else
                {
                    this.hyplnkRefSrch1.NavigateUrl = this.hyplnkRefSrch2.NavigateUrl =
                        "Home.aspx?action=refine";
                }
            }


            if (!IsPostBack && !IsCallback)
            {
                //This makes performing paging and sorting uses AJAX.
                //gvResult.enEnableSortingAndPagingCallbacks = true;
                //gvResult.PageSize = 3;
                ViewState["SortAscending"] = SortDirection.Ascending;
                //this.gvResult.ArrowDownImageUrl = "~/Image/RedDown.png";
                //this.gvResult.ArrowUpImageUrl = "~/Image/BlackWhiteUp.png";
                //Response.Write("haahahhahahhah "+ this.PreviousPage.Keyword);
                this.SortExpression = PubEntAdminManager.strDefaultoSearchSorting;
                //this.BindData();
            }

            System.Web.UI.UserControl userControl =
                (System.Web.UI.UserControl) this.LoadControl("UserControl/AdminMenu.ascx");
            this.plcHldMenu.Controls.Add(userControl);
        }
Пример #2
0
        protected void gvResult_ItemDataBound(object sender, DataGridItemEventArgs e)
        {
            List <Pub> dt   = ((List <Pub>) this.gvResult.DataSource);
            HyperLink  l_hl = new HyperLink();

            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                Pub l_pub = dt[e.Item.ItemIndex];

                if (!this.Export)
                {
                    this.mySearch.AddPubId(l_pub.PubID);
                }
                //---------------------------------------------------
                l_hl.Text = l_pub.Name;

                if (PubEntAdminManager.TamperProof)
                {
                    l_hl.NavigateUrl = PubEntAdminManager.EncodedURLWithQS("PubRecord.aspx", "mode=view&pubid=" + l_pub.PubID);
                }
                else
                {
                    l_hl.NavigateUrl = "~/PubRecord.aspx?mode=view&pubid=" + l_pub.PubID;
                }

                e.Item.Cells[3].Controls.Add(l_hl);
                //---------------------------------------------------
                if (l_pub.QtyAvailable == -1)
                {
                    e.Item.Cells[4].Text = "N/A";
                }
                //---------------------------------------------------
                if (l_pub.Status.Length > 0)
                {
                    if (l_pub.Status.Contains(PubEntAdminManager.stringDelim))
                    {
                        string[] l_bookstatus = l_pub.Status.Split(new string[] { PubEntAdminManager.stringDelim },
                                                                   StringSplitOptions.RemoveEmptyEntries);
                        Table l_tb = new Table();
                        foreach (string s in l_bookstatus)
                        {
                            TableRow  l_tr = new TableRow();
                            TableCell l_tc = new TableCell();
                            l_tc.Text = s;

                            l_tr.Controls.Add(l_tc);
                            l_tb.Rows.Add(l_tr);
                        }
                        e.Item.Cells[5].Controls.Add(l_tb);
                    }
                }
                else
                {
                    Label l_lbl = new Label();
                    l_lbl.Text = "-";
                    e.Item.Cells[5].Controls.Add(l_lbl);
                }
                //---------------------------------------------------
                if (l_pub.CreateDate.CompareTo(new DateTime(1900, 1, 1)) == 0)
                {
                    e.Item.Cells[6].Text = "-";
                }
                //---------------------------------------------------
                CheckBox l_chkbox = (CheckBox)e.Item.FindControl("chkSelect");
                if (Request.Browser.MSDomVersion.Major == 0) // Non IE Browser?)
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(),
                                                            "myScript",
                                                            " function HighlightSelected(colorcheckboxselected, RowState) { if (colorcheckboxselected.checked) colorcheckboxselected.parentNode.parentNode.style.backgroundColor='#FFAA63'; else { if (RowState=='Item') colorcheckboxselected.parentNode.parentNode.style.backgroundColor='white'; else colorcheckboxselected.parentNode.parentNode.style.backgroundColor='#D6E3F7'; } }"
                                                            , true);
                }
                else
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(),
                                                            "myScript",
                                                            " function HighlightSelected(colorcheckboxselected, RowState) { if (colorcheckboxselected.checked) colorcheckboxselected.parentElement.parentElement.style.backgroundColor='#FFAA63'; else { if (RowState=='Item') colorcheckboxselected.parentElement.parentElement.style.backgroundColor='#f5f5f3'; else colorcheckboxselected.parentElement.parentElement.style.backgroundColor='#ffffff'; } }"
                                                            , true);
                }
                l_chkbox.Attributes.Add("onclick", "HighlightSelected(this,'" + Convert.ToString(e.Item.ItemType) + "' );");

                //QC Report
                HyperLink QCLink = (HyperLink)e.Item.FindControl("QCLink");
                QCLink.NavigateUrl = "~/reportform.aspx?pubid=" + l_pub.PubID;
            }
        }