コード例 #1
0
        protected void fillGrid()
        {
            String[] contextId = Request.QueryString.GetValues("context");
            String[] sourceEnt = Request.QueryString.GetValues("source");
            String[] destEnt   = Request.QueryString.GetValues("destination");

            SortedDictionary <DateTime, BackEndObjects.Communications> allComm = BackEndObjects.Communications.
                                                                                 getAllCommunicationsforContextIdBetweenSourceAndDestDB(contextId[0], sourceEnt[0], destEnt[0]);

            DataTable dt = new DataTable();

            dt.Columns.Add("HiddenComm");
            dt.Columns.Add("RespDateTime");
            dt.Columns.Add("FromUsr");
            dt.Columns.Add("FromComp");
            dt.Columns.Add("Comments");
            int counter = 0;

            foreach (KeyValuePair <DateTime, BackEndObjects.Communications> kvp in allComm)
            {
                BackEndObjects.Communications commObj = kvp.Value;
                dt.Rows.Add();
                dt.Rows[counter]["HiddenComm"]   = commObj.getCommId();
                dt.Rows[counter]["RespDateTime"] = commObj.getDateCreated();
                dt.Rows[counter]["FromUsr"]      = commObj.getFromUserId();
                dt.Rows[counter]["FromComp"]     = MainBusinessEntity.getMainBusinessEntitybyIdwithLessDetailsDB(commObj.getFromEntityId()).getEntityName();
                dt.Rows[counter]["Comments"]     = commObj.getText();

                counter++;
            }

            if (dt.Rows.Count > 0)
            {
                GridView_RFQ_Resp_Quotes_Comm.DataSource = dt;
                GridView_RFQ_Resp_Quotes_Comm.DataBind();
                GridView_RFQ_Resp_Quotes_Comm.Visible            = true;
                GridView_RFQ_Resp_Quotes_Comm.Columns[0].Visible = false;
            }
        }