public IHttpActionResult PostNextMonth(NextMonth nextMonth) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.NextMonth.Add(nextMonth); try { db.SaveChanges(); } catch (DbUpdateException) { if (NextMonthExists(nextMonth.Id)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = nextMonth.Id }, nextMonth)); }
public IHttpActionResult PutNextMonth(int id, NextMonth nextMonth) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != nextMonth.Id) { return(BadRequest()); } db.Entry(nextMonth).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!NextMonthExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetNextMonth(int id) { NextMonth nextMonth = db.NextMonth.Find(id); if (nextMonth == null) { return(NotFound()); } return(Ok(nextMonth)); }
public IHttpActionResult DeleteNextMonth(int id) { NextMonth nextMonth = db.NextMonth.Find(id); if (nextMonth == null) { return(NotFound()); } db.NextMonth.Remove(nextMonth); db.SaveChanges(); return(Ok(nextMonth)); }
public int PickYearAndMonth(string month, string year) { _action = new Actions(Driver); int currentMonth = Array.FindIndex(yearMonths, row => row.Contains(Month)) + 1; int currentYear = Convert.ToInt32(Year); int monthToPick = Array.FindIndex(yearMonths, row => row.Contains(month)) + 1; int yearToPick = Convert.ToInt32(year); int monthsToScroll = (yearToPick - currentYear) * 12 + monthToPick - currentMonth; if (monthsToScroll > 0) { _action.MoveToElement(NextMonth).Perform(); while (monthsToScroll > 0) { NextMonth.Click(); monthsToScroll--; Thread.Sleep(1000); } } else if (monthsToScroll < 0) { _action.MoveToElement(PreviousMonth).Perform(); while (monthsToScroll < 0) { PreviousMonth.Click(); monthsToScroll++; Thread.Sleep(500); } } return(monthToPick); }
public void SendNextMonth() { NextMonth?.Invoke(this, EventArgs.Empty); }
/* * Event Handler for Display Button * It will Calculate Fees based on User provided Term input * Also It will validate Term provided */ private void DisplayButton_Click(object sender, EventArgs e) { decimal PerMonthPrice, TotalPrice; int TermInput; if (TermTextBox.Text == "") { MessageBox.Show("Term can not be blank. Please enter input in months", "Blank Entry Not allowed", MessageBoxButtons.OK, MessageBoxIcon.Error); TermTextBox.Focus(); TermTextBox.SelectAll(); } else { try { TermInput = int.Parse(TermTextBox.Text); if (TermInput < 0) { MessageBox.Show("Please Enter Positive Number", "Negative Number not Allowed in Terms", MessageBoxButtons.OK, MessageBoxIcon.Error); TermTextBox.Focus(); TermTextBox.SelectAll(); } else if (TermInput == 0) { MessageBox.Show("Term can not be Zero. Please enter valid input", "Zero Terms not allowed", MessageBoxButtons.OK, MessageBoxIcon.Error); TermTextBox.Focus(); TermTextBox.SelectAll(); } else { //Fetching Per Month price PerMonthPrice = CalculatePerMonth(TermInput); //Fetching Total Fees TotalPrice = CalculateTotalFees(TermInput); //Assigning Details of fees PricePerMonthLabel.Text = "€ " + PerMonthPrice.ToString("N2"); PriceFullTermLabel.Text = "€ " + TotalPrice.ToString("N2"); EnquiredPrice = TotalPrice; //Fetching Next Term based on current Term NextMonth = NextTermMonth(TermInput); //If Next month is more than limit if (TermInput > MONTH12) { NextTermLabel.Text = NEXTTERMTEXT; PriceNextTermLabel.Text = "N.A."; PitchLabel.Text = "Kudos! You are about to avail maximum Discount of 66.66%! Confirm Soon!!"; } else { TotalPrice = CalculateTotalFees(NextMonth); SuggestedPrice = TotalPrice; NextTermLabel.Text = NEXTTERMTEXT + " for " + NextMonth.ToString() + " Month(s)"; PriceNextTermLabel.Text = "€ " + TotalPrice.ToString("N2"); if (GetDiscount(NextMonth) == DISCOUNT7) { PitchLabel.Text = "Pay €" + (SuggestedPrice).ToString() + " to get " + (NextMonth - TermInput).ToString() + " Month(s) at whooping " + GetDiscount(NextMonth).ToString() + "% Discount"; } else { PitchLabel.Text = "Pay additional €" + (SuggestedPrice - EnquiredPrice).ToString() + " to get extra " + (NextMonth - TermInput).ToString() + " Month(s) at whooping " + GetDiscount(NextMonth).ToString() + "% Discount"; } } ClientConfirmedTextBox.Focus(); } } catch { MessageBox.Show("Invalid input provided for Terms. Please provide number", "Invalid Input", MessageBoxButtons.OK, MessageBoxIcon.Error); TermTextBox.Focus(); TermTextBox.SelectAll(); } } }