Пример #1
0
        public static List <Documents> GetListPagination(SearchDocuments dto, string SecretId)
        {
            if (dto.CurrentPage <= 0)
            {
                dto.CurrentPage = 1;
            }
            if (dto.ItemsPerPage <= 0)
            {
                dto.ItemsPerPage = 10;
            }
            if (dto.Keyword == null)
            {
                dto.Keyword = "";
            }

            string str_sql = "GetListPagination";

            if (dto.Status != -1)
            {
                str_sql = "GetListPagination_Status";
            }



            string StartDate = DateTime.ParseExact(dto.ShowStartDate, "dd/MM/yyyy", CultureInfo.InvariantCulture).ToString("yyyyMMdd");
            string EndDate   = DateTime.ParseExact(dto.ShowEndDate, "dd/MM/yyyy", CultureInfo.InvariantCulture).ToString("yyyyMMdd");
            var    tabl      = ConnectDb.ExecuteDataTableTask(Startup.ConnectionString, "SP_Documents",
                                                              new string[] { "@flag", "@CurrentPage", "@ItemsPerPage", "@Keyword", "@TypeId", "@LevelId", "@FieldId", "@CatId", "@StartDate", "@EndDate" },
                                                              new object[] { str_sql, dto.CurrentPage, dto.ItemsPerPage, dto.Keyword, dto.TypeId, dto.LevelId, dto.FieldId, dto.CatId, StartDate, EndDate });

            if (tabl == null)
            {
                return(new List <Documents>());
            }
            else
            {
                return((from r in tabl.AsEnumerable()
                        select new Documents
                {
                    Id = (int)r["Id"],
                    Title = (string)((r["Title"] == System.DBNull.Value) ? null : r["Title"]),
                    Alias = (string)((r["Alias"] == System.DBNull.Value) ? null : r["Alias"]),
                    Code = (string)((r["Code"] == System.DBNull.Value) ? null : r["Code"]),
                    Link = (string)((r["Link"] == System.DBNull.Value) ? null : r["Link"]),
                    Introtext = (string)((r["Introtext"] == System.DBNull.Value) ? null : r["Introtext"]),
                    Status = (Boolean)r["Status"],
                    IssuedDate = (DateTime)((r["IssuedDate"] == System.DBNull.Value) ? DateTime.Now : r["IssuedDate"]),
                    //EffectiveDate = (DateTime?)((r["EffectiveDate"] == System.DBNull.Value) ? null : r["EffectiveDate"]),
                    IssuedDateShow = (string)((r["IssuedDate"] == System.DBNull.Value) ? DateTime.Now.ToString("dd/MM/yyyy") : (string)((DateTime)r["IssuedDate"]).ToString("dd/MM/yyyy")),
                    EffectiveDateShow = (string)((r["EffectiveDate"] == System.DBNull.Value) ? null : (string)((DateTime)r["EffectiveDate"]).ToString("dd/MM/yyyy")),
                    CatId = (int)r["CatId"],
                    TypeId = (int)r["TypeId"],
                    FieldId = (int)r["FieldId"],
                    LevelId = (int)r["LevelId"],
                    OrganizationName = (string)((r["OrganizationName"] == System.DBNull.Value) ? null : r["OrganizationName"]),
                    Ids = MyModels.Encode((int)r["Id"], SecretId),
                    TotalRows = (int)r["TotalRows"],
                }).ToList());
            }
        }
Пример #2
0
        public static Menus GetItem(decimal Id, string SecretId = null)
        {
            DataTable tabl = ConnectDb.ExecuteDataTableTask(Startup.ConnectionString, "SP_Menus",
                                                            new string[] { "@flag", "@Id" }, new object[] { "GetItem", Id });

            return((from r in tabl.AsEnumerable()
                    select new Menus
            {
                Id = (int)r["Id"],
                Title = (string)r["Title"],
                CatId = (int)r["CatId"],
                StaticId = (int)r["StaticId"],
                Link = (string)((r["Link"] == System.DBNull.Value) ? null : r["Link"]),
                IdCoQuan = (int)((r["IdCoQuan"] == System.DBNull.Value) ? 0 : r["IdCoQuan"]),
                ParentId = (int)r["ParentId"],
                Type = (int)r["Type"],
                ModifiedBy = (int?)((r["ModifiedBy"] == System.DBNull.Value) ? null : r["ModifiedBy"]),
                Status = (Boolean?)((r["Status"] == System.DBNull.Value) ? null : r["Status"]),
                Deleted = (Boolean?)((r["Deleted"] == System.DBNull.Value) ? null : r["Deleted"]),
                ModifiedDate = (DateTime?)((r["ModifiedDate"] == System.DBNull.Value) ? null : r["ModifiedDate"]),
                ArticleId = (int?)((r["ArticleId"] == System.DBNull.Value) ? null : r["ArticleId"]),
                Ordering = (int?)((r["Ordering"] == System.DBNull.Value) ? null : r["Ordering"]),
                Icon = (string)((r["Icon"] == System.DBNull.Value) ? null : r["Icon"]),
                Ids = MyModels.Encode((int)r["Id"], SecretId),
            }).FirstOrDefault());
        }
Пример #3
0
        public static List <USGroups> GetListPagination(SearchUSGroups dto, string SecretId)
        {
            if (dto.CurrentPage <= 0)
            {
                dto.CurrentPage = 1;
            }
            if (dto.ItemsPerPage <= 0)
            {
                dto.ItemsPerPage = 10;
            }
            if (dto.Keyword == null)
            {
                dto.Keyword = "";
            }
            var tabl = ConnectDb.ExecuteDataTableTask(Startup.ConnectionString, "User_Groups",
                                                      new string[] { "@flag", "@Keyword" },
                                                      new object[] { "GetList", dto.Keyword });

            if (tabl == null)
            {
                return(new List <USGroups>());
            }
            else
            {
                return((from r in tabl.AsEnumerable()
                        select new USGroups
                {
                    Id = (int)r["Id"],
                    Title = (string)((r["Title"] == System.DBNull.Value) ? null : r["Title"]),
                    ListMenuId = (string)((r["ListMenuId"] == System.DBNull.Value) ? null : r["ListMenuId"]),
                    Status = (Boolean)((r["Status"] == System.DBNull.Value) ? null : r["Status"]),
                    Ids = MyModels.Encode((int)r["Id"], SecretId),
                }).ToList());
            }
        }
