Beispiel #1
0
        private object GetParentDataSourceList_tabPosts()
        {
            if (_debug)
            {
                Console.WriteLine("GetParentDataSourceList_tabPosts");
            }

            object ret = null;

            int blogs_id = -1;

            if (vBlogsBindingSource.Current != null)
            {
#if NETFRAMEWORK
                blogs_id = Int32.Parse((((DataRowView)vBlogsBindingSource.Current).Row)["blogs_id"].ToString());
#else
                blogs_id = (((DataRowView)vBlogsBindingSource.Current).Row).Field <int>("blogs_id");
#endif
            }

            IEnumerable <VPosts> vPosts =
                samplemodel.Posts.List(r => r.blogs_id == blogs_id).Select(
                    r => new VPosts
            {
                posts_id = r.posts_id,
                title    = r.posts_title
            }).ToList();

            ret = DGDataTableUtils.ToDataTable <VPosts>(vPosts);

            return(ret);
        }
Beispiel #2
0
        private object GetDataSourceList_tabPostslist_tabComments()
        {
            if (_debug)
            {
                Console.WriteLine("GetParentDataSourceList_tabPostslist_tabComments");
            }

            object ret = null;

            int posts_id = -1;

            if (vPostsBindingSource.Current != null)
            {
#if NETFRAMEWORK
                posts_id = Int32.Parse((((DataRowView)vPostsBindingSource.Current).Row)["posts_id"].ToString());
#else
                posts_id = (((DataRowView)vPostsBindingSource.Current).Row).Field <int>("posts_id");
#endif
            }

            IEnumerable <VComments> vComments =
                samplemodel.Comments.List(r => r.posts_id == posts_id).Select(
                    r => new VComments
            {
                comments_id = r.comments_id,
                text        = r.comments_text
            }).ToList();

            ret = DGDataTableUtils.ToDataTable <VComments>(vComments);

            return(ret);
        }
Beispiel #3
0
        public void DGDataTableUtils_ToDataTable1()
        {
            List <APost> posts = new List <APost>();

            posts.Add(new APost()
            {
                posts_id          = 1,
                posts_name        = "Post1",
                posts_description = "test description"
            });
            posts.Add(new APost()
            {
                posts_id          = 2,
                posts_name        = "Post2",
                posts_description = "test description"
            });
            IEnumerable <VAPost> posts_enum = posts.Select(r =>
                                                           new VAPost()
            {
                posts_name = r.posts_name
            });

            DataTable dt = DGDataTableUtils.ToDataTable <VAPost>(posts_enum);

            XmlSerializer xmlSerializer = new XmlSerializer(dt.GetType());
            StringWriter  textWriter    = new StringWriter();

            xmlSerializer.Serialize(textWriter, dt);

            string expected = @"PAA/AHgAbQBsACAAdgBlAHIAcwBpAG8AbgA9ACIAMQAuADAAIgAgAGUAbgBjAG8AZABpAG4AZwA9ACIAdQB0AGYALQAxADYAIgA/AD4ADQAKADwARABhAHQAYQBUAGEAYgBsAGUAPgANAAoAIAAgADwAeABzADoAcwBjAGgAZQBtAGEAIABpAGQAPQAiAE4AZQB3AEQAYQB0AGEAUwBlAHQAIgAgAHgAbQBsAG4AcwA9ACIAIgAgAHgAbQBsAG4AcwA6AHgAcwA9ACIAaAB0AHQAcAA6AC8ALwB3AHcAdwAuAHcAMwAuAG8AcgBnAC8AMgAwADAAMQAvAFgATQBMAFMAYwBoAGUAbQBhACIAIAB4AG0AbABuAHMAOgBtAHMAZABhAHQAYQA9ACIAdQByAG4AOgBzAGMAaABlAG0AYQBzAC0AbQBpAGMAcgBvAHMAbwBmAHQALQBjAG8AbQA6AHgAbQBsAC0AbQBzAGQAYQB0AGEAIgA+AA0ACgAgACAAIAAgADwAeABzADoAZQBsAGUAbQBlAG4AdAAgAG4AYQBtAGUAPQAiAE4AZQB3AEQAYQB0AGEAUwBlAHQAIgAgAG0AcwBkAGEAdABhADoASQBzAEQAYQB0AGEAUwBlAHQAPQAiAHQAcgB1AGUAIgAgAG0AcwBkAGEAdABhADoATQBhAGkAbgBEAGEAdABhAFQAYQBiAGwAZQA9ACIAVgBBAFAAbwBzAHQAIgAgAG0AcwBkAGEAdABhADoAVQBzAGUAQwB1AHIAcgBlAG4AdABMAG8AYwBhAGwAZQA9ACIAdAByAHUAZQAiAD4ADQAKACAAIAAgACAAIAAgADwAeABzADoAYwBvAG0AcABsAGUAeABUAHkAcABlAD4ADQAKACAAIAAgACAAIAAgACAAIAA8AHgAcwA6AGMAaABvAGkAYwBlACAAbQBpAG4ATwBjAGMAdQByAHMAPQAiADAAIgAgAG0AYQB4AE8AYwBjAHUAcgBzA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tAGUAbgB0AD4ADQAKACAAIAA8AC8AZABpAGYAZgBnAHIAOgBkAGkAZgBmAGcAcgBhAG0APgANAAoAPAAvAEQAYQB0AGEAVABhAGIAbABlAD4A";
            string actual   = Convert.ToBase64String(Encoding.Unicode.GetBytes(textWriter.ToString()));

            Assert.That(actual, Is.EqualTo(expected));
        }
