public List <NameObject> GetAllNamesFromDatabase() { MySqlConnection connection = new MySqlConnection(myConnectionString); MySqlCommand newCommand = connection.CreateCommand(); newCommand.CommandText = "select * from testnames"; connection.Open(); MySqlDataReader reader = newCommand.ExecuteReader(); List <NameObject> listOfNames = new List <NameObject>(); while (reader.Read()) { NameObject currentDatabaseRow = new NameObject( Convert.ToInt32(reader[0]), reader[1].ToString(), reader[2].ToString(), Convert.ToInt32(reader[3])); listOfNames.Add(currentDatabaseRow); } connection.Close(); return(listOfNames); }
private void SetClassifyData() { List <NameObject> objects = new List <NameObject>(); OracleCommand command = new OracleCommand(); command.Connection = obj_lib.Module.Connection; command.CommandText = @"select code, clcode || ': ' || clname as name from classify where cltype = :cltype order by clname"; command.Parameters.Add("cltype", 15); OracleDataReader reader = command.ExecuteReader(); while (reader.Read()) { NameObject obj = new NameObject(); obj.Code = reader.GetDecimal(0); obj.Name = reader.GetString(1); objects.Add(obj); } classifyBox.ValueMember = "code"; classifyBox.DisplayMember = "name"; classifyBox.DataSource = objects; }
public static string InsertStudentName(NameObject name) { SqlParameter[] sqlParameters = new SqlParameter[3]; sqlParameters[0] = new SqlParameter() { ParameterName = "@FirstName", SqlDbType = SqlDbType.VarChar, Value = name.FirstName, Size = 50 }; sqlParameters[1] = new SqlParameter() { ParameterName = "@LastName", SqlDbType = SqlDbType.VarChar, Value = name.LastName, Size = 50 }; sqlParameters[2] = new SqlParameter() { ParameterName = "@ReturnValue", SqlDbType = SqlDbType.VarChar, Size = 140, Direction = ParameterDirection.Output }; return(DbInsert.Save("spInsertStudentName", sqlParameters)); }
public static bool MatchStoredProcedureName(string input, string name, int occurrence) { int execEndPosition = -1; int startPosition = 0; for (int i = 1; i <= occurrence; i++) { execEndPosition = GetExecEndPosition(input, startPosition); startPosition = execEndPosition; } if (execEndPosition == -1) { return(false); } NameObject nameObject = GetName(execEndPosition, input); if (nameObject.Name == name) { return(true); } return(false); }
public static bool MatchStoredProcedureParameter(string input, int position, string value, int occurrence) { NameObject nameObject = GetStoredProcedureNameObject(input, occurrence); if (nameObject != null) { string parameters = input.Substring(nameObject.LastCharacterPositionInName).Trim(); List <string> parameterArray = GetParameters(parameters); if (position > 0) { for (int i = 0; i < parameterArray.Count; i++) { if (i == position - 1) { if (parameterArray[i] == value) { return(true); } } } } else { if (parameterArray.Count.ToString() == value) { return(true); } } } return(false); }
public CampaignDTO(string name, ProductDTO product, int limit, int targetSalesCount, int duration) { id = new Guid(); Product = product; Name = new NameObject(name); Duration = new DurationObject(duration); Limit = new PriceLimitObject(limit); Count = new SalesTargetObject(targetSalesCount); Status = true; }
public void ReadNameObjects(string fragment, string expected) { // 7.3.5 Name Objects byte[] bytes = System.Text.UTF8Encoding.UTF8.GetBytes(fragment); Tokenizer feed = new Tokenizer(new MemoryStream(bytes)); Objectizer objectizer = new Objectizer(feed); NameObject actual = (NameObject)objectizer.NextObject(); Assert.Equal(expected, actual.Value); }
public void TestDerivedCopy() { IdObject idobj1 = new IdObject { Id = 1}; IdObject idobj2 = (IdObject)CheckDerivedCopy(idobj1); idobj2.Id = idobj2.Id + 1; Assert.AreNotEqual(idobj2,idobj1); NameObject nameObj1 = new NameObject { Name = "cheka"}; NameObject nameObj2 = (NameObject)CheckDerivedCopy(nameObj1); nameObj2.Name = "NewName"; Assert.AreNotEqual(nameObj2,nameObj1); }
public void OnSubmitClick() { NameObject model = new NameObject { NameOfObject = ImageDescription.ImageName, SelectedNameOfObject = SelectedString, Correct = ImageDescription.ImageName.Equals(SelectedString), ScreenNumber = 2, TimeToComplete = stopwatch.Elapsed }; ds.CreateNameObjectMMSE(model); SceneManager.LoadScene((int)UnityApp.Utilities.ScreensScenes.AnimalDragging); }
public string WriteToDataBase(NameObject sentNewName) { MySqlConnection connection = new MySqlConnection(myConnectionString); MySqlCommand newCommand = connection.CreateCommand(); newCommand = connection.CreateCommand(); newCommand.CommandText = $"INSERT INTO testnames (first, last, age) VALUES ('{sentNewName.FirstName}', '{sentNewName.LastName}', {sentNewName.Age})"; connection.Open(); newCommand.ExecuteNonQuery(); connection.Close(); return("** New Name Added **"); }
public override IDictionary <string, object> Serialize(object obj, JavaScriptSerializer serializer) { NameObject nameObj = (NameObject)obj; Dictionary <string, object> dict = new Dictionary <string, object>(); if (nameObj.Names != null && nameObj.Names.Length == 1) { dict.Add("name", nameObj.Name); } else { dict.Add("name", nameObj.Names); } return(dict); }
public override object Deserialize(IDictionary <string, object> dictionary, Type type, JavaScriptSerializer serializer) { NameObject nameObj = new NameObject(); string singleName = GetValue <string>(dictionary, "name"); if (singleName != null) { nameObj.Name = singleName; } else { ArrayList arrayList = GetValue <ArrayList>(dictionary, "name"); nameObj.Names = (arrayList != null) ? arrayList.Cast <string>().ToArray() : null; } return(nameObj); }
public void TestDerivedCopy() { IdObject idobj1 = new IdObject { Id = 1 }; IdObject idobj2 = (IdObject)CheckDerivedCopy(idobj1); idobj2.Id = idobj2.Id + 1; Assert.AreNotEqual(idobj2, idobj1); NameObject nameObj1 = new NameObject { Name = "cheka" }; NameObject nameObj2 = (NameObject)CheckDerivedCopy(nameObj1); nameObj2.Name = "NewName"; Assert.AreNotEqual(nameObj2, nameObj1); }
public static IEnumerable <NameObject> GetNames() { IList <object> objectList = new List <object>(); NameObject nameObject = new NameObject(); ICollection <NameObject> nameObjectList = new List <NameObject>(); ListOfDataFromDatabase listOfDataFromDatabase = new ListOfDataFromDatabase("spGetStudentName", nameObject); objectList = listOfDataFromDatabase.GetAllDataListFromDB; for (int i = 0; i < objectList.Count; i++) { nameObject = (NameObject)objectList[i]; nameObjectList.Add(nameObject); } return(nameObjectList); }
private async Task UninstallListOfPrograms(ObservableCollection <NameObject> toRemoveList) { foreach (NameObject toRemove in (Collection <NameObject>)toRemoveList) { NameObject product = toRemove; await Task.Run((Action)(() => { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendFormat("WMIC PRODUCT WHERE \"NAME='{0}'\" call uninstall; shutdown /a", (object)product.Name); using (PowerShell powerShell = PowerShell.Create()) { powerShell.AddScript(stringBuilder.ToString()); powerShell.Invoke(); } })); this.List.Remove(product); } }
public static string GetStoredProcedureName(string input, int occurrence) { int execEndPosition = -1; int startPosition = 0; for (int i = 1; i <= occurrence; i++) { execEndPosition = GetExecEndPosition(input, startPosition); startPosition = execEndPosition; } if (execEndPosition == -1) { return(""); } NameObject nameObject = GetName(execEndPosition, input); return(nameObject.Name); }
private void SetOwnerData() { List <NameObject> objects = new List <NameObject>(); OracleCommand command = new OracleCommand(); command.Connection = obj_lib.Module.Connection; command.CommandText = @"select owner, name from owner_name order by name"; OracleDataReader reader = command.ExecuteReader(); while (reader.Read()) { NameObject obj = new NameObject(); obj.Code = reader.GetDecimal(0); obj.Name = reader.GetString(1); objects.Add(obj); } ownerBox.ValueMember = "code"; ownerBox.DisplayMember = "name"; ownerBox.DataSource = objects; }
/// <summary> /// Instanciates a new Document Catalog with an indirect Page Tree. /// </summary> /// <param name="pageTree">The <see cref="IndirectObject{PageTree}"/> that is the root of the document’s page tree.</param> public DocumentCatalog(IndirectObject <PageTreeNode> pageTree) { internalDictionary[TypeKey] = new NameObject(TypeValue); internalDictionary[PagesKey] = pageTree ?? throw new ArgumentNullException(nameof(pageTree)); }
private void Initialize() { this["Type"] = new NameObject("Catalog"); this["Pages"] = new PageTree(); }
public NameObject getName() { NameObject theName = nameList[Random.Range(0, nameList.Count)]; return(theName); }
private void LoadDataToFile() { string NameObject; int x, y; if (loadFile.ShowDialog() == DialogResult.OK) { ptbContain.Controls.Clear(); string filePath = loadFile.FileName; StreamReader sr = File.OpenText(filePath); string line = null; line = sr.ReadLine(); while ((line = sr.ReadLine()) != null) { if (line.Trim().CompareTo("<End>") == 0) { break; } string[] result = line.Split(' '); NameObject = result[1].Trim(); x = int.Parse(result[2].ToString()); y = int.Parse(result[3].ToString()); //load vao nao //(2 * ptbContain.Height - y - control.Image.Height)/ 2 if (NameObject.CompareTo("CLOUD") == 0) { PictureBoxObject ptb = new PictureBoxObject(ListImage[0], (x - ListImage[0].Width) / 2, (2 * ptbContain.Height - (y + ListImage[0].Height)) / 2); ptb.BorderStyle = BorderStyle.None; ptbContain.Controls.Add(ptb); } else if (NameObject.CompareTo("GRASS") == 0) { PictureBoxObject ptb = new PictureBoxObject(ListImage[1], (x - ListImage[1].Width) / 2, (2 * ptbContain.Height - (y + ListImage[1].Height)) / 2); ptb.BorderStyle = BorderStyle.None; ptbContain.Controls.Add(ptb); } else if (NameObject.CompareTo("BIGTREE") == 0) { PictureBoxObject ptb = new PictureBoxObject(ListImage[2], (x - ListImage[2].Width) / 2, (2 * ptbContain.Height - (y + ListImage[2].Height)) / 2); ptb.BorderStyle = BorderStyle.None; ptbContain.Controls.Add(ptb); } else if (NameObject.CompareTo("SMALLTREE") == 0) { PictureBoxObject ptb = new PictureBoxObject(ListImage[3], (x - ListImage[3].Width) / 2, (2 * ptbContain.Height - (y + ListImage[3].Height)) / 2); ptb.BorderStyle = BorderStyle.None; ptbContain.Controls.Add(ptb); } else if (NameObject.CompareTo("BIGPIPE") == 0) { PictureBoxObject ptb = new PictureBoxObject(ListImage[4], (x - ListImage[4].Width) / 2, (2 * ptbContain.Height - (y + ListImage[4].Height)) / 2); ptb.BorderStyle = BorderStyle.None; ptbContain.Controls.Add(ptb); } else if (NameObject.CompareTo("MEDIUMPIPE") == 0) { PictureBoxObject ptb = new PictureBoxObject(ListImage[5], (x - ListImage[5].Width) / 2, (2 * ptbContain.Height - (y + ListImage[5].Height)) / 2); ptb.BorderStyle = BorderStyle.None; ptbContain.Controls.Add(ptb); } else if (NameObject.CompareTo("SMALLPIPE") == 0) { PictureBoxObject ptb = new PictureBoxObject(ListImage[6], (x - ListImage[6].Width) / 2, (2 * ptbContain.Height - (y + ListImage[6].Height)) / 2); ptb.BorderStyle = BorderStyle.None; ptbContain.Controls.Add(ptb); } else if (NameObject.CompareTo("FENCE") == 0) { PictureBoxObject ptb = new PictureBoxObject(ListImage[7], (x - ListImage[7].Width) / 2, (2 * ptbContain.Height - (y + ListImage[7].Height)) / 2); ptb.BorderStyle = BorderStyle.None; ptbContain.Controls.Add(ptb); } else if (NameObject.CompareTo("MOUNTAIN") == 0) { PictureBoxObject ptb = new PictureBoxObject(ListImage[8], (x - ListImage[8].Width) / 2, (2 * ptbContain.Height - (y + ListImage[8].Height)) / 2); ptb.BorderStyle = BorderStyle.None; ptbContain.Controls.Add(ptb); } else if (NameObject.CompareTo("HOUSE") == 0) { PictureBoxObject ptb = new PictureBoxObject(ListImage[9], (x - ListImage[9].Width) / 2, (2 * ptbContain.Height - (y + ListImage[9].Height)) / 2); ptb.BorderStyle = BorderStyle.None; ptbContain.Controls.Add(ptb); } else if (NameObject.CompareTo("BRICK") == 0) { PictureBoxObject ptb = new PictureBoxObject(ListImage[10], (x - ListImage[10].Width) / 2, (2 * ptbContain.Height - (y + ListImage[10].Height)) / 2); ptb.BorderStyle = BorderStyle.None; ptbContain.Controls.Add(ptb); } else if (NameObject.CompareTo("LAND") == 0) { PictureBoxObject ptb = new PictureBoxObject(ListImage[11], (x - ListImage[11].Width) / 2, (2 * ptbContain.Height - (y + ListImage[11].Height)) / 2); ptb.BorderStyle = BorderStyle.None; ptbContain.Controls.Add(ptb); } else if (NameObject.CompareTo("COINQUESTION") == 0) { PictureBoxObject ptb = new PictureBoxObject(ListImage[12], (x - ListImage[12].Width) / 2, (2 * ptbContain.Height - (y + ListImage[12].Height)) / 2); ptb.BorderStyle = BorderStyle.None; ptbContain.Controls.Add(ptb); } else if (NameObject.CompareTo("COIN") == 0) { PictureBoxObject ptb = new PictureBoxObject(ListImage[13], (x - ListImage[13].Width) / 2, (2 * ptbContain.Height - (y + ListImage[13].Height)) / 2); ptb.BorderStyle = BorderStyle.None; ptbContain.Controls.Add(ptb); ptbContain.Invalidate(); } else if (NameObject.CompareTo("FLOWER") == 0) { PictureBoxObject ptb = new PictureBoxObject(ListImage[14], (x - ListImage[14].Width) / 2, (2 * ptbContain.Height - (y + ListImage[14].Height)) / 2); ptb.BorderStyle = BorderStyle.None; ptbContain.Controls.Add(ptb); } else if (NameObject.CompareTo("STAR") == 0) { PictureBoxObject ptb = new PictureBoxObject(ListImage[15], (x - ListImage[15].Width) / 2, (2 * ptbContain.Height - (y + ListImage[15].Height)) / 2); ptb.BorderStyle = BorderStyle.None; ptbContain.Controls.Add(ptb); } else if (NameObject.CompareTo("MUSHROOMBIG") == 0) { PictureBoxObject ptb = new PictureBoxObject(ListImage[16], (x - ListImage[16].Width) / 2, (2 * ptbContain.Height - (y + ListImage[16].Height)) / 2); ptb.BorderStyle = BorderStyle.None; ptbContain.Controls.Add(ptb); } else if (NameObject.CompareTo("MUSHROOMLIFE") == 0) { PictureBoxObject ptb = new PictureBoxObject(ListImage[17], (x - ListImage[17].Width) / 2, (2 * ptbContain.Height - (y + ListImage[17].Height)) / 2); ptb.BorderStyle = BorderStyle.None; ptbContain.Controls.Add(ptb); } else if (NameObject.CompareTo("MUSHROOM") == 0) { PictureBoxObject ptb = new PictureBoxObject(ListImage[18], (x - ListImage[18].Width) / 2, (2 * ptbContain.Height - (y + ListImage[18].Height)) / 2); ptb.BorderStyle = BorderStyle.None; ptbContain.Controls.Add(ptb); } else if (NameObject.CompareTo("TURTLE") == 0) { PictureBoxObject ptb = new PictureBoxObject(ListImage[19], (x - ListImage[19].Width) / 2, (2 * ptbContain.Height - (y + ListImage[19].Height)) / 2); ptb.BorderStyle = BorderStyle.None; ptbContain.Controls.Add(ptb); } else if (NameObject.CompareTo("BOSS") == 0) { PictureBoxObject ptb = new PictureBoxObject(ListImage[20], (x - ListImage[20].Width) / 2, (2 * ptbContain.Height - (y + ListImage[20].Height)) / 2); ptb.BorderStyle = BorderStyle.None; ptbContain.Controls.Add(ptb); } else if (NameObject.CompareTo("FLAG") == 0) { PictureBoxObject ptb = new PictureBoxObject(ListImage[21], (x - ListImage[21].Width) / 2, (2 * ptbContain.Height - (y + ListImage[21].Height)) / 2); ptb.BorderStyle = BorderStyle.None; ptbContain.Controls.Add(ptb); } } } }
private bool WriteObject(NameObject obj) { if (obj == null) return false; WriteEscapedName(obj.Value, _writer); return true; }
/// <summary> /// Instanciates a new PDF Page Tree node. /// </summary> public PageTreeItem() { internalDictionary[TypeKey] = new NameObject(TypeValue); }
/// <summary> /// Reads next <see cref="PdfObject"/> from PDF stream. /// </summary> /// <param name="reader">The <see cref="PdfReader"/> to use.</param> /// <returns>Read PdfObject.</returns> public static PdfObject ReadObject(this PdfReader reader) { if (reader == null) { throw new ArgumentNullException(nameof(reader)); } reader.MoveToNonWhiteSpace(); char firstChar = reader.Peek(); switch (firstChar) { case '%': // Skip comment reader.SkipWhile(c => !Chars.IsEndOfLine(c)); reader.SkipWhile(Chars.IsEndOfLine); // Then try read next object return(ReadObject(reader)); case 't': reader.ReadToken(BooleanObject.TrueToken); return(new BooleanObject(true, true)); case 'f': reader.ReadToken(BooleanObject.FalseToken); return(new BooleanObject(false, true)); case 'n': reader.ReadToken(NullObject.NullToken); return(new NullObject()); case '(': return(LiteralStringObject.FromReader(reader)); case '<': if (reader.Peek(1) == '<') { return(DictionaryObject.FromReader(reader)); } else { return(HexadecimalStringObject.FromReader(reader)); } case '/': return(NameObject.FromReader(reader)); case '[': return(ArrayObject.FromReader(reader)); case '+': case '-': return(NumericObject.FromReader(reader)); } if (char.IsDigit(firstChar)) { int indRefLength = IsIndirectReference(reader); if (indRefLength >= 5) { var indRefStr = reader.ReadString(indRefLength); var objectId = PdfObjectId.FromString(indRefStr.Substring(0, indRefLength - 2)); return(new IndirectReference(objectId)); } return(NumericObject.FromReader(reader)); } throw new NotImplementedException(); }
public JsonResult UpdateStudent(NameObject name) { return(Json(StudentLogic.UpdateStudentName(name).Split(','))); }
public JsonResult InsertStudentName(NameObject name) { return(Json(StudentLogic.InsertStudentName(name).Split(','))); }
public static string InsertStudentName(NameObject name) => StudentData.InsertStudentName(name);
public static string UpdateStudentName(NameObject name) => StudentData.UpdateStudentInfo(name);
public Contract(Dictionary <string, object> IR, Dictionary <string, HashSet <long> > resolvedSchedule, Dictionary <long, RiskItemCharacteristicIDAttributes> CoverageIdAttrMap) { this.ResolvedSchedule = resolvedSchedule; this.CoverageIdAttrMap = CoverageIdAttrMap; // Construct universal subject position HashSet <long> AllRITEIds = new HashSet <long>(); if (resolvedSchedule != null) { AllRITEIds = resolvedSchedule.Aggregate(new HashSet <long>(), (a, b) => { a.UnionWith(b.Value); return(a); }); } HashSet <long> AllRiskItemIds = new HashSet <long>(); if (CoverageIdAttrMap != null) { AllRiskItemIds = new HashSet <long>(AllRITEIds.Where(x => CoverageIdAttrMap.ContainsKey(x)).Select(x => CoverageIdAttrMap[x].RITExposureId).Distinct()); } UniversalSubject = new UniversalSubjectPosition(AllRITEIds, AllRiskItemIds); // Declarations Declarations = (Dictionary <string, object>)IR["Declarations"]; // Claims Adjustment Settings if (!Declarations.ContainsKey("Claims Adjustment Options") || Declarations["Claims Adjustment Options"] == null) { _AreSublimitsNetOfDeductible = false; _AreDeductiblesAbsorbable = false; } else { if (!((Declarations["Claims Adjustment Options"] as Dictionary <string, object>).ContainsKey("Claims Adjustment Sublimits")) || (Declarations["Claims Adjustment Options"] as Dictionary <string, object>)["Claims Adjustment Sublimits"] == null) { _AreSublimitsNetOfDeductible = false; } else { _AreSublimitsNetOfDeductible = (Declarations["Claims Adjustment Options"] as Dictionary <string, object>)["Claims Adjustment Sublimits"].ToString().Equals("Net Of Deductible"); } if (!((Declarations["Claims Adjustment Options"] as Dictionary <string, object>).ContainsKey("Claims Adjustment Deductibles")) || (Declarations["Claims Adjustment Options"] as Dictionary <string, object>)["Claims Adjustment Deductibles"] == null) { _AreDeductiblesAbsorbable = false; } else { _AreDeductiblesAbsorbable = (Declarations["Claims Adjustment Options"] as Dictionary <string, object>)["Claims Adjustment Deductibles"].ToString().Equals("Absorbable"); } } object NameObject; if (Declarations.TryGetValue("Name", out NameObject)) { this.Name = NameObject.ToString(); } object CausesOfLossObject; Declarations.TryGetValue("CausesOfLoss", out CausesOfLossObject); object ScheduleObject; Declarations.TryGetValue("Schedule", out ScheduleObject); object ExposureTypesObject; Declarations.TryGetValue("ExposureTypes", out ExposureTypesObject); object GrossPositionObject; Declarations.TryGetValue("GrossPosition", out GrossPositionObject); object CededPositionObject; Declarations.TryGetValue("CededPosition", out CededPositionObject); if (GrossPositionObject != null) { if (CededPositionObject != null) { this.ContractSubject = new NetPosition(ToHashSet(GrossPositionObject.ToString()), ToHashSet(CededPositionObject.ToString())); } else if (CausesOfLossObject != null) { this.ContractSubject = new SubjectPosition(ToHashSet(GrossPositionObject.ToString()), ToHashSet(CausesOfLossObject.ToString())); } else { this.ContractSubject = new SubjectPosition(ToHashSet(GrossPositionObject.ToString())); } } else if (CausesOfLossObject != null && ScheduleObject != null && ExposureTypesObject != null) { this.ContractSubject = new Subject( UniversalSubject, new Schedule(ToHashSet(ScheduleObject.ToString())), ToHashSet(CausesOfLossObject.ToString()), ToHashSet(ExposureTypesObject.ToString()), ResolvedSchedule, CoverageIdAttrMap); } // Covers object[] covers = (object[])IR["Covers"]; Covers = new List <ICover <Value, Value, Value> >(covers.Length); foreach (object cover in covers) { Dictionary <string, object> coverData = (Dictionary <string, object>)cover; Covers.Add(ConstructCover(coverData)); } // Sublimits object[] sublimits = (object[])IR["Sublimits"]; Sublimits = new List <ITerm <Value> >(sublimits.Length); foreach (object sublimit in sublimits) { Sublimits.Add(ConstructSublimit((Dictionary <string, object>)sublimit, AreSublimitsNetOfDeductible())); } // Deductibles object[] deductibles = (object[])IR["Deductibles"]; Deductibles = new List <ITerm <Value> >(deductibles.Length); foreach (object deductible in deductibles) { Deductibles.Add(ConstructDeductible((Dictionary <string, object>)deductible, AreDeductiblesAbsorbable())); } }