public static string ToAccountText(this CampaignAccountStatus status) { if (status == CampaignAccountStatus.AccountRequest) { return("Chờ xác nhận"); } else if (status == CampaignAccountStatus.AgencyRequest) { return("Doanh nghiệp chỉ định"); } else if (status == CampaignAccountStatus.Canceled) { return("Đã Hủy"); } else if (2 <= (int)status && 6 > (int)status) { return("Đã tham gia"); } else if (status == CampaignAccountStatus.Unfinished) { return("Chưa hoàn thành"); } return(""); }
public static string ToColorClass(this CampaignAccountStatus status) { if (status == CampaignAccountStatus.Canceled) { return("danger"); } else if (2 <= (int)status && 6 > (int)status) { return("success"); } else if (status == CampaignAccountStatus.Unfinished) { return("secondary"); } return("primary"); }
//public async Task<ListCampaignWithAccountViewModel> GetListCampaignByAllAccount(int type, string keyword, int page, int pagesize) //{ // var query = await _ICampaignRepository.QueryCampaignByAllAccount(type, keyword); // var total = await query.CountAsync(); // var campaigns = await query.OrderByDescending(m => m.Id).GetPagedAsync(page, pagesize); // //var filter = new CampaignByAccountSpecification(accountid, keyword); // //var campaigns = await _campaignRepository.ListPagedAsync(filter, "", page, pagesize); // //var total = await _campaignRepository.CountAsync(filter); // var list = new List<CampaignWithAccountViewModel>(); // foreach (var campaign in campaigns) // { // var campaignAccount = await _campaignAccountRepository.GetSingleBySpecAsync(new CampaignAccountByAccountSpecification(accountid, campaign.Id)); // if (campaignAccount != null) // { // list.Add(new CampaignWithAccountViewModel(campaign, campaignAccount)); // } // } // return new ListCampaignWithAccountViewModel() // { // Campaigns = list, // Pager = new PagerViewModel(page, pagesize, total) // }; //} public ListCampaignWithAccountViewModel GetCampaignAccountByStatus(CampaignAccountStatus status, int pageindex, int pagesize) { var filter = new CampaignAccountByStatusSpecification(status); var campaignAccounts = _ICampaignAccountRepository.ListPaged(filter, "DateModified_desc", pageindex, pagesize); var total = _ICampaignAccountRepository.Count(filter); var list = new List <CampaignWithAccountViewModel>(); foreach (var campaignAccount in campaignAccounts) { list.Add(new CampaignWithAccountViewModel(campaignAccount.Campaign, campaignAccount)); } return(new ListCampaignWithAccountViewModel() { Campaigns = list, Pager = new PagerViewModel(pageindex, pagesize, total) }); }
public IActionResult CampaignAccountChangeStatus(int campaignaccountid, CampaignAccountStatus selectStatus, string txt_note) { var campaignAccount = _ICampaignAccountRepository.GetById(campaignaccountid); if (campaignAccount != null) { campaignAccount.Status = selectStatus; if (!string.IsNullOrEmpty(txt_note)) { campaignAccount.Note = txt_note; } _ICampaignAccountRepository.Update(campaignAccount); TempData["MessageSuccess"] = "Thay đổi trạng thái thành công!"; } else { TempData["MessageError"] = "Dữ liệu không hợp lệ"; } return(Redirect("/campaign/campaignaccountchangestatus/?campaignaccountid=" + campaignaccountid)); }
public CampaignAccountByAgencySpecification(int campaignid, CampaignAccountStatus status) : base(m => m.CampaignId == campaignid && m.Status == status) { }
public CampaignAccountByStatusSpecification(CampaignAccountStatus status) : base(m => m.Status == status) { AddInclude(c => c.Account); AddInclude(c => c.Campaign); }
public CampaignAccountSpecification(CampaignAccountStatus status) : base(m => m.Status == status) { }
public static string ToAgencyText(this CampaignAccountStatus status) { return(status.ToString()); }