Beispiel #4
0
        private object GetDataSourceList_tabPostslist_tabCommentsuseful()
        {
            if (_debug)
            {
                Console.WriteLine("GetDataSourceList_tabPostslist_tabCommentsuseful");
            }

            object ret = null;

            int comments_id = -1;

            if (vCommentsBindingSource.Current != null)
            {
#if NETFRAMEWORK
                comments_id = Int32.Parse((((DataRowView)vCommentsBindingSource.Current).Row)["comments_id"].ToString());
#else
                comments_id = (((DataRowView)vCommentsBindingSource.Current).Row).Field <int>("comments_id");
#endif
            }

            IEnumerable <VCommentsUseful> vCommentsUseful =
                samplemodel.CommentsUseful.List(r => r.comments_id == comments_id).Select(
                    r => new VCommentsUseful
            {
                commentsuseful_id = r.commentsuseful_id,
                comments_id       = r.comments_id,
                points            = r.commentsuseful_points
            }).ToList();

            ret = DGDataTableUtils.ToDataTable <VCommentsUseful>(vCommentsUseful);

            return(ret);
        }
Beispiel #5
0
        private object GetDataSourceList_tabPostsextra_tabPoststotags()
        {
            if (_debug)
            {
                Console.WriteLine("GetDataSourceList_tabPostsextra_tabPoststotags");
            }

            object ret = null;

            int posts_id = -1;

            if (vPostsBindingSource.Current != null)
            {
#if NETFRAMEWORK
                posts_id = Int32.Parse((((DataRowView)vPostsBindingSource.Current).Row)["posts_id"].ToString());
#else
                posts_id = (((DataRowView)vPostsBindingSource.Current).Row).Field <int>("posts_id");
#endif
            }

            IEnumerable <VPostsToTags> vPostsToTags =
                samplemodel.PostsToTags.List(r => r.posts_id == posts_id).Select(
                    r => new VPostsToTags
            {
                posts_id = r.posts_id,
                tags_id  = r.tags_id,
                post     = samplemodel.Posts.Find(r.posts_id).posts_title,
                tag      = samplemodel.Tags.Find(r.tags_id).tags_name
            }).ToList();

            ret = DGDataTableUtils.ToDataTable <VPostsToTags>(vPostsToTags);

            return(ret);
        }
