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";
        }
Exemplo n.º 2
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.º 3
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);
                    }
                }
            }
        }
        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.º 5
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();
        }