コード例 #1
0
 public void updateActivity(Activity anActivity)
 {
     using (SqlCommand cmd = DatabaseContext.Connection.CreateCommand())
     {
         cmd.CommandText = "update Activity set ActivityName=" + "'" + anActivity.ActivityName + "'" + ",Rate=" + "'" + anActivity.Rate + "where ActivityNo=" + anActivity + ";";
         cmd.ExecuteNonQuery();
     }
 }
コード例 #2
0
        public Activity getActivityByNo(int no)
        {
            Activity result = null;

            using (SqlCommand cmd = new SqlCommand("select * from activity where activityname= " + no, DatabaseContext.Connection))
            {
                SqlDataReader reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    result = new Activity { ActivityName = reader["ActivityName"].ToString() };
                }
            }

            return result;
        }
コード例 #3
0
        public Activity getActivityByName(String name)
        {
            Activity result = null;

            using (SqlCommand cmd = new SqlCommand("select activityNo from activity where activityname='" + name + "';", DatabaseContext.Connection))
            {
                SqlDataReader reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    result = new Activity { ActivityNo = Convert.ToInt32(reader["ActivityNo"]) };
                }
                reader.Close();
            }

            return result;
        }
コード例 #4
0
        private void updateActivity()
        {
            Activity anActivity = new Activity
            {
                ActivityNo = Int32.Parse(tbAdminActivityNo.Text),
                ActivityName = tbAdminActivityName.Text.ToString(),
                Rate = Int32.Parse(tbAdminActivityRate.Text),
            };

            context.ActivityService.updateActivity(anActivity);
        }
コード例 #5
0
 public void updateActivity(Activity anActivity)
 {
     context.ActivityRepository.updateActivity(anActivity);
 }