Beispiel #6
0
        private object GetParentDataSourceEmptyList_tabPosts()
        {
            if (_debug)
            {
                Console.WriteLine("GetDataSourceEmptyList_tabPosts");
            }

            return(DGDataTableUtils.ToDataTable <VPosts>(Enumerable.Empty <VPosts>()));
        }
Beispiel #7
0
        private object GetDataSourceEmptyList_tabPostslist_tabCommentsuseful()
        {
            if (_debug)
            {
                Console.WriteLine("GetDataSourceEmptyList_tabPostslist_tabCommentsuseful");
            }

            return(DGDataTableUtils.ToDataTable <VCommentsUseful>(Enumerable.Empty <VCommentsUseful>()));
        }
Beispiel #8
0
        /// <summary>
        /// Get main list DataSource
        /// </summary>
        /// <returns></returns>
        private object GetDataSource_main()
        {
            IEnumerable <VMedicalrecordsTypes> vMedicalrecordsTypes =
                _dentnedModel.MedicalrecordsTypes.List().Select(
                    r => new VMedicalrecordsTypes
            {
                medicalrecordstypes_id = r.medicalrecordstypes_id,
                name = r.medicalrecordstypes_name
            }).ToList();

            return(DGDataTableUtils.ToDataTable <VMedicalrecordsTypes>(vMedicalrecordsTypes));
        }
Beispiel #9
0
        /// <summary>
        /// Get main list DataSource
        /// </summary>
        /// <returns></returns>
        private object GetDataSource_main()
        {
            IEnumerable <VRooms> vRooms =
                _dentnedModel.Rooms.List().Select(
                    r => new VRooms
            {
                rooms_id = r.rooms_id,
                name     = r.rooms_name
            }).ToList();

            return(DGDataTableUtils.ToDataTable <VRooms>(vRooms));
        }
Beispiel #10
0
        /// <summary>
        /// Get main list DataSource
        /// </summary>
        /// <returns></returns>
        private object GetDataSource_main()
        {
            IEnumerable <VTreatmentsPricesLists> vTreatmentsPricesLists =
                _dentnedModel.TreatmentsPricesLists.List().Select(
                    r => new VTreatmentsPricesLists
            {
                treatmentspriceslists_id = r.treatmentspriceslists_id,
                name = r.treatmentspriceslists_name
            }).ToList();

            return(DGDataTableUtils.ToDataTable <VTreatmentsPricesLists>(vTreatmentsPricesLists));
        }
Beispiel #11
0
        /// <summary>
        /// Get main list DataSource
        /// </summary>
        /// <returns></returns>
        private object GetDataSource_main()
        {
            IEnumerable <VContactsTypes> vContactsTypes =
                _dentnedModel.ContactsTypes.List().Select(
                    r => new VContactsTypes
            {
                contactstypes_id = r.contactstypes_id,
                name             = r.contactstypes_name
            }).ToList();

            return(DGDataTableUtils.ToDataTable <VContactsTypes>(vContactsTypes));
        }
Beispiel #12
0
        /// <summary>
        /// Get main list DataSource
        /// </summary>
        /// <returns></returns>
        private object GetDataSource_main()
        {
            IEnumerable <VDoctors> vDoctors =
                _dentnedModel.Doctors.List().Select(
                    r => new VDoctors
            {
                doctors_id = r.doctors_id,
                name       = r.doctors_surname + " " + r.doctors_name
            }).ToList();

            return(DGDataTableUtils.ToDataTable <VDoctors>(vDoctors));
        }
        /// <summary>
        /// Get main list DataSource
        /// </summary>
        /// <returns></returns>
        private object GetDataSource_main()
        {
            IEnumerable <VPatientsAttachmentsTypes> vPatientsAttachmentsTypes =
                _dentnedModel.PatientsAttachmentsTypes.List().Select(
                    r => new VPatientsAttachmentsTypes
            {
                patientsattachmentstypes_id = r.patientsattachmentstypes_id,
                name = r.patientsattachmentstypes_name
            }).ToList();

            return(DGDataTableUtils.ToDataTable <VPatientsAttachmentsTypes>(vPatientsAttachmentsTypes));
        }
