Esempio n. 1
0
        public void LoadBan()
        {
            var provider    = new Sqlite();
            var table_group = provider.ExecuteQuery($@"SELECT DISTINCT khuvuc from view_ban a LEFT JOIN (SELECT maban from tbl_hoadon where dathanhtoan=0) b on b.maban=a.maban where b.maban>0 and a.maban NOT IN ('{Data._strMaBan}')");
            var table_item  = provider.ExecuteQuery($@"SELECT DISTINCT a.maban, tenban, khuvuc, hinh, CASE when b.maban>0 THEN 'True' ELSE 'False' END as sudung from view_ban a LEFT JOIN (SELECT maban from tbl_hoadon where dathanhtoan=0) b on b.maban=a.maban where b.maban>0 and a.maban NOT IN ('{Data._strMaBan}')");

            count_group_gallery = table_group.Rows.Count;

            galleryControl1.Gallery.ItemImageLayout  = ImageLayoutMode.ZoomInside;
            galleryControl1.Gallery.ImageSize        = new Size(64, 64);
            galleryControl1.Gallery.ShowItemText     = true;
            galleryControl1.Gallery.ShowGroupCaption = true;

            foreach (DataRow group in table_group.Rows)
            {
                var galleryItem = new GalleryItemGroup();
                galleryItem.Caption = group["khuvuc"] as string;

                //  galleryItem.CaptionAlignment = GalleryItemGroupCaptionAlignment.Center;


                foreach (DataRow item in table_item.Rows)
                {
                    if (group["khuvuc"].ToString().Equals(item["khuvuc"].ToString()))
                    {
                        var gc_item = new GalleryItem();
                        gc_item.AppearanceCaption.Normal.Font  = new Font("Tahoma", 12, FontStyle.Regular);
                        gc_item.AppearanceCaption.Hovered.Font = new Font("Tahoma", 12, FontStyle.Regular);
                        gc_item.AppearanceCaption.Pressed.Font = new Font("Tahoma", 12, FontStyle.Regular);

                        string url = Data.BASE_URL_ICON + item["hinh"];
                        if (item["sudung"].ToString() == "True")
                        {
                            gc_item.ImageOptions.Image = Image.FromFile(url);
                        }
                        else
                        {
                            gc_item.ImageOptions.Image = Data.MakeGrayscale((Bitmap)Image.FromFile(url));
                        }
                        gc_item.Caption = item["tenban"].ToString();
                        gc_item.Value   = item["maban"].ToString();

                        galleryItem.Items.Add(gc_item);
                    }
                }
                galleryControl1.Gallery.Groups.Add(galleryItem);
            }
        }