Пример #4
0
        /*
         * public static List<Documents> GetList(Boolean Selected = true)
         * {
         *
         *  DataTable tabl = ConnectDb.ExecuteDataTableTask(Startup.ConnectionString, "SP_Documents",
         *      new string[] { "@flag", "@Selected" }, new object[] { "GetList", Convert.ToDecimal(Selected) });
         *  if (tabl == null)
         *  {
         *      return new List<Documents>();
         *  }
         *  else
         *  {
         *      return (from r in tabl.AsEnumerable()
         *                              select new Documents
         *                              {
         *                                      Id = (int)r["Id"],
         *              Title = (string)((r["Title"] == System.DBNull.Value) ? null : r["Title"]),
         *              Alias = (string)((r["Alias"] == System.DBNull.Value) ? null : r["Alias"]),
         *              Code = (string)((r["Code"] == System.DBNull.Value) ? null : r["Code"]),
         *              Link = (string)((r["Link"] == System.DBNull.Value) ? null : r["Link"]),
         *              Introtext = (string)((r["Introtext"] == System.DBNull.Value) ? null : r["Introtext"]),
         *                                      Status = (Boolean)r["Status"],
         *                                      IssuedDate = (DateTime)((r["IssuedDate"] == System.DBNull.Value) ? DateTime.Now : r["IssuedDate"]),
         *                                      EffectiveDate = (DateTime)((r["EffectiveDate"] == System.DBNull.Value) ? DateTime.Now : r["EffectiveDate"]),
         *              IssuedDateShow = (string)((r["IssuedDate"] == System.DBNull.Value) ? DateTime.Now.ToString("dd/MM/yyyy") : (string)((DateTime)r["IssuedDate"]).ToString("dd/MM/yyyy")),
         *              EffectiveDateShow = (string)((r["EffectiveDate"] == System.DBNull.Value) ? DateTime.Now.ToString("dd/MM/yyyy") : (string)((DateTime)r["EffectiveDate"]).ToString("dd/MM/yyyy")),
         *              CatId = (int)r["CatId"],
         *                                      TypeId = (int)r["TypeId"],
         *              FieldId = (int)r["FieldId"],
         *              LevelId = (int)r["LevelId"],
         *              OrganizationName = (string)((r["OrganizationName"] == System.DBNull.Value) ? null : r["OrganizationName"]),
         *                              }).ToList();
         *  }
         *
         * }*/

        public static Documents GetItem(decimal Id, string SecretId = null)
        {
            DataTable tabl = ConnectDb.ExecuteDataTableTask(Startup.ConnectionString, "SP_Documents",
                                                            new string[] { "@flag", "@Id" }, new object[] { "GetItem", Id });

            return((from r in tabl.AsEnumerable()
                    select new Documents
            {
                Id = (int)r["Id"],
                Title = (string)((r["Title"] == System.DBNull.Value) ? null : r["Title"]),
                Alias = (string)((r["Alias"] == System.DBNull.Value) ? null : r["Alias"]),
                Code = (string)((r["Code"] == System.DBNull.Value) ? null : r["Code"]),
                Link = (string)((r["Link"] == System.DBNull.Value) ? null : r["Link"]),
                Introtext = (string)((r["Introtext"] == System.DBNull.Value) ? null : r["Introtext"]),
                FullText = (string)((r["FullText"] == System.DBNull.Value) ? null : r["FullText"]),
                Status = (Boolean)r["Status"],
                IssuedDate = (DateTime)((r["IssuedDate"] == System.DBNull.Value) ? DateTime.Now : r["IssuedDate"]),
                EffectiveDate = (DateTime?)((r["EffectiveDate"] == System.DBNull.Value) ? null : r["EffectiveDate"]),
                IssuedDateShow = (string)((r["IssuedDate"] == System.DBNull.Value) ? DateTime.Now.ToString("dd/MM/yyyy") : (string)((DateTime)r["IssuedDate"]).ToString("dd/MM/yyyy")),
                EffectiveDateShow = (string)((r["EffectiveDate"] == System.DBNull.Value) ?  null: (string)((DateTime)r["EffectiveDate"]).ToString("dd/MM/yyyy")),
                CatId = (int)r["CatId"],
                TypeId = (int)r["TypeId"],
                FieldId = (int)r["FieldId"],
                LevelId = (int)r["LevelId"],
                OrganizationName = (string)((r["OrganizationName"] == System.DBNull.Value) ? null : r["OrganizationName"]),
                Ids = MyModels.Encode((int)r["Id"], SecretId),
            }).FirstOrDefault());
        }
Пример #5
0
        public static List <DMTinhThanh> GetListPagination(SearchDMTinhThanh dto, string SecretId)
        {
            if (dto.CurrentPage <= 0)
            {
                dto.CurrentPage = 1;
            }
            var tabl = ConnectDb.ExecuteDataTableTask(Startup.ConnectionString, "DanhMuc_TinhThanh",
                                                      new string[] { "@flag", "@CurrentPage", "@ItemsPerPage", "@Keyword" },
                                                      new object[] { "GetListPagination", dto.CurrentPage, dto.ItemsPerPage, dto.Keyword });

            if (tabl == null)
            {
                return(new List <DMTinhThanh>());
            }
            else
            {
                return((from r in tabl.AsEnumerable()
                        select new DMTinhThanh
                {
                    Id = (int?)((r["Id"] == System.DBNull.Value) ? null : r["Id"]),
                    Ten = (string)((r["Ten"] == System.DBNull.Value) ? null : r["Ten"]),
                    Ma = (string)((r["Ma"] == System.DBNull.Value) ? null : r["Ma"]),
                    MoTa = (string)((r["MoTa"] == System.DBNull.Value) ? null : r["MoTa"]),
                    TrangThai = (Boolean?)((r["TrangThai"] == System.DBNull.Value) ? null : r["TrangThai"]),
                    CreatedBy = (int?)((r["CreatedBy"] == System.DBNull.Value) ? null : r["CreatedBy"]),
                    CreatedDate = (DateTime?)((r["CreatedDate"] == System.DBNull.Value) ? null : r["CreatedDate"]),
                    ModifiedBy = (int?)((r["ModifiedBy"] == System.DBNull.Value) ? null : r["ModifiedBy"]),
                    ModifiedDate = (DateTime?)((r["ModifiedDate"] == System.DBNull.Value) ? null : r["ModifiedDate"]),
                    Deleted = (Boolean?)((r["Deleted"] == System.DBNull.Value) ? null : r["Deleted"]),
                    Ids = MyModels.Encode((int)r["Id"], SecretId),
                    TotalRows = (int)r["TotalRows"],
                }).ToList());
            }
        }
Пример #6
0
        public static List <ProductsOrderDetail> GetListPagination(SearchProductsOrderDetail dto, string SecretId)
        {
            var tabl = ConnectDb.ExecuteDataTableTask(Startup.ConnectionString, "SP_ProductsOrderDetail",
                                                      new string[] { "@flag", "@ProductOrderId" },
                                                      new object[] { "GetListByProductsOrderDetailId", dto.ProductOrderId });

            if (tabl == null)
            {
                return(new List <ProductsOrderDetail>());
            }
            else
            {
                return((from r in tabl.AsEnumerable()
                        select new ProductsOrderDetail
                {
                    Id = (int)r["Id"],
                    ProductId = (int)r["ProductId"],
                    Name = (string)((r["Name"] == System.DBNull.Value) ? null : r["Name"]),
                    Price = (decimal)((r["Price"] == System.DBNull.Value) ? 0 : r["Price"]),
                    Quantity = (int)((r["Quantity"] == System.DBNull.Value) ? null : r["Quantity"]),
                    Unit = (string)((r["Unit"] == System.DBNull.Value) ? null : r["Unit"]),
                    Ids = MyModels.Encode((int)r["Id"], SecretId),
                }).ToList());
            }
        }
