public GetThongTinShopViewModels GetThongTinShop(int? account_ID) { SqlConnection sqlConnection = new SqlConnection(); sqlConnection.ConnectionString = MyConnectionString1; SqlCommand sqlCommand = new SqlCommand(); sqlCommand.CommandText = "GetThongTinShop"; sqlCommand.CommandType = CommandType.StoredProcedure; SqlParameter i_QLSP_ID = sqlCommand.Parameters.Add("@account_ID", SqlDbType.Int); i_QLSP_ID.Direction = ParameterDirection.Input; i_QLSP_ID.Value = account_ID; sqlCommand.Connection = sqlConnection; sqlConnection.Open(); SqlDataReader reader = sqlCommand.ExecuteReader(); GetThongTinShopViewModels qlShop = new GetThongTinShopViewModels(); while (reader.Read()) { qlShop.QLSHOP_ID = reader.GetInt32NullCheck(0); qlShop.tenShop = reader.GetStringNullCheck(1); qlShop.diaChi = reader.GetStringNullCheck(2); qlShop.tenQuanHuyen = reader.GetStringNullCheck(3); qlShop.tenTinhThanh = reader.GetStringNullCheck(4); qlShop.dienThoai = reader.GetStringNullCheck(5); qlShop.website = reader.GetStringNullCheck(6); qlShop.ChuShop = reader.GetStringNullCheck(7); qlShop.AccountID = reader.GetInt32NullCheck(8); } return qlShop; }
public List<GetThongTinShopViewModels> ListThongTinShopAdmin( string TuNgaySearch, string DenNgaySearch, string IDShop, string TenShop, string DiaChi, string LienHe, string TinhTrang, string LoaiShop, int? PageIndex, int? PageSize, ref int TotalRecords) { HtmlHelperGeneral.openConnection(); SqlCommand sqlCommand = new SqlCommand(); sqlCommand.CommandText = "GetListThongTinShop"; sqlCommand.CommandType = CommandType.StoredProcedure; SqlParameter i_Page_Index = sqlCommand.Parameters.Add("@i_Page_Index", SqlDbType.Int); i_Page_Index.Direction = ParameterDirection.Input; i_Page_Index.Value = PageIndex; SqlParameter i_Page_Count = sqlCommand.Parameters.Add("@i_Page_Count", SqlDbType.Int); i_Page_Count.Direction = ParameterDirection.Input; i_Page_Count.Value = PageSize; SqlParameter i_IDShop = sqlCommand.Parameters.Add("@IDShop", SqlDbType.Int); i_IDShop.Direction = ParameterDirection.Input; if (IDShop == "" || IDShop == null) { IDShop = ""; } i_IDShop.Value = (IDShop == "" ? 0 : int.Parse(IDShop)); SqlParameter i_TenShop = sqlCommand.Parameters.Add("@TenShop", SqlDbType.NVarChar); i_TenShop.Direction = ParameterDirection.Input; i_TenShop.Value = TenShop; SqlParameter i_DiaChi = sqlCommand.Parameters.Add("@DiaChi", SqlDbType.NVarChar); i_DiaChi.Direction = ParameterDirection.Input; i_DiaChi.Value = DiaChi; SqlParameter i_LienHe = sqlCommand.Parameters.Add("@LienHe", SqlDbType.NVarChar); i_LienHe.Direction = ParameterDirection.Input; i_LienHe.Value = LienHe; SqlParameter i_TinhTrang = sqlCommand.Parameters.Add("@TinhTrang", SqlDbType.NVarChar); i_TinhTrang.Direction = ParameterDirection.Input; i_TinhTrang.Value = TinhTrang; SqlParameter i_LoaiShop = sqlCommand.Parameters.Add("@LoaiShop", SqlDbType.NVarChar); i_LoaiShop.Direction = ParameterDirection.Input; i_LoaiShop.Value = LoaiShop; SqlParameter i_TuNgaySearch = sqlCommand.Parameters.Add("@startDate", SqlDbType.VarChar); i_TuNgaySearch.Direction = ParameterDirection.Input; i_TuNgaySearch.Value = TuNgaySearch; SqlParameter i_DenNgaySearch = sqlCommand.Parameters.Add("@endDate", SqlDbType.VarChar); i_DenNgaySearch.Direction = ParameterDirection.Input; i_DenNgaySearch.Value = DenNgaySearch; sqlCommand.Parameters.Add("@o_total_rows", SqlDbType.Int).Direction = ParameterDirection.Output; sqlCommand.Connection = HtmlHelperGeneral.con; SqlDataReader reader = sqlCommand.ExecuteReader(); List<GetThongTinShopViewModels> qlShop = new List<GetThongTinShopViewModels>(); while (reader.Read()) { GetThongTinShopViewModels h = new GetThongTinShopViewModels(); h.QLSHOP_ID = reader.GetInt32NullCheck(0); h.tenShop = reader.GetStringNullCheck(1); h.diaChi = reader.GetStringNullCheck(2); h.tenTinhThanh = reader.GetStringNullCheck(3); h.tenQuanHuyen = reader.GetStringNullCheck(4); if (!reader.IsDBNull(5)) { h.NgayXacThuc = reader.GetDateTime(5); } h.NguoiLienHe = reader.GetStringNullCheck(6); h.AccountID = reader.GetInt32NullCheck(7); h.TrangThai = reader.GetStringNullCheck(9); qlShop.Add(h); } reader.NextResult(); TotalRecords = Convert.ToInt32(sqlCommand.Parameters["@o_total_rows"].Value); HtmlHelperGeneral.Close(); return qlShop; }
public GetThongTinShopViewModels GetThongTinShopAdmin(int account_ID) { HtmlHelperGeneral.openConnection(); SqlCommand sqlCommand = new SqlCommand(); sqlCommand.CommandText = "GetThongTinShopAdmin"; sqlCommand.CommandType = CommandType.StoredProcedure; SqlParameter i_QLSP_ID = sqlCommand.Parameters.Add("@account_ID", SqlDbType.Int); i_QLSP_ID.Direction = ParameterDirection.Input; i_QLSP_ID.Value = account_ID; sqlCommand.Connection = HtmlHelperGeneral.con; SqlDataReader reader = sqlCommand.ExecuteReader(); GetThongTinShopViewModels qlShop = new GetThongTinShopViewModels(); while (reader.Read()) { qlShop.QLSHOP_ID = reader.GetInt32NullCheck(0); qlShop.tenShop = reader.GetStringNullCheck(1); qlShop.diaChi = reader.GetStringNullCheck(2); qlShop.tenQuanHuyen = reader.GetStringNullCheck(3); qlShop.tenTinhThanh = reader.GetStringNullCheck(4); qlShop.dienThoai = reader.GetStringNullCheck(5); qlShop.website = reader.GetStringNullCheck(6); qlShop.ChuShop = reader.GetStringNullCheck(7); qlShop.AccountID = reader.GetInt32NullCheck(8); qlShop.sofax = reader.GetStringNullCheck(9); qlShop.email = reader.GetStringNullCheck(10); qlShop.TrangThai = reader.GetStringNullCheck(11); } HtmlHelperGeneral.Close(); return qlShop; }
public List<GetThongTinShopViewModels> ListThongTinShop(int? ThanhPhoID, int? PageIndex, int? PageSize, ref int TotalRecords) { HtmlHelperGeneral.openConnection(); SqlCommand sqlCommand = new SqlCommand(); sqlCommand.CommandText = "ListThongTinShop"; sqlCommand.CommandType = CommandType.StoredProcedure; SqlParameter i_Page_Index = sqlCommand.Parameters.Add("@i_Page_Index", SqlDbType.Int); i_Page_Index.Direction = ParameterDirection.Input; i_Page_Index.Value = PageIndex; SqlParameter i_Page_Count = sqlCommand.Parameters.Add("@i_Page_Count", SqlDbType.Int); i_Page_Count.Direction = ParameterDirection.Input; i_Page_Count.Value = PageSize; SqlParameter i_QLSP_ID = sqlCommand.Parameters.Add("@tinhThanh_ID", SqlDbType.Int); i_QLSP_ID.Direction = ParameterDirection.Input; i_QLSP_ID.Value = ThanhPhoID; sqlCommand.Parameters.Add("@o_total_rows", SqlDbType.Int).Direction = ParameterDirection.Output; sqlCommand.Connection = HtmlHelperGeneral.con; SqlDataReader reader = sqlCommand.ExecuteReader(); List<GetThongTinShopViewModels> qlShop = new List<GetThongTinShopViewModels>(); while (reader.Read()) { GetThongTinShopViewModels h = new GetThongTinShopViewModels(); h.QLSHOP_ID = reader.GetInt32NullCheck(0); h.tenShop = reader.GetStringNullCheck(1); h.diaChi = reader.GetStringNullCheck(2); h.diemNoiBat = reader.GetStringNullCheck(3); h.ImageShop = reader.GetStringNullCheck(4); h.Total = reader.GetInt32NullCheck(5); h.AccountID = reader.GetInt32NullCheck(6); qlShop.Add(h); } reader.NextResult(); TotalRecords = Convert.ToInt32(sqlCommand.Parameters["@o_total_rows"].Value); HtmlHelperGeneral.Close(); return qlShop; }