예제 #1
0
 //Activity History
 public async Task <TranStatus> activity_history(int Aid, ActivityListModel model)
 {
     using (activityRepository = new ActivityRepository())
     {
         return(await activityRepository.activity_history(Aid, model));
     }
 }
예제 #2
0
 //Update updateToCancel
 public async Task <TranStatus> updateToCancel(int Aid, ActivityListModel model)
 {
     using (activityRepository = new ActivityRepository())
     {
         return(await activityRepository.updateToCancel(Aid, model));
     }
 }
예제 #3
0
        public ActionResult Search(long?statusId, DateTime?startTime, DateTime?endTime, string keyWord, int pageIndex = 1)
        {
            ActivitySearchResult result = activityService.Search(statusId, startTime, endTime, keyWord, (pageIndex - 1) * 20, 20);
            ActivityListModel    model  = new ActivityListModel();

            model.Activities = result.Activities;

            //分页
            Pagination pager = new Pagination();

            pager.PageIndex  = pageIndex;
            pager.PageSize   = 20;
            pager.TotalCount = result.TotalCount;

            if (result.TotalCount <= 20)
            {
                model.Page = "";
            }
            else
            {
                model.Page = pager.GetPagerHtml();
            }
            return(Json(new AjaxResult {
                Status = "1", Data = model
            }));
        }
예제 #4
0
        //Display
        //public async Task<List<ActivityList_while_addingModel>> ActivityList_while_adding()
        //{
        //    using (activityRepository = new ActivityRepository())
        //    {
        //        return await activityRepository.ActivityList_while_adding();
        //    }
        //}


        // Display each sales List Individually
        //public async Task<List<ActivityListModel>> each_sales_activityList(ActivityListModel model)
        //{
        //    using (activityRepository = new ActivityRepository())
        //    {
        //        return await activityRepository.each_sales_activityList(model);
        //    }
        //}

        public List <ActivityListModel> each_sales_activityList(ActivityListModel model, out int RowCount)
        {
            using (activityRepository = new ActivityRepository())
            {
                return(activityRepository.each_sales_activityList(model, out RowCount));
            }
        }
예제 #5
0
        public ActionResult UserActList(string mobile)
        {
            ActivityListModel model = new ActivityListModel();

            ActivityDTO[] dtos = activityService.GetByUserId(mobile);
            model.Activities = dtos;
            return(View(model));
        }
예제 #6
0
        public ActionResult Join(int Uid, int Aid)
        {
            ActivityListModel AL = new ActivityListModel();

            Aid = Convert.ToInt32(Request.QueryString["aid"]);
            AL.Join(Uid, Aid);

            return(new RedirectResult("~/Activity/ReadMore"));
        }
        public void List_RequestDataError_ThrowsServiceValidationException()
        {
            //1. Setup data
            //a.request
            var request = new ActivityListModel
            {
                SearchType   = "ACTIVITYTYPE",
                ActivityType = "AETV",
            };

            //2. exec
            var result = SystemUnderTest().ListActivities(request);

            //3. Verification
        }
        internal static ActivityListModel CreateDummyActivityListModel()
        {
            var data = new ActivityListModel
            {
                SearchType   = "ACTIVITYTYPE",
                ActivityType = "AETV",
                SubType      = "C4",
                ESACode      = "4ACQ",
                Status       = "CL",
                //FromPostCode = "2121",
                StartActivityId        = 123123,
                StartActivityStartDate = DateTime.Today
            };

            return(data);
        }
