示例#1
0
        private void FillGrid()
        {
            Carriers.Refresh();
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col;

            if (checkCDAnet.Checked)
            {
                gridMain.Size = new Size(745, gridMain.Height);
                col           = new ODGridColumn(Lan.g("TableCarriers", "Carrier Name"), 160);
                gridMain.Columns.Add(col);
                col = new ODGridColumn(Lan.g("TableCarriers", "ElectID"), 60);
                gridMain.Columns.Add(col);
                col = new ODGridColumn(Lan.g("TableCarriers", "PMP"), 50, HorizontalAlignment.Center);
                gridMain.Columns.Add(col);
                col = new ODGridColumn(Lan.g("TableCarriers", "Network"), 50);
                gridMain.Columns.Add(col);
                col = new ODGridColumn(Lan.g("TableCarriers", "Version"), 50);
                gridMain.Columns.Add(col);
                col = new ODGridColumn(Lan.g("TableCarriers", "02"), 50, HorizontalAlignment.Center);
                gridMain.Columns.Add(col);
                col = new ODGridColumn(Lan.g("TableCarriers", "03"), 50, HorizontalAlignment.Center);
                gridMain.Columns.Add(col);
                col = new ODGridColumn(Lan.g("TableCarriers", "04"), 50, HorizontalAlignment.Center);
                gridMain.Columns.Add(col);
                col = new ODGridColumn(Lan.g("TableCarriers", "05"), 50, HorizontalAlignment.Center);
                gridMain.Columns.Add(col);
                col = new ODGridColumn(Lan.g("TableCarriers", "06"), 50, HorizontalAlignment.Center);
                gridMain.Columns.Add(col);
                col = new ODGridColumn(Lan.g("TableCarriers", "07"), 50, HorizontalAlignment.Center);
                gridMain.Columns.Add(col);
                col = new ODGridColumn(Lan.g("TableCarriers", "08"), 50, HorizontalAlignment.Center);
                gridMain.Columns.Add(col);
            }
            else
            {
                gridMain.Size = new Size(839, gridMain.Height);
                col           = new ODGridColumn(Lan.g("TableCarriers", "Carrier Name"), 160);
                gridMain.Columns.Add(col);
                col = new ODGridColumn(Lan.g("TableCarriers", "Phone"), 90);
                gridMain.Columns.Add(col);
                col = new ODGridColumn(Lan.g("TableCarriers", "Address"), 130);
                gridMain.Columns.Add(col);
                col = new ODGridColumn(Lan.g("TableCarriers", "Address2"), 120);
                gridMain.Columns.Add(col);
                col = new ODGridColumn(Lan.g("TableCarriers", "City"), 110);
                gridMain.Columns.Add(col);
                col = new ODGridColumn(Lan.g("TableCarriers", "ST"), 60);
                gridMain.Columns.Add(col);
                col = new ODGridColumn(Lan.g("TableCarriers", "Zip"), 90);
                gridMain.Columns.Add(col);
                col = new ODGridColumn(Lan.g("TableCarriers", "ElectID"), 60);
                gridMain.Columns.Add(col);
            }
            gridMain.Rows.Clear();
            ODGridRow row;

            if (checkCDAnet.Checked)
            {
                table = Carriers.Refresh(true);
                for (int i = 0; i < table.Rows.Count; i++)
                {
                    row = new ODGridRow();
                    //row.Tag//CarrierNum
                    row.Cells.Add(table.Rows[i]["CarrierName"].ToString());
                    row.Cells.Add(table.Rows[i]["ElectID"].ToString());
                    row.Cells.Add(table.Rows[i]["PMP"].ToString());
                    row.Cells.Add(table.Rows[i]["Network"].ToString());
                    row.Cells.Add(table.Rows[i]["Version"].ToString());
                    row.Cells.Add(table.Rows[i]["Trans02"].ToString());
                    row.Cells.Add(table.Rows[i]["Trans03"].ToString());
                    row.Cells.Add(table.Rows[i]["Trans04"].ToString());
                    row.Cells.Add(table.Rows[i]["Trans05"].ToString());
                    row.Cells.Add(table.Rows[i]["Trans06"].ToString());
                    row.Cells.Add(table.Rows[i]["Trans07"].ToString());
                    row.Cells.Add(table.Rows[i]["Trans08"].ToString());
                    gridMain.Rows.Add(row);
                }
            }
            else
            {
                for (int i = 0; i < Carriers.List.Length; i++)
                {
                    row = new ODGridRow();
                    row.Cells.Add(Carriers.List[i].CarrierName);
                    row.Cells.Add(Carriers.List[i].Phone);
                    row.Cells.Add(Carriers.List[i].Address);
                    row.Cells.Add(Carriers.List[i].Address2);
                    row.Cells.Add(Carriers.List[i].City);
                    row.Cells.Add(Carriers.List[i].State);
                    row.Cells.Add(Carriers.List[i].Zip);
                    row.Cells.Add(Carriers.List[i].ElectID);
                    gridMain.Rows.Add(row);
                }
            }

            gridMain.EndUpdate();
            //if(tbCarriers.SelectedIndices.Length>0){
            //	tbCarriers.ScrollToLine(tbCarriers.SelectedIndices[0]);
            //}
        }