Пример #7
0
        public static ProductsCategories GetItemByAlias(string Alias, string SecretId = null)
        {
            DataTable tabl = ConnectDb.ExecuteDataTableTask(Startup.ConnectionString, "SP_ProductsCategories",
                                                            new string[] { "@flag", "@Alias" }, new object[] { "GetItemByAlias", Alias });

            return((from r in tabl.AsEnumerable()
                    select new ProductsCategories
            {
                Id = (int)r["Id"],
                Title = (string)((r["Title"] == System.DBNull.Value) ? null : r["Title"]),
                Alias = (string)((r["Alias"] == System.DBNull.Value) ? null : r["Alias"]),
                Description = (string)((r["Description"] == System.DBNull.Value) ? null : r["Description"]),
                ParentId = (int?)((r["ParentId"] == System.DBNull.Value) ? null : r["ParentId"]),
                Status = (Boolean)r["Status"],
                FeaturedHome = (Boolean)((r["FeaturedHome"] == System.DBNull.Value) ? false : r["FeaturedHome"]),
                Metadesc = (string)((r["Metadesc"] == System.DBNull.Value) ? null : r["Metadesc"]),
                Metakey = (string)((r["Metakey"] == System.DBNull.Value) ? null : r["Metakey"]),
                Metadata = (string)((r["Metadata"] == System.DBNull.Value) ? null : r["Metadata"]),
                Images = (string)((r["Images"] == System.DBNull.Value) ? null : r["Images"]),
                Params = (string)((r["Params"] == System.DBNull.Value) ? null : r["Params"]),
                Ordering = (int?)((r["Ordering"] == System.DBNull.Value) ? null : r["Ordering"]),
                Hits = (int?)((r["Hits"] == System.DBNull.Value) ? null : r["Hits"]),
                Ids = MyModels.Encode((int)r["Id"], SecretId),
            }).FirstOrDefault());
        }
Пример #8
0
        public static List <Ablums> GetList(int Id = 0, string SecretId = null)
        {
            DataTable tabl = ConnectDb.ExecuteDataTableTask(Startup.ConnectionString, "SP_Ablums",
                                                            new string[] { "@flag", "@Id" }, new object[] { "GetListAlbums", Id });

            if (tabl == null)
            {
                return(new List <Ablums>());
            }
            else
            {
                return((from r in tabl.AsEnumerable()
                        select new Ablums
                {
                    Id = (int)r["Id"],
                    CatId = (int)r["CatId"],
                    Title = (string)r["Title"],
                    Description = (string)((r["Description"] == System.DBNull.Value) ? null : r["Description"]),
                    Images = (string)r["Images"],
                    Status = (Boolean)r["Status"],
                    LinkImg = (string)r["LinkImg"],
                    Ids = MyModels.Encode((int)r["Id"], SecretId)
                }).ToList());
            }
        }
Пример #9
0
        public static DuAn GetItem(decimal Id, string SecretId = null)
        {
            DataTable tabl = ConnectDb.ExecuteDataTableTask(Startup.ConnectionString, "SP_DuAn",
                                                            new string[] { "@flag", "@Id" }, new object[] { "GetItem", Id });

            return((from r in tabl.AsEnumerable()
                    select new DuAn
            {
                Id = (int)r["Id"],
                Ten = (string)((r["Ten"] == System.DBNull.Value) ? null : r["Ten"]),
                ChuNhiem = (string)((r["ChuNhiem"] == System.DBNull.Value) ? null : r["ChuNhiem"]),
                MucTieu = (string)((r["MucTieu"] == System.DBNull.Value) ? null : r["MucTieu"]),
                LinhVuc = (string)((r["LinhVuc"] == System.DBNull.Value) ? null : r["LinhVuc"]),
                PhuongPhap = (string)((r["PhuongPhap"] == System.DBNull.Value) ? null : r["PhuongPhap"]),
                FileKetQua = (string)((r["FileKetQua"] == System.DBNull.Value) ? null : r["FileKetQua"]),
                ThoiGianBatDau = (DateTime)((r["ThoiGianBatDau"] == System.DBNull.Value) ? DateTime.Now : r["ThoiGianBatDau"]),
                ThoiGianBatDauShow = (string)((r["ThoiGianBatDau"] == System.DBNull.Value) ? DateTime.Now.ToString("dd/MM/yyyy") : (string)((DateTime)r["ThoiGianBatDau"]).ToString("dd/MM/yyyy")),
                ThoiGianKetThuc = (DateTime)((r["ThoiGianKetThuc"] == System.DBNull.Value) ? DateTime.Now : r["ThoiGianKetThuc"]),
                ThoiGianKetThucShow = (string)((r["ThoiGianKetThuc"] == System.DBNull.Value) ? DateTime.Now.ToString("dd/MM/yyyy") : (string)((DateTime)r["ThoiGianKetThuc"]).ToString("dd/MM/yyyy")),
                KetQuaThucHien = (string)((r["KetQuaThucHien"] == System.DBNull.Value) ? null : r["KetQuaThucHien"]),
                KinhPhi = (string)((r["KinhPhi"] == System.DBNull.Value) ? null : r["KinhPhi"]),
                Image = (string)((r["Image"] == System.DBNull.Value) ? null : r["Image"]),
                Loai = (int)r["Loai"],
                TrangThai = (int)r["TrangThai"],
                Status = (Boolean)r["Status"],
                Ids = MyModels.Encode((int)r["Id"], SecretId)
            }).FirstOrDefault());
        }
Пример #10
0
        public static Videos GetItem(decimal Id, string SecretId = null)
        {
            DataTable tabl = ConnectDb.ExecuteDataTableTask(Startup.ConnectionString, "SP_Videos",
                                                            new string[] { "@flag", "@Id" }, new object[] { "GetItem", Id });

            return((from r in tabl.AsEnumerable()
                    select new Videos
            {
                Id = (int)r["Id"],
                Title = (string)((r["Title"] == System.DBNull.Value) ? null : r["Title"]),
                IdType = (int)((r["IdType"] == System.DBNull.Value) ? null : r["IdType"]),
                Description = (string)((r["Description"] == System.DBNull.Value) ? null : r["Description"]),
                Link = (string)((r["Link"] == System.DBNull.Value) ? null : r["Link"]),
                CatId = (int?)((r["CatId"] == System.DBNull.Value) ? null : r["CatId"]),
                Image = (string)((r["Image"] == System.DBNull.Value) ? null : r["Image"]),
                Status = (Boolean)r["Status"],
                Featured = (Boolean)r["Featured"],
                Deleted = (Boolean)r["Deleted"],
                CreatedBy = (int)r["CreatedBy"],
                CreatedDate = (DateTime?)((r["CreatedDate"] == System.DBNull.Value) ? null : r["CreatedDate"]),
                ModifiedBy = (int?)((r["ModifiedBy"] == System.DBNull.Value) ? null : r["ModifiedBy"]),
                ModifiedDate = (DateTime?)((r["ModifiedDate"] == System.DBNull.Value) ? null : r["ModifiedDate"]),
                Ids = MyModels.Encode((int)r["Id"], SecretId),
            }).FirstOrDefault());
        }
