Exemplo n.º 1
0
    protected void OnCommand(object sender, CommandEventArgs e)
    {
        //Event handler for toolbar button clicked
        try {
            switch (e.CommandName)
            {
            case "Refresh":
                OnClientChanged(this.cboClient, EventArgs.Empty);
                break;

            case "Submit":
                Session["LoadTenders"] = null;
                if (this.grdTenders.DataKeys.Count > 0)
                {
                    //Get parameters for the query
                    string            client = this.cboClient.SelectedValue;
                    DateTime          start  = DateTime.Parse(this.txtFromDate.Text);
                    DateTime          end    = DateTime.Parse(this.txtToDate.Text);
                    LoadTenderDataset ds     = new LoadTenderDataset();
                    LoadTenderDataset _ds    = new Argix.TsortGateway().GetLoadTenders(client, start, end);
                    foreach (GridViewRow row in SelectedRows)
                    {
                        DataKey dataKey = (DataKey)this.grdTenders.DataKeys[row.RowIndex];
                        string  load    = dataKey["Load"].ToString();
                        ds.Merge(_ds.LoadTenderTable.Select("Load='" + load + "'"));

                        LoadTenderDetailDataset detail = new Argix.TsortGateway().GetLoadTenderDetails(load);
                        if (detail.LoadTenderDetailTable.Rows.Count > 0)
                        {
                            ds.Merge(detail);
                        }
                    }
                    Session["LoadTenders"] = ds;
                    Response.Redirect("LoadTender.aspx", false);
                }
                break;
            }
        }
        catch (Exception ex) { Master.ReportError(ex, 4); }
    }
Exemplo n.º 2
0
        public LoadTenderDataset GetLoadTenders(string clientNumber, DateTime startDate, DateTime endDate)
        {
            //Get load tenders for the selected client and date range
            LoadTenderDataset lts = null;

            try {
                lts = new LoadTenderDataset();
                if (clientNumber != null && clientNumber.Trim().Length > 0)
                {
                    DataSet ds = new DataService().FillDataset(SQL_CONNID, USP_LOADTENDERS, TBL_LOADTENDERS, new object[] { clientNumber, startDate.ToString("yyyy-MM-dd"), endDate.ToString("yyyy-MM-dd") });
                    if (ds != null && ds.Tables[TBL_LOADTENDERS].Rows.Count > 0)
                    {
                        lts.Merge(ds);
                    }
                }
            }
            catch (Exception ex) { throw new ApplicationException(ex.Message); }
            return(lts);
        }