public BOAllCount AllCount() { using (SqlConnection _sqlconnection = ConnectionInfo.GetConnection()) { _sqlcommand = new SqlCommand(); _sqlcommand.CommandText = "SP_GetAllCount"; _sqlcommand.CommandType = CommandType.StoredProcedure; _sqlcommand.Connection = _sqlconnection; _sqlconnection.Open(); _sqldataadapter = new SqlDataAdapter(_sqlcommand); _datatable = new DataTable(); _sqldataadapter.Fill(_datatable); _sqlconnection.Close(); BOAllCount _boallcnt = (from list in _datatable.AsEnumerable() select new BOAllCount { TotalMerchant = list.Field <int>("TotalMerchant"), TotalUser = list.Field <int>("TotalUser"), TotalExams = list.Field <int>("TotalExams"), TotalQuestion = list.Field <int>("TotalQuestion") }).FirstOrDefault(); return(_boallcnt); } }
private void AllCount() { BAAllOperation _baallcnt = new BAAllOperation(); BOAllCount _boallcnt = new BOAllCount(); _boallcnt = _baallcnt.AllCount(); lblMerchantCount.Text = _boallcnt.TotalMerchant.ToString(); lblUserCount.Text = _boallcnt.TotalUser.ToString(); lblExamCount.Text = _boallcnt.TotalExams.ToString(); lblQuestionCount.Text = _boallcnt.TotalQuestion.ToString(); }