Пример #11
0
        public static Contacts GetItem(decimal Id, string SecretId = null)
        {
            DataTable tabl = ConnectDb.ExecuteDataTableTask(Startup.ConnectionString, "SP_Contacts",
                                                            new string[] { "@flag", "@Id" }, new object[] { "GetItem", Id });

            return((from r in tabl.AsEnumerable()
                    select new Contacts
            {
                Id = (int)r["Id"],
                Title = (string)r["Title"],
                Status = (Boolean)r["Status"],
                Fullname = (string)((r["Fullname"] == System.DBNull.Value) ? null : r["Fullname"]),
                Phone = (string)((r["Phone"] == System.DBNull.Value) ? null : r["Phone"]),
                Email = (string)((r["Email"] == System.DBNull.Value) ? null : r["Email"]),
                Address = (string)((r["Address"] == System.DBNull.Value) ? null : r["Address"]),
                Introtext = (string)((r["Introtext"] == System.DBNull.Value) ? null : r["Introtext"]),
                Description = (string)((r["Description"] == System.DBNull.Value) ? null : r["Description"]),
                Deleted = (Boolean)r["Deleted"],
                CreatedBy = (int)r["CreatedBy"],
                CreatedDate = (DateTime)r["CreatedDate"],
                CreatedDateShow = (string)((r["CreatedDate"] == System.DBNull.Value) ? DateTime.Now.ToString("dd/MM/yyyy") : (string)((DateTime)r["CreatedDate"]).ToString("dd/MM/yyyy HH:mm")),
                ModifiedBy = (int?)((r["ModifiedBy"] == System.DBNull.Value) ? null : r["ModifiedBy"]),
                ModifiedDate = (DateTime?)((r["ModifiedDate"] == System.DBNull.Value) ? null : r["ModifiedDate"]),
                Ids = MyModels.Encode((int)r["Id"], SecretId),
                Type = (int)r["Type"],
                EventId = (int)r["EventId"]
            }).FirstOrDefault());
        }
Пример #12
0
        public static List <Products> GetListPagination(SearchProducts dto, string SecretId)
        {
            if (dto.CurrentPage <= 0)
            {
                dto.CurrentPage = 1;
            }
            if (dto.ItemsPerPage <= 0)
            {
                dto.ItemsPerPage = 15;
            }
            if (dto.Keyword == null)
            {
                dto.Keyword = "";
            }
            string  StartDate = DateTime.ParseExact(dto.ShowStartDate, "dd/MM/yyyy", CultureInfo.InvariantCulture).ToString("yyyyMMdd");
            string  EndDate   = DateTime.ParseExact(dto.ShowEndDate, "dd/MM/yyyy", CultureInfo.InvariantCulture).ToString("yyyyMMdd");
            string  str_sql   = "GetListPagination_Status";
            Boolean Status    = true;

            if (dto.Status == -1)
            {
                str_sql = "GetListPagination";
            }
            else if (dto.Status == 0)
            {
                Status = false;
            }
            var tabl = ConnectDb.ExecuteDataTableTask(Startup.ConnectionString, "SP_Products",
                                                      new string[] { "@flag", "@CurrentPage", "@ItemsPerPage", "@Keyword", "@CatId", "@IdCoQuan", "@AuthorId", "@StartDate", "@EndDate", "@CreatedBy", "@Status" },
                                                      new object[] { str_sql, dto.CurrentPage, dto.ItemsPerPage, dto.Keyword, dto.CatId, dto.IdCoQuan, dto.AuthorId, StartDate, EndDate, dto.CreatedBy, Status });

            if (tabl == null)
            {
                return(new List <Products>());
            }
            else
            {
                return((from r in tabl.AsEnumerable()
                        select new Products
                {
                    Id = (int)r["Id"],
                    Title = (string)r["Title"],
                    Alias = (string)((r["Alias"] == System.DBNull.Value) ? null : r["Alias"]),
                    CatId = (int)r["CatId"],
                    Category = (string)((r["Category"] == System.DBNull.Value) ? null : r["Category"]),
                    IntroText = (string)((r["IntroText"] == System.DBNull.Value) ? null : r["IntroText"]),
                    Status = (Boolean)r["Status"],
                    PublishUpShow = (string)((r["PublishUp"] == System.DBNull.Value) ? DateTime.Now.ToString("dd/MM/yyyy") : (string)((DateTime)r["PublishUp"]).ToString("dd/MM/yyyy")),
                    Featured = (Boolean)((r["Featured"] == System.DBNull.Value) ? null : r["Featured"]),
                    FeaturedHome = (Boolean)((r["FeaturedHome"] == System.DBNull.Value) ? null : r["FeaturedHome"]),
                    Images = (string)((r["Images"] == System.DBNull.Value) ? null : r["Images"]),
                    Ordering = (int?)((r["Ordering"] == System.DBNull.Value) ? null : r["Ordering"]),
                    Deleted = (Boolean)((r["Deleted"] == System.DBNull.Value) ? null : r["Deleted"]),
                    Price = (Decimal?)((r["Price"] == System.DBNull.Value) ?null : r["Price"]),
                    Ids = MyModels.Encode((int)r["Id"], SecretId)
                }).ToList());
            }
        }
Пример #13
0
        public static List <DuAn> GetListPaginationFront(SearchDuAn dto, string SecretId)
        {
            if (dto.CurrentPage <= 0)
            {
                dto.CurrentPage = 1;
            }
            if (dto.ItemsPerPage <= 0)
            {
                dto.ItemsPerPage = 10;
            }
            if (dto.Keyword == null)
            {
                dto.Keyword = "";
            }

            string str_sql = "GetListPagination_Status";

            string StartDate = DateTime.ParseExact(dto.ShowStartDate, "dd/MM/yyyy", CultureInfo.InvariantCulture).ToString("yyyyMMdd");
            string EndDate   = DateTime.ParseExact(dto.ShowEndDate, "dd/MM/yyyy", CultureInfo.InvariantCulture).ToString("yyyyMMdd");
            var    tabl      = ConnectDb.ExecuteDataTableTask(Startup.ConnectionString, "SP_DuAn",
                                                              new string[] { "@flag", "@CurrentPage", "@ItemsPerPage", "@Keyword", "@TrangThai", "@Loai", "@StatusSearch", "@StartDate", "@EndDate" },
                                                              new object[] { str_sql, dto.CurrentPage, dto.ItemsPerPage, dto.Keyword, dto.TrangThai, dto.Loai, dto.Status, StartDate, EndDate });

            if (tabl == null)
            {
                return(new List <DuAn>());
            }
            else
            {
                return((from r in tabl.AsEnumerable()
                        select new DuAn
                {
                    Id = (int)r["Id"],
                    Ten = (string)((r["Ten"] == System.DBNull.Value) ? null : r["Ten"]),
                    ChuNhiem = (string)((r["ChuNhiem"] == System.DBNull.Value) ? null : r["ChuNhiem"]),
                    MucTieu = (string)((r["MucTieu"] == System.DBNull.Value) ? null : r["MucTieu"]),
                    LinhVuc = (string)((r["LinhVuc"] == System.DBNull.Value) ? null : r["LinhVuc"]),
                    PhuongPhap = (string)((r["PhuongPhap"] == System.DBNull.Value) ? null : r["PhuongPhap"]),
                    FileKetQua = (string)((r["FileKetQua"] == System.DBNull.Value) ? null : r["FileKetQua"]),
                    ThoiGianBatDau = (DateTime)((r["ThoiGianBatDau"] == System.DBNull.Value) ? DateTime.Now : r["ThoiGianBatDau"]),
                    ThoiGianKetThuc = (DateTime)((r["ThoiGianKetThuc"] == System.DBNull.Value) ? DateTime.Now : r["ThoiGianKetThuc"]),
                    KetQuaThucHien = (string)((r["KetQuaThucHien"] == System.DBNull.Value) ? null : r["KetQuaThucHien"]),
                    KinhPhi = (string)((r["KinhPhi"] == System.DBNull.Value) ? null : r["KinhPhi"]),
                    Image = (string)((r["Image"] == System.DBNull.Value) ? null : r["Image"]),
                    Loai = (int)r["Loai"],
                    TrangThai = (int)r["TrangThai"],
                    Status = (Boolean)r["Status"],
                    Ids = MyModels.Encode((int)r["Id"], SecretId),
                    TotalRows = (int)r["TotalRows"]
                }).ToList());
            }
        }