Beispiel #14
0
        /// <summary>
        /// Get main list DataSource
        /// </summary>
        /// <returns></returns>
        private object GetDataSource_main()
        {
            IEnumerable <VAddressesTypes> vAddressesTypes =
                _dentnedModel.AddressesTypes.List().Select(
                    r => new VAddressesTypes
            {
                addressestypes_id = r.addressestypes_id,
                name = r.addressestypes_name
            }).ToList();

            return(DGDataTableUtils.ToDataTable <VAddressesTypes>(vAddressesTypes));
        }
Beispiel #15
0
        /// <summary>
        /// Get main list DataSource
        /// </summary>
        /// <returns></returns>
        private object GetDataSource_main()
        {
            IEnumerable <VTaxesDeductions> vTaxesDeductions =
                _dentnedModel.TaxesDeductions.List().Select(
                    r => new VTaxesDeductions
            {
                taxesdeductions_id = r.taxesdeductions_id,
                name      = r.taxesdeductions_name,
                isdefault = r.taxesdeductions_isdefault
            }).ToList();

            return(DGDataTableUtils.ToDataTable <VTaxesDeductions>(vTaxesDeductions));
        }
Beispiel #16
0
        /// <summary>
        /// Get main list DataSource
        /// </summary>
        /// <returns></returns>
        private object GetDataSource_main()
        {
            IEnumerable <VComputedLines> vComputedLines =
                _dentnedModel.ComputedLines.List().Select(
                    r => new VComputedLines
            {
                computedlines_id = r.computedlines_id,
                code             = r.computedlines_code,
                name             = r.computedlines_name
            }).ToList();

            return(DGDataTableUtils.ToDataTable <VComputedLines>(vComputedLines));
        }
        /// <summary>
        /// Get main list DataSource
        /// </summary>
        /// <returns></returns>
        private object GetDataSource_main()
        {
            IEnumerable <VEstimatesFooters> vEstimatesFooters =
                _dentnedModel.EstimatesFooters.List().Select(
                    r => new VEstimatesFooters
            {
                estimatesfooters_id = r.estimatesfooters_id,
                name      = r.estimatesfooters_name,
                isdefault = r.estimatesfooters_isdefault
            }).ToList();

            return(DGDataTableUtils.ToDataTable <VEstimatesFooters>(vEstimatesFooters));
        }
Beispiel #18
0
        /// <summary>
        /// Get main list DataSource
        /// </summary>
        /// <returns></returns>
        private object GetDataSource_main()
        {
            ResetTabsDataGrid();

            IEnumerable <VTreatments> vTreatments =
                _dentnedModel.Treatments.List().Select(
                    r => new VTreatments
            {
                treatments_id = r.treatments_id,
                code          = r.treatments_code,
                type          = _dentnedModel.TreatmentsTypes.Find(r.treatmentstypes_id).treatmentstypes_name,
                name          = r.treatments_name
            }).ToList();

            return(DGDataTableUtils.ToDataTable <VTreatments>(vTreatments));
        }
Beispiel #19
0
        private object GetDataSource_main()
        {
            if (_debug)
            {
                Console.WriteLine("GetDataSource_main");
            }

            IEnumerable <VTags> vTags =
                samplemodel.Tags.List().Select(
                    r => new VTags
            {
                tags_id = r.tags_id,
                name    = r.tags_name
            }).ToList();

            return(DGDataTableUtils.ToDataTable <VTags>(vTags));
        }
