예제 #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         CurItemsName.Value = "CurItems";
         if (Request.QueryString["Type"] != null)
         {
             CurItemsName.Value     = "BuyItems";
             ReportType.Value       = Request.QueryString["Type"];
             this.Title             = "CPR Buy Front End";
             lblParentMenuName.Text = "CPR Buy Report Item Selection";
         }
         RunByLabel.Text = Session["UserName"].ToString();
         dt = cpr.GetVMIDDL().Tables[0];
         VMIContractDDL.DataSource = dt.DefaultView.ToTable();
         VMIContractDDL.DataBind();
         BindStaticLists();
         StaticListsGrid.Visible = false;
         BindExceptionLists();
         ExceptionListsGrid.Visible = false;
         BindListTypeDDL();
         SingleItemNo.Focus();
         if (Session[CurItemsName.Value] != null)
         {
             try
             {
                 dt = (DataTable)Session[CurItemsName.Value];
                 //DataView dv = new DataView(dt);
                 ReportItemsGrid.DataSource = dt;
                 ReportItemsGrid.DataBind();
                 ItemCountLabel.Text = ReportItemsGrid.Rows.Count.ToString();
                 Static.Checked      = true;
                 Single.Checked      = false;
                 Excel.Checked       = false;
             }
             catch { };
         }
     }
     else
     {
         ScriptManager1.AsyncPostBackTimeout = 1200;
     }
 }
예제 #2
0
    protected void RunReportButt_Click(object sender, ImageClickEventArgs e)
    {
        ClearPageMessages();
        Boolean ReportOK = false;

        if (Single.Checked)
        {
            if (SingleItemNo.Text != "")
            {
                dt = cpr.LoadCurrentItems(CurItemKey(), SingleItemNo.Text).Tables[0];
                Session[CurItemsName.Value] = null;
                Session[CurItemsName.Value] = dt;
                ReportOK = true;
            }
            else
            {
                lblErrorMessage.Text = " A Single Item number is required or there must a Items to Report";
                SingleItemNo.Focus();
                return;
            }
        }
        if (CreateStaticList.Checked)
        {
            if (NewStaticListName.Text != "")
            {
                cpr.CreateStaticList(Session["UserName"].ToString(), NewStaticListName.Text, ReportItemsGrid);
                BindListTypeDDL();
                BindStaticLists();
            }
            else
            {
                lblErrorMessage.Text = "Static List name is required";
                NewStaticListName.Focus();
                return;
            }
        }
        if (!Single.Checked)
        {
            if (ReportItemsGrid.Rows.Count > 0)
            {
                cpr.LoadCurrentItems(CurItemKey(), ReportItemsGrid);
                ReportOK = true;
            }
            else
            {
                lblErrorMessage.Text = "There are no Items to Report";
                NewStaticListName.Focus();
                return;
            }
        }
        if (ReportOK)
        {
            Session["VMIRun"]          = VMI.Checked;
            Session["VMIContractCode"] = VMIContractDDL.SelectedValue.ToString();
            string NextPage = "ReportPrompts.aspx";
            if (ReportType.Value == "Buy")
            {
                NextPage = "ReportPrompts.aspx?Type=Buy";
            }
            Server.Transfer(NextPage);
        }
    }