Пример #14
0
        public static Products GetItem(decimal Id, string SecretId = null)
        {
            DataTable tabl = ConnectDb.ExecuteDataTableTask(Startup.ConnectionString, "SP_Products",
                                                            new string[] { "@flag", "@Id" }, new object[] { "GetItem", Id });
            Products Item = (from r in tabl.AsEnumerable()
                             select new Products
            {
                Id = (int)r["Id"],
                Title = (string)r["Title"],
                Str_ListFile = (string)((r["Str_ListFile"] == System.DBNull.Value) ? null : r["Str_ListFile"]),
                Str_Link = (string)((r["Str_Link"] == System.DBNull.Value) ? null : r["Str_Link"]),
                Alias = (string)((r["Alias"] == System.DBNull.Value) ? null : r["Alias"]),
                CatId = (int)r["CatId"],
                IntroText = (string)((r["IntroText"] == System.DBNull.Value) ? null : r["IntroText"]),
                FullText = (string)((r["FullText"] == System.DBNull.Value) ? null : r["FullText"]),
                Status = (Boolean)r["Status"],
                CreatedBy = (int?)((r["CreatedBy"] == System.DBNull.Value) ? null : r["CreatedBy"]),
                ModifiedBy = (int?)((r["ModifiedBy"] == System.DBNull.Value) ? null : r["ModifiedBy"]),
                CreatedDate = (DateTime?)((r["CreatedDate"] == System.DBNull.Value) ? null : r["CreatedDate"]),
                PublishUp = (DateTime)((r["PublishUp"] == System.DBNull.Value) ? null : r["PublishUp"]),
                PublishUpShow = (string)((r["PublishUp"] == System.DBNull.Value) ? DateTime.Now.ToString("dd/MM/yyyy") : (string)((DateTime)r["PublishUp"]).ToString("dd/MM/yyyy")),
                ModifiedDate = (DateTime?)((r["ModifiedDate"] == System.DBNull.Value) ? null : r["ModifiedDate"]),
                Metadesc = (string)((r["Metadesc"] == System.DBNull.Value) ? null : r["Metadesc"]),
                Metakey = (string)((r["Metakey"] == System.DBNull.Value) ? null : r["Metakey"]),
                Metadata = (string)((r["Metadata"] == System.DBNull.Value) ? null : r["Metadata"]),
                Language = (string)((r["Language"] == System.DBNull.Value) ? null : r["Language"]),
                Featured = (Boolean)((r["Featured"] == System.DBNull.Value) ? null : r["Featured"]),
                Notification = (Boolean)((r["Notification"] == System.DBNull.Value) ? null : r["Notification"]),
                StaticPage = (Boolean)((r["StaticPage"] == System.DBNull.Value) ? null : r["StaticPage"]),
                Images = (string)((r["Images"] == System.DBNull.Value) ? null : r["Images"]),
                Params = (string)((r["Params"] == System.DBNull.Value) ? null : r["Params"]),
                Ordering = (int?)((r["Ordering"] == System.DBNull.Value) ? null : r["Ordering"]),
                Deleted = (Boolean)((r["Deleted"] == System.DBNull.Value) ? null : r["Deleted"]),
                IdCoQuan = (int)((r["IdCoQuan"] == System.DBNull.Value) ? 0 : r["IdCoQuan"]),
                AuthorId = (int)((r["AuthorId"] == System.DBNull.Value) ? 0 : r["AuthorId"]),
                Ids = MyModels.Encode((int)r["Id"], SecretId),
                Hit = (int)((r["Hit"] == System.DBNull.Value) ? 0 : r["Hit"]),
                Price = (Decimal?)((r["Price"] == System.DBNull.Value) ?null : r["Price"]),
            }).FirstOrDefault();

            if (Item.Str_ListFile != null && Item.Str_ListFile != "")
            {
                Item.ListFile = JsonConvert.DeserializeObject <List <FileArticle> >(Item.Str_ListFile);
            }
            if (Item.Str_Link != null && Item.Str_Link != "")
            {
                Item.ListLinkArticle = JsonConvert.DeserializeObject <List <LinkArticle> >(Item.Str_Link);
            }
            return(Item);
        }
Пример #15
0
        public static BannersCategories GetItem(decimal Id, string SecretId = null)
        {
            DataTable tabl = ConnectDb.ExecuteDataTableTask(Startup.ConnectionString, "SP_BannersCategories",
                                                            new string[] { "@flag", "@Id" }, new object[] { "GetItem", Id });

            return((from r in tabl.AsEnumerable()
                    select new BannersCategories
            {
                Id = (int)r["Id"],
                Title = (string)((r["Title"] == System.DBNull.Value) ? null : r["Title"]),
                Description = (string)((r["Description"] == System.DBNull.Value) ? null : r["Description"]),
                Status = (Boolean)((r["Status"] == System.DBNull.Value) ? null : r["Status"]),
                Ids = MyModels.Encode((int)r["Id"], SecretId),
            }).FirstOrDefault());
        }
Пример #16
0
        public static DMChucVu GetItem(int Id, string SecretId = null)
        {
            DataTable tabl = ConnectDb.ExecuteDataTableTask(Startup.ConnectionString, "DanhMuc_ChucVu",
                                                            new string[] { "@flag", "@Id" }, new object[] { "GetItem", Id });

            return((from r in tabl.AsEnumerable()
                    select new DMChucVu
            {
                Id = (int)r["Id"],
                Title = (string)r["Title"],
                Status = (bool)r["Status"],
                Description = (string)((r["Description"] == System.DBNull.Value) ? "" : r["Description"]),
                Leader = (bool)r["Leader"],
                Ids = MyModels.Encode((int)r["Id"], SecretId),
            }).FirstOrDefault());
        }
Пример #17
0
        public static DMLoaiCoQuan GetItem(int Id, string SecretId = null)
        {
            DataTable tabl = ConnectDb.ExecuteDataTableTask(Startup.ConnectionString, "DanhMuc_LoaiCoQuan",
                                                            new string[] { "@flag", "@Id" }, new object[] { "GetItem", Id });

            return((from r in tabl.AsEnumerable()
                    select new DMLoaiCoQuan
            {
                Id = (int)r["Id"],
                Title = (string)((r["Title"] == System.DBNull.Value) ? null : r["Title"]),
                Code = (string)((r["Code"] == System.DBNull.Value) ? null : r["Code"]),
                Description = (string)((r["Description"] == System.DBNull.Value) ? null : r["Description"]),
                Status = (Boolean)((r["Status"] == System.DBNull.Value) ? null : r["Status"]),
                Ids = MyModels.Encode((int)r["Id"], SecretId),
            }).FirstOrDefault());
        }
