public static void Merge(Case[] cases, int left, int mid, int right) { Case [] temp = new Case[20]; int i, left_end, num_elements, tmp_pos; left_end = (mid - 1); tmp_pos = left; num_elements = (right - left + 1); while ((left <= left_end) && (mid <= right)) { if (ComparePriority(cases[left].priority, cases[mid].priority)) temp[tmp_pos++] = cases[left++]; else temp[tmp_pos++] = cases[mid++]; } while (left <= left_end) temp[tmp_pos++] = cases[left++]; while (mid <= right) temp[tmp_pos++] = cases[mid++]; for (i = 0; i < num_elements; i++) { cases[right] = temp[right]; right--; } }
/// <summary> /// Converts the phrase to specified convention. /// </summary> /// <param name="phrase"></param> /// <param name="cases">The cases.</param> /// <returns>string</returns> public static string ToCase(this string phrase, Case cases) { string[] splittedPhrase = phrase.Split(' ', '-', '.'); var sb = new StringBuilder(); if (cases == Case.CamelCase) { sb.Append(char.ToLower(splittedPhrase[0][0])); sb.Append(splittedPhrase[0].Substring(1)); splittedPhrase[0] = string.Empty; } else if (cases == Case.PascalCase) sb = new StringBuilder(); foreach (var s in splittedPhrase) { char[] splittedPhraseChars = s.ToCharArray(); if (splittedPhraseChars.Length > 0) { splittedPhraseChars[0] = ((new String(splittedPhraseChars[0], 1)).ToUpper().ToCharArray())[0]; } sb.Append(new String(splittedPhraseChars)); } return sb.ToString(); }
public override string GeneratePropertyCode(string propertyName, Case classCase, IEnumerable<AttributeProxy> attributes, DocumentType documentType) { if (documentType != DocumentType.Xml) { return base.GeneratePropertyCode(propertyName, classCase, attributes, documentType); } var sb = new StringBuilder(); sb.AppendFormat( @"[XmlIgnore] public {0} {1} {{ get; set; }}", TypeAlias, propertyName).AppendLine().AppendLine(); foreach (var attribute in attributes) { sb.AppendLine(attribute.ToCode()); } sb.AppendFormat( @"public string {0}String {{ get {{ return {0} == null ? null : {0}{1}; }} set {{ {0} = string.IsNullOrEmpty(value) ? null : ({2}){3}; }} }}", propertyName, _toString, TypeAlias, _parse); return sb.ToString(); }
public void Write(string @namespace, Case classCase, Case propertyCase, TextWriter writer, bool skipNamespace, DocumentType documentType) { WriteHeader(writer, documentType); if (!skipNamespace) { WriteUsings(writer, documentType); writer.WriteLine(); writer.WriteLine("namespace {0}", @namespace); writer.WriteLine("{"); } var usedClasses = _repository.GetUsedClasses().ToList(); if (usedClasses.Count == 0) { writer.WriteLine("/* No used classes found! */"); } writer.WriteLine( string.Join( "\r\n\r\n", _repository.GetUsedClasses().Select(x => x.GenerateCSharpCode(classCase, propertyCase, documentType)))); if (!skipNamespace) { writer.WriteLine("}"); } }
public Create_Case(Case incomingCase, string _formEditMode) { InitializeComponent(); formEditMode = _formEditMode; NewCase = incomingCase; }
public void Execute(Case @case, Action next) { //Behavior chooses not to invoke next(). //Since the cases are never invoked, they don't //have the chance to throw exceptions, resulting //in all 'passing'. }
private PersonalPronoun(Case personalPronounCase, Number number, Person person, string name) { _case = personalPronounCase; _number = number; _person = person; _name = name; }
public override string GeneratePropertyCode(string propertyName, Case classCase, IEnumerable<AttributeProxy> attributes, DocumentType documentType) { var sb = new StringBuilder(); var ignoreAttribute = documentType == DocumentType.Xml ? "[XmlIgnore]" : "[IgnoreDataMember]"; sb.AppendFormat( @"{0} public DateTime {1} {{ get; set; }}", ignoreAttribute, propertyName).AppendLine().AppendLine(); foreach (var attribute in attributes) { sb.AppendLine(attribute.ToCode()); } sb.AppendFormat( @"public string {0}String {{ get {{ return {0}.ToString(""{1}"", new CultureInfo(""en-US"")); }} set {{ {0} = DateTime.ParseExact(value, ""{1}"", new CultureInfo(""en-US"")); }} }}", propertyName, Format); return sb.ToString(); }
public string GeneratePropertyCode(string propertyName, Case classCase, IEnumerable<AttributeProxy> attributes, DocumentType documentType) { string typeName; var userDefinedClass = _class as UserDefinedClass; if (userDefinedClass != null) { typeName = string.IsNullOrEmpty(userDefinedClass.CustomName) ? userDefinedClass.TypeName.FormatAs(classCase) : userDefinedClass.CustomName; } else { typeName = ((IBclClass)_class).TypeAlias; } var sb = new StringBuilder(); foreach (var attribute in attributes) { sb.AppendLine(string.Format("{0}", attribute.ToCode())); } sb.AppendFormat("public List<{0}> {1} {{ get; set; }}", typeName, propertyName); return sb.ToString(); }
public APISpecExample() { Contract.Ensures(State == Case.A); _case = Case.A; }
public CaseDetailWindow (Case c, Gtk.Window parent) : base(Gtk.WindowType.Toplevel) { this.Build (); case_show.Case = c; case_show.HideEditingButtons (); }
public void instancierUnHexagone(int position, Case caseInitiale ) { int decalX, decalY; switch (position) { case(0) : decalX = 1; decalY = 0; break; case(1) : decalX = 1; decalY = 1; break; case(2) : decalX = (-1); decalY = 1; break; case(3) : decalX = (-1); decalY = 0; break; case(4) : decalX = (-1); decalY = (-1); break; case(5) : decalX = 1; decalY = (-1); break; default: decalX = 0; decalY = 0; break; } instancierUnHexagone (caseInitiale.coordX + decalX, caseInitiale.coordY + decalY); }
public PassResult(Case @case) { Name = @case.Name; MethodGroup = @case.MethodGroup; Output = @case.Output; Duration = @case.Duration; }
public void onCaseClick(Case c) { if (c.getUnit () == null) { Debug.Log (c.posX + " - " + c.posY); if (selectedUnit) { selectedUnit.setSelected (false); setSelectedUnit (null); } } else { if (selectedUnit && selectedUnit != c.getUnit ()) { selectedUnit.setSelected (false); c.getUnit ().setSelected (true); } else if (selectedUnit != c.getUnit ()) { c.getUnit ().setSelected (true); } setSelectedUnit(c.getUnit ()); Debug.Log (c.posX + " - " + c.posY + " " + c.getUnit().gameObject.name); } }
public CaseReportWindow (Case acase) : base(Gtk.WindowType.Toplevel) { this.Build (); this.Modal = true; _case = acase; }
public void Check_Equal_StrContent(Case.BasicTestCase refTestCase, string sourceDataName, string dataObjectName, bool isInterupt, Core.CodeProcessor.CodeLine activeSelectLine) { if(refTestCase!=null) { if (refTestCase.ActiveDataBuffer.ContainsKey(sourceDataName) && refTestCase.ActiveDataBuffer.ContainsKey(dataObjectName)) { string sourceDataValue = refTestCase.ActiveDataBuffer[sourceDataName]; string objectDataValue = refTestCase.ActiveDataBuffer[dataObjectName]; if (sourceDataValue != objectDataValue) { if (isInterupt) { refTestCase.SingleInterrupt = true; <<<<<<< HEAD ======= refTestCase.ActiveTestCaseReport.InsertFaildItem(activeSelectLine.CodeIndex, "Analyse StrContent Not Equal : " + sourceDataValue + " != " + objectDataValue, true); } else refTestCase.ActiveTestCaseReport.InsertFaildItem(activeSelectLine.CodeIndex, "Analyse StrContent Not Equal : " + sourceDataValue + " != " + objectDataValue, true); } } else { refTestCase.SingleInterrupt = true; refTestCase.ActiveTestCaseReport.InsertFaildItem(activeSelectLine.CodeIndex, "Analyse Exception : Can not find symbol - " + sourceDataName + " or " + dataObjectName, true); } } }
public void Execute(Type testClass, Convention convention, Case[] cases) { foreach (var @case in cases) { var exceptions = @case.Exceptions; try { var instance = construct(testClass); var fixture = new Fixture(testClass, instance, convention.CaseExecution.Behavior, new[] { @case }); convention.InstanceExecution.Behavior.Execute(fixture); Lifecycle.Dispose(instance); } catch (PreservedException preservedException) { var constructionException = preservedException.OriginalException; exceptions.Add(constructionException); } catch (Exception constructionException) { exceptions.Add(constructionException); } } }
public static void ShouldBe(this string actual, string expected, Case caseSensitivity, [InstantHandle] Func<string> customMessage) { if (caseSensitivity == Case.Sensitive) ShouldBe(actual, expected, customMessage); else ShouldBe(actual, expected, customMessage, StringCompareShould.IgnoreCase); }
internal AdjectiveForm(Stem stem, Gender gender, Case @case, Number number, string suffix) : base(stem, suffix) { Gender = gender; Case = @case; Number = number; }
/// <summary> /// Perform a string comparison, specifying the desired case sensitivity /// </summary> public static void ShouldBe(this string actual, string expected, Case caseSensitivity) { var constraint = (caseSensitivity == Case.Sensitive) ? Is.EqualTo(expected) : Is.EqualTo(expected).IgnoreCase; actual.AssertAwesomely(constraint, actual, expected); }
public override string GeneratePropertyCode(string propertyName, Case classCase, IEnumerable<AttributeProxy> attributes, DocumentType documentType) { var sb = new StringBuilder(); var ignoreAttribute = documentType == DocumentType.Xml ? "[XmlIgnore]" : "[IgnoreDataMember]"; sb.AppendFormat( @"{0} public bool {1} {{ get; set; }}", ignoreAttribute, propertyName).AppendLine().AppendLine(); foreach (var attribute in attributes) { sb.AppendLine(attribute.ToCode()); } sb.AppendFormat( @"public string {0}String {{ get {{ return {0} ? ""True"" : ""False""; }} set {{ {0} = bool.Parse(value); }} }}", propertyName); return sb.ToString(); }
public override void Initialize(Case testCase) { base.Initialize(testCase); tempObjectFactory.dataSetFactory.ForSearchKey = true; tempObjectValidator = new TempObjectValidator(); tempObjectValidator.Initialize(testCase); tempObjectValidator.SectionType = Section.SectionType.DataAsExpected; }
bool SkipDueToClassLevelExplicitAttribute(Case @case) { var method = @case.Method; var isMarkedExplicit = method.DeclaringType.Has<ExplicitAttribute>(); return isMarkedExplicit && TargetMember != method.DeclaringType && TargetMember != method; }
public string Get(Case nounCase, Number number) { if (Overrides.ContainsKey(nounCase) && Overrides[nounCase].ContainsKey(number)) { return Overrides[nounCase][number]; } return GetRegular(nounCase, number); }
public void DeleteOverride(Case nounCase, Number number) { if (!Overrides.ContainsKey(nounCase) || !Overrides[nounCase].ContainsKey(number)) { return; } Overrides[nounCase].Remove(number); }
public virtual string InflectMiddleNameTo(Case @case) { Guard.IfArgumentNullOrWhitespace(MiddleName, "FirstName", "Middle name was not provided"); if (AutoDetectGender) DetectGender(); return MiddleName = new CaseInflection(provider, Gender).InflectMiddleNameTo(MiddleName, @case); }
public ActionResult Edit() { if (Request["id"] != null) { ViewData["Case"] = new Case().Find(Converter.ToInt(Request["id"].ToString())); } return View(); }
static string SkipAttributeReason(Case @case) { var method = @case.Method; var target = method.HasOrInherits<SkipAttribute>() ? (MemberInfo)method : method.DeclaringType; return target.GetCustomAttribute<SkipAttribute>(true).Reason; }
bool SkipDueToExplicitAttribute(Case @case) { var method = @case.Method; var isMarkedExplicit = method.Has<ExplicitAttribute>(); return isMarkedExplicit && TargetMember != method; }
public CasesReportGenerator (Case[] cases) { AddHeader (0, new String[] {"Nombre del caso", "Actos", "Tipo de perpetrador", "Número de Víctimas", "Fecha de inicio", "Fecha de término"}); for (int i = 0, max = cases.Length; i < max; i++) { Case acase = cases[i]; AddRow (i+1, acase.ToReportArray ()); } }
static string ExplicitAttributeReason(Case @case) { return("[Explicit] tests run only when they are individually selected for execution."); }
protected IObjectComparer GetComparer(MemberInfo memberInfo) => GetComparer(memberInfo.TypeMatch() .With(Case.Is <PropertyInfo>(), v => v.PropertyType) .With(Case.Is <FieldInfo>(), v => v.FieldType) .Do(), memberInfo);
static bool HasSkipAttribute(Case @case) { return(@case.Method.HasOrInherits <SkipAttribute>()); }
private void SelectCase(int i) { dropCaseList.SelectedIndex = i; TrackedCase = ((Case)dropCaseList.Items[i]); }
protected void Button1_Click(object sender, EventArgs e) { int ApplicantsPostalNumber; int RefNumber; string EmploymentDocumentsCategory = ""; string EmploymentOfEmployeesCategory = ""; string OccupationPensionCategory = ""; string RetirementCategory = ""; string OtherCategory = ""; if (anonymousCheck.Checked == true) { anonymousCheck.Value = "True"; } else { anonymousCheck.Value = "False"; } //Kategorier string kategori = categoriSelect.Value.ToString(); if (kategori == "EmploymentDocumentsCategory") { EmploymentDocumentsCategory = "True"; EmploymentOfEmployeesCategory = "False"; OccupationPensionCategory = "False"; RetirementCategory = "False"; OtherCategory = "False"; } else if (kategori == "EmploymentOfEmployeesCategory") { EmploymentDocumentsCategory = "False"; EmploymentOfEmployeesCategory = "True"; OccupationPensionCategory = "False"; RetirementCategory = "False"; OtherCategory = "False"; } else if (kategori == "OccupationPensionCategory") { EmploymentDocumentsCategory = "False"; EmploymentOfEmployeesCategory = "False"; OccupationPensionCategory = "True"; RetirementCategory = "False"; OtherCategory = "False"; } else if (kategori == "RetirementCategory") { EmploymentDocumentsCategory = "False"; EmploymentOfEmployeesCategory = "False"; OccupationPensionCategory = "False"; RetirementCategory = "True"; OtherCategory = "False"; } else if (kategori == "OtherCategory") { EmploymentDocumentsCategory = "False"; EmploymentOfEmployeesCategory = "False"; OccupationPensionCategory = "False"; RetirementCategory = "False"; OtherCategory = "True"; } //Leverans string LeveransMetod = ""; if (RadioKommunhuset.Checked == true) { LeveransMetod = RadioKommunhuset.Value.ToString(); } else if (RadioEmail.Checked == true) { LeveransMetod = RadioEmail.Value.ToString(); } else if (RadioPosten.Checked == true) { LeveransMetod = RadioPosten.Value.ToString(); } //Kopplar till webbservice ServiceReference1.EServiceClient client = new ServiceReference1.EServiceClient(); //ger variabler värden string ApplicantsFirstName = Firstname.Value.ToString(); string ApplicantsSurname = Lastname.Value.ToString(); if (FormRefNumber.Value.Length == 0) { RefNumber = 0; } else { RefNumber = int.Parse(FormRefNumber.Value.ToString()); } string CourtName = courtSelect.Value.ToString(); string CountryOfApplicants = Country.Value.ToString(); string CityOfApplicants = City.Value.ToString(); DateTime Date = Convert.ToDateTime(FormDate.Value.ToString()); string Description = FormDescription.Value.ToString(); string DeliveryOption = LeveransMetod; string ApplicantsAddress = Adress.Value.ToString(); string ApplicantsPhoneNumber = PhoneNumber.Value.ToString(); if (PostalNumber.Value.Length == 0) { ApplicantsPostalNumber = 0; } else { ApplicantsPostalNumber = int.Parse(PostalNumber.Value.ToString()); } string RequestMotivation = Motivation.Value.ToString(); string ApplicantsEmail = Email.Value.ToString(); string Anonymous = anonymousCheck.Value.ToString(); DateTime DateOfCreatedCase = DateTime.Now; ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "msg", "alert('Anmälan inskickad')", true); //ger newCase formulär värden Case newCase = new Case(); newCase.ApplicantsFirstName = ApplicantsFirstName; newCase.ApplicantsSurname = ApplicantsSurname; newCase.RefNumber = RefNumber; newCase.CourtName = CourtName; newCase.CountryOfApplicants = CountryOfApplicants; newCase.CityOfApplicants = CityOfApplicants; newCase.Date = Date; newCase.Description = Description; newCase.DeliveryOption = DeliveryOption; newCase.ApplicantsAddress = ApplicantsAddress; newCase.ApplicantsPhoneNumber = ApplicantsPhoneNumber; newCase.ApplicantsPostalNumber = ApplicantsPostalNumber; newCase.RequestMotivation = RequestMotivation; newCase.ApplicantsEmail = ApplicantsEmail; newCase.Anonymous = Anonymous; newCase.EmploymentDocumentsCategory = EmploymentDocumentsCategory; newCase.EmploymentOfEmployeesCategory = EmploymentOfEmployeesCategory; newCase.OccupationPensionCategory = OccupationPensionCategory; newCase.RetirementCategory = RetirementCategory; newCase.OtherCategory = OtherCategory; //Skickar värderna till webbservicen och skapar ett nytt ärende client.CreateCase(newCase); }
public InfoHead(Case location, Player player) : base(location, player) { }
private ObservableCollection <Case> SortOutScotusData(List <ScotusRow> rawData) { Dictionary <string, Case> allCases = new Dictionary <string, Case>(); foreach (ScotusRow sr in rawData) { // if it doesn't have this case yet, populate the case if (!allCases.ContainsKey(sr.caseId)) { var newCase = new Case() { CaseId = sr.caseId, Court = sr.chief, DecisionDate = sr.dateDecision, ArgumentDate = sr.dateArgument, Term = sr.term, CaseName = sr.caseName, OpinionWriterId = sr.majOpinWriter, PartisanDecision = sr.decisionDirection }; var voteDetail = new ScotusVoteTotal() { CaseId = sr.caseId, MajorityCount = sr.majVotes, MinorityCount = sr.minVotes, IsEqualVote = sr.minVotes == sr.majVotes }; newCase.VoteDetails = voteDetail; newCase.Dockets.Add(sr.docketId); allCases.Add(sr.caseId, newCase); } if (allCases[sr.caseId].Dockets[0] == sr.docketId) { if (sr.majority == 2) { allCases[sr.caseId].VoteDetails.MajorityVotes.Add(sr.justice); } else if (sr.majority == 1) { allCases[sr.caseId].VoteDetails.MinorityVotes.Add(sr.justice); } } else if (allCases[sr.caseId].Dockets.FirstOrDefault(d => d == sr.docketId) == null) { allCases[sr.caseId].Dockets.Add(sr.docketId); } } var casesAsList = new ObservableCollection <Case>(); int typicalSplit = 0; int atypicalSplit = 0; foreach (KeyValuePair <string, Case> kvp in allCases) { kvp.Value.VoteDetails.ParseVotes(); if (kvp.Value.VoteDetails.MajorityCount <= 9) { if (kvp.Value.Court == "Roberts") { kvp.Value.VoteSplit = Case.EvalSplit(kvp.Value.VoteDetails); if (kvp.Value.VoteSplit == VoteResult.TypicalSplit) { typicalSplit++; } if (kvp.Value.VoteSplit == VoteResult.NonTypicalSplit) { atypicalSplit++; } casesAsList.Add(kvp.Value); } //casesAsList.Add(kvp.Value); } } Debug.WriteLine("Typical Split Count = " + casesAsList.Count(t => t.VoteSplit == VoteResult.TypicalSplit)); Debug.WriteLine("ATypical Split Count = " + casesAsList.Count(t => t.VoteSplit == VoteResult.NonTypicalSplit)); Debug.WriteLine("Unanimous Count = " + casesAsList.Count(t => t.VoteSplit == VoteResult.Unanimous)); Debug.WriteLine("Mixed Minority Count = " + casesAsList.Count(t => t.VoteSplit == VoteResult.MixedMinority)); Debug.WriteLine("Con Minority Count = " + casesAsList.Count(t => t.VoteSplit == VoteResult.ConMinority)); Debug.WriteLine("Lib Minority Count = " + casesAsList.Count(t => t.VoteSplit == VoteResult.LibMinority)); Debug.WriteLine("Single Dissent Count = " + casesAsList.Count(t => t.VoteSplit == VoteResult.SingleDissent)); return(casesAsList); }
public abstract bool CanExectute(Case selectedCase);
public static void PickUserCase(int caseNum) //takes the number of the case and adds it to a new Dictionary so it can be stored/ then removes the case from the currentCase list { userCase = cases[caseNum - 1]; OpenCase(caseNum); }
public abstract void Execute(Case selectedCase);
/// <summary> /// Initialize a new <see cref="CaptureLiteral"/> with the given <paramref name="capture"/>. /// </summary> /// <param name="capture">The <see cref="Capture"/> to parse.</param> /// <param name="comparisonType">The <see cref="Case"/> to use when parsing.</param> internal CaptureLiteral([DisallowNull] Capture capture, Case comparisonType) : base(comparisonType) => CapStore = capture;
public static void OpenCase(int caseNum) //get case that is selected to remove, { Case c = cases[caseNum - 1]; c.IsOpened = true; }
/// <summary> /// Override to specify the casing that should be used for the table and variable names. /// </summary> /// <param name="command"></param> /// <param name="case"></param> /// <typeparam name="T"></typeparam> /// <returns></returns> public static string BuildInsertStatement <T>(this Command command, Case @case) { return(BuildInsertStatement <T>(command, null, @case)); }
public static void ShouldNotContain(this string actual, string expected, Case caseSensitivity) { ShouldNotContain(actual, expected, () => null, caseSensitivity); }
/// <summary> /// Returns a string of the Insert Statement that will be inserted into the database. /// </summary> /// <param name="command"></param> /// <param name="table"></param> /// <param name="case"></param> /// <param name="removeParameters"></param> /// <typeparam name="T"></typeparam> /// <returns></returns> /// <exception cref="ArgumentException"></exception> public static string BuildInsertStatement <T>(this Command command, string table, Case @case, object removeParameters = null) { var dt = typeof(T).ObjectToDataTable(); if (table is null) { table = typeof(T).Name.Pluralize().ConvertCase(@case); } var sqlStatement = new StringBuilder(); if (removeParameters != null) { var type = removeParameters.GetType(); var props = new List <PropertyInfo>(type.GetProperties()); foreach (var prop in props) { dt.Columns.Remove(prop.Name); } } switch (command.Dbms) { case DBMS.MySQL: sqlStatement.Append($"INSERT INTO `{table}` ("); break; case DBMS.SQLite: sqlStatement.Append($"INSERT INTO {table} ("); break; case DBMS.MSSQL: sqlStatement.Append($"INSERT INTO [{table}] ("); break; default: throw new InvalidDatabaseTypeException(); } foreach (DataColumn column in dt.Columns) { sqlStatement.Append($"{column.ColumnName.ConvertCase(@case)}, "); } sqlStatement.Remove(sqlStatement.Length - 2, 2); sqlStatement.Append(") VALUES ("); foreach (DataColumn column in dt.Columns) { sqlStatement.Append($"@{column.ColumnName}, "); } sqlStatement.Remove(sqlStatement.Length - 2, 2); sqlStatement.Append("); "); command.AppendReturnId(sqlStatement); return(sqlStatement.ToString()); }
public static void ShouldNotContain(this string actual, string expected, string customMessage, Case caseSensitivity) { ShouldNotContain(actual, expected, () => customMessage, caseSensitivity); }
public void Initialize() { this.auditClient = new AuditHttpClient("https://azureinaction.azurewebsites.net/"); this.@case = new Case(); }
public underDecision(int val, Case c) { value = val; choice = c; }
private void PopulateTestData() { MockContactList = new List <Contact>(); MockCaseList = new List <Case>(); MockCaseRuleList = new List <CaseRule>(); MockCaseAlertList = new List <CaseAlert>(); MockCasePropertySetList = new List <CasePropertySet>(); MockCasePropertyValueList = new List <CasePropertyValue>(); MockContactPropertyValueList = new List <ContactPropertyValue>(); MockCommunicationItemList = new List <CommunicationItem>(); MockLabelList = new List <Label>(); MockCaseRuleList.Add(new CaseRule { Name = "Rule01", Description = "rule 01 description", Priority = 2 }); MockCaseRuleList.Add(new CaseRule { Name = "Rule02", Description = "rule 02 description", Priority = 1 }); MockCaseRuleList.Add(new CaseRule { Name = "Rule03", Description = "rule 03 description", Priority = 4 }); FillCasePropertySetsContent(); MockLabelList.Add(new Label() { Name = "LabelName1", Description = "Description1" }); MockLabelList.Add(new Label() { Name = "LabelName2", Description = "Description2" }); Random r = new Random(); for (int i = 0; i < 25; i++) { Contact contact = new Contact(); contact.Addresses.Add(new Address() { City = string.Format("Kaliningrad {0}", i), Line1 = "Line1", Type = "Primary" }); contact.Phones.Add(new Phone() { Number = "891112345678", Type = "Primary" }); contact.Emails.Add(new Email() { Address = "*****@*****.**", Type = "Primary" }); contact.Notes.Add(new Note() { Title = "Customer Note 1", Body = "Customer Note 1 body" }); contact.Notes.Add(new Note() { Title = "Customer Note 2", Body = "Customer Note 2 body" }); contact.BirthDate = new DateTime(1989, 2, 3); contact.FullName = string.Format("Иван Иванов {0}", i); Case c = new Case(); c.Contact = contact; c.Description = string.Format("Description {0}", i); c.Priority = r.Next(0, 3); c.Title = string.Format("Title {0}", i); c.Status = ((CaseStatus)r.Next(0, 3)).ToString(); c.Channel = ((CaseChannel)r.Next(0, 4)).ToString(); c.AgentName = "ETatar"; c.AgentId = Guid.NewGuid().ToString(); Attachment attachment = new Attachment() { CreatorName = "test creator", DisplayName = "New Attachment", FileType = "txt", FileUrl = "fileUrl" }; EmailItem emailItem = new EmailItem() { To = "To", From = "From", Title = "Title email" }; emailItem.Attachments.Add(attachment); c.CommunicationItems.Add(emailItem); c.CommunicationItems.Add(new PhoneCallItem { PhoneNumber = "79846134", Direction = "Inbound" }); c.Notes.Add(new Note() { Body = "test Body", Title = "Test title" }); MockCasePropertyValueList.Add(CreateCasePropertyValue("Agent", false, c.CaseId, null, 0, 0, null, c.AgentId, PropertyValueType.ShortString.GetHashCode(), r.Next(4))); MockContactPropertyValueList.Add(CreateContactPropertyValue("Additional note", false, contact.MemberId, null, 0, 0, null, contact.FullName, PropertyValueType.ShortString.GetHashCode(), r.Next(3))); contact.Cases.Add(c); MockContactList.Add(contact); MockCaseList.Add(c); } }
/// <summary> /// Main method /// </summary> /// <param name="args">Initial args</param> public static void Main(string[] args) { PersonalComputer myPc = new PersonalComputer(); myPc.Guarantee = 2; myPc.Price = 1000; myPc.Provider = "World PC"; myPc.HardwarePc = new List <Hardware>(); // setting screen Screen myScreen = new Screen(); myScreen.Brand = "Samsung"; myPc.HardwarePc.Add(myScreen); // setting keyboard Keyboard myKeyboard = new Keyboard(); myKeyboard.Brand = "Genius"; myPc.HardwarePc.Add(myKeyboard); // setting mouse Mouse myMouse = new Mouse(); myMouse.Brand = "Genius"; myPc.HardwarePc.Add(myMouse); // setting case Case myCase = new Case(); myCase.Brand = "Ducky"; myPc.HardwarePc.Add(myCase); // setting camera Camera myCamera = new Camera(); myCamera.Color = "Silver"; myPc.HardwarePc.Add(myCamera); // setting speaker Speaker mySpeaker = new Speaker(); mySpeaker.Frequency = 100; myPc.HardwarePc.Add(mySpeaker); myPc.SoftwarePc = new List <Software>(); // setting softwareOS Software mySoftwareOS = new Software(); mySoftwareOS.Version = 2; mySoftwareOS.LastUpdate = DateTime.Now.AddYears(-10); mySoftwareOS.Name = "Windows XP"; myPc.SoftwarePc.Add(mySoftwareOS); Software mySoftwareApp = new Software(); mySoftwareApp.Version = 5; mySoftwareApp.LastUpdate = DateTime.Now.AddYears(-2); mySoftwareApp.Name = "League of Legends"; mySoftwareApp.Release = DateTime.Now.AddYears(-8); myPc.SoftwarePc.Add(mySoftwareApp); // Mauricio modified... again :/ and again User myUser = new User(); myUser.FirstName = "Mauricio"; myUser.LastName = "Gates"; myUser.UserName = "******"; myUser.LastName = "Iriarte"; mySoftwareOS.Users = new List <User>(); mySoftwareOS.Users.Add(myUser); myScreen.Brand = "Samsung"; myPc.HardwarePc.Add(myScreen); }
public static void ShouldNotContain(this string actual, string expected, [InstantHandle] Func <string> customMessage, Case caseSensitivity) { actual.AssertAwesomely(v => { var b = (caseSensitivity == Case.Sensitive) ? !Is.StringContainingUsingCaseSensitivity(v, expected) : !Is.StringContainingIgnoreCase(v, expected); return(b); }, actual.Clip(100, "..."), expected, caseSensitivity, customMessage); }
static bool HasExplicitAttribute(Case @case) { return(@case.Method.HasOrInherits <ExplicitAttribute>()); }
public Decision(int val, Case deci, ChessMan piece) { decision.value = val; decision.choice = deci; chess = piece; }
public IActionResult Edit(int id) { Case oldCase = dataContext.Cases.FirstOrDefault(p => p.CaseId == id); return(View(oldCase)); }
/// <summary> /// Returns a SQL UPDATE statement with the override for a where clause to specify the where condition. /// </summary> /// <param name="command"></param> /// <param name="casing"></param> /// <param name="clause"></param> /// <typeparam name="T"></typeparam> /// <returns></returns> public static string BuildUpdateStatement <T>(this Command command, Case @case, string clause) { return(BuildUpdateStatement <T>(command, null, @case, clause)); }
/// <summary> /// Returns a SQL UPDATE statement with the override for a where clause and an override for the case and table name. /// </summary> /// <param name="command"></param> /// <param name="table"></param> /// <param name="case"></param> /// <param name="clause"></param> /// <typeparam name="T"></typeparam> /// <returns></returns> /// <exception cref="InvalidDatabaseTypeException"></exception> public static string BuildUpdateStatement <T>(this Command command, string table, Case @case, string clause) { var dt = typeof(T).ObjectToDataTable(); if (table is null) { table = typeof(T).Name.Pluralize().ConvertCase(@case); } if (clause is null) { clause = "WHERE id = @Id;"; } var sqlStatement = new StringBuilder(); switch (command.Dbms) { case DBMS.SQLite: sqlStatement.Append($"UPDATE {table} SET"); break; case DBMS.MySQL: sqlStatement.Append($"UPDATE `{table}` SET"); break; case DBMS.MSSQL: sqlStatement.Append($"UPDATE [{table}] SET"); break; default: throw new InvalidDatabaseTypeException(); } sqlStatement.Append(" "); foreach (DataColumn column in dt.Columns) { sqlStatement.Append($"{column.ColumnName.ConvertCase(@case)} = @{column.ColumnName}, "); } sqlStatement.Remove(sqlStatement.Length - 2, 2); sqlStatement.Append(" "); sqlStatement.Append(clause); sqlStatement.Append(" SELECT 0;"); return(sqlStatement.ToString()); }
public Labyrinthe(int xPosDebut, int zPosDebut, int xTaille, int zTaille, string nomDuFichier, Case prefabCase, HubFin prefabHubFin) { xt = xTaille; zt = zTaille; xD = xPosDebut; zD = zPosDebut; fichierLaby = nomDuFichier; if (fichierLaby == "") { GenerationTableau(); } else { ChargerLabyrinthe(nomDuFichier); } Generation(prefabCase, prefabHubFin); }
/// <summary> /// Returns a SQL DELETE statement. /// </summary> /// <param name="command"></param> /// <param name="table"></param> /// <param name="casing"></param> /// <param name="clause"></param> /// <typeparam name="T"></typeparam> /// <returns></returns> /// <exception cref="InvalidDatabaseTypeException"></exception> public static string BuildDeleteStatement <T>(this Command command, string table, Case @case, string clause) { if (table is null) { table = typeof(T).Name.Pluralize().ConvertCase(@case); } if (clause is null) { clause = "WHERE id = @Id"; } var sqlStatement = new StringBuilder(); switch (command.Dbms) { case DBMS.SQLite: sqlStatement.Append($"DELETE FROM {table}"); break; case DBMS.MySQL: sqlStatement.Append($"DELETE FROM `{table}`"); break; case DBMS.MSSQL: sqlStatement.Append($"DELETE FROM [{table}]"); break; default: throw new InvalidDatabaseTypeException(); } sqlStatement.Append(" "); sqlStatement.Append(clause); return(sqlStatement.ToString()); }
// Extension activity public static void VariableChanging() { string[] Split, SplitCase; string Input, Case, tempString, finalString; int Length, fromCase, toCase; Case = Console.ReadLine(); Input = Console.ReadLine(); SplitCase = Case.Split(" "); fromCase = Int32.Parse(SplitCase[0]); toCase = Int32.Parse(SplitCase[1]); if (fromCase >= 1) { Split = Input.Split("_"); Length = Split.Count(); finalString = Split[0]; for (int i = 1; i < Length; i++) { tempString = Split[i]; finalString = finalString + " " + tempString; } finalString = finalString.ToLower(); Split = finalString.Split(" "); if (toCase == 0) { CamelCase(Split, Length); } else if (toCase == 1) { SnakeCase(Split, Length); } else { SnakeCase_Caps(Split, Length); } } else { Split = Regex.Split(Input, @"(?<!^)(?=[A-Z])"); Length = Split.Count(); finalString = Split[0]; for (int i = 1; i < Length; i++) { tempString = Split[i]; finalString = finalString + " " + tempString; } finalString = finalString.ToLower(); Split = finalString.Split(" "); if (toCase == 0) { CamelCase(Split, Length); } else if (toCase == 1) { SnakeCase(Split, Length); } else { SnakeCase_Caps(Split, Length); } } }
public static void Method() { IQuery <User> q = context.Query <User>(); var space = new char[] { ' ' }; DateTime startTime = DateTime.Now; DateTime endTime = DateTime.Now.AddDays(1); var ret = q.Select(a => new { Id = a.Id, String_Length = (int?)a.Name.Length, //LENGTH([Users].[Name]) Substring = a.Name.Substring(0), //SUBSTR([Users].[Name],0 + 1) Substring1 = a.Name.Substring(1), //SUBSTR([Users].[Name],1 + 1) Substring1_2 = a.Name.Substring(1, 2), //SUBSTR([Users].[Name],1 + 1,2) ToLower = a.Name.ToLower(), //LOWER([Users].[Name]) ToUpper = a.Name.ToUpper(), //UPPER([Users].[Name]) IsNullOrEmpty = string.IsNullOrEmpty(a.Name), //CASE WHEN ([Users].[Name] IS NULL OR [Users].[Name] = '') THEN 1 ELSE 0 END = 1 Contains = (bool?)a.Name.Contains("s"), //[Users].[Name] LIKE '%' || 's' || '%' StartsWith = (bool?)a.Name.StartsWith("s"), //[Users].[Name] LIKE 's' || '%' EndsWith = (bool?)a.Name.EndsWith("s"), //[Users].[Name] LIKE '%' || 's' Trim = a.Name.Trim(), //TRIM([Users].[Name]) TrimStart = a.Name.TrimStart(space), //LTRIM([Users].[Name]) TrimEnd = a.Name.TrimEnd(space), //RTRIM([Users].[Name]) Replace = a.Name.Replace("l", "L"), DiffYears = Sql.DiffYears(startTime, endTime), //(CAST(STRFTIME('%Y',@P_0) AS INTEGER) - CAST(STRFTIME('%Y',@P_1) AS INTEGER)) DiffMonths = Sql.DiffMonths(startTime, endTime), //((CAST(STRFTIME('%Y',@P_0) AS INTEGER) - CAST(STRFTIME('%Y',@P_1) AS INTEGER)) * 12 + (CAST(STRFTIME('%m',@P_0) AS INTEGER) - CAST(STRFTIME('%m',@P_1) AS INTEGER))) DiffDays = Sql.DiffDays(startTime, endTime), //CAST((JULIANDAY(@P_0) - JULIANDAY(@P_1)) AS INTEGER) DiffHours = Sql.DiffHours(startTime, endTime), //CAST((JULIANDAY(@P_0) - JULIANDAY(@P_1)) * 24 AS INTEGER) DiffMinutes = Sql.DiffMinutes(startTime, endTime), //CAST((JULIANDAY(@P_0) - JULIANDAY(@P_1)) * 1440 AS INTEGER) DiffSeconds = Sql.DiffSeconds(startTime, endTime), //CAST((JULIANDAY(@P_0) - JULIANDAY(@P_1)) * 86400 AS INTEGER) //DiffMilliseconds = Sql.DiffMilliseconds(startTime, endTime),//不支持 Millisecond //DiffMicroseconds = Sql.DiffMicroseconds(startTime, endTime),//不支持 Microseconds AddYears = startTime.AddYears(1), //DATETIME(@P_0,'+' || 1 || ' years') AddMonths = startTime.AddMonths(1), //DATETIME(@P_0,'+' || 1 || ' months') AddDays = startTime.AddDays(1), //DATETIME(@P_0,'+' || 1 || ' days') AddHours = startTime.AddHours(1), //DATETIME(@P_0,'+' || 1 || ' hours') AddMinutes = startTime.AddMinutes(2), //DATETIME(@P_0,'+' || 2 || ' minutes') AddSeconds = startTime.AddSeconds(120), //DATETIME(@P_0,'+' || 120 || ' seconds') //AddMilliseconds = startTime.AddMilliseconds(2000),//不支持 Now = DateTime.Now, //DATETIME('NOW','LOCALTIME') UtcNow = DateTime.UtcNow, //DATETIME() Today = DateTime.Today, //DATE('NOW','LOCALTIME') Date = DateTime.Now.Date, //DATE('NOW','LOCALTIME') Year = DateTime.Now.Year, //CAST(STRFTIME('%Y',DATETIME('NOW','LOCALTIME')) AS INTEGER) Month = DateTime.Now.Month, //CAST(STRFTIME('%m',DATETIME('NOW','LOCALTIME')) AS INTEGER) Day = DateTime.Now.Day, //CAST(STRFTIME('%d',DATETIME('NOW','LOCALTIME')) AS INTEGER) Hour = DateTime.Now.Hour, //CAST(STRFTIME('%H',DATETIME('NOW','LOCALTIME')) AS INTEGER) Minute = DateTime.Now.Minute, //CAST(STRFTIME('%M',DATETIME('NOW','LOCALTIME')) AS INTEGER) Second = DateTime.Now.Second, //CAST(STRFTIME('%S',DATETIME('NOW','LOCALTIME')) AS INTEGER) Millisecond = DateTime.Now.Millisecond, //@P_2 直接计算 DateTime.Now.Millisecond 的值 DayOfWeek = DateTime.Now.DayOfWeek, //CAST(STRFTIME('%w',DATETIME('NOW','LOCALTIME')) AS INTEGER) Byte_Parse = byte.Parse("1"), //CAST('1' AS INTEGER) Int_Parse = int.Parse("1"), //CAST('1' AS INTEGER) Int16_Parse = Int16.Parse("11"), //CAST('11' AS INTEGER) Long_Parse = long.Parse("2"), //CAST('2' AS INTEGER) Double_Parse = double.Parse("3.1"), //CAST('3.1' AS REAL) Float_Parse = float.Parse("4.1"), //CAST('4.1' AS REAL) //Decimal_Parse = decimal.Parse("5"),//不支持 //Guid_Parse = Guid.Parse("D544BC4C-739E-4CD3-A3D3-7BF803FCE179"),//不支持 'D544BC4C-739E-4CD3-A3D3-7BF803FCE179' Bool_Parse = bool.Parse("1"), //CAST('1' AS INTEGER) DateTime_Parse = DateTime.Parse("2014-01-01"), //DATETIME('2014-01-01') B = a.Age == null ? false : a.Age > 1, //三元表达式 CaseWhen = Case.When(a.Id > 100).Then(1).Else(0) //case when }).ToList(); ConsoleHelper.WriteLineAndReadKey(); }