コード例 #1
0
        public ResultModel EventOperation(EventOperationModel model)
        {
            ResultModel result = new ResultModel();

            sqlCommand = new SqlCommand()
            {
                Connection  = connectionHelper.connection,
                CommandType = CommandType.StoredProcedure,
                CommandText = "EventOperationSP",
            };

            sqlCommand.Parameters.Add("@EventId", SqlDbType.Int).Value      = model.EventId;
            sqlCommand.Parameters.Add("@PersonId", SqlDbType.Int).Value     = model.PersonId;
            sqlCommand.Parameters.Add("@IsGoing", SqlDbType.Bit).Value      = model.IsGoing;
            sqlCommand.Parameters.Add("@IsInterested", SqlDbType.Bit).Value = model.IsInterested;

            connectionHelper.connection.Open();
            SqlDataReader sqlReader = sqlCommand.ExecuteReader();

            if (sqlReader.HasRows)
            {
                if (sqlReader.Read())
                {
                    result = new ResultModel()
                    {
                        IsSuccess = (bool)sqlReader["IsSuccess"],
                        Message   = sqlReader["Message"] as string
                    };
                }
            }

            connectionHelper.connection.Close();

            return(result);
        }
コード例 #2
0
        protected void Interested_Click(object sender, EventArgs e)
        {
            var user = (UserBO)Session["user"];

            if (interestedButton.InnerText == "Interested")
            {
                goingButton.InnerText      = "Going";
                interestedButton.InnerText = "Cancel";

                var model = new EventOperationModel()
                {
                    EventId      = eventId,
                    PersonId     = user.Id,
                    IsGoing      = false,
                    IsInterested = true
                };

                var response = eventOperationBal.EventsOperation(model);
                if (response != null && response.IsSuccess == true)
                {
                    GetEventOperationStatusRequest();
                    GetEventOperationStatisticRequest();
                }
            }

            else
            {
                goingButton.InnerText      = "Going";
                interestedButton.InnerText = "Interested";

                var model = new EventOperationModel()
                {
                    EventId      = eventId,
                    PersonId     = user.Id,
                    IsGoing      = false,
                    IsInterested = false
                };

                var response = eventOperationBal.EventsOperation(model);
                if (response != null && response.IsSuccess == true)
                {
                    GetEventOperationStatusRequest();
                    GetEventOperationStatisticRequest();
                }
            }
        }
コード例 #3
0
 public ResultModel EventsOperation(EventOperationModel model)
 {
     return(eventOperationDal.EventOperation(model));
 }