Exemplo n.º 1
0
        private void menuUnboundContactList_Click(object sender, EventArgs e)
        {
            // this is an example of adding unbound data into the grid
            // while the grouping mechanism keeps functioning

            // first clear any previous bindings
            outlookGrid1.BindData(null, null);

            // setup the column headers
            outlookGrid1.Columns.Add("column1", "Id");
            outlookGrid1.Columns.Add("column2", "First name");
            outlookGrid1.Columns.Add("column3", "Date");
            outlookGrid1.Columns.Add("column4", "Title");
            outlookGrid1.Columns.Add("column5", "Value");

            // example of unbound items
            foreach (ContactInfo obj in ContactList)
            {
                // notice that the outlookgrid only works with OutlookGridRow objects
                OutlookGridRow row = new OutlookGridRow();
                row.CreateCells(outlookGrid1, obj.Id, obj.Name, obj.Date, obj.Subject, obj.Concentration);
                outlookGrid1.Rows.Add(row);
            }

            //set our view for sorting
            View = "UnboundContactInfo";
        }
        /// <summary>
        /// Raises the <see cref="E:MouseDown" /> event.
        /// </summary>
        /// <param name="e">The <see cref="DataGridViewCellMouseEventArgs"/> instance containing the event data.</param>
        protected override void OnMouseDown(DataGridViewCellMouseEventArgs e)
        {
            Rectangle dis       = DataGridView.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, false);
            Rectangle glyphRect = new Rectangle(dis.X + GlyphMargin, dis.Y, INDENT_WIDTH, dis.Height - 1);

            //if (e.X > this.InheritedStyle.Padding.Left)
            if ((e.X + dis.X <= glyphRect.X + 11) &&
                (e.X + dis.X >= glyphRect.X))
            {
                // Expand the node
                //TODO: Calculate more precise location
                OutlookGridRow node = OwningNode;
                if (node != null)
                {
                    ((Classes.KryptonOutlookGrid)node.DataGridView)._inExpandCollapseMouseCapture = true;

                    if (node.Collapsed)
                    {
                        node.Expand();
                    }
                    else
                    {
                        node.Collapse();
                    }
                }
            }
            else
            {
                base.OnMouseDown(e);
            }
        }
    public int Compare(object x, object y)
    {
        OutlookGridRow obj1 = (OutlookGridRow)x;
        OutlookGridRow obj2 = (OutlookGridRow)y;

        return(string.Compare(obj1.Cells[this.columnIndex].Value.ToString(), obj2.Cells[this.columnIndex].Value.ToString()) * (direction == ListSortDirection.Ascending ? 1 : -1));
    }
 private void ctrl_TRecords_SelectionChanged(object sender, EventArgs e)
 {
     if (!m_SelectedRecordBlock && ctrl_TRecords.CurrentRow != null && ctrl_TRecords.CurrentRow is OutlookGridRow)
     {
         var row = (OutlookGridRow)ctrl_TRecords.CurrentRow;
         if (row.IsGroupRow)
         {
             for (var i = 1; i < ctrl_TRecords.Rows.Count; i++)
             {
                 OutlookGridRow _row = (OutlookGridRow)ctrl_TRecords.Rows[i];
                 if (_row.IsGroupRow)
                 {
                     return;
                 }
                 if (_row.Selected)
                 {
                     row = _row;
                     break;
                 }
             }
         }
         if (row != null && row.Selected && (m_SelectedRecord == null || m_SelectedRecord.p_ID != ((Cl_Record)row.Tag).p_ID))
         {
             f_OnSelectRow(row);
         }
     }
 }
        /// <summary>
        /// Raises the <see cref="E:MouseUp" /> event.
        /// </summary>
        /// <param name="e">The <see cref="DataGridViewCellMouseEventArgs"/> instance containing the event data.</param>
        protected override void OnMouseUp(DataGridViewCellMouseEventArgs e)
        {
            base.OnMouseUp(e);

            OutlookGridRow node = OwningNode;

            if (node != null)
            {
                ((Classes.KryptonOutlookGrid)node.DataGridView)._inExpandCollapseMouseCapture = false;
            }
        }