Beispiel #20
0
        private object GetDataSource_main()
        {
            if (_debug)
            {
                Console.WriteLine("GetDataSource_main");
            }

            IEnumerable <VPosts> vPosts =
                samplemodel.Posts.List().Select(
                    r => new VPosts
            {
                posts_id = r.posts_id,
                title    = r.posts_title
            }).ToList();

            return(DGDataTableUtils.ToDataTable <VPosts>(vPosts));
        }
Beispiel #21
0
        private object GetDataSource_main()
        {
            if (_debug)
            {
                Console.WriteLine("GetDataSource_main");
            }

            IEnumerable <VBlogs> vBlogs =
                samplemodel.Blogs.List().Select(
                    r => new VBlogs
            {
                blogs_id = r.blogs_id,
                title    = r.blogs_title,
                date     = r.blogs_date
            }).ToList();

            return(DGDataTableUtils.ToDataTable <VBlogs>(vBlogs));
        }
Beispiel #22
0
        private void FormPosts_Load(object sender, EventArgs e)
        {
            //load blogs combobox
            IEnumerable <VCBlogs> vCBlogs = samplemodel.Blogs.List().OrderBy(r => r.blogs_title).Select(
                r => new VCBlogs
            {
                blogs_id = r.blogs_id,
                title    = r.blogs_title
            }).ToList();

            vCBlogsBindingSource.DataSource = DGDataTableUtils.ToDataTable <VCBlogs>(vCBlogs);
            blogs_idComboBox.SelectedIndex  = -1;

            //load tags combobox
            comboBox_tabPostsextra_tabPoststotags_tags.DataSource    = samplemodel.Tags.List().OrderBy(q => q.tags_name).Select(a => new { _id = a.tags_id, _value = a.tags_name + " (" + a.tags_id.ToString() + ")" }).ToArray();
            comboBox_tabPostsextra_tabPoststotags_tags.ValueMember   = "_id";
            comboBox_tabPostsextra_tabPoststotags_tags.DisplayMember = "_value";
            comboBox_tabPostsextra_tabPoststotags_tags.SelectedIndex = -1;

            ReloadView();
        }
Beispiel #23
0
        /// <summary>
        /// Get tab list DataSource
        /// </summary>
        /// <returns></returns>
        private object GetDataSourceList_tabTreatmentsPrices()
        {
            object ret = null;

            //get current treatment
            int treatments_id = -1;

            if (vTreatmentsBindingSource.Current != null)
            {
                treatments_id = (((DataRowView)vTreatmentsBindingSource.Current).Row).Field <int>("treatments_id");
            }

            //get treatments
            List <treatmentsprices> treatmentspricesl = new List <treatmentsprices>();

            if (comboBox_tabTreatmentsPrices_filterPriceslists.SelectedIndex != -1 && comboBox_tabTreatmentsPrices_filterPriceslists.SelectedIndex != 0)
            {
                int treatmentspriceslists_id = Convert.ToInt32(comboBox_tabTreatmentsPrices_filterPriceslists.SelectedValue);
                treatmentspricesl = _dentnedModel.TreatmentsPrices.List(r => r.treatments_id == treatments_id && r.treatmentspriceslists_id == treatmentspriceslists_id).ToList();
            }
            else
            {
                treatmentspricesl = _dentnedModel.TreatmentsPrices.List(r => r.treatments_id == treatments_id).ToList();
            }
            IEnumerable <VTreatmentsPrices> vTreatmentsPrices =
                treatmentspricesl.Select(
                    r => new VTreatmentsPrices
            {
                treatmentsprices_id = r.treatmentsprices_id,
                price     = (double)r.treatmentsprices_price,
                pricelist = _dentnedModel.TreatmentsPricesLists.Find(r.treatmentspriceslists_id).treatmentspriceslists_name
            }).ToList();

            ret = DGDataTableUtils.ToDataTable <VTreatmentsPrices>(vTreatmentsPrices);

            return(ret);
        }