예제 #9
0
        public ActionResult ActivityList()
        {
            int cid = Convert.ToInt32(Request.QueryString["cid"]);

            ActivityListModel AListModel = new ActivityListModel();
            GuestBookModel    GModel     = new GuestBookModel();

            List <Activity>  alist = AListModel.GetActivityList(cid);
            List <GuestBook> glist = GModel.ReadComment(cid);

            ViewData["AList"]      = alist;
            ViewData["GList"]      = glist;
            ViewData["CategoryID"] = cid;

            return(View());
        }
        public async Task <IActionResult> activity_history(int Aid, [FromBody] ActivityListModel model)
        {
            Dictionary <String, Object> dctData = new Dictionary <string, object>();
            HttpStatusCode statusCode           = HttpStatusCode.OK;
            TranStatus     transaction          = new TranStatus();

            try
            {
                transaction = await iactivity.activity_history(Aid, model);
            }
            catch (Exception ex)
            {
                transaction = CommonHelper.TransactionErrorHandler(ex);
                statusCode  = HttpStatusCode.BadRequest;
            }
            dctData.Add("Status", transaction);
            return(this.StatusCode(Convert.ToInt32(statusCode), dctData));
        }
        //Activity_History

        //Update
        public async Task <TranStatus> activity_history(int Aid, ActivityListModel model)
        {
            using (var connection = new SqlConnection(ConnectionString))
            {
                await connection.OpenAsync();

                TranStatus        transaction = new TranStatus();
                DynamicParameters parameter   = new DynamicParameters();
                parameter.Add("@Aid", Aid);
                parameter.Add("@User_id", model.User_id);
                parameter.Add("@Message", dbType: DbType.String, direction: ParameterDirection.Output, size: 500);
                parameter.Add("@Code", dbType: DbType.Int32, direction: ParameterDirection.Output);
                await connection.QueryAsync("activity_history", parameter, commandType : CommandType.StoredProcedure);

                transaction.returnMessage = parameter.Get <string>("@Message");
                transaction.code          = parameter.Get <int>("@Code");
                return(transaction);
            }
        }
        //Display ActivityList_while_adding
        //public async Task<List<ActivityList_while_addingModel>> ActivityList_while_adding()
        //{
        //    using (var connection = new SqlConnection(ConnectionString))
        //    {
        //        connection.Open();
        //        var result = await connection.QueryAsync<ActivityList_while_addingModel>("ActivityList_while_adding", commandType: CommandType.StoredProcedure);
        //        return result.ToList();

        //    }
        //}



        // Display each sales List Individually
        //public async Task<List<ActivityListModel>> each_sales_activityList(ActivityListModel model)
        //{
        //    using (var connection = new SqlConnection(ConnectionString))
        //    {
        //        connection.Open();
        //        TranStatus transaction = new TranStatus();
        //        DynamicParameters parameter = new DynamicParameters();
        //        parameter.Add("@SalesID", model.userId);

        //        var result = await connection.QueryAsync<ActivityListModel>("each_sales_activityList", parameter, commandType: CommandType.StoredProcedure);
        //        return result.ToList();

        //    }
        //}

        public List <ActivityListModel> each_sales_activityList(ActivityListModel model, out int RowCount)
        {
            using (var connection = new SqlConnection(ConnectionString))
            {
                connection.Open();
                TranStatus        transaction = new TranStatus();
                DynamicParameters parameter   = new DynamicParameters();
                parameter.Add("@SalesID", model.userId);
                parameter.Add("@pageIndex", model.pageIndex);
                parameter.Add("@pageSize", model.pageSize);
                parameter.Add("@Search", model.Search);
                parameter.Add("@From_Date", model.From_date);
                parameter.Add("@To_Date", model.To_date);

                parameter.Add("@RowCount", dbType: DbType.Int32, direction: ParameterDirection.Output);
                var result = connection.Query <ActivityListModel>("each_sales_activityList", parameter, commandType: CommandType.StoredProcedure);
                RowCount = parameter.Get <int>("@RowCount");
                return(result.ToList());
            }
        }
예제 #13
0
        public async Task <ActivityListModel> GetActivities()
        {
            var judges = await judgeService
                         .QueryJudgesAsync(null, 0, 0, 0, (int)ResultCode.Accepted);

            var result = judges
                         .Where(i => (i.ContestId == null && i.GroupId == null && !i.Problem.Hidden) ||
                                (i.ContestId != null && i.GroupId == null && !i.Contest.Hidden) ||
                                (i.GroupId != null && !i.Group.IsPrivate))
                         .Select(i =>
                                 new
            {
                ProblemName = i.Problem.Name,
                UserName    = i.UserInfo.UserName,
                UserId      = i.UserId,
                Time        = i.JudgeTime,
                Title       = "通过题目",
                Content     = $"成功通过了题目 {i.Problem.Name}"
            })
                         .OrderByDescending(i => i.Time);

            var model = new ActivityListModel
            {
                TotalCount = 10
            };

            foreach (var i in result.Take(10))
            {
                model.Activities.Add(new ActivityModel
                {
                    Content  = $"成功通过了题目 {i.ProblemName}",
                    Time     = i.Time,
                    Title    = "通过题目",
                    UserId   = i.UserId,
                    UserName = i.UserName
                });
            }

            return(model);
        }