Пример #18
0
        public static ProductsOrderDetail GetItem(decimal Id, string SecretId = null)
        {
            DataTable tabl = ConnectDb.ExecuteDataTableTask(Startup.ConnectionString, "SP_ProductsOrderDetail",
                                                            new string[] { "@flag", "@Id" }, new object[] { "GetItem", Id });

            return((from r in tabl.AsEnumerable()
                    select new ProductsOrderDetail
            {
                Id = (int)r["Id"],
                ProductId = (int)r["ProductId"],
                Name = (string)((r["Name"] == System.DBNull.Value) ? null : r["Name"]),
                Price = (decimal)((r["Price"] == System.DBNull.Value) ? 0 : r["Price"]),
                Quantity = (int)((r["Quantity"] == System.DBNull.Value) ? null : r["Quantity"]),
                Unit = (string)((r["Unit"] == System.DBNull.Value) ? null : r["Unit"]),
                Ids = MyModels.Encode((int)r["Id"], SecretId),
            }).FirstOrDefault());
        }
Пример #19
0
        public const string SecretXSRF = "7f71f3acb09cf48e22b99c0b694c238ddschangkho"; // your symmetric

        public static List <USUsers> GetListPagination(SearchUSUsers dto, string SecretId)
        {
            if (dto.CurrentPage <= 0)
            {
                dto.CurrentPage = 1;
            }
            if (dto.ItemsPerPage <= 0)
            {
                dto.ItemsPerPage = 10;
            }
            if (dto.Keyword == null)
            {
                dto.Keyword = "";
            }
            var tabl = ConnectDb.ExecuteDataTableTask(Startup.ConnectionString, "user_users",
                                                      new string[] { "@flag", "@CurrentPage", "@ItemsPerPage", "@Keyword" },
                                                      new object[] { "GetListPagination", dto.CurrentPage, dto.ItemsPerPage, dto.Keyword });

            if (tabl == null)
            {
                return(new List <USUsers>());
            }
            else
            {
                return((from r in tabl.AsEnumerable()
                        select new USUsers
                {
                    Id = (int)r["Id"],
                    UserName = (string)r["UserName"],
                    Status = (byte)r["Status"],
                    Gender = (byte)r["Gender"],
                    Telephone = (string)((r["Telephone"] == System.DBNull.Value) ? "" : r["Telephone"]),
                    Specialize = (string)((r["Specialize"] == System.DBNull.Value) ? "" : r["Specialize"]),
                    FullName = (string)((r["FullName"] == System.DBNull.Value) ? "" : r["FullName"]),
                    GroupsTitle = (string)((r["GroupsTitle"] == System.DBNull.Value) ? "" : r["GroupsTitle"]),
                    Email = (string)((r["Email"] == System.DBNull.Value) ? "" : r["Email"]),
                    Ids = MyModels.Encode((int)r["Id"], SecretId),
                    TotalRows = (int)r["TotalRows"],
                    IdCoQuan = (int)r["IdCoQuan"],
                    IdRegency = (int)((r["IdRegency"] == System.DBNull.Value) ? 0 : r["IdRegency"]),
                    TenChucVu = (string)((r["TenChucVu"] == System.DBNull.Value) ? "" : r["TenChucVu"]),
                    TenCoQuan = (string)((r["TenCoQuan"] == System.DBNull.Value) ? "" : r["TenCoQuan"]),
                }).ToList());
            }
        }
Пример #20
0
        public static DMPhuongXa GetItem(decimal Id, string SecretId = null)
        {
            DataTable tabl = ConnectDb.ExecuteDataTableTask(Startup.ConnectionString, "danhmuc_phuongxa",
                                                            new string[] { "@flag", "@Id" }, new object[] { "GetItem", Id });

            return((from r in tabl.AsEnumerable()
                    select new DMPhuongXa
            {
                Id = (int)r["Id"],
                Ten = (string)r["Ten"],
                TrangThai = (bool)r["TrangThai"],
                MoTa = (string)((r["MoTa"] == System.DBNull.Value) ? "" : r["MoTa"]),
                Ma = (string)((r["Ma"] == System.DBNull.Value) ? "" : r["Ma"]),
                MaQuanHuyen = (string)((r["MaQuanHuyen"] == System.DBNull.Value) ? "" : r["MaQuanHuyen"]),
                IdQuanHuyen = (int)r["IdQuanHuyen"],
                Ids = MyModels.Encode((int)r["Id"], SecretId),
            }).FirstOrDefault());
        }
Пример #21
0
        public static ProductsOrder GetItem(decimal Id, string SecretId = null)
        {
            DataTable tabl = ConnectDb.ExecuteDataTableTask(Startup.ConnectionString, "SP_ProductsOrder",
                                                            new string[] { "@flag", "@Id" }, new object[] { "GetItem", Id });

            return((from r in tabl.AsEnumerable()
                    select new ProductsOrder
            {
                Id = (int)r["Id"],
                Name = (string)((r["Name"] == System.DBNull.Value) ? null : r["Name"]),
                Phone = (string)((r["Phone"] == System.DBNull.Value) ? null : r["Phone"]),
                Email = (string)((r["Email"] == System.DBNull.Value) ? null : r["Email"]),
                Address = (string)((r["Address"] == System.DBNull.Value) ? null : r["Address"]),
                Description = (string)((r["Description"] == System.DBNull.Value) ? null : r["Description"]),
                CreatedDate = (DateTime)((r["CreatedDate"] == System.DBNull.Value) ? null : r["CreatedDate"]),
                Status = (int)r["Status"],
                Ids = MyModels.Encode((int)r["Id"], SecretId)
            }).FirstOrDefault());
        }
Пример #22
0
        public static List <ProductsCategories> GetListPagination(SearchProductsCategories dto, string SecretId)
        {
            if (dto.CurrentPage <= 0)
            {
                dto.CurrentPage = 1;
            }
            if (dto.ItemsPerPage <= 0)
            {
                dto.ItemsPerPage = 10;
            }
            if (dto.Keyword == null)
            {
                dto.Keyword = "";
            }
            var tabl = ConnectDb.ExecuteDataTableTask(Startup.ConnectionString, "SP_ProductsCategories",
                                                      new string[] { "@flag", "@CurrentPage", "@ItemsPerPage", "@Keyword" },
                                                      new object[] { "GetListPagination", dto.CurrentPage, dto.ItemsPerPage, dto.Keyword });

            if (tabl == null)
            {
                return(new List <ProductsCategories>());
            }
            else
            {
                return((from r in tabl.AsEnumerable()
                        select new ProductsCategories
                {
                    Id = (int)r["Id"],
                    Title = (string)((r["Title"] == System.DBNull.Value) ? null : r["Title"]),
                    Alias = (string)((r["Alias"] == System.DBNull.Value) ? null : r["Alias"]),
                    ParentId = (int?)((r["ParentId"] == System.DBNull.Value) ? null : r["ParentId"]),
                    Status = (Boolean)r["Status"],
                    NoDelete = (Boolean)r["NoDelete"],
                    Level = (int?)((r["alevel"] == System.DBNull.Value) ? null : r["alevel"]),
                    FeaturedHome = (Boolean)((r["FeaturedHome"] == System.DBNull.Value) ? false : r["FeaturedHome"]),
                    Hits = (int?)((r["Hits"] == System.DBNull.Value) ? null : r["Hits"]),
                    Images = (string)((r["Images"] == System.DBNull.Value) ? null : r["Images"]),
                    Params = (string)((r["Params"] == System.DBNull.Value) ? null : r["Params"]),
                    Ordering = (int?)((r["Ordering"] == System.DBNull.Value) ? null : r["Ordering"]),
                    Ids = MyModels.Encode((int)r["Id"], SecretId),
                }).ToList());
            }
        }
