public static List <Events> GetList(Boolean Selected = true) { DataTable tabl = ConnectDb.ExecuteDataTableTask(Startup.ConnectionString, "SP_Events", new string[] { "@flag", "@Selected" }, new object[] { "GetList", Convert.ToDecimal(Selected) }); if (tabl == null) { return(new List <Events>()); } else { 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"]), TotalRows = (int)r["TotalRows"], DateExpired = (DateTime)r["DateExpired"], DateExpiredShow = (string)((DateTime)r["DateExpired"]).ToString("dd/MM/yyyy") }).ToList()); } }
public void LayCauHinh() { byte[] key = Blowfish.GetBytes(this.str123).Clone() as byte[]; Blowfish blowfish = new Blowfish(key); StringReader reader = new StringReader(blowfish.ReadFromFile(Application.StartupPath + @"\Config.tps")); this._dsKetNoi = new DataSet(); this._dsKetNoi.ReadXml(reader); if (this._dsKetNoi.Tables[0].Rows.Count < 1) { throw new Exception("File cấu hình không có kết nối nào"); } ReadXML xml = new ReadXML(); xml.db_name = Convert.ToString(_dsKetNoi.Tables["KetNoi"].Rows[0]["DBName"]); xml.db_server = Convert.ToString(_dsKetNoi.Tables["KetNoi"].Rows[0]["ServerName"]); xml.db_username = Convert.ToString(_dsKetNoi.Tables["KetNoi"].Rows[0]["UserName"]); xml.db_password = Convert.ToString(_dsKetNoi.Tables["KetNoi"].Rows[0]["Password"]); ConnectDb.Connect(xml.db_server, xml.db_name, xml.db_username, xml.db_password); txtDBname.Caption += xml.db_server + " - " + xml.db_name; try { reader.Close(); } catch { } }
public List <DANH_MUC_TIEN_ICH> getDetailTienIch(int id) { c = new ConnectDb(); List <DANH_MUC_TIEN_ICH> list = new List <DANH_MUC_TIEN_ICH>(); SqlCommand cmd = new SqlCommand("getAllTienIch", c.conn); cmd.CommandType = CommandType.StoredProcedure; rdr = cmd.ExecuteReader(); while (rdr.Read()) { if (id == (int)rdr["ID"]) { DANH_MUC_TIEN_ICH item = new DANH_MUC_TIEN_ICH(); item.ID = (int)rdr["ID"]; item.MADV = (string)rdr["MADV"]; item.TENDV = (string)rdr["TENDV"]; item.MOTA = (string)rdr["MOTA"]; item.URL = (string)rdr["URL"]; item.NGAYTAO = (DateTime)rdr["NGAYTAO"]; list.Add(item); } } return(list); }
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()); } }
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()); }
public List <SU_KIEN> getAllSuKien1(int id) { connectdb = new ConnectDb(); List <SU_KIEN> list = new List <SU_KIEN>(); SqlCommand cmd = new SqlCommand("getAllSuKien", connectdb.conn); cmd.CommandType = CommandType.StoredProcedure; sdr = cmd.ExecuteReader(); while (sdr.Read()) { SU_KIEN item_sukien = new SU_KIEN(); if (id == (int)sdr["MASUKIEN"]) { item_sukien.MASUKIEN = (int)sdr["MASUKIEN"]; item_sukien.TIEUDESUKIEN = (string)sdr["TIEUDESUKIEN"]; item_sukien.NOIDUNGSUKIEN = (string)sdr["NOIDUNGSUKIEN"]; item_sukien.URLANH = (string)sdr["URLANH"]; item_sukien.NGAYTAO = (DateTime)sdr["NGAYTAO"]; item_sukien.NGUOITAO = (string)sdr["NGUOITAO"]; list.Add(item_sukien); } } return(list); }
public static List <Banners> GetListByCat(int CatId, int IdCoQuan = 1) { DataTable tabl = ConnectDb.ExecuteDataTableTask(Startup.ConnectionString, "SP_Banners", new string[] { "@flag", "@CatId", "@IdCoQuan" }, new object[] { "GetListByCat", CatId, 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"]), 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"]), IdCoQuan = (int)((r["IdCoQuan"] == System.DBNull.Value) ? null : r["IdCoQuan"]), }).ToList()); } }
/* * 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()); }
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()); } }
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()); } }
public static DataTable GetListChucNang(int Id = 0) { DataTable tabl = ConnectDb.ExecuteDataTableTask(Startup.ConnectionString, "user_groups", new string[] { "@flag", "@Id" }, new object[] { "GetListGroupMenu", Id }); return(tabl); }
public List <Tuple <string, int> > GetGameCount() { List <Tuple <string, int> > list = new List <Tuple <string, int> >(); using (var conn = ConnectDb.GetConnection()) { conn.Open(); Command = new SqlCommand("GameTagCount", conn) { CommandType = CommandType.StoredProcedure }; using (var reader = Command.ExecuteReader()) { if (reader.HasRows) { while (reader.Read()) { int count = Convert.ToInt32(reader["GAMECOUNT"]); string name = Convert.ToString(reader["TagName"]); list.Add(new Tuple <string, int>(name, count)); } } conn.Close(); } } return(list); }
public List <KHUYEN_MAI> getAllKhuyenMai1(int id) { connectdb = new ConnectDb(); List <KHUYEN_MAI> list = new List <KHUYEN_MAI>(); SqlCommand cmd = new SqlCommand("getAllKhuyenMai", connectdb.conn); cmd.CommandType = CommandType.StoredProcedure; sdr = cmd.ExecuteReader(); while (sdr.Read()) { KHUYEN_MAI item_khuyenmai = new KHUYEN_MAI(); if (id == (int)sdr["MAKHUYENMAI"]) { item_khuyenmai.MAKHUYENMAI = (int)sdr["MAKHUYENMAI"]; item_khuyenmai.TIEUDEKHUYENMAI = (string)sdr["TIEUDEKHUYENMAI"]; item_khuyenmai.NOIDUNGKHUYENMAI = (string)sdr["NOIDUNGKHUYENMAI"]; item_khuyenmai.URLANH = (string)sdr["URLANH"]; item_khuyenmai.THOIGIANTAO = (DateTime)sdr["THOIGIANTAO"]; item_khuyenmai.NGUOITAO = (string)sdr["NGUOITAO"]; list.Add(item_khuyenmai); } } return(list); }
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()); } }
public static List <Products> GetListHot(int IdCoQuan = 0, int Limit = 5) { if (IdCoQuan == 0) { IdCoQuan = 1; } DataTable tabl = ConnectDb.ExecuteDataTableTask(Startup.ConnectionString, "SP_Products", new string[] { "@flag", "@IdCoQuan", "@Limit" }, new object[] { "GetListHot", IdCoQuan, Limit }); 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"]), }).ToList()); } }
public static dynamic SaveItem(Documents dto) { if (dto.Alias == null || dto.Alias == "") { dto.Alias = API.Models.MyHelper.StringHelper.UrlFriendly(dto.Title); } DateTime IssuedDate = DateTime.ParseExact(dto.IssuedDateShow, "dd/MM/yyyy", CultureInfo.InvariantCulture); String EffectiveDate = null; if (dto.EffectiveDateShow != null) { EffectiveDate = DateTime.ParseExact(dto.EffectiveDateShow, "dd/MM/yyyy", CultureInfo.InvariantCulture).ToString(); } ; DataTable tabl = ConnectDb.ExecuteDataTableTask(Startup.ConnectionString, "SP_Documents", new string[] { "@flag", "@Id", "@Title", "@Code", "@Link", "@Alias", "@Introtext", "@FullText", "@Status", "@CreatedBy", "@ModifiedBy", "@IssuedDate", "@EffectiveDate", "@CatId", "@TypeId", "@FieldId", "@LevelId", "@OrganizationName" }, new object[] { "SaveItem", dto.Id, dto.Title, dto.Code, dto.Link, dto.Alias, dto.Introtext, dto.FullText, dto.Status, dto.CreatedBy, dto.ModifiedBy, IssuedDate, EffectiveDate, dto.CatId, dto.TypeId, dto.FieldId, dto.LevelId, dto.OrganizationName }); return((from r in tabl.AsEnumerable() select new { N = (int)(r["N"]), }).FirstOrDefault()); }
public static List <Products> GetListNotification(SearchProducts dto) { DataTable tabl = ConnectDb.ExecuteDataTableTask(Startup.ConnectionString, "SP_Products", new string[] { "@flag", "@CurrentPage", "@ItemsPerPage" }, new object[] { "GetListNotification", dto.CurrentPage, dto.ItemsPerPage }); 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"], 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"]), }).ToList()); } }
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()); }
public bool Login(string taikhoan, string matkhau) { db = new ConnectDb(); int i = 0; if (taikhoan != null && matkhau != null) { SqlCommand cmd = new SqlCommand("checkLogin", db.conn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@taikhoan", taikhoan)); cmd.Parameters.Add(new SqlParameter("@matkhau", matkhau)); sdr = cmd.ExecuteReader(); while (sdr.Read()) { i++; } } if (i != 0) { return(true); } else { return(false); } }
public static List <USMenu> GetList(Boolean Selected = true) { DataTable tabl = ConnectDb.ExecuteDataTableTask(Startup.ConnectionString, "User_Menu", new string[] { "@flag", "@Selected" }, new object[] { "GetList", Convert.ToDecimal(Selected) }); if (tabl == null) { return(new List <USMenu>()); } else { return((from r in tabl.AsEnumerable() select new USMenu { Id = (int)r["Id"], Title = (string)((r["Title"] == System.DBNull.Value) ? null : r["Title"]), PathName = (string)((r["PathName"] == System.DBNull.Value) ? null : r["PathName"]), IdParent = (int)r["IdParent"], Styles = (string)((r["Styles"] == System.DBNull.Value) ? null : r["Styles"]), Description = (string)((r["Description"] == System.DBNull.Value) ? null : r["Description"]), SortOrder = (int)r["SortOrder"], Status = (Boolean)r["Status"], 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"], TotalRows = (int)r["TotalRows"], }).ToList()); } }
public List <PHIEU_DAT_PHONG1> getKhachHangDatPhong() { c = new ConnectDb(); List <PHIEU_DAT_PHONG1> list = new List <PHIEU_DAT_PHONG1>(); SqlCommand cmd = new SqlCommand("getKhachHangDatPhong", c.conn); cmd.CommandType = CommandType.StoredProcedure; rdr = cmd.ExecuteReader(); while (rdr.Read()) { PHIEU_DAT_PHONG1 item = new PHIEU_DAT_PHONG1(); item.SOPHIEU = (long)rdr["SOPHIEU"]; item.TENLOAIPHONG = (string)rdr["TENLOAIPHONG"]; item.HOTENKHACHHANG = (string)rdr["HOTENKHACHHANG"]; item.DIENTHOAI = (string)rdr["DIENTHOAI"]; item.NGAYDUKIENDEN = (DateTime)rdr["NGAYDUKIENDEN"]; item.NGAYDUKIENTRA = (DateTime)rdr["NGAYDUKIENTRA"]; item.NGAYTAOPHIEU = (DateTime)rdr["NGAYTAOPHIEU"]; item.TRANGTHAIPHIEU = (int)rdr["TRANGTHAIPHIEU"]; item.TIENDATCOC = (double)rdr["TIENDATCOC"]; item.LOAITIEN = (int)rdr["LOAITIEN"]; item.SOLUONGPHONG = (int)rdr["SOLUONGPHONG"]; list.Add(item); } return(list); }
public static USUsers GetItemByGroup(int Id, int IdGroup) { DataTable tabl = ConnectDb.ExecuteDataTableTask(Startup.ConnectionString, "user_users", new string[] { "@flag", "@Id", "@IdGroup" }, new object[] { "GetItemByGroup", Id, IdGroup }); return((from r in tabl.AsEnumerable() select new USUsers { Id = (int)r["Id"], IdGroup = (int)r["IdGroup"], FullName = (string)((r["FullName"] == System.DBNull.Value) ? "" : r["FullName"]), UserName = (string)((r["UserName"] == System.DBNull.Value) ? "" : r["UserName"]), UserCode = (string)((r["UserCode"] == System.DBNull.Value) ? "" : r["UserCode"]), Specialize = (string)((r["Specialize"] == System.DBNull.Value) ? "" : r["Specialize"]), TenChucVu = (string)((r["TenChucVu"] == System.DBNull.Value) ? "" : r["TenChucVu"]), TenCoQuan = (string)((r["TenCoQuan"] == System.DBNull.Value) ? "" : r["TenCoQuan"]), Avatar = (string)((r["Avatar"] == System.DBNull.Value) ? "" : r["Avatar"]), Status = (byte)r["Status"], Gender = (byte)r["Gender"], Email = (string)((r["Email"] == System.DBNull.Value) ? "" : r["Email"]), Description = (string)((r["Description"] == System.DBNull.Value) ? "" : r["Description"]), Telephone = (string)((r["Telephone"] == System.DBNull.Value) ? "" : r["Telephone"]), IdRegency = (int)((r["IdRegency"] == System.DBNull.Value) ? 0 : r["IdRegency"]), IdCoQuan = (int)((r["IdCoQuan"] == System.DBNull.Value) ? 0 : r["IdCoQuan"]), }).FirstOrDefault()); }
public static List <Ablums> GetListPagination(SearchAblums dto) { if (dto.CurrentPage <= 0) { dto.CurrentPage = 1; } if (dto.ItemsPerPage <= 0) { dto.ItemsPerPage = 10; } var tabl = ConnectDb.ExecuteDataTableTask(Startup.ConnectionString, "SP_Ablums", new string[] { "@flag", "@CurrentPage", "@ItemsPerPage" }, new object[] { "GetListAlbumsPagination", dto.CurrentPage, dto.ItemsPerPage }); 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"], TotalRows = (int)r["TotalRows"], }).ToList()); } }
public static List <USUsers> GetListByGroup(int IdGroup) { var tabl = ConnectDb.ExecuteDataTableTask(Startup.ConnectionString, "user_users", new string[] { "@flag", "@IdGroup" }, new object[] { "GetListByGroup", IdGroup }); 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"]), TotalRows = (int)r["TotalRows"], IdCoQuan = (int)r["IdCoQuan"], TenCoQuan = (string)((r["TenCoQuan"] == System.DBNull.Value) ? "" : r["TenCoQuan"]), IdRegency = (int)((r["IdRegency"] == System.DBNull.Value) ? 0 : r["IdRegency"]), TenChucVu = (string)((r["TenChucVu"] == System.DBNull.Value) ? "" : r["TenChucVu"]), }).ToList()); }
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()); } }
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()); }
public List <TIN_TUC_KHAC> getAllTinTuc1(int id) { connectdb = new ConnectDb(); List <TIN_TUC_KHAC> list = new List <TIN_TUC_KHAC>(); SqlCommand cmd = new SqlCommand("getAllTinTuc", connectdb.conn); cmd.CommandType = CommandType.StoredProcedure; sdr = cmd.ExecuteReader(); while (sdr.Read()) { TIN_TUC_KHAC item_tintuc = new TIN_TUC_KHAC(); if (id == (int)sdr["MATINTUC"]) { item_tintuc.MATINTUC = (int)sdr["MATINTUC"]; item_tintuc.TIEUDETINTUC = (string)sdr["TIEUDETINTUC"]; item_tintuc.NOIDUNGTINTUC = (string)sdr["NOIDUNGTINTUC"]; item_tintuc.URLANH = (string)sdr["URLANH"]; item_tintuc.NGAYTAO = (DateTime)sdr["NGAYTAO"]; item_tintuc.NGUOITAO = (string)sdr["NGUOITAO"]; list.Add(item_tintuc); } } return(list); }
public static List <Videos> GetListFeatured() { DataTable tabl = ConnectDb.ExecuteDataTableTask(Startup.ConnectionString, "SP_Videos", new string[] { "@flag" }, new object[] { "GetListFeatured" }); 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"]), }).ToList()); } }
public static DataTable GetList(Boolean Selected = true) { DataTable tabl = ConnectDb.ExecuteDataTableTask(Startup.ConnectionString, "DanhMuc_ChucVu", new string[] { "@flag", "@Selected" }, new object[] { "GetList", Selected }); return(tabl); }
public static List <ProductsCategories> GetList(Boolean Selected = true) { DataTable tabl = ConnectDb.ExecuteDataTableTask(Startup.ConnectionString, "SP_ProductsCategories", new string[] { "@flag", "@Selected" }, new object[] { "GetList", Convert.ToDecimal(Selected) }); 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"]), //Description = (string)((r["Description"] == System.DBNull.Value) ? null : r["Description"]), ParentId = (int?)((r["ParentId"] == System.DBNull.Value) ? null : r["ParentId"]), Images = (string)((r["Images"] == System.DBNull.Value) ? null : r["Images"]), //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"]), * * 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"]), * TotalRows = (int)r["TotalRows"],*/ }).ToList()); } }