예제 #14
0
        public ActionResult CreateActivity()
        {
            ActivityModel     AModel     = new ActivityModel();
            ActivityListModel AListModel = new ActivityListModel();

            //List<Activity> AList = new List<Activity>();

            AModel.UserId       = Convert.ToInt32(Session["UserId"]);
            AModel.ACategoryId  = Convert.ToInt32(Request.Form["Category"]);
            AModel.AName        = Request.Form["Title"];
            AModel.ALocation    = Request.Form["Address"];
            AModel.AStartTime   = Request.Form["BeginAt"];
            AModel.AEndTime     = Request.Form["EndAt"];
            AModel.APhone       = Request.Form["Phone"];
            AModel.AContent     = Request.Form["Content"];
            AModel.ATotalPeople = Convert.ToInt32(Request.Form["TotalPeople"]);
            AModel.ACost        = Request.Form["Cost"];

            AModel.Create();

            return(View());
        }
        public IActionResult each_sales_activityList([FromBody] ActivityListModel model)
        {
            TranStatus transaction = new TranStatus();
            Dictionary <String, Object> dctData = new Dictionary <string, object>();
            HttpStatusCode statusCode           = HttpStatusCode.OK;

            try
            {
                List <ActivityListModel> each_sales_activityList = new List <ActivityListModel>();
                int rowcount = 0;
                each_sales_activityList = iactivity.each_sales_activityList(model, out rowcount);

                dctData.Add("each_sales_activityList", each_sales_activityList);
                dctData.Add("RowCount", rowcount);
            }
            catch (Exception ex)
            {
                transaction = CommonHelper.TransactionErrorHandler(ex);
                statusCode  = HttpStatusCode.BadRequest;
            }
            dctData.Add("Status", transaction);
            return(this.StatusCode(Convert.ToInt32(statusCode), dctData));
        }
예제 #16
0
        public ActionResult List(int pageIndex = 1)
        {
            ActivitySearchResult result = activityService.Search(null, null, null, null, (pageIndex - 1) * 20, 20);
            ActivityListModel    model  = new ActivityListModel();

            model.Activities = result.Activities;

            //分页
            Pagination pager = new Pagination();

            pager.PageIndex  = pageIndex;
            pager.PageSize   = 20;
            pager.TotalCount = result.TotalCount;

            if (result.TotalCount <= 20)
            {
                model.Page = "";
            }
            else
            {
                model.Page = pager.GetPagerHtml();
            }
            return(View(model));
        }
        //Update updateToPending
        public async Task <TranStatus> updateToPending(int Aid, ActivityListModel model)
        {
            using (var connection = new SqlConnection(ConnectionString))
            {
                await connection.OpenAsync();

                TranStatus        transaction = new TranStatus();
                DynamicParameters parameter   = new DynamicParameters();
                parameter.Add("@Aid", Aid);
                parameter.Add("@Status", model.pendingId);
                parameter.Add("@Latitude", model.Latitude);
                parameter.Add("@Longitude", model.Longitude);
                parameter.Add("@Paydue", model.Paydue);
                parameter.Add("@Paymentmode", model.Payment_mode);

                parameter.Add("@Message", dbType: DbType.String, direction: ParameterDirection.Output, size: 500);
                parameter.Add("@Code", dbType: DbType.Int32, direction: ParameterDirection.Output);
                await connection.QueryAsync("updateToPending", parameter, commandType : CommandType.StoredProcedure);

                transaction.returnMessage = parameter.Get <string>("@Message");
                transaction.code          = parameter.Get <int>("@Code");
                return(transaction);
            }
        }