Пример #23
0
        public static List <Banners> GetListPagination(SearchBanners dto, string SecretId)
        {
            if (dto.CurrentPage <= 0)
            {
                dto.CurrentPage = 1;
            }
            if (dto.ItemsPerPage <= 0)
            {
                dto.ItemsPerPage = 10;
            }
            if (dto.Keyword == null)
            {
                dto.Keyword = "";
            }
            var tabl = ConnectDb.ExecuteDataTableTask(Startup.ConnectionString, "SP_Banners",
                                                      new string[] { "@flag", "@CurrentPage", "@ItemsPerPage", "@Keyword", "@CatId", "@IdCoQuan" },
                                                      new object[] { "GetListPagination", dto.CurrentPage, dto.ItemsPerPage, dto.Keyword, dto.CatId, dto.IdCoQuan });

            if (tabl == null)
            {
                return(new List <Banners>());
            }
            else
            {
                return((from r in tabl.AsEnumerable()
                        select new Banners
                {
                    Id = (int)r["Id"],
                    Title = (string)((r["Title"] == System.DBNull.Value) ? null : r["Title"]),
                    Description = (string)((r["Description"] == System.DBNull.Value) ? null : r["Description"]),
                    TenCoQuan = (string)((r["TenCoQuan"] == System.DBNull.Value) ? null : r["TenCoQuan"]),
                    IdCoQuan = (int)((r["IdCoQuan"] == System.DBNull.Value) ? null : r["IdCoQuan"]),
                    CategoriesTitle = (string)((r["CategoriesTitle"] == System.DBNull.Value) ? null : r["CategoriesTitle"]),
                    Status = (Boolean)((r["Status"] == System.DBNull.Value) ? null : r["Status"]),
                    Link = (string)((r["Link"] == System.DBNull.Value) ? null : r["Link"]),
                    SortOrder = (int)r["SortOrder"],
                    CatId = (int)((r["CatId"] == System.DBNull.Value) ? null : r["CatId"]),
                    Target = (string)((r["Target"] == System.DBNull.Value) ? null : r["Target"]),
                    Image = (string)((r["Image"] == System.DBNull.Value) ? null : r["Image"]),
                    Ids = MyModels.Encode((int)r["Id"], SecretId),
                }).ToList());
            }
        }
Пример #24
0
        public static List <Menus> GetListPagination(SearchMenus dto, string SecretId)
        {
            if (dto.CurrentPage <= 0)
            {
                dto.CurrentPage = 1;
            }
            if (dto.ItemsPerPage <= 0)
            {
                dto.ItemsPerPage = 10;
            }
            if (dto.Keyword == null)
            {
                dto.Keyword = "";
            }
            var tabl = ConnectDb.ExecuteDataTableTask(Startup.ConnectionString, "SP_Menus",
                                                      new string[] { "@flag", "@CurrentPage", "@ItemsPerPage", "@Keyword", "@IdCoQuan" },
                                                      new object[] { "GetListPagination", dto.CurrentPage, dto.ItemsPerPage, dto.Keyword, dto.IdCoQuan });

            if (tabl == null)
            {
                return(new List <Menus>());
            }
            else
            {
                return((from r in tabl.AsEnumerable()
                        select new Menus
                {
                    Id = (int)r["Id"],
                    Title = (string)r["Title"],
                    CatId = (int)r["CatId"],
                    StaticId = (int)r["StaticId"],
                    Link = (string)((r["Link"] == System.DBNull.Value) ? null : r["Link"]),
                    IdCoQuan = (int)((r["IdCoQuan"] == System.DBNull.Value) ? 0 : r["IdCoQuan"]),
                    TenCoQuan = (string)((r["TenCoQuan"] == System.DBNull.Value) ? 0 : r["TenCoQuan"]),
                    ParentId = (int)r["ParentId"],
                    Type = (int)r["Type"],
                    Status = (Boolean?)((r["Status"] == System.DBNull.Value) ? null : r["Status"]),
                    Ordering = (int?)((r["Ordering"] == System.DBNull.Value) ? null : r["Ordering"]),
                    Icon = (string)((r["Icon"] == System.DBNull.Value) ? null : r["Icon"]),
                    Ids = MyModels.Encode((int)r["Id"], SecretId),
                }).ToList());
            }
        }
Пример #25
0
        public static List <Reviews> GetListPagination(SearchReviews dto, string SecretId)
        {
            if (dto.CurrentPage <= 0)
            {
                dto.CurrentPage = 1;
            }
            if (dto.ItemsPerPage <= 0)
            {
                dto.ItemsPerPage = 10;
            }
            if (dto.Keyword == null)
            {
                dto.Keyword = "";
            }
            var tabl = ConnectDb.ExecuteDataTableTask(Startup.ConnectionString, "SP_Reviews",
                                                      new string[] { "@flag", "@CurrentPage", "@ItemsPerPage", "@Keyword" },
                                                      new object[] { "GetListPagination", dto.CurrentPage, dto.ItemsPerPage, dto.Keyword });

            if (tabl == null)
            {
                return(new List <Reviews>());
            }
            else
            {
                return((from r in tabl.AsEnumerable()
                        select new Reviews
                {
                    Id = (int)r["Id"],
                    Title = (string)((r["Title"] == System.DBNull.Value) ? null : r["Title"]),
                    FullName = (string)((r["FullName"] == System.DBNull.Value) ? null : r["FullName"]),
                    Description = (string)((r["Description"] == System.DBNull.Value) ? null : r["Description"]),
                    ReviewDate = (DateTime)((r["ReviewDate"] == System.DBNull.Value) ? null : r["ReviewDate"]),
                    Featured = (Boolean)((r["Featured"] == System.DBNull.Value) ? 0 : r["Featured"]),
                    Status = (Boolean)((r["Status"] == System.DBNull.Value) ? null : r["Status"]),
                    Introtext = (string)((r["Introtext"] == System.DBNull.Value) ? null : r["Introtext"]),
                    Start = (int)r["Start"],
                    Image = (string)((r["Image"] == System.DBNull.Value) ? null : r["Image"]),
                    Ids = MyModels.Encode((int)r["Id"], SecretId),
                    DisplayOder = (int)r["DisplayOder"]
                }).ToList());
            }
        }
Пример #26
0
        public static NewsLetter GetItem(decimal Id, string SecretId = null)
        {
            DataTable tabl = ConnectDb.ExecuteDataTableTask(Startup.ConnectionString, "SP_NewsLetter",
                                                            new string[] { "@flag", "@Id" }, new object[] { "GetItem", Id });

            return((from r in tabl.AsEnumerable()
                    select new NewsLetter
            {
                Id = (int)r["Id"],
                Title = (string)r["Title"],
                Status = (Boolean)r["Status"],
                Email = (string)((r["Email"] == System.DBNull.Value) ? null : r["Email"]),
                Deleted = (Boolean)r["Deleted"],
                CreatedBy = (int)r["CreatedBy"],
                CreatedDate = (DateTime)r["CreatedDate"],
                ModifiedBy = (int?)((r["ModifiedBy"] == System.DBNull.Value) ? null : r["ModifiedBy"]),
                ModifiedDate = (DateTime?)((r["ModifiedDate"] == System.DBNull.Value) ? null : r["ModifiedDate"]),
                Ids = MyModels.Encode((int)r["Id"], SecretId),
            }).FirstOrDefault());
        }
