public override List <Question> GetQuestions(Amendment amendment) { var questions = new List <Question>(); var countries = _dataService.GetAnswerPotentials(nameof(PupilCountryQuestion)); var countryQuestion = new CountryPupilLeftEnglandFor(countries.ToList()); questions.Add(countryQuestion); var pupilDateOffRoleQuestion = new PupilDateOffRollQuestion(); questions.Add(pupilDateOffRoleQuestion); if (GetAnswer(amendment, nameof(PupilDateOffRollQuestion))?.Value.ToDateTimeWhenSureNotNull() < _config.CensusDate.ToDateTimeWhenSureNotNull()) { var explainQuestion = new ExplainYourRequestQuestion("The date off roll is before the January census but this pupil was recorded on your January census"); questions.Add(explainQuestion); } var evidenceQuestion = new EvidenceUploadQuestion(_evidenceHelpDeskText); questions.Add(evidenceQuestion); return(questions); }
public AmendmentOutcome ApplyRules(rscd_Amendment amendmentDto, Amendment amendment) { var ruleSet = _rules.FirstOrDefault(x => x.AmendmentType == amendment.AmendmentType && x.AmendmentReason == amendment.InclusionReasonId); if (ruleSet != null) { var outcome = ruleSet.Apply(amendment); if (outcome.OutcomeStatus != OutcomeStatus.AwaitingValidationPass) { if (outcome.OutcomeStatus == OutcomeStatus.AutoAccept) { amendmentDto.rscd_Outcome = rscd_Outcome.Autoapproved; } else if (outcome.OutcomeStatus == OutcomeStatus.AutoReject) { amendmentDto.rscd_Outcome = rscd_Outcome.Autorejected; } else { amendmentDto.rscd_Outcome = rscd_Outcome.AwaitingDfEreview; } } return(outcome); } return(new AmendmentOutcome(OutcomeStatus.AwatingDfeReview, $"No Accept or Reject rules found for this Reason {amendment.InclusionReasonId}")); }
protected override void ApplyOutcomeToAmendment(Amendment amendment, AmendmentOutcome amendmentOutcome) { if (amendmentOutcome.IsComplete && amendmentOutcome.FurtherQuestions == null) { var isNonPlasc = _establishmentService.IsNonPlascEstablishment(amendment.CheckingWindow, new URN(amendment.URN)); amendment.AmendmentDetail.SetField(RemovePupilAmendment.FIELD_ReasonDescription, amendmentOutcome.ReasonDescription); amendment.AmendmentDetail.SetField(RemovePupilAmendment.FIELD_ReasonCode, amendmentOutcome.ReasonId); amendment.AmendmentDetail.SetField(RemovePupilAmendment.FIELD_OutcomeDescription, amendmentOutcome.OutcomeDescription); amendment.AmendmentDetail.SetField(RemovePupilAmendment.FIELD_CountryOfOrigin, GetFlattenedDisplayField(amendment, nameof(PupilCountryQuestion))); amendment.AmendmentDetail.SetField(RemovePupilAmendment.FIELD_NativeLanguage, GetFlattenedDisplayField(amendment, nameof(PupilNativeLanguageQuestion))); amendment.AmendmentDetail.SetField(RemovePupilAmendment.FIELD_DateOfArrivalUk, GetAnswer(amendment, nameof(ArrivalDateQuestion)).Value); if (isNonPlasc) { amendment.AmendmentDetail.SetField(RemovePupilAmendment.FIELD_DateOnRoll, GetAnswer(amendment, nameof(PupilDateOnRollQuestion)).Value); } } }
public override List <Question> GetQuestions(Amendment amendment) { var questions = new List <Question>(); var countries = _dataService.GetAnswerPotentials(nameof(PupilCountryQuestion)); var languages = _dataService.GetAnswerPotentials(nameof(PupilNativeLanguageQuestion)); var isNonPlasc = _establishmentService.IsNonPlascEstablishment(amendment.CheckingWindow, new URN(amendment.URN)); var nativeLanguageQuestion = new PupilNativeLanguageQuestion(languages.ToList()); questions.Add(nativeLanguageQuestion); var countryQuestion = new PupilCountryQuestion(countries.ToList()); questions.Add(countryQuestion); var pupilArrivalToUk = new ArrivalDateQuestion(); questions.Add(pupilArrivalToUk); if (isNonPlasc) { questions.Add(new PupilDateOnRollQuestion()); } var evidenceQuestion = new EvidenceUploadQuestion(_evidenceHelpDeskText); questions.Add(evidenceQuestion); return(questions); }
public AmendResponseHolder DoAddProductAmendment(String subscriptionId, DateTime effectiveDate, String productRatePlanId, AmendOptions ao = null, PreviewOptions po = null) { AmendRequest amendRequest = new AmendRequest(); Amendment amendment = new Amendment(); amendment.Name = "Add Product Amendment"; amendment.Type = "NewProduct"; amendment.ContractEffectiveDate = effectiveDate; amendment.ContractEffectiveDateSpecified = true; amendment.SubscriptionId = subscriptionId; RatePlanData ratePlanData = new RatePlanData(); RatePlan ratePlan = new RatePlan(); ratePlan.ProductRatePlanId = productRatePlanId; ratePlanData.RatePlan = ratePlan; amendment.RatePlanData = ratePlanData; if (ao != null) { amendRequest.AmendOptions = ao; } if (po != null) { amendRequest.PreviewOptions = po; } amendRequest.Amendments = new Amendment[] { amendment }; return zs.Amend(new List<AmendRequest> { amendRequest })[0]; }
public AmendResponseHolder DoTermsAndConditionsAmendment(String subscriptionId, DateTime effectiveDate, String termType, int initialTerm, int renewalTerm, AmendOptions ao = null, PreviewOptions po = null) { AmendRequest amendRequest = new AmendRequest(); Amendment amendment = new Amendment(); if (ao != null) { amendRequest.AmendOptions = ao; } if (po != null) { amendRequest.PreviewOptions = po; } amendment.Name = "T's and C's amendment"; amendment.Type = "TermsAndConditions"; amendment.ContractEffectiveDate = effectiveDate; amendment.ContractEffectiveDateSpecified = true; if(termType != null) amendment.TermType = termType; amendment.InitialTerm = initialTerm; amendment.InitialTermSpecified = true; amendment.RenewalTerm = renewalTerm; amendment.RenewalTermSpecified = true; amendment.SubscriptionId = subscriptionId; amendRequest.Amendments = new Amendment[] { amendment }; return zs.Amend(new List<AmendRequest> { amendRequest })[0]; }
public List <Amendment> getAmendmentList() { List <Amendment> amendmentList = new List <Amendment>(); // Create sqlite_conn = new SQLiteConnection("Data source=" + path + ";Version=3;New=True;Compress=True;"); // Open sqlite_conn.Open(); // Create command sqlite_cmd = sqlite_conn.CreateCommand(); sqlite_cmd.CommandText = "SELECT * FROM Amendment;"; SQLiteDataReader sqlite_datareader = sqlite_cmd.ExecuteReader(); while (sqlite_datareader.Read()) { Amendment tempAmendment = new Amendment(sqlite_datareader["id"].ToString(), sqlite_datareader["entryType"].ToString(), sqlite_datareader["originalDescription"].ToString(), sqlite_datareader["editedDescription"].ToString(), sqlite_datareader["originalRecommendation"].ToString(), sqlite_datareader["editedRecommendation"].ToString(), sqlite_datareader["originalReferenceLink"].ToString(), sqlite_datareader["editedReferenceLink"].ToString()); amendmentList.Add(tempAmendment); } sqlite_datareader.Close(); sqlite_conn.Close(); return(amendmentList); }
protected override void ApplyOutcomeToAmendment(Amendment amendment, AmendmentOutcome amendmentOutcome) { if (amendmentOutcome.IsComplete && amendmentOutcome.FurtherQuestions == null) { amendment.AmendmentDetail.SetField(RemovePupilAmendment.FIELD_ReasonDescription, amendmentOutcome.ReasonDescription); amendment.AmendmentDetail.SetField(RemovePupilAmendment.FIELD_ReasonCode, amendmentOutcome.ReasonId); amendment.AmendmentDetail.SetField(RemovePupilAmendment.FIELD_OutcomeDescription, amendmentOutcome.OutcomeDescription); amendment.AmendmentDetail.SetField(RemovePupilAmendment.FIELD_CountryLeftEnglandFor, GetFlattenedDisplayField(amendment, nameof(CountryPupilLeftEnglandFor))); amendment.AmendmentDetail.SetField(RemovePupilAmendment.FIELD_DateOffRoll, GetAnswer(amendment, nameof(PupilDateOffRollQuestion)).Value); if (HasAnswer(amendment, nameof(ExplainYourRequestQuestion))) { amendment.AmendmentDetail.SetField(RemovePupilAmendment.FIELD_Detail, GetAnswer(amendment, nameof(ExplainYourRequestQuestion)).Value); } } }
protected override AmendmentOutcome ApplyRule(Amendment amendment) { var dateOffRoll = GetAnswer(amendment, nameof(PupilDateOffRollQuestion)); var evidenceUploadQuestion = GetAnswer(amendment, nameof(EvidenceUploadQuestion)); amendment.EvidenceStatus = string.IsNullOrEmpty(evidenceUploadQuestion.Value) || evidenceUploadQuestion.Value == "0" ? EvidenceStatus.Later : EvidenceStatus.Now; if (dateOffRoll.Value.ToDateTimeWhenSureNotNull() < _config.CensusDate.ToDateTimeWhenSureNotNull()) { return(new AmendmentOutcome(OutcomeStatus.AwatingDfeReview, null) { ScrutinyStatusCode = ScrutinyCode, ReasonId = AmendmentReason, ReasonDescription = ReasonDescription }); } if (!amendment.Pupil.PortlandStudentID.HasValue) { return(new AmendmentOutcome(OutcomeStatus.AutoReject, "Request to add an unlisted pupil who has permanently left England. Addition will be reviewed.") { ScrutinyStatusCode = ScrutinyCode, ReasonId = AmendmentReason, ReasonDescription = ReasonDescription }); } return(new AmendmentOutcome(OutcomeStatus.AwatingDfeReview, null) { ScrutinyStatusCode = ScrutinyCode, ReasonId = AmendmentReason, ReasonDescription = ReasonDescription }); }
public void TestAmendmentIsValid() { var testSubject = new Amendment() { Court = new StateCourt("CA"), GetServiceOfProcess = lp => new VoluntaryEntry { GetToDateOfService = lp1 => DateTime.UtcNow.AddDays(-14) }, LinkedTo = new Complaint(), }; var testResult = testSubject.IsValid(new ExamplePlaintiff(), new ExampleDefendant()); Console.WriteLine(testSubject.ToString()); Assert.IsTrue(testResult); testSubject = new Amendment() { Court = new StateCourt("CA"), GetServiceOfProcess = lp => new VoluntaryEntry { GetToDateOfService = lp1 => DateTime.UtcNow.AddDays(-45) }, LinkedTo = new Complaint(), }; testResult = testSubject.IsValid(new ExamplePlaintiff(), new ExampleDefendant()); Console.WriteLine(testSubject.ToString()); Assert.IsFalse(testResult); }
public override List <Question> GetQuestions(Amendment amendment) { var dateOffRoll = new PupilDateOffRollQuestion(); return(new List <Question> { dateOffRoll }); }
public override List <Question> GetQuestions(Amendment amendment) { var evidenceQuestion = new EvidenceUploadQuestion(EvidenceHelperTextHtml); return(new List <Question> { evidenceQuestion }); }
protected override Entity MapAmendmentTypeToDto(Amendment amendment) { var pupil = PupilService.GetById(amendment.CheckingWindow, amendment.Pupil.Id.ToString()); amendment.Pupil = pupil; return(amendment.AmendmentDetail.ToCrmRemovePupil(amendment)); }
protected UserAnswer GetAnswer(Amendment amendment, string questionId) { if (HasAnswer(amendment, questionId)) { return(amendment.Answers.Single(x => x.QuestionId == questionId)); } return(null); }
public ActionResult SetSession([FromBody] Amendment amendment) { if (IsDevelopment() || _env.IsStaging()) { SaveAmendment(amendment); return(Json(amendment)); } return(Json("Not Allowed")); }
private static QuestionViewModel GoToTheNextQuestion(PromptAnswerViewModel promptAnswerViewModel, List <Question> questions, Amendment amendment) { var nextQuestionViewModel = new QuestionViewModel(questions, promptAnswerViewModel.CurrentIndex + 1) { PupilDetails = new PupilViewModel(amendment.Pupil) }; return(nextQuestionViewModel); }
public AmendmentOutcome BuildAmendments(Amendment amendment) { using (var context = new CrmServiceContext(_organizationService)) { AmendmentOutcome outcome; var amendmentDto = new rscd_Amendment { rscd_Checkingwindow = amendment.CheckingWindow.ToCRMCheckingWindow(), rscd_Amendmenttype = amendment.AmendmentType.ToCRMAmendmentType(), rscd_Academicyear = _allocationYear, rscd_URN = amendment.URN, OwnerId = _firstLineTeam }; outcome = _outcomeService.ApplyRules(amendmentDto, amendment); if (amendment.IsUserConfirmed && outcome.IsComplete && outcome.FurtherQuestions == null) { MapAmendmentToDto(amendment, amendmentDto); var amendmentTypeEntity = MapAmendmentTypeToDto(amendment); context.AddObject(amendmentTypeEntity); context.AddObject(amendmentDto); // Save var result = context.SaveChanges(); if (result.HasError) { throw result.FirstOrDefault(e => e.Error != null)?.Error ?? new ApplicationException(); } if (amendmentDto.rscd_Outcome == rscd_Outcome.Autoapproved || amendmentDto.rscd_Outcome == rscd_Outcome.Autorejected) { amendmentDto.StateCode = rscd_AmendmentState.Inactive; amendmentDto.rscd_recorded_by = _autoRecordedUser; _organizationService.Update(amendmentDto); } var relationship = new Relationship(RelationshipKey); _organizationService.Associate(amendmentTypeEntity.LogicalName, amendmentTypeEntity.Id, relationship, new EntityReferenceCollection { new EntityReference(amendmentDto.LogicalName, amendmentDto.Id) }); outcome.IsAmendmentCreated = true; outcome.NewAmendmentId = amendmentDto.Id; _logger.LogInformation("Amendment requested - ID: {amendmentId}", amendmentDto.Id); } return(outcome); } }
public async Task <IActionResult> GetAmendment([FromRoute] int id) { Amendment amendment = await unitOfWork.Amendment.GetWithReasons(a => a.ID == id); if (amendment == null) { return(BadRequest()); } //return amendment; return(Ok(amendment)); }
private static QuestionViewModel CreateConditionalPrompt(PromptAnswerViewModel promptAnswerViewModel, List <Question> questions, Amendment amendment) { var conditionalViewModel = new QuestionViewModel(questions, promptAnswerViewModel.CurrentIndex) { PupilDetails = new PupilViewModel(amendment.Pupil), ShowConditional = true }; return(conditionalViewModel); }
public virtual AmendmentOutcome Apply(Amendment amendment) { var questions = GetQuestions(amendment); var errorMessages = new Dictionary <string, List <string> >(); foreach (var question in questions) { var answer = amendment.Answers.SingleOrDefault(x => x.QuestionId == question.Id); if (answer != null) { var errors = question.Validate(answer.Value); if (errors.Count > 0) { errorMessages.Add(question.Id, errors); } if (question.Answer.HasConditional) { answer = amendment.Answers.SingleOrDefault(x => x.QuestionId == question.Answer.ConditionalQuestion.Id); if (answer != null) { errors = question.Answer.ConditionalQuestion.Validate(answer.Value); if (errors.Count > 0) { errorMessages.Add(question.Answer.ConditionalQuestion.Id, errors); } } } } } if (errorMessages.Count > 0) { return(new AmendmentOutcome(questions, errorMessages)); } if (amendment.Answers == null || amendment.Answers .Where(x => !x.QuestionId.Contains(".")) .Select(x => x.QuestionId) .Distinct() .Count() < questions.Count) { return(new AmendmentOutcome(questions)); } AmendmentOutcome amendmentOutcome = ApplyRule(amendment); ApplyOutcomeToAmendment(amendment, amendmentOutcome); return(amendmentOutcome); }
protected string GetFlattenedDisplayField(Amendment amendment, string questionId) { var selectedItem = GetSelectedAnswerItem(amendment, questionId); var conditionalValue = GetConditionalValue(amendment, questionId); if (string.IsNullOrEmpty(conditionalValue)) { return(selectedItem.Description); } return(selectedItem.Description + " - " + conditionalValue); }
private QuestionViewModel CreateUploadMoreViewModel(PromptAnswerViewModel promptAnswerViewModel, List <Question> questions, Amendment amendment) { var uploadEvidenceViewModel = new QuestionViewModel(questions, promptAnswerViewModel.CurrentIndex) { PupilDetails = new PupilViewModel(amendment.Pupil), ShowConditional = true }; ViewBag.Upload = GetFiles(); ViewBag.HasAdded = !Request.Form.ContainsKey("skipValidation"); return(uploadEvidenceViewModel); }
protected override AmendmentOutcome ApplyRule(Amendment amendment) { var evidenceUploadQuestion = GetAnswer(amendment, nameof(EvidenceUploadQuestion)); amendment.EvidenceStatus = string.IsNullOrEmpty(evidenceUploadQuestion.Value) || evidenceUploadQuestion.Value == "0" ? EvidenceStatus.Later : EvidenceStatus.Now; return(new AmendmentOutcome(OutcomeStatus.AwatingDfeReview, null) { ReasonId = (int)AmendmentReasonCode.Other, ReasonDescription = "Other", SubReason = ReasonDescription }); }
protected string GetConditionalValue(Amendment amendment, string questionId) { var question = GetQuestions(amendment).Single(x => x.Id == questionId); if (question.Answer.HasConditional) { var answer = GetAnswer(amendment, question.Answer.ConditionalQuestion.Id); if (answer != null) { return(answer.Value); } } return(string.Empty); }
protected override void ApplyOutcomeToAmendment(Amendment amendment, AmendmentOutcome amendmentOutcome) { if (amendmentOutcome.IsComplete && amendmentOutcome.FurtherQuestions == null) { amendment.AmendmentDetail.SetField(RemovePupilAmendment.FIELD_ReasonDescription, amendmentOutcome.ReasonDescription); amendment.AmendmentDetail.SetField(RemovePupilAmendment.FIELD_ReasonCode, amendmentOutcome.ReasonId); amendment.AmendmentDetail.SetField(RemovePupilAmendment.FIELD_SubReasonDescription, amendmentOutcome.SubReason); amendment.AmendmentDetail.SetField(RemovePupilAmendment.FIELD_OutcomeDescription, amendmentOutcome.OutcomeDescription); var dateOffRoll = GetAnswer(amendment, nameof(PupilDateOffRollQuestion)).Value; amendment.AmendmentDetail.SetField(RemovePupilAmendment.FIELD_DateOffRoll, dateOffRoll); var explanation = GetAnswer(amendment, nameof(ExplainYourRequestQuestion)).Value; amendment.AmendmentDetail.SetField(RemovePupilAmendment.FIELD_Detail, explanation); } }
protected override void ApplyOutcomeToAmendment(Amendment amendment, AmendmentOutcome amendmentOutcome) { if (amendmentOutcome.IsComplete && amendmentOutcome.FurtherQuestions == null) { amendment.AmendmentDetail.SetField(RemovePupilAmendment.FIELD_ReasonDescription, amendmentOutcome.ReasonDescription); amendment.AmendmentDetail.SetField(RemovePupilAmendment.FIELD_ReasonCode, amendmentOutcome.ReasonId); amendment.AmendmentDetail.SetField(RemovePupilAmendment.FIELD_OutcomeDescription, amendmentOutcome.OutcomeDescription); amendment.AmendmentDetail.SetField(RemovePupilAmendment.FIELD_DateOffRoll, GetAnswer(amendment, nameof(PupilDateOffRollQuestion)).Value); } }
protected override void ApplyOutcomeToAmendment(Amendment amendment, AmendmentOutcome amendmentOutcome) { if (amendmentOutcome.IsComplete && amendmentOutcome.FurtherQuestions == null) { amendment.AmendmentDetail.SetField(RemovePupilAmendment.FIELD_ReasonDescription, amendmentOutcome.ReasonDescription); amendment.AmendmentDetail.SetField(RemovePupilAmendment.FIELD_ReasonCode, amendmentOutcome.ReasonId); amendment.AmendmentDetail.SetField(RemovePupilAmendment.FIELD_SubReasonDescription, amendmentOutcome.SubReason); amendment.AmendmentDetail.SetField(RemovePupilAmendment.FIELD_OutcomeDescription, amendmentOutcome.OutcomeDescription); } }
protected AnswerPotential GetSelectedAnswerItem(Amendment amendment, string questionId) { var question = GetQuestions(amendment).Single(x => x.Id == questionId); var actualValue = amendment.Answers.Single(x => x.QuestionId == questionId)?.Value; if (question.Answer.AnswerPotentials != null && question.Answer.AnswerPotentials.Count > 0) { var answer = question.Answer.AnswerPotentials.SingleOrDefault(x => x.Value == actualValue); if (answer != null) { return(answer); } } return(new AnswerPotential { Description = actualValue, Value = actualValue, Reject = false }); }
public override List <Question> GetQuestions(Amendment amendment) { var laestabQuestion = new LaestabNumberQuestion( CustomLaEstabValidator, Content.RemovePupilDualRegLAESTABTitle, Content.RemovePupilDualRegLAESTABLabel, Content.RemovePupilDualRegLAESTABError); var explainQuestion = new ExplainYourRequestQuestion(null, Content.RemovePupilDualRegExplainDetailsLabel); var evidenceQuestion = new EvidenceUploadQuestion(Content.RemovePupilDualRegEvidence); return(new List <Question> { laestabQuestion, explainQuestion, evidenceQuestion }); }
public override List <Question> GetQuestions(Amendment amendment) { var questions = new List <Question>(); var pupilDateOffRoleQuestion = new PupilDateOffRollQuestion(); questions.Add(pupilDateOffRoleQuestion); var explainQuestion = new ExplainYourRequestQuestion(null); questions.Add(explainQuestion); var evidenceQuestion = new EvidenceUploadQuestion(Content.RemovePupilOtherMissingInEducation_HTML); questions.Add(evidenceQuestion); return(questions); }
public override List <Question> GetQuestions(Amendment amendment) { var questions = new List <Question>(); var pupilDateOffRoleQuestion = new PupilDateOffRollQuestion(); questions.Add(pupilDateOffRoleQuestion); var explainQuestion = new ExplainYourRequestQuestion(null); questions.Add(explainQuestion); var evidenceQuestion = new EvidenceUploadQuestion(_evidenceHelpDeskText); questions.Add(evidenceQuestion); return(questions); }
public async void TestAmendmentModel() { //Create a new Unit in the database Amendment amendment = new Amendment(); amendment.DateCreated = new DateTime(2018, 10, 16, 11, 59, 59); amendment.Comment = "This is a sample comment"; amendment.IdeaID = 1; amendment.UserID = new Guid(); //Add the model to the database _context.Amendment.Add(amendment); //Wait for the database to update changes await _context.SaveChangesAsync(); //Confirm that the changes exist in the database. IEnumerable <Amendment> amendmentList = _context.Amendment.Where(row => row.ID == amendment.ID).ToList(); Assert.Equal(amendmentList.ElementAt(0), amendment); //Update the model in the database. amendment.Comment = "This is an updated comment"; _context.Amendment.Update(amendment); //Wait for changes to be saved. await _context.SaveChangesAsync(); //Query the database again amendmentList = _context.Amendment.Where(row => row.ID == amendment.ID).ToList(); //Ensure that the model has the updated information and updates are working. Assert.Equal(amendmentList.ElementAt(0), amendment); //Delete the fake data from the database so that the data does not stay in the tables. _context.Amendment.Remove(amendment); //Wait for the changes to be saved await _context.SaveChangesAsync(); //Ensure that the row doesn't exist Assert.Empty(_context.Amendment.Where(row => row.ID == amendment.ID).ToList()); }
public AmendResponseHolder DoRenewalAmendment(String subscriptionId, DateTime effectiveDate, AmendOptions ao = null, PreviewOptions po = null) { AmendRequest amendRequest = new AmendRequest(); Amendment amendment = new Amendment(); if (ao != null) { amendRequest.AmendOptions = ao; } if (po != null) { amendRequest.PreviewOptions = po; } amendment.Name = "Renewal amendment"; amendment.Type = "Renewal"; amendment.ContractEffectiveDate = effectiveDate; amendment.ContractEffectiveDateSpecified = true; amendment.SubscriptionId = subscriptionId; amendRequest.Amendments = new Amendment[] { amendment }; return zs.Amend(new List<AmendRequest> { amendRequest })[0]; }
public AmendRequest CreateAmendRequest(String subscriptionId, String type) { AmendRequest amendRequest = new AmendRequest(); Amendment amendment = new Amendment(); if (type == "tsandcs") { amendment.Name = "t's and c's amendment"; amendment.Type = "TermsAndConditions"; amendment.ContractEffectiveDate = DateTime.Now; amendment.ContractEffectiveDateSpecified = true; amendment.TermType = "TERMED"; amendment.InitialTerm = 12; amendment.InitialTermSpecified = true; amendment.RenewalTerm = 24; amendment.RenewalTermSpecified = true; amendment.SubscriptionId = subscriptionId; } amendRequest.Amendments = new Amendment[] { amendment }; return amendRequest; }