public bool RenewalPayment(RenewalViewModel renewalViewModel) { using (var con = new SqlConnection(_configuration.GetConnectionString("DatabaseConnection"))) { con.Open(); var sqlTransaction = con.BeginTransaction(); var paramater = new DynamicParameters(); paramater.Add("@PaymentID", 0); paramater.Add("@PlanID", renewalViewModel.PlanID); paramater.Add("@WorkouttypeID", renewalViewModel.SchemeID); paramater.Add("@Paymenttype", "Cash"); paramater.Add("@PaymentFromdt", renewalViewModel.NextRenwalDate); paramater.Add("@PaymentAmount", renewalViewModel.Amount); paramater.Add("@CreateUserID", renewalViewModel.Createdby); paramater.Add("@ModifyUserID", renewalViewModel.Createdby); paramater.Add("@RecStatus", "A"); paramater.Add("@MemberID", renewalViewModel.MemberId); paramater.Add("@PaymentIDOUT", dbType: DbType.Int32, direction: ParameterDirection.Output); int resultPayment = con.Execute("sprocPaymentDetailsInsertUpdateSingleItem", paramater, sqlTransaction, 0, CommandType.StoredProcedure); if (resultPayment > 0) { sqlTransaction.Commit(); int paymentId = paramater.Get <int>("PaymentIDOUT"); return(true); } else { sqlTransaction.Rollback(); return(false); } } }
public IActionResult Post([FromBody] RenewalViewModel renewalViewModel) { if (_renewal.CheckRenewalPaymentExists(renewalViewModel.NewDate, renewalViewModel.MemberId)) { return(BadRequest("Already Renewed"));//ReasonPhrase } else { int cmp = renewalViewModel.NewDate.CompareTo(renewalViewModel.NextRenwalDate); var userId = this.User.FindFirstValue(ClaimTypes.Name); if (cmp > 0) { var months = _planMaster.GetPlanMonthbyPlanId(renewalViewModel.PlanID); var calculatedNextRenewalDate = renewalViewModel.NewDate.AddMonths(months).AddDays(-1); renewalViewModel.NextRenwalDate = calculatedNextRenewalDate; renewalViewModel.Createdby = Convert.ToInt32(userId); if (_paymentDetails.RenewalPayment(renewalViewModel)) { return(Ok("Renewed Successfully")); } else { return(BadRequest("Renewal Failed")); //HttpStatusCode.InternalServerError } } if (cmp < 0) { return(BadRequest("Invalid Date")); } } return(BadRequest("Something went wrong")); }
public ActionResult KeepLocked(int id) { RenewalViewModel model = new RenewalViewModel(); model.LockRenewal(id, BHIP.Model.Helper.Security.GetLoggedInUserID()); return(Json(new { success = true })); }
public ActionResult RefreshContact(int id) { RenewalViewModel model = new RenewalViewModel(); ContactScheduleHoldViewModel hold = new ContactScheduleHoldViewModel(); return(PartialView("_ContactScheduleHoldGrid", hold.GetAllContactScheduleHolds(model.GetMemberCoverageID(id)))); }
public ActionResult Unlock(int id) { RenewalViewModel model = new RenewalViewModel(); model.UnlockRenewal(id); return(Json(new { success = true }, JsonRequestBehavior.AllowGet)); }
public ActionResult SaveRenewal(RenewalViewModel model) { model.SaveRenewal(model); model.SaveQuestions(model); model.SaveInspectionBody(model.InspectionBodyGrid, model.RenewalID); model.SaveHandleFunds(model.HandleFundsGrid, model.RenewalID); return(Json(new { success = true })); }
public ActionResult RenewalFUT() { HttpResponseMessage response = null; RenewalViewModel modelReturnJSON = null; RenewalViewModel hallOfFameMode = new RenewalViewModel(); setViewBagVariables(); try { hallOfFameMode.actionUser = "******"; hallOfFameMode.seasonID = 0; hallOfFameMode.renewalMode = "FUT"; hallOfFameMode.championshipIDRenewal = ConfigurationManager.AppSettings["renewal.fut.id"].ToString(); hallOfFameMode.championshipIDBenchRenewal = ConfigurationManager.AppSettings["renewal.fut.id.bench"].ToString(); hallOfFameMode.championshipIDRenewalWorldCupUefaEuro = String.Empty; hallOfFameMode.totalLimitBlackList = Convert.ToInt16(ConfigurationManager.AppSettings["renewal.total.limit.blackList"].ToString()); hallOfFameMode.totalLimitBanWorldCupUefaEuro = 0; hallOfFameMode.dataBaseName = GlobalVariables.DATABASE_NAME_STAGING; response = GlobalVariables.WebApiClient.PostAsJsonAsync("HallOfFame", hallOfFameMode).Result; modelReturnJSON = response.Content.ReadAsAsync <RenewalViewModel>().Result; switch (response.StatusCode) { case HttpStatusCode.Created: if (modelReturnJSON.returnMessage == "HallOfFameSuccessfully") { return(View(modelReturnJSON)); } else { //ModelState.AddModelError("", "Senha Atual inválida! Favor tentar novamente."); TempData["returnMessage"] = "Some error occurred when the system was trying to show the view - FUT Renewal. (" + modelReturnJSON.returnMessage + ")"; return(View(hallOfFameMode)); } default: TempData["returnMessage"] = "Some error occurred when the system was trying to show the view - FUT Renewal. (" + response.StatusCode + ")"; ModelState.AddModelError("", "application error."); return(View(hallOfFameMode)); } } catch (Exception ex) { TempData["returnMessage"] = "Internal error - when the system was trying to show the view - FUT Renewal: (" + ex.Message + ")"; ModelState.AddModelError("", "application error."); return(View(hallOfFameMode)); } finally { response = null; modelReturnJSON = null; hallOfFameMode = null; } }
// GET: HallOfFame/RenewalPRO public ActionResult RenewalPRO() { HttpResponseMessage response = null; RenewalViewModel modelReturnJSON = null; RenewalViewModel hallOfFameMode = new RenewalViewModel(); setViewBagVariables(); try { hallOfFameMode.actionUser = "******"; hallOfFameMode.seasonID = 0; hallOfFameMode.renewalMode = "PRO"; hallOfFameMode.championshipIDRenewal = ConfigurationManager.AppSettings["renewal.pro.id"].ToString(); hallOfFameMode.championshipIDBenchRenewal = ConfigurationManager.AppSettings["renewal.pro.id.bench"].ToString(); hallOfFameMode.championshipIDRenewalWorldCupUefaEuro = String.Empty; hallOfFameMode.totalLimitBlackList = Convert.ToInt16(ConfigurationManager.AppSettings["renewal.total.limit.blackList"].ToString()); hallOfFameMode.totalLimitBanWorldCupUefaEuro = 0; response = GlobalVariables.WebApiClient.PostAsJsonAsync("HallOfFame", hallOfFameMode).Result; modelReturnJSON = response.Content.ReadAsAsync <RenewalViewModel>().Result; switch (response.StatusCode) { case HttpStatusCode.Created: if (modelReturnJSON.returnMessage == "HallOfFameSuccessfully") { return(View(modelReturnJSON)); } else { //ModelState.AddModelError("", "Senha Atual inválida! Favor tentar novamente."); TempData["returnMessage"] = "Ocorreu algum erro na exibição do Hall da Fama - Renovações PRO. (" + modelReturnJSON.returnMessage + ")"; return(View(hallOfFameMode)); } default: TempData["returnMessage"] = "Ocorreu algum erro na exibição do Hall da Fama - Renovações PRO. (" + response.StatusCode + ")"; ModelState.AddModelError("", "application error."); return(View(hallOfFameMode)); } } catch (Exception ex) { TempData["returnMessage"] = "Erro interno - Exibindo Hall da Fama - Renovações PRO: (" + ex.InnerException.Message + ")"; ModelState.AddModelError("", "application error."); return(View(hallOfFameMode)); } finally { response = null; modelReturnJSON = null; hallOfFameMode = null; } }
public async Task <IActionResult> Renewal(RenewalViewModel renewalViewModel) { var user = await _userManager.GetAsync(renewalViewModel.UserId); if (user == null) { return(NotFound()); } return(GenerateToken(user)); }
public List <RenewalViewModel> getRenewalInfo(int bonderSlNo) { RenewalViewModel renewalviewmodel = new RenewalViewModel(); renewalviewmodel.Bondstatus = db.BONDSTATUS.Where(y => y.BONDERSLNO == bonderSlNo).ToList(); renewalviewmodel.Bonder = db.BONDERs.Where(x => x.BONDERSLNO == bonderSlNo).ToList(); renewalviewmodel.DocumentAttachments = db.DOCUMENTATTACHMENTs.Where(x => x.BONDERSLNO == bonderSlNo).ToList(); List <RenewalViewModel> viewModelList = new List <RenewalViewModel>(); viewModelList.Add(renewalviewmodel); return(viewModelList); }
public ActionResult SubmitRenewal(int id) { string ip = Request.UserHostAddress; string userAgent = Request.UserAgent; RenewalViewModel model = new RenewalViewModel(); if (model.SubmitRenewal(id, BHIP.Model.Helper.Security.GetUserName(), ip, userAgent)) { EmailSystem objEmail = new EmailSystem(); if (WebConfigurationManager.AppSettings["EmailSystem"] == "Testing") { objEmail.EmailIt(objEmail.RenderViewToString(this.ControllerContext, "_Email", null), "*****@*****.**", "*****@*****.**", "*****@*****.**", BHIP.Model.ProjectGlobals.NextYear.ToString() + " Renewal Application - " + BHIP.Model.Helper.MemberInformation.GetMemberNameByRenewalID(id), null); } else { objEmail.EmailIt(objEmail.RenderViewToString(this.ControllerContext, "_Email", null), "*****@*****.**", BHIP.Model.Helper.MemberInformation.GetAuthorizeRepEmail(BHIP.Model.Helper.MemberInformation.GetMemberCoverageIDByRenewalID(id)) + "; " + BHIP.Model.Helper.MemberInformation.GetContactEmail(BHIP.Model.Helper.MemberInformation.GetMemberCoverageIDByRenewalID(id)), "*****@*****.**", BHIP.Model.ProjectGlobals.NextYear.ToString() + " Renewal Application - " + BHIP.Model.Helper.MemberInformation.GetMemberNameByRenewalID(id), null); } } return(Json(new { success = true })); }
public bool RenewalPayment(RenewalViewModel renewalViewModel) { var result = new PaymentDetails() { PaymentAmount = _context.PaymentDetails.Where(p => p.PaymentID == renewalViewModel.PaymentID).FirstOrDefault().PaymentAmount, MemberID = renewalViewModel.MemberId, MemberNo = renewalViewModel.MemberNo, PaymentFromdt = renewalViewModel.NewDate, }; int time = Convert.ToInt32(_context.PeriodTb.Where(p => p.PeriodID == (_context.PlanMaster.Where(c => c.PlanID == renewalViewModel.PlanID).FirstOrDefault().PeriodID)).FirstOrDefault().Value.ToString()); result.PaymentTodt = renewalViewModel.NewDate.AddMonths(time); result.NextRenwalDate = renewalViewModel.NewDate.AddMonths(time).AddDays(1); var res = _context.PaymentDetails.Add(result).Entity; _context.SaveChanges(); if (res.PaymentID > 0) { return(true); } return(false); }
public HttpResponseMessage Post([FromBody] RenewalViewModel renewalViewModel) { if (_renewal.CheckRenewalPaymentExists(renewalViewModel.NewDate, renewalViewModel.MemberId)) { var response = new HttpResponseMessage() { StatusCode = HttpStatusCode.BadRequest, ReasonPhrase = "Already Renewed" }; return(response); } else { int cmp = renewalViewModel.NewDate.CompareTo(renewalViewModel.NextRenwalDate); var userId = this.User.FindFirstValue(ClaimTypes.Name); if (cmp > 0) { var months = _planMaster.GetPlanMonthbyPlanId(renewalViewModel.PlanID); var calculatedNextRenewalDate = renewalViewModel.NewDate.AddMonths(months).AddDays(-1); renewalViewModel.NextRenwalDate = calculatedNextRenewalDate; renewalViewModel.Createdby = Convert.ToInt32(userId); if (_paymentDetails.RenewalPayment(renewalViewModel)) { var response = new HttpResponseMessage() { StatusCode = HttpStatusCode.OK, ReasonPhrase = "Renewed Successfully" }; return(response); } else { var response = new HttpResponseMessage() { StatusCode = HttpStatusCode.InternalServerError, ReasonPhrase = "Renewal Failed" }; return(response); } } if (cmp < 0) { var response = new HttpResponseMessage() { StatusCode = HttpStatusCode.BadRequest, Content = new StringContent("Invalid Date") }; return(response); } } var responseMessage = new HttpResponseMessage() { StatusCode = HttpStatusCode.BadRequest, Content = new StringContent("Something went wrong") }; return(responseMessage); }
// GET: Renewal public ActionResult Index(int id = 0) { int renewalId = 0; HttpContext.Server.ScriptTimeout = 60; if (id == 0) { id = BHIP.Model.Helper.Security.GetMemberID(); } RenewalViewModel model = new RenewalViewModel(id); PropertyViewModel propertyModel = new PropertyViewModel(); VehicleScheduleViewModel vehicleModel = new VehicleScheduleViewModel(); DriverInfoViewModel driverModel = new DriverInfoViewModel(); DocumentViewModel docModel = new DocumentViewModel(); if (model.CheckRenewalExists(id)) { model.GetRenewalRecord(id, model.GetMemberCoverageID(id)); if (model.IsLocked(model.RenewalID, BHIP.Model.Helper.Security.GetLoggedInUserID())) { Response.Redirect("/Renewal/Locked"); } else { model.LockRenewal(model.RenewalID, BHIP.Model.Helper.Security.GetLoggedInUserID()); } model.MemberCoverageID = model.GetMemberCoverageID(id); model.TotalBuilding = propertyModel.TotalBuildingValue(model.GetMemberCoverageID(id)); model.TotalContent = propertyModel.TotalContentValue(model.GetMemberCoverageID(id)); model.TotalFootage = propertyModel.TotalSquareFeet(model.GetMemberCoverageID(id)); model.InspectionBodyGrid = model.GetInpsectionBody(model.RenewalID); model.HandleFundsGrid = model.GetHandleFunds(model.RenewalID); model.Attachments = docModel.GetDocuments(model.RenewalID); if (model.TotalFootage > 0) { model.CostSquareFoot = (model.TotalBuilding + model.TotalContent) / model.TotalFootage; } else { model.CostSquareFoot = 0; } model.TotalInsurable = model.TotalBuilding + model.TotalContent; } else { if (id > 0) { renewalId = model.CreateRenewalRecord(id); model.MemberCoverageID = model.GetMemberCoverageID(id); model.GetRenewalRecord(id, model.GetMemberCoverageID(id)); model.InitializeQuestions(renewalId, id); model.InspectionBodyGrid = model.GetInpsectionBody(0); model.HandleFundsGrid = model.GetHandleFunds(0); model.TotalAutos = vehicleModel.TotalAutos(model.GetMemberCoverageID(id)); model.TotalDrivers = driverModel.TotalDrivers(model.GetMemberCoverageID(id)); model.TotalBuilding = propertyModel.TotalBuildingValue(model.GetMemberCoverageID(id)); model.TotalContent = propertyModel.TotalContentValue(model.GetMemberCoverageID(id)); model.TotalFootage = propertyModel.TotalSquareFeet(model.GetMemberCoverageID(id)); if (model.TotalFootage > 0) { model.CostSquareFoot = (model.TotalBuilding + model.TotalContent) / model.TotalFootage; } else { model.CostSquareFoot = 0; } model.TotalInsurable = model.TotalBuilding + model.TotalContent; model.Attachments = new DocumentViewModel[0]; } else { model.MemberID = id; model.ContactList = new ContactScheduleViewModel[0]; model.ContactHoldList = new ContactScheduleHoldViewModel[0]; model.LicenseList = new LicenseViewModel[0]; model.AgencyPlanList = new AgencyPlanViewModel[0]; model.HandleFundsGrid = model.GetHandleFunds(0); model.InspectionBodyGrid = model.GetInpsectionBody(0); model.PsychiatryList = new PsychiatryViewModel[0]; model.PsychiatryHoldList = new PsychiatryScheduleHoldViewModel[0]; model.PrimaryCareList = new PrimaryCareViewModel[0]; model.PrimaryCareHoldList = new PrimaryCareHoldViewModel[0]; model.VehicleList = new VehicleScheduleViewModel[0]; model.VehicleHoldList = new VehicleScheduleHoldViewModel[0]; model.DriverInfoList = new DriverInfoViewModel[0]; model.DriverInfoHoldList = new DriverInfoHoldViewModel[0]; model.PropertyList = new PropertyViewModel[0]; model.PropertyHoldList = new PropertyScheduleHoldViewModel[0]; model.Attachments = new DocumentViewModel[0]; } } if (model.Submitted == true && User.IsInRole("Administrator") != true) { model.IsRenewLocked = true; } model.UserRoles = model.GetUserRoles(); return(View(model)); }
public ActionResult Renewinfo(RenewalViewModel rvm, string[] doc, string[] rgno, string[] issuedate, string[] expdate, HttpPostedFileBase[] files) { System.Data.OracleClient.OracleCommand cmd = new System.Data.OracleClient.OracleCommand(); System.Data.OracleClient.OracleConnection conn = ConnectBMS.Connection(); cmd.Connection = conn; System.Data.OracleClient.OracleTransaction bmsTransaction = conn.BeginTransaction(); cmd.Transaction = bmsTransaction; cmd.CommandText = "update BONDSTATUS set STATUS=:STATUS,BSDATE=:BSDATE,SUBMITTEDBYNM=:SUBMITTEDBYNM,REMARKS=:REMARKS" + " where BONDERSLNO=:BONDERSLNO"; cmd.Parameters.Clear(); cmd.Parameters.AddWithValue("STATUS", Request["STATUS"]); if (!String.IsNullOrEmpty(Request["ApplicationSubmissionDate"])) { cmd.Parameters.Add(new OracleParameter(":BSDATE", OracleType.DateTime)).Value = Request["ApplicationSubmissionDate"]; } else { cmd.Parameters.Add(new OracleParameter(":BSDATE", OracleType.DateTime)).Value = DBNull.Value; } cmd.Parameters.AddWithValue("SUBMITTEDBYNM", Request["SubmittedBy"]); cmd.Parameters.AddWithValue("REMARKS", Request["Remarks"]); cmd.Parameters.AddWithValue("BONDERSLNO", BondInfo.bondSlNoToRenew); try { try { bmsTransaction = conn.BeginTransaction(); } catch { } cmd.Transaction = bmsTransaction; cmd.ExecuteNonQuery(); bmsTransaction.Commit(); } catch { bmsTransaction.Rollback(); } if (Request["STATUS"] == "Cm") { cmd.CommandText = "update BONDAPPLICATIONPROGRESS set READYFORAPP=:READYFORAPP where BONDERSLNO=:BONDERSLNO and BSNO=:BSNO"; cmd.Parameters.Clear(); cmd.Parameters.AddWithValue("BONDERSLNO", BondInfo.bondSlNoToRenew); cmd.Parameters.AddWithValue("BSNO", BondInfo.BSNoToRenew); cmd.Parameters.AddWithValue("READYFORAPP", "Y"); try { try { bmsTransaction = conn.BeginTransaction(); } catch { } cmd.Transaction = bmsTransaction; cmd.ExecuteNonQuery(); bmsTransaction.Commit(); } catch { bmsTransaction.Rollback(); } } int p = 1; if (doc != null) { try { for (int i = 0; i < doc.Length; i++) { if (doc[i] != null && doc[i] != "") { DOCUMENTATTACHMENT D = new DOCUMENTATTACHMENT(); var path = ""; D.ATTCHSLNO = (Int16)p; //foreach (var outitem in rvm) //{ // foreach (var item in outitem.Bonder) // { D.BONDERSLNO = BondInfo.bondSlNoToRenew; //} //foreach (var item in outitem.Bondstatus) //{ D.BSNO = BondInfo.BSNoToRenew; // } //} if (files[i] != null) { var filename = Path.GetFileName(files[i].FileName); path = Path.Combine(Server.MapPath(Url.Content("~/Uploads/")), filename); files[i].SaveAs(path); D.ATTACHFILENM = path; } D.DOCHEADINGNAME = doc[i]; D.RGATTCHNAME = rgno[i]; //D.ISSUEDATE = Convert.ToDateTime(issuedate[i], CultureInfo.CurrentCulture); //D.EXPDATE = Convert.ToDateTime(expdate[i], CultureInfo.CurrentCulture); if (!String.IsNullOrEmpty(issuedate[i])) { D.ISSUEDATE = DateTime.ParseExact(issuedate[i], "dd/MM/yyyy", null); } if (!String.IsNullOrEmpty(expdate[i])) { D.EXPDATE = DateTime.ParseExact(expdate[i], "dd/MM/yyyy", null); } db.DOCUMENTATTACHMENTs.Add(D); p++; db.SaveChanges(); } } ViewBag.Message = "Successfully Inserted"; //return View(renewalviewmodel); //return Search(BIMS.CommonAppSet.BondInfo.bondLicenseNoToRenew); //return View("Search",rvm); //return View("RenewalForm"); } catch (DbEntityValidationException dbEx) { foreach (var validationErrors in dbEx.EntityValidationErrors) { foreach (var validationError in validationErrors.ValidationErrors) { System.Console.WriteLine("Property: {0} Error: {1}", validationError.PropertyName, validationError.ErrorMessage); } } ViewBag.Message = "Insertion Failed"; return(View("RenewalForm")); } } cmd.CommandText = "select STATUS,BSDATE,SUBMITTEDBYNM,REMARKS from BONDSTATUS where BONDERSLNO=:BONDERSLNO"; cmd.Parameters.Clear(); cmd.Parameters.AddWithValue("BONDERSLNO", BondInfo.bondSlNoToRenew); System.Data.OracleClient.OracleDataReader drBondStatus = cmd.ExecuteReader(); if (drBondStatus.HasRows) { drBondStatus.Read(); ViewBag.STATUS = drBondStatus.GetValue(0); ViewBag.BSDATE = drBondStatus.GetValue(1); ViewBag.SUBMITTEDBYNM = drBondStatus.GetValue(2); ViewBag.REMARKS = drBondStatus.GetValue(3); } return(View("Search", getRenewalInfo(BondInfo.bondSlNoToRenew))); //return View("RenewalForm"); }
public IHttpActionResult hallOfFame(HallOfFameSummaryViewModel model) { if (String.IsNullOrEmpty(model.dataBaseName)) { model.dataBaseName = GlobalVariables.DATABASE_NAME_ONLINE; } db.openConnection(model.dataBaseName); DataTable dt = null; string returnMessage = String.Empty; try { if (model.actionUser == "summary") { paramName = new string[] { }; paramValue = new string[] { }; dt = db.executePROC("spGetSummaryHallOfFame", paramName, paramValue); model.psnIDSerieAH2H = dt.Rows[0]["psnIDH2HChampion"].ToString(); model.teamIDSerieAH2H = dt.Rows[0]["teamNameH2HChampion"].ToString(); model.psnIDSerieAFUT = dt.Rows[0]["psnIDFUTChampion"].ToString(); model.teamIDSerieAFUT = dt.Rows[0]["teamNameFUTChampion"].ToString(); model.psnIDSerieAPRO = dt.Rows[0]["psnIDPROChampion"].ToString(); model.teamIDSerieAPRO = dt.Rows[0]["teamNamePROChampion"].ToString(); model.psnIDCDM = dt.Rows[0]["psnIDCDMChampion"].ToString(); model.teamIDCDM = dt.Rows[0]["teamNameCDMChampion"].ToString(); model.psnIDUCL = dt.Rows[0]["psnIDUCLChampion"].ToString(); model.teamIDUCL = dt.Rows[0]["teamNameUCLChampion"].ToString(); model.psnIDSCP = dt.Rows[0]["psnIDSCPChampion"].ToString(); model.teamIDSCP = dt.Rows[0]["teamNameSCPChampion"].ToString(); model.returnMessage = "HallOfFameSuccessfully"; return(CreatedAtRoute("DefaultApi", new { id = 0 }, model)); } else if (model.actionUser == "championshipScoring") { paramName = new string[] { }; paramValue = new string[] { }; dt = db.executePROC("spGetAllCampeonatosScoring", paramName, paramValue); ChampionshipScoreViewModel championshipScoring = new ChampionshipScoreViewModel(); ChampionshipTypeModel championshipType = new ChampionshipTypeModel(); List <ChampionshipTypeModel> listOfChampionship = new List <ChampionshipTypeModel>(); try { for (var i = 0; i < dt.Rows.Count; i++) { championshipType = new ChampionshipTypeModel(); championshipType.championshipType = dt.Rows[i]["SG_TIPO_CAMPEONATO"].ToString(); championshipType.scoreChampion = Convert.ToInt16(dt.Rows[i]["PT_CAMPEAO"].ToString()); championshipType.scoreVice = Convert.ToInt16(dt.Rows[i]["PT_VICECAMPEAO"].ToString()); championshipType.scoreSemi = Convert.ToInt16(dt.Rows[i]["PT_SEMIS"].ToString()); championshipType.scoreQuarter = Convert.ToInt16(dt.Rows[i]["PT_QUARTAS"].ToString()); championshipType.scoreRound16 = Convert.ToInt16(dt.Rows[i]["PT_OITAVAS"].ToString()); championshipType.scoreQualifyNextStage = Convert.ToInt16(dt.Rows[i]["PT_CLASSIF_FASE2"].ToString()); championshipType.scoreWins = Convert.ToInt16(dt.Rows[i]["PT_VITORIAS_FASE1"].ToString()); championshipType.scoreDraws = Convert.ToInt16(dt.Rows[i]["PT_EMPATES_FASE1"].ToString()); championshipType.score2ndStage = Convert.ToInt16(dt.Rows[i]["PT_FASE2"].ToString()); listOfChampionship.Add(championshipType); } championshipScoring.listChampionshipScore = listOfChampionship; championshipScoring.returnMessage = "HallOfFameSuccessfully"; return(CreatedAtRoute("DefaultApi", new { id = 0 }, championshipScoring)); } catch (Exception ex) { championshipScoring = new ChampionshipScoreViewModel(); model.returnMessage = "error_" + ex.Message; return(CreatedAtRoute("DefaultApi", new { id = 0 }, championshipScoring)); } finally { championshipScoring = null; championshipType = null; listOfChampionship = null; } } else if (model.actionUser == "blackList") { paramName = new string[] { }; paramValue = new string[] { }; dt = db.executePROC("spGetAllListaNegra", paramName, paramValue); GeneralBlackListViewModel blackListModel = new GeneralBlackListViewModel(); GeneralBlackListModel listGeneralBlackList = new GeneralBlackListModel(); List <GeneralBlackListModel> listOfBlackList = new List <GeneralBlackListModel>(); try { for (var i = 0; i < dt.Rows.Count; i++) { listGeneralBlackList = new GeneralBlackListModel(); listGeneralBlackList.psnID = dt.Rows[i]["PSN_ID"].ToString(); listGeneralBlackList.userName = dt.Rows[i]["NM_USUARIO"].ToString(); listGeneralBlackList.total = Convert.ToInt16(dt.Rows[i]["TOTAL_GERAL"].ToString()); if (!String.IsNullOrEmpty(dt.Rows[i]["TOTAL_TEMP"].ToString())) { listGeneralBlackList.totalPreviousSeason = Convert.ToInt16(dt.Rows[i]["TOTAL_TEMP"].ToString()); } else { listGeneralBlackList.totalPreviousSeason = 0; } listOfBlackList.Add(listGeneralBlackList); } blackListModel.listBlackList = listOfBlackList; blackListModel.returnMessage = "HallOfFameSuccessfully"; return(CreatedAtRoute("DefaultApi", new { id = 0 }, blackListModel)); } catch (Exception ex) { blackListModel = new GeneralBlackListViewModel(); model.returnMessage = "error_" + ex.Message; return(CreatedAtRoute("DefaultApi", new { id = 0 }, blackListModel)); } finally { blackListModel = null; listGeneralBlackList = null; listOfBlackList = null; } } else if (model.actionUser == "renewal") { RenewalChampionshipModel renewalChampionship = new RenewalChampionshipModel(); RenewalViewModel RenewalModel = new RenewalViewModel(); List <RenewalChampionshipModel> listOfRenewal = new List <RenewalChampionshipModel>(); int totAcceptedApproved = 0; int totUnderAnalysis = 0; int blackListPoints = 0; try { if (model.seasonID == 0) { paramName = new string[] { "pMode" }; paramValue = new string[] { "" }; dt = db.executePROC("spGetIDsTemporadaByMode", paramName, paramValue); model.seasonID = Convert.ToInt32(dt.Rows[0]["id_current_temporada"].ToString()); model.seasonName = dt.Rows[0]["nm_current_temporada"].ToString(); model.previousSeasonID = Convert.ToInt32(dt.Rows[0]["id_previous_temporada"].ToString()); model.previousSeasonName = dt.Rows[0]["nm_previous_temporada"].ToString(); } paramName = new string[] { "pIdTemporada", "pIdTemporadaAnt", "pIdsCampeonato" }; paramValue = new string[] { Convert.ToString(model.seasonID), Convert.ToString(model.previousSeasonID), model.championshipIDRenewal }; if (model.renewalMode == "H2H") { dt = db.executePROC("spGetAllConfirmacaoTemporadaOfCampeonatoH2H", paramName, paramValue); } else if (model.renewalMode == "FUT") { dt = db.executePROC("spGetAllConfirmacaoTemporadaOfCampeonatoFUT", paramName, paramValue); } else if (model.renewalMode == "PRO") { dt = db.executePROC("spGetAllConfirmacaoTemporadaOfCampeonatoPRO", paramName, paramValue); } for (var i = 0; i < dt.Rows.Count; i++) { renewalChampionship = new RenewalChampionshipModel(); renewalChampionship.psnID = dt.Rows[i]["PSN_ID"].ToString(); renewalChampionship.userName = dt.Rows[i]["NM_USUARIO"].ToString(); renewalChampionship.userID = Convert.ToInt32(dt.Rows[i]["ID_USUARIO"].ToString()); renewalChampionship.championshipID = Convert.ToInt16(dt.Rows[i]["ID_CAMPEONATO"].ToString()); renewalChampionship.teamName = dt.Rows[i]["NM_TIME"].ToString(); if (String.IsNullOrEmpty(dt.Rows[i]["PT_LSTNEGRA"].ToString())) { blackListPoints = 0; } else { blackListPoints = Convert.ToInt32(dt.Rows[i]["PT_LSTNEGRA"].ToString()); } if (String.IsNullOrEmpty(dt.Rows[i]["IN_CONFIRMACAO"].ToString())) { renewalChampionship.actionRenewal = "Ainda não confirmou"; renewalChampionship.acceptedRenewal = "-1"; renewalChampionship.status = "AGUARDANDO"; } else if (Convert.ToInt16(dt.Rows[i]["IN_CONFIRMACAO"].ToString()) == 1 && blackListPoints >= model.totalLimitBlackList) { renewalChampionship.actionRenewal = "Confirmou, mas chegou ao limite de pontos na Lista Negra"; renewalChampionship.acceptedRenewal = "9"; renewalChampionship.status = "NÃO ACEITO"; totUnderAnalysis += 1; } else if (Convert.ToInt16(dt.Rows[i]["IN_CONFIRMACAO"].ToString()) == 1) { renewalChampionship.actionRenewal = "Confirmou Participação"; renewalChampionship.acceptedRenewal = "1"; renewalChampionship.status = "APROVADO"; totAcceptedApproved += 1; } else if (Convert.ToInt16(dt.Rows[i]["IN_CONFIRMACAO"].ToString()) == 0) { renewalChampionship.actionRenewal = "Não deseja Participar"; renewalChampionship.acceptedRenewal = "0"; renewalChampionship.status = "DESISTIU"; } renewalChampionship.statusInitials = dt.Rows[i]["DS_STATUS"].ToString(); if (model.renewalMode == "PRO") { renewalChampionship.playersTotal = Convert.ToInt32(dt.Rows[i]["TOTAL_JOGADORES"].ToString()); } renewalChampionship.blackListtotal = blackListPoints; if (String.IsNullOrEmpty(dt.Rows[i]["PT_TOTAL"].ToString())) { renewalChampionship.total = 0; } else { renewalChampionship.total = Convert.ToInt32(dt.Rows[i]["PT_TOTAL"].ToString()); } if (String.IsNullOrEmpty(dt.Rows[i]["PT_TOTAL_ATUAL"].ToString())) { renewalChampionship.seasonCurrentTotal = 0; } else { renewalChampionship.seasonCurrentTotal = Convert.ToInt32(dt.Rows[i]["PT_TOTAL_ATUAL"].ToString()); } renewalChampionship.grandTotal = renewalChampionship.total + renewalChampionship.seasonCurrentTotal; listOfRenewal.Add(renewalChampionship); } //get all of the bench paramName = new string[] { "pIdTemporada", "pIdTemporadaAnt", "pIdsCampeonato" }; paramValue = new string[] { Convert.ToString(model.seasonID), Convert.ToString(model.previousSeasonID), model.championshipIDBenchRenewal }; if (model.renewalMode == "H2H") { dt = db.executePROC("spGetAllConfirmacaoTemporadaOfCampeonatoH2HBco", paramName, paramValue); } else if (model.renewalMode == "FUT") { dt = db.executePROC("spGetAllConfirmacaoTemporadaOfCampeonatoFUTBco", paramName, paramValue); } else if (model.renewalMode == "PRO") { dt = db.executePROC("spGetAllConfirmacaoTemporadaOfCampeonatoPROBco", paramName, paramValue); } for (var i = 0; i < dt.Rows.Count; i++) { renewalChampionship = new RenewalChampionshipModel(); renewalChampionship.psnID = dt.Rows[i]["PSN_ID"].ToString(); renewalChampionship.userName = dt.Rows[i]["NM_USUARIO"].ToString(); renewalChampionship.userID = Convert.ToInt32(dt.Rows[i]["ID_USUARIO"].ToString()); renewalChampionship.championshipID = Convert.ToInt16(dt.Rows[i]["ID_CAMPEONATO"].ToString()); renewalChampionship.teamName = dt.Rows[i]["NM_TIME"].ToString(); if (String.IsNullOrEmpty(dt.Rows[i]["PT_LSTNEGRA"].ToString())) { blackListPoints = 0; } else { blackListPoints = Convert.ToInt32(dt.Rows[i]["PT_LSTNEGRA"].ToString()); } if (String.IsNullOrEmpty(dt.Rows[i]["IN_CONFIRMACAO"].ToString())) { renewalChampionship.actionRenewal = "Ainda não confirmou"; renewalChampionship.acceptedRenewal = "-1"; renewalChampionship.status = "AGUARDANDO"; } else if (Convert.ToInt16(dt.Rows[i]["IN_CONFIRMACAO"].ToString()) == 1 && blackListPoints >= model.totalLimitBlackList) { renewalChampionship.actionRenewal = "Confirmou, mas chegou ao limite de pontos na Lista Negra"; renewalChampionship.acceptedRenewal = "9"; renewalChampionship.status = "NÃO ACEITO"; totUnderAnalysis += 1; } else if (Convert.ToInt16(dt.Rows[i]["IN_CONFIRMACAO"].ToString()) == 1) { renewalChampionship.actionRenewal = "Confirmou Participação"; renewalChampionship.acceptedRenewal = "1"; renewalChampionship.status = "APROVADO"; totAcceptedApproved += 1; } else if (Convert.ToInt16(dt.Rows[i]["IN_CONFIRMACAO"].ToString()) == 0) { renewalChampionship.actionRenewal = "Não deseja Participar"; renewalChampionship.acceptedRenewal = "0"; renewalChampionship.status = "DESISTIU"; } renewalChampionship.statusInitials = dt.Rows[i]["DS_STATUS"].ToString(); if (model.renewalMode == "PRO") { renewalChampionship.playersTotal = Convert.ToInt32(dt.Rows[i]["TOTAL_JOGADORES"].ToString()); } renewalChampionship.blackListtotal = blackListPoints; if (String.IsNullOrEmpty(dt.Rows[i]["PT_TOTAL"].ToString())) { renewalChampionship.total = 0; } else { renewalChampionship.total = Convert.ToInt32(dt.Rows[i]["PT_TOTAL"].ToString()); } renewalChampionship.seasonCurrentTotal = 0; // Convert.ToInt16(dt.Rows[i]["PT_TOTAL_ATUAL"].ToString()); renewalChampionship.grandTotal = renewalChampionship.total + renewalChampionship.seasonCurrentTotal; listOfRenewal.Add(renewalChampionship); } //get all of H2H world cup or ueaf euro if (model.renewalMode == "H2H" && !String.IsNullOrEmpty(model.championshipIDRenewalWorldCupUefaEuro)) { paramName = new string[] { "pIdTemporada", "pIdTemporadaAnt", "pIdsCampeonato" }; paramValue = new string[] { Convert.ToString(model.seasonID), Convert.ToString(model.previousSeasonID), model.championshipIDRenewalWorldCupUefaEuro }; dt = db.executePROC("spGetAllConfirmacaoTemporadaOfCampeonatoCDM", paramName, paramValue); for (var i = 0; i < dt.Rows.Count; i++) { renewalChampionship = new RenewalChampionshipModel(); renewalChampionship.psnID = dt.Rows[i]["PSN_ID"].ToString(); renewalChampionship.userName = dt.Rows[i]["NM_USUARIO"].ToString(); renewalChampionship.userID = Convert.ToInt32(dt.Rows[i]["ID_USUARIO"].ToString()); renewalChampionship.championshipID = Convert.ToInt16(dt.Rows[i]["ID_CAMPEONATO"].ToString()); renewalChampionship.teamName = String.Empty; if (String.IsNullOrEmpty(dt.Rows[i]["PT_LSTNEGRA"].ToString())) { blackListPoints = 0; } else { blackListPoints = Convert.ToInt32(dt.Rows[i]["PT_LSTNEGRA"].ToString()); } if (String.IsNullOrEmpty(dt.Rows[i]["IN_CONFIRMACAO"].ToString())) { renewalChampionship.actionRenewal = "Ainda não confirmou"; renewalChampionship.acceptedRenewal = "-1"; renewalChampionship.status = "AGUARDANDO"; } else if (Convert.ToInt16(dt.Rows[i]["IN_CONFIRMACAO"].ToString()) == 1 && blackListPoints >= model.totalLimitBanWorldCupUefaEuro) { renewalChampionship.actionRenewal = "Confirmou, mas chegou ao limite de pontos na Lista Negra para Copa do Mundo/Eurocopa"; renewalChampionship.acceptedRenewal = "9"; renewalChampionship.status = "NÃO ACEITO"; } else if (Convert.ToInt16(dt.Rows[i]["IN_CONFIRMACAO"].ToString()) == 1) { renewalChampionship.actionRenewal = "Confirmou Participação"; renewalChampionship.acceptedRenewal = "1"; renewalChampionship.status = "APROVADO"; } else if (Convert.ToInt16(dt.Rows[i]["IN_CONFIRMACAO"].ToString()) == 0) { renewalChampionship.actionRenewal = "Não deseja Participar"; renewalChampionship.acceptedRenewal = "0"; renewalChampionship.status = "DESISTIU"; } renewalChampionship.statusInitials = dt.Rows[i]["DS_STATUS"].ToString(); renewalChampionship.blackListtotal = blackListPoints; if (String.IsNullOrEmpty(dt.Rows[i]["PT_TOTAL"].ToString())) { renewalChampionship.total = 0; } else { renewalChampionship.total = Convert.ToInt32(dt.Rows[i]["PT_TOTAL"].ToString()); } if (String.IsNullOrEmpty(dt.Rows[i]["PT_TOTAL_ATUAL"].ToString())) { renewalChampionship.seasonCurrentTotal = 0; } else { renewalChampionship.seasonCurrentTotal = Convert.ToInt32(dt.Rows[i]["PT_TOTAL_ATUAL"].ToString()); } renewalChampionship.grandTotal = renewalChampionship.total + renewalChampionship.seasonCurrentTotal; listOfRenewal.Add(renewalChampionship); } } RenewalModel.renewalMode = model.renewalMode; RenewalModel.seasonID = model.seasonID; RenewalModel.seasonName = model.seasonName; RenewalModel.previousSeasonID = model.previousSeasonID; RenewalModel.previousSeasonName = model.previousSeasonName; RenewalModel.championshipIDBenchRenewal = model.championshipIDBenchRenewal; RenewalModel.championshipIDRenewal = model.championshipIDRenewal; RenewalModel.championshipIDRenewalWorldCupUefaEuro = model.championshipIDRenewalWorldCupUefaEuro; RenewalModel.totalApprovedRenewal = totAcceptedApproved; RenewalModel.totalUnderAnalysisRenewal = totUnderAnalysis; RenewalModel.listOfRenewal = listOfRenewal; RenewalModel.returnMessage = "HallOfFameSuccessfully"; return(CreatedAtRoute("DefaultApi", new { id = 0 }, RenewalModel)); } catch (Exception ex) { RenewalModel = new RenewalViewModel(); model.returnMessage = "error_" + ex.Message; return(CreatedAtRoute("DefaultApi", new { id = 0 }, RenewalModel)); } finally { renewalChampionship = null; RenewalModel = null; listOfRenewal = null; } } else if (model.actionUser == "renewalSquad") { RenewalPROCLUBSquadViewModel PROCLUBSquadModel = new RenewalPROCLUBSquadViewModel(); squadListModel renewalSquad = new squadListModel(); List <squadListModel> listOfSquad = new List <squadListModel>(); PROCLUBSquadModel.managerID = model.managerID; PROCLUBSquadModel.seasonID = model.seasonID; PROCLUBSquadModel.clubName = model.clubName; try { paramName = new string[] { "pIdUsuario" }; paramValue = new string[] { Convert.ToString(PROCLUBSquadModel.managerID) }; dt = db.executePROC("spGetUsuarioById", paramName, paramValue); PROCLUBSquadModel.psnID = dt.Rows[0]["PSN_ID"].ToString(); PROCLUBSquadModel.mangerName = dt.Rows[0]["NM_USUARIO"].ToString(); PROCLUBSquadModel.mobileNumber = dt.Rows[0]["NO_CELULAR"].ToString(); PROCLUBSquadModel.codeMobileNumber = dt.Rows[0]["NO_DDD"].ToString(); PROCLUBSquadModel.listOfSquad = GlobalFunctions.getListOfSquadPROCLUB(db, model.seasonID, model.managerID, out returnMessage); PROCLUBSquadModel.returnMessage = "HallOfFameSuccessfully"; return(CreatedAtRoute("DefaultApi", new { id = 0 }, PROCLUBSquadModel)); } catch (Exception ex) { PROCLUBSquadModel = new RenewalPROCLUBSquadViewModel(); model.returnMessage = "error_" + ex.Message; return(CreatedAtRoute("DefaultApi", new { id = 0 }, PROCLUBSquadModel)); } finally { PROCLUBSquadModel = null; renewalSquad = null; listOfSquad = null; } } else if (model.actionUser.Substring(0, 11) == "achievement") { paramName = new string[] { }; paramValue = new string[] { }; if (model.actionUser.IndexOf("H2H") > 0) { dt = db.executePROC("spGetAchievementH2H", paramName, paramValue); } else if (model.actionUser.IndexOf("FUT") > 0) { dt = db.executePROC("spGetAchievementFUT", paramName, paramValue); } else if (model.actionUser.IndexOf("PRO") > 0) { dt = db.executePROC("spGetAchievementPRO", paramName, paramValue); } AchievementViewModel GeneralAchievementModel = new AchievementViewModel(); AchievementModel achievementModel = new AchievementModel(); List <AchievementModel> listOfAchievement = new List <AchievementModel>(); try { for (var i = 0; i < dt.Rows.Count; i++) { achievementModel = new AchievementModel(); achievementModel.championshipType = dt.Rows[i]["SG_TIPO_CAMPEONATO"].ToString(); achievementModel.inGroup = Convert.ToBoolean(dt.Rows[i]["IN_CAMPEONATO_GRUPO"].ToString()); achievementModel.seasonName = dt.Rows[i]["ID_TEMPORADA"].ToString() + "ª Temporada (" + dt.Rows[i]["IN_CONSOLE"].ToString() + ")"; achievementModel.userName = dt.Rows[i]["NM_USUARIO"].ToString() + " (" + dt.Rows[i]["PSN_ID"].ToString() + ")"; achievementModel.teamName = dt.Rows[i]["NM_TIME"].ToString() + "-" + dt.Rows[i]["DS_TIPO"].ToString(); listOfAchievement.Add(achievementModel); } GeneralAchievementModel.listOfAchievement = listOfAchievement; GeneralAchievementModel.returnMessage = "HallOfFameSuccessfully"; return(CreatedAtRoute("DefaultApi", new { id = 0 }, GeneralAchievementModel)); } catch (Exception ex) { GeneralAchievementModel = new AchievementViewModel(); model.returnMessage = "error_" + ex.Message; return(CreatedAtRoute("DefaultApi", new { id = 0 }, GeneralAchievementModel)); } finally { GeneralAchievementModel = null; listOfAchievement = null; achievementModel = null; } } else { return(StatusCode(HttpStatusCode.NotAcceptable)); } } catch (Exception ex) { model = new HallOfFameSummaryViewModel(); model.returnMessage = "error_" + ex.Message; return(CreatedAtRoute("DefaultApi", new { id = 0 }, model)); } finally { db.closeConnection(); dt = null; } }