Пример #27
0
        public static Events GetItem(decimal Id, string SecretId = null)
        {
            DataTable tabl = ConnectDb.ExecuteDataTableTask(Startup.ConnectionString, "SP_Events",
                                                            new string[] { "@flag", "@Id" }, new object[] { "GetItem", Id });

            return((from r in tabl.AsEnumerable()
                    select new Events
            {
                Id = (int)r["Id"],
                Title = (string)((r["Title"] == System.DBNull.Value) ? null : r["Title"]),
                Description = (string)((r["Description"] == System.DBNull.Value) ? null : r["Description"]),
                Status = (Boolean)((r["Status"] == System.DBNull.Value) ? null : r["Status"]),
                SortOrder = (int)r["SortOrder"],
                Image = (string)((r["Image"] == System.DBNull.Value) ? null : r["Image"]),
                Ids = MyModels.Encode((int)r["Id"], SecretId),
                DateExpired = (DateTime)r["DateExpired"],
                DateExpiredShow = (string)((DateTime)r["DateExpired"]).ToString("dd/MM/yyyy"),
                NumberRegist = (int)r["NumberRegist"],
            }).FirstOrDefault());
        }
Пример #28
0
        public static List <DMPhuongXa> GetListPagination(SearchDMPhuongXa dto, string SecretId)
        {
            if (dto.CurrentPage <= 0)
            {
                dto.CurrentPage = 1;
            }
            if (dto.ItemsPerPage <= 0)
            {
                dto.ItemsPerPage = 10;
            }
            if (dto.Keyword == null)
            {
                dto.Keyword = "";
            }
            var tabl = ConnectDb.ExecuteDataTableTask(Startup.ConnectionString, "danhmuc_phuongxa",
                                                      new string[] { "@flag", "@CurrentPage", "@ItemsPerPage", "@Keyword", "@IdQuanHuyen", "@IdTinhThanh" },
                                                      new object[] { "GetListPagination", dto.CurrentPage, dto.ItemsPerPage, dto.Keyword, dto.IdQuanHuyen, dto.IdTinhThanh });

            if (tabl == null)
            {
                return(new List <DMPhuongXa>());
            }
            else
            {
                return((from r in tabl.AsEnumerable()
                        select new DMPhuongXa
                {
                    Id = (int)r["Id"],
                    Ten = (string)r["Ten"],
                    Ma = (string)((r["Ma"] == System.DBNull.Value) ? "" : r["Ma"]),
                    TrangThai = (bool)r["TrangThai"],
                    MoTa = (string)((r["MoTa"] == System.DBNull.Value) ? "" : r["MoTa"]),
                    MaQuanHuyen = (string)((r["MaQuanHuyen"] == System.DBNull.Value) ? "" : r["MaQuanHuyen"]),
                    TenQuanHuyen = (string)((r["TenQuanHuyen"] == System.DBNull.Value) ? "" : r["TenQuanHuyen"]),
                    TenTinhThanh = (string)((r["TenTinhThanh"] == System.DBNull.Value) ? "" : r["TenTinhThanh"]),
                    IdQuanHuyen = (int)r["IdQuanHuyen"],
                    Ids = MyModels.Encode((int)r["Id"], SecretId),
                    TotalRows = (int)r["TotalRows"],
                }).ToList());
            }
        }
Пример #29
0
        public static List <Videos> GetListPagination(SearchVideos dto, string SecretId)
        {
            if (dto.CurrentPage <= 0)
            {
                dto.CurrentPage = 1;
            }
            if (dto.ItemsPerPage <= 0)
            {
                dto.ItemsPerPage = 10;
            }
            if (dto.Keyword == null)
            {
                dto.Keyword = "";
            }
            var tabl = ConnectDb.ExecuteDataTableTask(Startup.ConnectionString, "SP_Videos",
                                                      new string[] { "@flag", "@CurrentPage", "@ItemsPerPage", "@Keyword" },
                                                      new object[] { "GetListPagination", dto.CurrentPage, dto.ItemsPerPage, dto.Keyword });

            if (tabl == null)
            {
                return(new List <Videos>());
            }
            else
            {
                return((from r in tabl.AsEnumerable()
                        select new Videos
                {
                    Id = (int)r["Id"],
                    Title = (string)((r["Title"] == System.DBNull.Value) ? null : r["Title"]),
                    IdType = (int)((r["IdType"] == System.DBNull.Value) ? null : r["IdType"]),
                    Description = (string)((r["Description"] == System.DBNull.Value) ? null : r["Description"]),
                    Link = (string)((r["Link"] == System.DBNull.Value) ? null : r["Link"]),
                    CatId = (int?)((r["CatId"] == System.DBNull.Value) ? null : r["CatId"]),
                    Image = (string)((r["Image"] == System.DBNull.Value) ? null : r["Image"]),
                    Status = (Boolean)r["Status"],
                    Featured = (Boolean)r["Featured"],
                    Ids = MyModels.Encode((int)r["Id"], SecretId),
                    TotalRows = (int)r["TotalRows"],
                }).ToList());
            }
        }
Пример #30
0
        public static List <Contacts> GetListPagination(SearchContacts dto, string SecretId)
        {
            if (dto.CurrentPage <= 0)
            {
                dto.CurrentPage = 1;
            }
            if (dto.ItemsPerPage <= 0)
            {
                dto.ItemsPerPage = 10;
            }
            if (dto.Keyword == null)
            {
                dto.Keyword = "";
            }
            var tabl = ConnectDb.ExecuteDataTableTask(Startup.ConnectionString, "SP_Contacts",
                                                      new string[] { "@flag", "@CurrentPage", "@ItemsPerPage", "@Keyword", "@Type" },
                                                      new object[] { "GetListPagination", dto.CurrentPage, dto.ItemsPerPage, dto.Keyword, dto.Type });

            if (tabl == null)
            {
                return(new List <Contacts>());
            }
            else
            {
                return((from r in tabl.AsEnumerable()
                        select new Contacts
                {
                    Id = (int)r["Id"],
                    Title = (string)r["Title"],
                    Status = (Boolean)r["Status"],
                    Fullname = (string)((r["Fullname"] == System.DBNull.Value) ? null : r["Fullname"]),
                    Phone = (string)((r["Phone"] == System.DBNull.Value) ? null : r["Phone"]),
                    Email = (string)((r["Email"] == System.DBNull.Value) ? null : r["Email"]),
                    Introtext = (string)((r["Introtext"] == System.DBNull.Value) ? null : r["Introtext"]),
                    Description = (string)((r["Description"] == System.DBNull.Value) ? null : r["Description"]),
                    Address = (string)((r["Address"] == System.DBNull.Value) ? null : r["Address"]),
                    Ids = MyModels.Encode((int)r["Id"], SecretId),
                    TotalRows = (int)r["TotalRows"],
                }).ToList());
            }
        }