Exemplo n.º 6
0
        /// <summary>Reloads the vault.
        /// Slow, rebuilds entire grid, but can't seem to bind to bindingsource presently</summary>
        private void LoadVault(bool refreshOnly = false)
        {
            kryptonHeaderGroup1.ValuesPrimary.Heading = $"Vault Configs - {BLL._Settings.TheVault}";

            if (!refreshOnly)
            {
                BLL._VaultRecords = BLL.GetVaultList(BLL._Settings.TheVault);
            }

            OutlookGridRow        row      = new OutlookGridRow();
            List <OutlookGridRow> gridList = new List <OutlookGridRow>();

            kryptonGrid.SuspendLayout();
            kryptonGrid.ClearInternalRows();
            kryptonGrid.FillMode = FillMode.GROUPSANDNODES;

            foreach (var vCart in BLL._VaultRecords)
            {
                try
                {
                    row          = new OutlookGridRow();
                    vCart.HasUCE = File.Exists($"{BLL._Settings.DefaultFolder_USBRoot}\\{vCart.Genre}\\AddOn_{vCart.Title}.UCE");
                    row.CreateCells(kryptonGrid, new object[] {
                        vCart.Index.ToString(),
                        vCart.HasUCE,
                        vCart.Title,
                        vCart.Genre,
                        vCart.CoverArtFile,
                        vCart.BezelArtFile,
                        vCart.UseInternalCore,
                        vCart.EmulatorCoreFile,
                        vCart.UseOverLayFile,
                        vCart.ROMFile,
                        vCart.Description,
                        vCart.ResizeImages
                    });
                    gridList.Add(row);
                    ((KryptonDataGridViewTreeTextCell)row.Cells[3]).UpdateStyle(); //Important : after added to the rows list
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Gasp...Something went wrong ! " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }

            kryptonGrid.ResumeLayout();
            kryptonGrid.AssignRows(gridList);
            if (!refreshOnly)
            {
                kryptonGrid.GroupColumn("ColumnGenre", SortOrder.Ascending, null);
                kryptonGrid.ForceRefreshGroupBox();
            }
            kryptonGrid.Fill();
        }
Exemplo n.º 7
0
    protected override void OnCellBeginEdit(DataGridViewCellCancelEventArgs e)
    {
        OutlookGridRow row = (OutlookGridRow)base.Rows[e.RowIndex];

        if (row.IsGroupRow)
        {
            e.Cancel = true;
        }
        else
        {
            base.OnCellBeginEdit(e);
        }
    }
        /// <summary>
        /// Updates the style.
        /// </summary>
        /// <remarks>padding especially.</remarks>
        public void UpdateStyle()
        {
            OutlookGridRow node = OwningNode;
            //Console.WriteLine(DateTime.Now.ToString() + " " + node.ToString());
            bool hasChildNodes = node.HasChildren;
            int  level         = Level;
            int  plus          = 0;

            //if (hasChildNodes)
            //    plus = 15;
            Style.Padding = new Padding(defaultPadding.Left + (level * INDENT_WIDTH) + INDENT_MARGIN + plus,
                                        defaultPadding.Top, defaultPadding.Right, defaultPadding.Bottom);
        }
Exemplo n.º 9
0
    protected override void OnCellDoubleClick(DataGridViewCellEventArgs e)
    {
        if (e.RowIndex >= 0)
        {
            OutlookGridRow row = (OutlookGridRow)base.Rows[e.RowIndex];
            if (row.IsGroupRow)
            {
                row.Group.Collapsed = !row.Group.Collapsed;

                //this is a workaround to make the grid re-calculate it's contents and backgroun bounds
                // so the background is updated correctly.
                // this will also invalidate the control, so it will redraw itself
                row.Visible = false;
                row.Visible = true;
                return;
            }
        }
        base.OnCellClick(e);
    }
Exemplo n.º 10
0
        private void loadBillingDetailsWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            if (selectedListBoxIndex >= 0)
            {
                List <BillingItem> items = billingItems[(string)lbTimeEntries.Items[selectedListBoxIndex]];
                OutlookGridRow     row;
                rows = new List <OutlookGridRow>();

                foreach (BillingItem item in items)
                {
                    if (item.OfficeTime == TimeSpan.Zero)
                    {
                        row = new OutlookGridRow();
                        row.CreateCells(billingGrid, new object[] {
                            item.ID,
                            item.Description,
                            item.FieldRate,
                            Utility.ToFullString(item.FieldTime)
                        });
                        row.Tag = item;
                        rows.Add(row);
                    }
                    else
                    {
                        row = new OutlookGridRow();
                        row.CreateCells(billingGrid, new object[] {
                            item.ID,
                            item.Description,
                            item.OfficeRate,
                            Utility.ToFullString(item.OfficeTime)
                        });
                        row.Tag = item;
                        rows.Add(row);
                    }
                }
            }
        }
        /// <summary>
        /// Paints the specified graphics.
        /// </summary>
        /// <param name="graphics">The graphics.</param>
        /// <param name="clipBounds">The clip bounds.</param>
        /// <param name="cellBounds">The cell bounds.</param>
        /// <param name="rowIndex">Index of the row.</param>
        /// <param name="cellState">State of the cell.</param>
        /// <param name="value">The value.</param>
        /// <param name="formattedValue">The formatted value.</param>
        /// <param name="errorText">The error text.</param>
        /// <param name="cellStyle">The cell style.</param>
        /// <param name="advancedBorderStyle">The advanced border style.</param>
        /// <param name="paintParts">The paint parts.</param>
        protected override void Paint(Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts)
        {
            OutlookGridRow node = OwningNode;

            // Console.WriteLine(DateTime.Now.ToString() + " " + node.ToString());
            //bool hasChildNodes = node.HasChildren;
            //int level = this.Level ;
            //int plus = 0;
            //if (hasChildNodes)
            //    plus = 15;
            //Padding currentPadding = this.InheritedStyle.Padding;
            // this.Style.Padding = new Padding(defaultPadding.Left + (level * INDENT_WIDTH) + INDENT_MARGIN,
            //                                             defaultPadding.Top, defaultPadding.Right, defaultPadding.Bottom);

            //this.Style.Padding = new Padding(currentPadding.Left + (level * INDENT_WIDTH) + _imageWidth + INDENT_MARGIN,
            //                                   currentPadding.Top, currentPadding.Right, currentPadding.Bottom);

            //if (this.Value != null && ((TextAndImage)this.Value).Image != null)
            //{
            //    Padding inheritedPadding = this.InheritedStyle.Padding;
            //    this.Style.Padding = new Padding(18, inheritedPadding.Top, inheritedPadding.Right, inheritedPadding.Bottom);
            //    // Draw the image clipped to the cell.
            //    System.Drawing.Drawing2D.GraphicsContainer container = graphics.BeginContainer();
            //    graphics.SetClip(cellBounds);
            //    graphics.DrawImageUnscaled(((TextAndImage)this.Value).Image, new Point(cellBounds.Location.X + 2, cellBounds.Location.Y + ((cellBounds.Height - 16) / 2) - 1));
            //    graphics.EndContainer(container);
            //}

            //if (node == null) return;

            //Image image = node.Image;

            //if (this._imageHeight == 0 && image != null) this.UpdateStyle();

            // paint the cell normally
            base.Paint(graphics, clipBounds, cellBounds, rowIndex, cellState, value, formattedValue, errorText, cellStyle, advancedBorderStyle, paintParts);

            // TODO: Indent width needs to take image size into account
            Rectangle glyphRect = new Rectangle(cellBounds.X + GlyphMargin, cellBounds.Y, INDENT_WIDTH, cellBounds.Height - 1);


            ////TODO: This painting code needs to be rehashed to be cleaner
            //int level = this.Level;

            ////TODO: Rehash this to take different Imagelayouts into account. This will speed up drawing
            ////		for images of the same size (ImageLayout.None)
            //if (image != null)
            //{
            //    Point pp;
            //    if (_imageHeight > cellBounds.Height)
            //        pp = new Point(glyphRect.X + this.glyphWidth, cellBounds.Y + _imageHeightOffset);
            //    else
            //        pp = new Point(glyphRect.X + this.glyphWidth, (cellBounds.Height / 2 - _imageHeight / 2) + cellBounds.Y);

            //    // Graphics container to push/pop changes. This enables us to set clipping when painting
            //    // the cell's image -- keeps it from bleeding outsize of cells.
            //    System.Drawing.Drawing2D.GraphicsContainer gc = graphics.BeginContainer();
            //    {
            //        graphics.SetClip(cellBounds);
            //        graphics.DrawImageUnscaled(image, pp);
            //    }
            //    graphics.EndContainer(gc);
            //}

            // Paint tree lines
            if (((Classes.KryptonOutlookGrid)node.DataGridView).ShowLines)
            {
                using (Pen linePen = new Pen(SystemBrushes.ControlDark, 1.0f))
                {
                    linePen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot;
                    bool isLastSibling  = node.IsLastSibling;
                    bool isFirstSibling = node.IsFirstSibling;

                    if (node.NodeLevel == 0)
                    {
                        // the Root nodes display their lines differently
                        if (isFirstSibling && isLastSibling)
                        {
                            // only node, both first and last. Just draw horizontal line
                            graphics.DrawLine(linePen, glyphRect.X + 4, cellBounds.Top + cellBounds.Height / 2, glyphRect.Right, cellBounds.Top + cellBounds.Height / 2);
                        }
                        else if (isLastSibling)
                        {
                            // last sibling doesn't draw the line extended below. Paint horizontal then vertical
                            graphics.DrawLine(linePen, glyphRect.X + 4, cellBounds.Top + cellBounds.Height / 2, glyphRect.Right, cellBounds.Top + cellBounds.Height / 2);
                            graphics.DrawLine(linePen, glyphRect.X + 4, cellBounds.Top, glyphRect.X + 4, cellBounds.Top + cellBounds.Height / 2);
                        }
                        else if (isFirstSibling)
                        {
                            // first sibling doesn't draw the line extended above. Paint horizontal then vertical
                            graphics.DrawLine(linePen, glyphRect.X + 4, cellBounds.Top + cellBounds.Height / 2, glyphRect.Right, cellBounds.Top + cellBounds.Height / 2);
                            graphics.DrawLine(linePen, glyphRect.X + 4, cellBounds.Top + cellBounds.Height / 2, glyphRect.X + 4, cellBounds.Bottom);
                        }
                        else
                        {
                            // normal drawing draws extended from top to bottom. Paint horizontal then vertical
                            graphics.DrawLine(linePen, glyphRect.X + 4, cellBounds.Top + cellBounds.Height / 2, glyphRect.Right, cellBounds.Top + cellBounds.Height / 2);
                            graphics.DrawLine(linePen, glyphRect.X + 4, cellBounds.Top, glyphRect.X + 4, cellBounds.Bottom);
                        }
                    }
                    else
                    {
                        if (isLastSibling)
                        {
                            // last sibling doesn't draw the line extended below. Paint horizontal then vertical
                            graphics.DrawLine(linePen, glyphRect.X + 4, cellBounds.Top + cellBounds.Height / 2, glyphRect.Right, cellBounds.Top + cellBounds.Height / 2);
                            graphics.DrawLine(linePen, glyphRect.X + 4, cellBounds.Top, glyphRect.X + 4, cellBounds.Top + cellBounds.Height / 2);
                        }
                        else
                        {
                            // normal drawing draws extended from top to bottom. Paint horizontal then vertical
                            graphics.DrawLine(linePen, glyphRect.X + 4, cellBounds.Top + cellBounds.Height / 2, glyphRect.Right, cellBounds.Top + cellBounds.Height / 2);
                            graphics.DrawLine(linePen, glyphRect.X + 4, cellBounds.Top, glyphRect.X + 4, cellBounds.Bottom);
                        }

                        // paint lines of previous levels to the root
                        OutlookGridRow previousNode   = node.ParentNode;
                        int            horizontalStop = (glyphRect.X + 4) - INDENT_WIDTH;

                        while (previousNode != null)//.IsRoot)
                        {
                            if (previousNode.HasChildren && !previousNode.IsLastSibling)
                            {
                                // paint vertical line
                                graphics.DrawLine(linePen, horizontalStop, cellBounds.Top, horizontalStop, cellBounds.Bottom);
                            }
                            previousNode   = previousNode.ParentNode;
                            horizontalStop = horizontalStop - INDENT_WIDTH;
                        }
                    }
                }
            }

            if (node.HasChildren)
            {
                // Paint node glyphs
                if (node.Collapsed)
                {
                    if (KryptonManager.CurrentGlobalPalette.GetRenderer() == KryptonManager.RenderOffice2010 || KryptonManager.CurrentGlobalPalette.GetRenderer() == KryptonManager.RenderOffice2013)
                    {
                        graphics.DrawImage(Properties.Resources.CollapseIcon2010, glyphRect.X, glyphRect.Y + (glyphRect.Height / 2) - 4, 11, 11);
                    }
                    else
                    {
                        graphics.DrawImage(Properties.Resources.ExpandIcon, glyphRect.X, glyphRect.Y + (glyphRect.Height / 2) - 4, 11, 11);
                    }
                }
                else
                {
                    if (KryptonManager.CurrentGlobalPalette.GetRenderer() == KryptonManager.RenderOffice2010 || KryptonManager.CurrentGlobalPalette.GetRenderer() == KryptonManager.RenderOffice2013)
                    {
                        graphics.DrawImage(Properties.Resources.ExpandIcon2010, glyphRect.X, glyphRect.Y + (glyphRect.Height / 2) - 4, 11, 11);
                    }
                    else
                    {
                        graphics.DrawImage(Properties.Resources.CollapseIcon, glyphRect.X, glyphRect.Y + (glyphRect.Height / 2) - 4, 11, 11);
                    }
                }
            }
            //graphics.DrawRectangle(new Pen(new SolidBrush(Color.Red)), glyphRect);
        }
        private void f_UpdateRecords(Cl_Record selectedRecord = null)
        {
            try
            {
                var patientID  = Cl_SessionFacade.f_GetInstance().p_Patient.p_UserID;
                var patientUID = Cl_SessionFacade.f_GetInstance().p_Patient.p_UserUID;

                var records = Cl_App.m_DataContext.p_Records.Include(r => r.p_MedicalCard).AsQueryable();
                if (Cl_SessionFacade.f_GetInstance().p_Doctor.p_Permission.p_IsReadSelectedRecords)
                {
                    if (Cl_SessionFacade.f_GetInstance().p_DateStart != null && Cl_SessionFacade.f_GetInstance().p_DateEnd != null)
                    {
                        var dateStart = Cl_SessionFacade.f_GetInstance().p_DateStart;
                        var dateEnd   = Cl_SessionFacade.f_GetInstance().p_DateEnd;
                        records = records.Where(r => r.p_DateLastChange >= dateStart && r.p_DateLastChange <= dateEnd);
                    }
                    else
                    {
                        MonitoringStub.Error("Error_Editor", "Для проверяющего С/К не указан период", null, null, null);
                    }
                }

                records = records.Where(r => p_IsShowDeleted ? true : !r.p_IsDelete && r.p_MedicalCard != null && (r.p_MedicalCard.p_PatientUID == patientUID || r.p_MedicalCard.p_PatientID == patientID));

                m_Records = records.GroupBy(e => e.p_RecordID).Select(grp => grp
                                                                      .OrderByDescending(v => v.p_Version).FirstOrDefault())
                            .Include(r => r.p_CategoryTotal).Include(r => r.p_CategoryClinic).Include(r => r.p_Values).Include(r => r.p_Template).Include(r => r.p_Values.Select(v => v.p_Params)).ToArray();

                m_SelectedRecordBlock = true;
                ctrl_TRecords.BindData(null, null);
                ctrl_TRecords.Columns.AddRange(p_MedicalCardNumber, p_ClinikName, p_DateForming, p_CategoryTotal, p_Title, p_DoctorFIO);
                foreach (var record in m_Records)
                {
                    OutlookGridRow row = new OutlookGridRow();
                    row.CreateCells(ctrl_TRecords,
                                    record.p_MedicalCardNumber,
                                    record.p_ClinicName,
                                    record.p_DateReception.ToString("dd.MM.yyyy HH:mm"),
                                    record.p_CategoryTotal != null ? record.p_CategoryTotal.p_Name : "",
                                    record.p_Title,
                                    record.p_DoctorFIO);
                    row.Tag = record;
                    ctrl_TRecords.Rows.Add(row);
                }
                ctrl_TRecords.Columns[0].Visible   = false;
                ctrl_TRecords.GroupTemplate.Column = ctrl_TRecords.Columns[0];

                ctrl_TRecords.Sort(ctrl_TRecords.Columns[2], System.ComponentModel.ListSortDirection.Descending);
                m_SelectedRecordBlock = false;

                if (selectedRecord != null)
                {
                    foreach (OutlookGridRow row in ctrl_TRecords.Rows)
                    {
                        if (!row.IsGroupRow && ((Cl_Record)row.Tag).p_ID == selectedRecord.p_ID)
                        {
                            row.Selected = true;
                            break;
                        }
                    }
                }
            }
            catch (Exception er)
            {
                MonitoringStub.Error("Error_Editor", "Не удалось обновить записи", er, null, null);
            }
        }
Exemplo n.º 13
0
        private void LoadData()
        {
            //Setup Rows
            OutlookGridRow        row = new OutlookGridRow();
            List <OutlookGridRow> l   = new List <OutlookGridRow>();

            OutlookGrid1.SuspendLayout();
            OutlookGrid1.ClearInternalRows();
            OutlookGrid1.FillMode = FillMode.GroupsAndNodes;

            List <Token> tokensList = new List <Token>();

            tokensList.Add(new Token("Best seller", Color.Orange, Color.Black));
            tokensList.Add(new Token("New", Color.LightGreen, Color.Black));
            tokensList.Add(null);
            tokensList.Add(null);
            tokensList.Add(null);

            Random random = new Random();
            //.Next permet de retourner un nombre aléatoire contenu dans la plage spécifiée entre parenthèses.
            XmlDocument doc = new XmlDocument();

            doc.Load("invoices.xml");
            IFormatProvider culture = new CultureInfo("en-US", true);

            foreach (XmlNode customer in doc.SelectNodes("//invoice")) //TODO for instead foreach for perfs...
            {
                try
                {
                    row = new OutlookGridRow();
                    row.CreateCells(OutlookGrid1, new object[] {
                        customer["CustomerID"].InnerText,
                        customer["CustomerName"].InnerText,
                        customer["Address"].InnerText,
                        customer["City"].InnerText,
                        new TextAndImage(customer["Country"].InnerText, GetFlag(customer["Country"].InnerText)),
                        DateTime.Parse(customer["OrderDate"].InnerText, culture),
                        customer["ProductName"].InnerText,
                        double.Parse(customer["Price"].InnerText, CultureInfo.InvariantCulture), //We put a float the formatting in design does the rest
                        (double)random.Next(101) / 100,
                        tokensList[random.Next(5)]
                    });
                    if (random.Next(2) == 1)
                    {
                        //Sub row
                        OutlookGridRow row2 = new OutlookGridRow();
                        row2.CreateCells(OutlookGrid1, new object[] {
                            customer["CustomerID"].InnerText + " 2",
                            customer["CustomerName"].InnerText + " 2",
                            customer["Address"].InnerText + "2",
                            customer["City"].InnerText + " 2",
                            new TextAndImage(customer["Country"].InnerText, GetFlag(customer["Country"].InnerText)),
                            DateTime.Now,
                            customer["ProductName"].InnerText + " 2",
                            (double)random.Next(1000),
                            (double)random.Next(101) / 100,
                            tokensList[random.Next(5)]
                        });
                        row.Nodes.Add(row2);
                        ((KryptonDataGridViewTreeTextCell)row2.Cells[1]).UpdateStyle(); //Important : after added to the parent node
                    }
                    l.Add(row);
                    ((KryptonDataGridViewTreeTextCell)row.Cells[1]).UpdateStyle(); //Important : after added to the rows list
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Gasp...Something went wrong ! " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }



            OutlookGrid1.ResumeLayout();
            OutlookGrid1.AssignRows(l);
            OutlookGrid1.ForceRefreshGroupBox();
            OutlookGrid1.Fill();
        }