示例#1
0
        public static ListView getTCListViewForPerticularDoc(string docid)
        {
            ListView lv = new ListView();

            try
            {
                lv.View               = View.Details;
                lv.LabelEdit          = true;
                lv.AllowColumnReorder = true;
                lv.CheckBoxes         = true;
                lv.FullRowSelect      = true;
                lv.GridLines          = true;
                lv.Sorting            = System.Windows.Forms.SortOrder.Ascending;
                lv.Columns.Add("Select", -2, HorizontalAlignment.Left);
                lv.Columns.Add("Paragraph ID", -2, HorizontalAlignment.Left);
                lv.Columns.Add("Paragraph Heading", -2, HorizontalAlignment.Left);
                lv.Columns.Add("Detail", -2, HorizontalAlignment.Left);
                DocTcMappingDB      tcmapdb = new DocTcMappingDB();
                List <doctcmapping> TCList  = tcmapdb.getdocTCList(docid).OrderByDescending(tc => tc.ParagraphID).ToList();
                foreach (doctcmapping tcmap in TCList)
                {
                    ListViewItem item = new ListViewItem();
                    item.Checked = false;
                    item.SubItems.Add(tcmap.ParagraphID.ToString());
                    item.SubItems.Add(tcmap.Heading);
                    item.SubItems.Add(tcmap.Detail);
                    lv.Items.Add(item);
                }
            }
            catch (Exception ex)
            {
            }
            return(lv);
        }
示例#2
0
        public DataGridView getTclistGrid(string docid)
        {
            DataGridView empGgrid = new DataGridView();

            try
            {
                DataGridViewCheckBoxColumn colChk = new DataGridViewCheckBoxColumn();
                colChk.Width      = 50;
                colChk.Name       = "Select";
                colChk.HeaderText = "Select";
                colChk.ReadOnly   = false;

                DataGridViewCellStyle dataGridViewCellStyle1 = new DataGridViewCellStyle();
                dataGridViewCellStyle1.Alignment          = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
                dataGridViewCellStyle1.BackColor          = System.Drawing.Color.LightSeaGreen;
                dataGridViewCellStyle1.Font               = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                dataGridViewCellStyle1.ForeColor          = System.Drawing.SystemColors.WindowText;
                dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
                dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
                dataGridViewCellStyle1.WrapMode           = System.Windows.Forms.DataGridViewTriState.True;

                empGgrid.EnableHeadersVisualStyles = false;

                empGgrid.AllowUserToAddRows            = false;
                empGgrid.AllowUserToDeleteRows         = false;
                empGgrid.BackgroundColor               = System.Drawing.SystemColors.GradientActiveCaption;
                empGgrid.BorderStyle                   = System.Windows.Forms.BorderStyle.None;
                empGgrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
                empGgrid.EditMode            = System.Windows.Forms.DataGridViewEditMode.EditOnEnter;
                empGgrid.ColumnHeadersHeight = 27;
                empGgrid.RowHeadersVisible   = false;
                empGgrid.Columns.Add(colChk);

                DocTcMappingDB      DoctcDB    = new DocTcMappingDB();
                List <doctcmapping> empSElList = DoctcDB.getTCList(docid);
                doctcmapping        obj        = new doctcmapping();
                var prop = obj.GetType().GetProperties();
                foreach (var v in prop)
                {
                    empGgrid.Columns.Add(v.Name, v.Name);
                }

                //empGgrid.DataSource = empSElList;
                foreach (doctcmapping tcsel in empSElList)
                {
                    empGgrid.Rows.Add();
                    empGgrid.Rows[empGgrid.Rows.Count - 1].Cells["RowID"].Value       = tcsel.RowID;
                    empGgrid.Rows[empGgrid.Rows.Count - 1].Cells["ParagraphID"].Value = tcsel.ParagraphID;
                    empGgrid.Rows[empGgrid.Rows.Count - 1].Cells["Heading"].Value     = tcsel.Heading;
                    empGgrid.Rows[empGgrid.Rows.Count - 1].Cells["Detail"].Value      = tcsel.Detail;
                    empGgrid.Rows[empGgrid.Rows.Count - 1].Height = 60;
                }
            }
            catch (Exception ex)
            {
            }

            return(empGgrid);
        }
示例#3
0
        public static DataGridView getGridViewForTCMapping(string docID, List <doctcmapping> TCListTemp)
        {
            DataGridView grdTC = new DataGridView();

            try
            {
                string[] strColArr = { "ParagraphID", "ParagraphHeading", "Detail" };
                DataGridViewTextBoxColumn[] colArr =
                {
                    new DataGridViewTextBoxColumn(), new DataGridViewTextBoxColumn(), new DataGridViewTextBoxColumn()
                };

                DataGridViewCellStyle dataGridViewCellStyle1 = new DataGridViewCellStyle();
                dataGridViewCellStyle1.Alignment          = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
                dataGridViewCellStyle1.BackColor          = System.Drawing.Color.LightSeaGreen;
                dataGridViewCellStyle1.Font               = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                dataGridViewCellStyle1.ForeColor          = System.Drawing.SystemColors.WindowText;
                dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
                dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
                //dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
                grdTC.EnableHeadersVisualStyles = false;
                grdTC.AllowUserToAddRows        = false;
                grdTC.AllowUserToDeleteRows     = false;
                grdTC.BackgroundColor           = System.Drawing.SystemColors.GradientActiveCaption;
                grdTC.BorderStyle = System.Windows.Forms.BorderStyle.None;
                grdTC.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
                grdTC.EditMode            = System.Windows.Forms.DataGridViewEditMode.EditOnEnter;
                grdTC.ColumnHeadersHeight = 27;
                grdTC.RowHeadersVisible   = false;
                grdTC.SelectionMode       = DataGridViewSelectionMode.FullRowSelect;
                DataGridViewCheckBoxColumn colChk = new DataGridViewCheckBoxColumn();
                colChk.Width      = 50;
                colChk.Name       = "Select";
                colChk.HeaderText = "Select";
                colChk.ReadOnly   = false;
                grdTC.Columns.Add(colChk);
                foreach (string str in strColArr)
                {
                    int index = Array.IndexOf(strColArr, str);
                    colArr[index].Name = str;
                    //colArr[index].ToolTipText = "Double click to see detail";
                    colArr[index].HeaderText = str;
                    colArr[index].ReadOnly   = true;
                    if (index == 2)
                    {
                        colArr[index].Width = 440;
                    }
                    //else if (index == 2)
                    //    colArr[index].Width = 100;
                    else
                    {
                        colArr[index].Width = 100;
                    }
                    grdTC.Columns.Add(colArr[index]);
                }

                DocTcMappingDB tcmapdb = new DocTcMappingDB();
                if (TCListTemp.Count == 0)
                {
                    TCListTemp = tcmapdb.getdocTCList(docID);
                }
                foreach (doctcmapping tcmap in TCListTemp)
                {
                    grdTC.Rows.Add();
                    grdTC.Rows[grdTC.Rows.Count - 1].Cells[strColArr[0]].Value = tcmap.ParagraphID;
                    grdTC.Rows[grdTC.Rows.Count - 1].Cells[strColArr[1]].Value = tcmap.Heading;
                    grdTC.Rows[grdTC.Rows.Count - 1].Cells[strColArr[2]].Value = tcmap.Detail;
                }
            }
            catch (Exception ex)
            {
            }

            return(grdTC);
        }