Esempio n. 2
0
        public void LoadBan()
        {
            var       provider    = new Sqlite();
            DataTable table_group = new DataTable();
            DataTable table_item  = new DataTable();

            table_group = provider.ExecuteQuery($@"SELECT DISTINCT c.khuvuc from tbl_ban a LEFT JOIN (SELECT DISTINCT maban from tbl_hoadon where ngayban>='{Convert.ToDateTime(dateTuNgay.EditValue).ToString("yyyy-MM-dd")}' and ngayban<='{Convert.ToDateTime(dateDenNgay.EditValue).ToString("yyyy-MM-dd")}' and huyhoadon=0) b on b.maban=a.maban INNER JOIN tbl_khuvuc c on c.makhuvuc=a.makhuvuc");
            table_item  = provider.ExecuteQuery($@"SELECT a.maban, a.tenban, c.khuvuc, c.hinh, CASE when b.maban is null then 'False' ELSE 'True' END as sudung from tbl_ban a LEFT JOIN (SELECT DISTINCT maban from tbl_hoadon where ngayban>='{Convert.ToDateTime(dateTuNgay.EditValue).ToString("yyyy-MM-dd")}' and ngayban<='{Convert.ToDateTime(dateDenNgay.EditValue).ToString("yyyy-MM-dd")}' and huyhoadon=0) b on b.maban=a.maban INNER JOIN tbl_khuvuc c on c.makhuvuc=a.makhuvuc");

            count_group_gallery = table_group.Rows.Count;

            galleryControl1.Gallery.ItemImageLayout  = ImageLayoutMode.ZoomInside;
            galleryControl1.Gallery.ImageSize        = new Size(64, 64);
            galleryControl1.Gallery.ShowItemText     = true;
            galleryControl1.Gallery.ShowGroupCaption = true;

            foreach (DataRow group in table_group.Rows)
            {
                var galleryItem = new GalleryItemGroup();
                galleryItem.Caption = group["khuvuc"] as string;

                foreach (DataRow item in table_item.Rows)
                {
                    if (group["khuvuc"].ToString().Equals(item["khuvuc"].ToString()))
                    {
                        var gc_item = new GalleryItem();
                        gc_item.AppearanceCaption.Normal.Font  = new Font("Tahoma", 12, FontStyle.Regular);
                        gc_item.AppearanceCaption.Hovered.Font = new Font("Tahoma", 12, FontStyle.Regular);
                        gc_item.AppearanceCaption.Pressed.Font = new Font("Tahoma", 12, FontStyle.Regular);

                        string url = Data.BASE_URL_ICON + item["hinh"];
                        if (item["sudung"].ToString() == "True")
                        {
                            gc_item.ImageOptions.Image = Image.FromFile(url);
                        }
                        else
                        {
                            gc_item.ImageOptions.Image = Data.MakeGrayscale((Bitmap)Image.FromFile(url));
                        }
                        gc_item.Caption = item["tenban"].ToString();
                        gc_item.Value   = item["maban"].ToString();

                        galleryItem.Items.Add(gc_item);
                    }
                }
                galleryControl1.Gallery.Groups.Add(galleryItem);
            }
        }
Esempio n. 3
0
        public void LoadBan()
        {
            var provider    = new Sqlite();
            var table_group = provider.ExecuteQuery("SELECT DISTINCT khuvuc FROM view_ban2");
            var table_item  = provider.ExecuteQuery("SELECT * from view_ban2");

            count_group_gallery = table_group.Rows.Count;

            galleryControl1.Gallery.ItemImageLayout  = ImageLayoutMode.ZoomInside;
            galleryControl1.Gallery.ImageSize        = new Size(64, 64);
            galleryControl1.Gallery.ShowItemText     = true;
            galleryControl1.Gallery.ShowGroupCaption = true;

            foreach (DataRow group in table_group.Rows)
            {
                var galleryItem = new GalleryItemGroup();
                galleryItem.Caption = group["khuvuc"] as string;
                //  galleryItem.CaptionAlignment = GalleryItemGroupCaptionAlignment.Center;

                foreach (DataRow item in table_item.Rows)
                {
                    if (group["khuvuc"].ToString().Equals(item["khuvuc"].ToString()))
                    {
                        var gc_item = new GalleryItem();
                        gc_item.AppearanceCaption.Normal.Font  = new Font("Tahoma", 12, FontStyle.Regular);
                        gc_item.AppearanceCaption.Hovered.Font = new Font("Tahoma", 12, FontStyle.Regular);
                        gc_item.AppearanceCaption.Pressed.Font = new Font("Tahoma", 12, FontStyle.Regular);
                        string url = Data.BASE_URL_ICON + item["hinh"];
                        if (item["sudung"].ToString() == "True")
                        {
                            gc_item.ImageOptions.Image = Image.FromFile(url);
                        }
                        else
                        {
                            gc_item.ImageOptions.Image = Data.MakeGrayscale((Bitmap)Image.FromFile(url));
                        }
                        gc_item.Caption = item["tenban"].ToString();
                        gc_item.Value   = item["maban"].ToString();

                        galleryItem.Items.Add(gc_item);
                    }
                }
                galleryControl1.Gallery.Groups.Add(galleryItem);
            }
        }