public async Task <ActionResult> Index() { var newsFeedLogicLogic = LogicContext.Create <NewsFeedLogic>(); var newsFeedData = await newsFeedLogicLogic.GetAllNewsFeedAdmin(); return(View(newsFeedData)); }
public async Task <ActionResult> Index() { var chargesLogic = LogicContext.Create <DibzChargesLogic>(); var chargesData = await chargesLogic.GetAllDibzChargesData(); return(View(chargesData)); }
public async Task <ActionResult> Index() { //IEnumerable<GameCatalogModel> GameCatalogList = new List<GameCatalogModel>(); var gameCatalogLogic = LogicContext.Create <GameCatalogLogic>(); var gameData = new List <GameCatalogModel>(); var formatLogic = LogicContext.Create <FormatLogic>(); ViewBag.Formats = await formatLogic.GetAllFormats(); var categoryLogic = LogicContext.Create <CategoryLogic>(); ViewBag.Categories = await categoryLogic.GetAllCategories(); if (TempData["searchedGameData"] != null) { //ViewBag.GameCatalogList = TempData["searchOfferDataa"]; gameData = TempData["searchedGameData"] as List <GameCatalogModel>; TempData["searchedGameData"] = null; } else { gameData = await gameCatalogLogic.GetAllGameCatalog(); } return(View(gameData)); }
public ActionResult UserFirstGame() { var gameCatalogLogic = LogicContext.Create <GameCatalogLogic>(); var userFirstGame = gameCatalogLogic.GetUsersFirstGame(); return(View(userFirstGame)); }
public async Task <ActionResult> Index() { var bannerLogic = LogicContext.Create <CompetitionLogic>(); var bannerData = await bannerLogic.GetAllCompetition(); return(View(bannerData)); }
public async Task <ActionResult> AddUpdateGame(DIBZ.Common.Model.GameCatalog request, HttpPostedFileBase file) { var gameCatalogLogic = LogicContext.Create <GameCatalogLogic>(); var serverPath = Server.MapPath("~/Uploads"); string fileName = string.Empty; if (file != null) { fileName = file.FileName; } var gameData = await gameCatalogLogic.AddUpdate(request, fileName); if (file != null) { var fileSizeInMB = file.ContentLength / 1024; var savePath = Path.Combine(serverPath, gameData.GameImage.Id.ToString()); if (fileSizeInMB >= 1024 * 1.65) { var originalFilePath = Path.Combine(serverPath, (gameData.GameImage.Id + 100).ToString()); file.SaveAs(originalFilePath); FileSaveHelper.ResizeTo(originalFilePath, 865, 500, savePath); System.IO.File.Delete(originalFilePath); } else { file.SaveAs(savePath); } } return(RedirectToAction("Index")); }
public async Task <ActionResult> Index() { var nonWokringDayLogic = LogicContext.Create <NonWorkingDayLogic>(); var nonWokringDayData = await nonWokringDayLogic.GetAllNonWorkingDaysPublic(); return(View(nonWokringDayData)); }
//public bool SendMessage() //{ // Clients.All.messageReceived("mohsin", "khan"); // return true; //} public int?GetCurrentUserId(string token) { bool result = false; int? appUserId = 0; try { if (!string.IsNullOrEmpty(token)) { var session = LogicContext.Create <AuthLogic>().GetLoginSessionByToken(token); if (session == null) { result = false; } else { appUserId = session.ApplicationUserId; result = true; } } } catch { result = false; } if (!result) { throw new Exception("User not logged in"); } return(appUserId); }
public void ProcessOnEmailQueue() { while (EmailQueue.Count() > 0) { Console.WriteLine("Processsing email queue...."); LogHelper.LogInfo("Processsing email queue...."); DIBZ.Common.Model.EmailNotification SendEmail = EmailQueue.Peek(); if (SendEmail.EmailType == EmailType.Email) { try { //var emailTemplateLogic = Context.Create<EmailTemplateLogic>(); LogicContext = new LogicContext(); var emailTemplateLogic = LogicContext.Create <EmailTemplateLogic>(); Console.WriteLine("sending queued email...."); LogHelper.LogInfo("sending queued email...."); EmailHelper.Email(SendEmail.ApplicationUserEmail, SendEmail.Tiltle, SendEmail.Body); Console.WriteLine("Marking email status to sent...."); LogHelper.LogInfo("Marking email status to sent...."); emailTemplateLogic.UpdateEmailNotificationStatusById(SendEmail.Id); EmailQueue.Dequeue(); } catch (System.Exception ex) { LogHelper.LogError(ex.Message, ex); } } } }
public async Task <ActionResult> CheckUserProfile() { var authLogic = LogicContext.Create <AuthLogic>(); try { var authLogic1 = LogicContext.Create <AuthLogic>(); var userData = await authLogic.GetApplicationUserById(CurrentLoginSession.ApplicationUserId.GetValueOrDefault()); if (userData != null) { if (userData.Address == null || userData.FirstName == null || userData.LastName == null || userData.CellNo == null) { return(Json(new { IsSuccess = false, msg = "Please completed your profile first" }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { IsSuccess = true, msg = "Success" }, JsonRequestBehavior.AllowGet)); } } } catch (Exception lex) { return(Json(new { IsSuccess = false, msg = lex.Message }, JsonRequestBehavior.AllowGet)); } return(Json(new { IsSuccess = false, msg = "Please completed your profile first" }, JsonRequestBehavior.AllowGet)); }
public async Task <ActionResult> UpdateOfferStatusToPaymentNeeded(int id) { var offerLogic = LogicContext.Create <OfferLogic>(); await offerLogic.UpdateOfferStatusToPaymentNeeded(id); return(RedirectToAction("PossibleSwaps", "Offer")); }
public async Task<ActionResult> ReadQR(string id) { var swapLogic = LogicContext.Create<SwapLogic>(); var swapDetail = await swapLogic.GetSwapDetailByDFOMCode(id); return View(swapDetail); }
//public ActionResult Login(string email, string password, string rememberMe) public ActionResult Login(string email, string password, bool rememberMe) { try { var authLogic = LogicContext.Create <AuthLogic>(); DIBZ.Common.Model.ApplicationUser ApplicationUser = new DIBZ.Common.Model.ApplicationUser(); ApplicationUser.Email = email; ApplicationUser.Password = password; //AuthLogic.GetApplicationUserByEmail(email); var loginSession = authLogic.CreateLoginSession(email, password, false); Response.Cookies["AuthCookie"].Value = loginSession.Token; //if (rememberMe == "on") if (rememberMe) { Response.Cookies["AuthCookie"].Expires = DateTime.Now.AddYears(1); } return(Json(new { IsSuccess = true, AppUserName = loginSession.ApplicationUser.NickName, AppUserId = loginSession.ApplicationUserId }, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { LogHelper.LogError("Login: ", ex); return(Json(new { IsSuccess = false, message = ex.Message }, JsonRequestBehavior.AllowGet)); } }
public async Task <ActionResult> CounterOffer() { var notificationLogic = LogicContext.Create <NotificationLogic>(); DIBZ.Common.Model.Notification notification = new DIBZ.Common.Model.Notification(); NotificationModel notificationModel = new NotificationModel(); //if you want to store some addional data in notification info string Ingame = "Pock"; var data = new { IntrestedUserName = "******", InGame = "Pock" }; notificationModel.AdditionalData = Helpers.GetJson(data); notificationModel.AppUserId = Convert.ToInt32(CurrentLoginSession.ApplicationUserId); //Channel like Android,Ios,Web notificationModel.Channel = 0; notificationModel.Content = "is intrested in your " + Ingame + ""; notificationModel.CreatedTime = DateTime.Now; notificationModel.LastError = ""; notificationModel.OfferId = 4; notificationModel.Status = Convert.ToInt32(DIBZ.Common.Model.NotificationStatus.UnRead); notificationModel.Title = "Counter Intrest"; notificationModel.NotificationType = Convert.ToInt32(DIBZ.Common.Model.NotificationType.Desktop); notificationModel.NotificationBusinessType = Convert.ToInt32(DIBZ.Common.Model.NotificationBusinessType.CounterOffer); //save notification in notification table notification = await notificationLogic.AddNotification(notificationModel); //sent notification to offer creater new DIBZ.Services.ServerNotificationService().CounterOffer(CurrentLoginSession.ApplicationUserId, notification.Id, notificationModel.Content, notificationModel.CreatedTime, notificationModel.AdditionalData); return(this.Json("your counter offer notification has been sent to relevent person", JsonRequestBehavior.AllowGet)); }
public async Task <ActionResult> SearchGames(int currentPage = 1, int formatId = 0, string gameName = "", int categoryId = 0) { SearchOffer SearchGames = new SearchOffer(); SearchGames.GameName = gameName; SearchGames.FormatId = formatId; SearchGames.CategoryId = categoryId; var gameLogic = LogicContext.Create <GameCatalogLogic>(); var searchGamesData = await gameLogic.SearchGameCatalog(CurrentLoginSession.ApplicationUserId.GetValueOrDefault(), SearchGames, currentPage); var searchGamesTotalCount = await gameLogic.SearchGameCatalog(CurrentLoginSession.ApplicationUserId.GetValueOrDefault(), SearchGames, currentPage, true); TempData["searchCount"] = searchGamesTotalCount.Count; TempData["searchGamesData"] = searchGamesData; TempData["currentPage"] = currentPage; TempData["imgpath"] = SearchGames.imgpath; TempData["gameName"] = SearchGames.GameName; TempData["formatId"] = SearchGames.FormatId; TempData["categoryId"] = SearchGames.CategoryId; string view = Request.UrlReferrer.Segments[2]; if (view == "MyGames") { return(RedirectToAction("MyGames", "Offer")); } else { return(RedirectToAction("CreateOffer", "Offer")); } }
protected override void OnActionExecuting(ActionExecutingContext filterContext) { var request = filterContext.RequestContext.HttpContext.Request; string token = null; if (filterContext.ActionParameters.ContainsKey("token")) { token = filterContext.ActionParameters["token"] as string; } else if (Request.Cookies["AuthCookie"] != null) { token = Request.Cookies["AuthCookie"].Value as string; } else if (filterContext.ActionParameters.Count > 0 && filterContext.ActionParameters.Values.First() is RequestWithToken) { var requestWithToken = filterContext.ActionParameters.Values.First() as RequestWithToken; token = requestWithToken.Token; } if (!string.IsNullOrEmpty(token)) { var authLogic = LogicContext.Create <AuthLogic>(); _currentLoginSession = authLogic.GetLoginSessionByToken(token); } base.OnActionExecuting(filterContext); }
public async Task <ActionResult> ReadQR(int id) { var offerLogic = LogicContext.Create <OfferLogic>(); var offerDetail = await offerLogic.GetOfferDetailById(id); return(View(offerDetail)); }
public async Task <ActionResult> ReadQR(int id) { var swapLogic = LogicContext.Create <SwapLogic>(); var swapDetail = await swapLogic.GetSwapDetailById(id); return(View(swapDetail)); }
public async Task <ActionResult> AddTransaction(string offerId, string amount, string counterOfferId) { var transactionLogic = LogicContext.Create <TransactionLogic>(); var offerLogic = LogicContext.Create <OfferLogic>(); try { var offer = await offerLogic.GetOfferById(ConversionHelper.SafeConvertToInt32(offerId)); var x = await transactionLogic.AddTransaction(ConversionHelper.SafeConvertToInt32(offerId), Convert.ToDecimal(amount), CurrentLoginSession.ApplicationUser.Id, offer.Swaps.FirstOrDefault().Id); var isNeedToRedirect = false; if (offer.OfferStatus == OfferStatus.PaymentNeeded && offer.Transactions.Count() == 2) { await new CounterOfferController().AcceptOfferAfterTransactionDone(ConversionHelper.SafeConvertToInt32(counterOfferId)); isNeedToRedirect = true; } if (x > 0) { return(Json(new { IsSuccess = true, IsNeedToRedirect = isNeedToRedirect }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { IsSuccess = false, fail = "Some Thing Wrong!" }, JsonRequestBehavior.AllowGet)); } } catch (Exception lex) { return(Json(new { IsSuccess = false, fail = lex.Message }, JsonRequestBehavior.AllowGet)); } }
public async Task <ActionResult> OfferDetail(int id) { var swapLogic = LogicContext.Create <SwapLogic>(); //DIBZ.Common.Model.ApplicationUser appUser = new DIBZ.Common.Model.ApplicationUser(); var authLogic = LogicContext.Create <AuthLogic>(); var swapStatusOfferer = await swapLogic.GetSwapById(id, "Offerer"); var swapStatusSwapper = await swapLogic.GetSwapById(id, "Swapper"); ViewBag.SwapStatusOfferer = swapStatusOfferer.SwapStatus == SwapStatus.Accepted ? "Awaiting Payment" : swapStatusOfferer.SwapStatus.ToString().Replace("_", " "); ViewBag.SwapStatusSwapper = swapStatusSwapper.SwapStatus == SwapStatus.Accepted ? "Awaiting Payment" : swapStatusSwapper.SwapStatus.ToString().Replace("_", " "); var swapStatus = (swapStatusOfferer.Offer.Transactions.Count == 2 && (swapStatusOfferer.SwapStatus == SwapStatus.Payment_Done_By_Offerer || swapStatusOfferer.SwapStatus == SwapStatus.Payment_Done_By_Swapper)) ? SwapStatus.Payment_Successful : swapStatusOfferer.SwapStatus; ViewBag.SwapStatus = swapStatus.ToString().Replace("_", " "); ViewBag.Login = CurrentLoginSession.ApplicationUserId.GetValueOrDefault() == swapStatusOfferer.GameSwapPsersonId ? "Swapper" : "Offerer"; DIBZ.Common.Model.Offer offer = new DIBZ.Common.Model.Offer(); var offerLogic = LogicContext.Create <OfferLogic>(); if (id > 0) { offer = await offerLogic.GetOfferById(id); var appUser = authLogic.GetUserById(swapStatusOfferer.GameSwapPsersonId); ViewBag.SwapWith = appUser.NickName.ToString(); return(View(offer)); } return(RedirectToAction("Index", "Myprofile")); }
public async Task <ActionResult> Index(int formatId = 0) { var formatLogic = LogicContext.Create <FormatLogic>(); ViewBag.Formats = await formatLogic.GetAllFormats(); var bannerLogic = LogicContext.Create <BannerLogic>(); ViewBag.BannerImage = await bannerLogic.GetAllBannerImage(); //string userType = System.Web.Configuration.WebConfigurationManager.AppSettings["User"]; //if (userType == "Admin") //{ // return this.Redirect("/Admin/Login"); //} ViewData["Error"] = TempData["Error"]; LogHelper.LogInfo("Fetching dashboard data"); var gameCatalogLogic = LogicContext.Create <GameCatalogLogic>(); //get all GamesCatalog var gameCatalogs = await gameCatalogLogic.GetAllFeaturedGames(); if (TempData["searchOfferData"] != null) { ViewBag.Offers = TempData["searchOfferData"]; TempData["searchOfferData"] = null; } else { var offerLogic = LogicContext.Create <OfferLogic>(); ViewBag.Offers = await offerLogic.GetAllOfferForDashboard(formatId); } return(View(gameCatalogs)); }
public async Task <ActionResult> CreateDeal(int id) { var counterOfferLogic = LogicContext.Create <CounterOfferLogic>(); var counterOffersData = await counterOfferLogic.CreateDeal(id); return(RedirectToAction("Index", "Dashboard")); }
public ActionResult SaveProfileImage(HttpPostedFileBase file) { var authLogic = LogicContext.Create <AuthLogic>(); try { var serverPath = Server.MapPath("~/Uploads"); string profileImageName = string.Empty; if (file != null) { profileImageName = file.FileName; } var appUser = authLogic.EditProfileImage(CurrentLoginSession.ApplicationUserId.GetValueOrDefault(), profileImageName); if (appUser != null) { var savePathBackgroundImage = Path.Combine(serverPath, appUser.ProfileImage.Id.ToString()); if (file != null) { file.SaveAs(savePathBackgroundImage); } return(Json(new { IsSuccess = true }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { IsSuccess = false, fail = "Some Thing Wrong!" }, JsonRequestBehavior.AllowGet)); } } catch (Exception lex) { return(Json(new { IsSuccess = false, fail = lex.Message }, JsonRequestBehavior.AllowGet)); } }
public ActionResult GetMyQueryDetailByMyQueryIdForAdmin(int id) { var spqueryLogic = LogicContext.Create <SupportQueryLogic>(); var UserQueries = spqueryLogic.GetQueryDetailById(id); return(PartialView("~/Areas/Admin/Views/AppUserQueries/_UserQueriesPartial.cshtml", UserQueries)); }
public ActionResult GetDibzCharges(string gameOwned, string gameDesired, string retailPrice, string creditValue, string cashValue) { var chargesLogic = LogicContext.Create <DibzChargesLogic>(); try { var chargesData = chargesLogic.GetAllDibzChargesData(); decimal savingCNV = 0; decimal savingCAV = 0; var dibzCharges = chargesData.Result[0].Charges; var result = ""; var error = ""; if (dibzCharges != "") { //if(creditValue != "" && cashValue == "") if (creditValue != "") { savingCNV = (Convert.ToDecimal(retailPrice) - Convert.ToDecimal(creditValue) - Convert.ToDecimal(dibzCharges)); if (savingCNV > 0) { result = "Good news! By using DIBZ you could save £" + String.Format("{0:0.00}", savingCNV) + " instead of using a credit note for your game to purchase " + gameDesired + ". <br /><br />"; } else { result = "Unfortunately, it is cheaper to use a credit note value for your game to purchase " + gameDesired + ". Thank you for your custom. <br /><br />"; } } // else if (cashValue != "" && creditValue == "") if (cashValue != "") { savingCAV = (Convert.ToDecimal(retailPrice) - Convert.ToDecimal(cashValue) - Convert.ToDecimal(dibzCharges)); if (savingCAV > 0) { result += "Good news! By using DIBZ you could save £" + String.Format("{0:0.00}", savingCAV) + " instead of trading in your game for cash to purchase " + gameDesired + "."; } else { result += "Unfortunately, it is cheaper to use a cash for your game to purchase " + gameDesired + ". Thank you for your custom."; } } //else //{ // error = "Please enter credit note value or cash value"; // return Json(new { IsSuccess = false, fail = error, Result = result }, JsonRequestBehavior.AllowGet); //} return(Json(new { IsSuccess = true, Result = result }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { IsSuccess = false, fail = "Some Thing Wrong dibz charges not found!" }, JsonRequestBehavior.AllowGet)); } } catch (Exception lex) { return(Json(new { IsSuccess = false, fail = lex.Message }, JsonRequestBehavior.AllowGet)); } }
public async Task <ActionResult> SendForgotPasswordEmailNotification(string emailAddress) { DIBZ.Common.Model.ApplicationUser appUser = new DIBZ.Common.Model.ApplicationUser(); var authLogic = LogicContext.Create <AuthLogic>(); var result = authLogic.GetApplicationUserByEmail(emailAddress); if (result != null) { EmailTemplateHelper templates = new EmailTemplateHelper(); EmailTemplateResponse emailTemplateResponse = new EmailTemplateResponse(); DIBZ.Common.Model.EmailNotification email = new DIBZ.Common.Model.EmailNotification(); var emailTemplateLogic = LogicContext.Create <EmailTemplateLogic>(); emailTemplateResponse = await emailTemplateLogic.GetEmailTemplate(EmailType.Email, EmailContentType.ForgotPassword); templates.AddParam(DIBZ.Common.Model.Contants.AppUserNickName, result.NickName); templates.AddParam(DIBZ.Common.Model.Contants.ForgotPassword, string.Format("<a href='{0}'>Here</a>", string.Concat(Request.Url.AbsoluteUri.Substring(0, Request.Url.AbsoluteUri.LastIndexOf("/") + 1), "ChangePassword?id=" + result.Id))); templates.AddParam(DIBZ.Common.Model.Contants.UrlContactUs, string.Format("<a href='{0}'>link</a>", hostName + "/Dashboard/ContactUs")); var emailBody = templates.FillTemplate(emailTemplateResponse.Body); //save email data in table await emailTemplateLogic.SaveEmailNotification(result.Email, emailTemplateResponse.Title, emailBody, EmailType.Email, Priority.High); EmailHelper.Email(result.Email, emailTemplateResponse.Title, emailBody); return(Json(new { IsSuccess = true }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { IsSuccess = false, fail = "some thing wrong" }, JsonRequestBehavior.AllowGet)); } }
public async Task <ActionResult> MyGames(int currentPage = 1, string searchGame = "", int formatId = 0, int categoryId = 0) { var offerlogic = LogicContext.Create <OfferLogic>(); var gameCatalogLogic = LogicContext.Create <GameCatalogLogic>(); var myGames = await gameCatalogLogic.GetAllGamesOfApplicationUser(CurrentLoginSession.ApplicationUserId.GetValueOrDefault()); var pageSize = Convert.ToInt16(PageSize.AllGames); if (TempData["searchGamesData"] != null) { currentPage = Convert.ToInt16(TempData["currentPage"]); var searchCount = Convert.ToInt32(TempData["searchCount"]); var Pages = offerlogic.PagingLogic(currentPage - 1, pageSize, searchCount); ViewBag.Pages = Pages; ViewBag.FormatId = TempData["formatId"]; ViewBag.CategoryId = TempData["categoryId"]; ViewBag.GameName = TempData["gameName"]; ViewBag.GameCollection = TempData["searchGamesData"]; ViewBag.SelectedPage = currentPage; ViewBag.pageSize = pageSize; ViewBag.CurrentPage = currentPage; } else { SearchOffer Search = new SearchOffer(); Search.GameName = searchGame; Search.FormatId = formatId; Search.CategoryId = categoryId; //var currentPage = selectedPage; var countAllGames = await gameCatalogLogic.SearchGameCatalog(CurrentLoginSession.ApplicationUserId.GetValueOrDefault(), Search, currentPage, true); var totalCount = Convert.ToInt32(countAllGames.Count); var Pages = offerlogic.PagingLogic(currentPage, pageSize, totalCount); ViewBag.Pages = Pages; ViewBag.FormatId = 0; ViewBag.CategoryId = 0; ViewBag.GameName = ""; ViewBag.GameCollection = await gameCatalogLogic.SearchGameCatalog(CurrentLoginSession.ApplicationUserId.GetValueOrDefault(), Search, currentPage, false); ViewBag.SelectedPage = currentPage; ViewBag.pageSize = pageSize; ViewBag.CurrentPage = currentPage; } var formatLogic = LogicContext.Create <FormatLogic>(); var formats = await formatLogic.GetAllFormats(); ViewBag.Formats = new SelectList(formats, "Id", "Name"); var categoryLogic = LogicContext.Create <CategoryLogic>(); var categories = await categoryLogic.GetAllCategories(); ViewBag.Categories = new SelectList(categories, "Id", "Name"); return(View(myGames)); }
public async Task <ActionResult> Delete(int id) { if (id > 0) { var spqueryLogic = LogicContext.Create <SupportQueryLogic>(); await spqueryLogic.DeleteForAdmin(id); } return(RedirectToAction("UserQueries", "AppUserQueries")); }
// public ActionResult Index() public async Task <ActionResult> Index() { //var competitionLogic = LogicContext.Create<CompetitionLogic>(); var competitionLogic = LogicContext.Create <CompetitionLogic>(); ViewBag.CompetitionData = await competitionLogic.GetAllCompetitionData(); return(View()); }
public async Task <ActionResult> ViewGamerDetail(int id) { DIBZ.Common.Model.ApplicationUser appUser = new DIBZ.Common.Model.ApplicationUser(); var authLogic = LogicContext.Create <AuthLogic>(); appUser = await authLogic.GetAppUserWithScorecardById(id); return(Json(new { IsSuccess = true, GamerNickName = appUser.NickName, GamerImageId = (appUser.ProfileImageId.HasValue) ? appUser.ProfileImageId.Value : 0, Proposal = appUser.Scorecard.Proposals, NoShows = appUser.Scorecard.NoShows, GamesSent = appUser.Scorecard.GamesSent, TestFail = appUser.Scorecard.TestFails, TestPass = appUser.Scorecard.TestPass, DIBz = appUser.Scorecard.DIBz }, JsonRequestBehavior.AllowGet)); }