private void LoadPropertyType() { string ddlAll = this.GetLocalResourceObject("Text.ddlAll").ToString(); Dictionary dict = new Dictionary(); dict.Id = "PropertyType"; DictionaryCollection col = dict.GetByKey(); string textvalue = ""; string currentCulture = Convert.ToString(Session["MyCulture"]); if (String.IsNullOrEmpty(currentCulture)) { textvalue = "English"; } switch (currentCulture) { case "en-US": textvalue = "English"; break; case "ar-LB": textvalue = "Arabic"; break; case "fr-FR": textvalue = "French"; break; } Helpers.Helper.LoadDropDown(ddlPropertyType, col, textvalue, "English", true, ddlAll); }
private static Dictionary <string, DictionaryCollection> GetAppConfigParameters() { var appConfigParameters = new Dictionary <string, DictionaryCollection>(StringComparer.OrdinalIgnoreCase); var appConfigParametersSection = ConfigurationManager.GetSection(Constants.AppConfigParametersSection) as NameValueCollection; if (appConfigParametersSection != null) { foreach (var key in appConfigParametersSection.AllKeys) { // ReSharper disable once AssignNullToNotNullAttribute var values = appConfigParametersSection.GetValues(key).FirstOrDefault(); if (values == null) { continue; } var parameterValues = DictionaryCollection.CleanValues(values, DelimiterType.SemiColon); var parametersCollection = CreateCollection(parameterValues); appConfigParameters.Add(key, parametersCollection); } } return(appConfigParameters); }
protected override void Initialize() { Cells = new DictionaryCollection<Cell>(this.Part); Cells.ItemCreated += (o, e) => { e.Payload.RowIndex = Index; }; }
public void AddDictionaryCollection(DictionaryCollection col) { if (col != null & col.Count > 0) { foreach (Dictionary dict in col) { dict.AddDictionary(); } } }
protected override void Initialize() { Margin = new Thickness(.7, .75, .7, .75); HeaderSpace = .3; FooterSpace = .3; SheetFormat = CreateElement<SheetFormatProperties>(); Rows = new DictionaryCollection<Row>(this); DefinedNames = new Dictionary<string, CellDefinition>(); _columnSizeDefinition = new List<ColumnSizeDefinition>(); AddRequiredNamespace(FiftyNine.Ag.OpenXML.Common.Constants.Namespaces.Relationships); }
public IndexerProgram() { var idexer = new DictionaryCollection <string, string>(); idexer["k1"] = "abcd"; idexer["k2"] = "Wxyz"; foreach (var k in idexer.Keys) { Console.WriteLine("idexer[{0}] = {1}", k, idexer[k]); } }
public static void Main(string[] args) { DictionaryCollection dictionaryCollection = new DictionaryCollection(); ListCollection listCollection = new ListCollection(); QueueCollection queueCollection = new QueueCollection(); SortedListCollection sortedListCollection = new SortedListCollection(); StackCollection stackCollection = new StackCollection(); dictionaryCollection.FillCollection("dictionary"); listCollection.FillCollection(); queueCollection.FillCollection(); sortedListCollection.FillCollection("sorted list"); stackCollection.FillCollection(); Console.WriteLine(); dictionaryCollection.FindValueByKey(6, "dictionary"); listCollection.FindValueByPosition(600); queueCollection.FindFirstElement(); sortedListCollection.FindValueByKey(300, "sorted list"); stackCollection.FindTopElement(); Console.WriteLine(); dictionaryCollection.RemoveElementByKey(100, "dictionary"); listCollection.RemoveElementByPosition(250); queueCollection.RemoveBeginningElement(); sortedListCollection.RemoveElementByKey(1000, "sorted list"); stackCollection.RemoveTopElement(); Console.WriteLine(); /*List<Vegetable> springSaladIngredients = new List<Vegetable>() * { * new Tomato(200), * new Cucumber(200), * new Onion(50) * }; * Salad springSalad = new Salad (springSaladIngredients, "Spring Salad"); * List<Vegetable> tangySaladIngredients = new List<Vegetable>() * { * new Cucumber(200), * new Avocado(200), * new Lime(50), * new GreenOnion(50) * }; * Salad tangySalad = new Salad(tangySaladIngredients, "Tangy Salad"); * springSalad.getSaladCaloricity(); * tangySalad.getSaladCaloricity(); * springSalad.sortByCalories(); * springSalad.sortByWeigth(); * tangySalad.selectVegetablesByWeigth(40, 150) ; */ }
private DictionaryCollection InitializeCollection(DataTable dt) { DictionaryCollection retVal = null; if (dt != null && dt.Columns.Count > 0) { retVal = new DictionaryCollection(); foreach (DataRow row in dt.Rows) { Dictionary item = InitializeObject(row); retVal.Add(item); } } return(retVal); }
private static DictionaryCollection CreateCollection(IEnumerable <string> parameters) { var dictionaryCollection = new DictionaryCollection(); foreach (var parameter in parameters) { var split = parameter.Split(new[] { '=' }, 2); if (split[0].StartsWith("#") || split[0].StartsWith("_")) { continue; } dictionaryCollection.Collection[split[0]] = split[1].Trim(); } return(dictionaryCollection); }
public void AddDictionaryCollection() { DataService data = new DataService(); DictionaryCollection col = new DictionaryCollection(); Dictionary dict = new Dictionary(); dict.Id = "key3"; dict.English = "eoasdde"; dict.French = "asdasdasd"; dict.Arabic = "sikasdasd"; col.Add(dict); Dictionary dict2 = new Dictionary(); dict2.Id = "key4"; dict2.English = "eoasdde"; //dict2.French = ""; dict2.Arabic = "sikasdasd"; col.Add(dict2); dict.AddDictionaryCollection(col); }
static void Main(string[] args) { ArrayCollection arrayCollection = new ArrayCollection(5); for (int i = 0; i < arrayCollection.Length(); i++) { arrayCollection[i] = new Item($"Item {i}"); } IIterator arrayIterator = arrayCollection.GetIterator(); Console.WriteLine("Array collection iteration:"); while (arrayIterator.HasMore()) { Console.WriteLine(arrayIterator.GetNext().Name); } Console.WriteLine(); DictionaryCollection dictionaryCollection = new DictionaryCollection(); for (int i = 0; i < 10; i++) { dictionaryCollection[$"Key {i}"] = new Item($"Item {i}"); } IIterator dictionaryIterator = dictionaryCollection.GetIterator(); Console.WriteLine("Dictionary collection iteration:"); while (dictionaryIterator.HasMore()) { Console.WriteLine(dictionaryIterator.GetNext().Name); } }
//main() is the entry point for project execuition static void Main(string[] args) { //To keep breakpoint use F9 (key) keyboard //#region <tab> (code segment for region will be automatically created) #region "Understanding ADO.Net" //DataSet Operations LearnADO.TableOperation.RetrieveRecordsDataSet retrieveRecordsDataSet = new LearnADO.TableOperation.RetrieveRecordsDataSet(); DataSet dataSet = retrieveRecordsDataSet.DataSetOperations(); Console.WriteLine(dataSet.GetXml()); //understanding reader object in detail LearnADO.TableOperation.RetrieveRecord retrieveRec = new LearnADO.TableOperation.RetrieveRecord(); retrieveRec.RetrieveRecordSelect(); //get records from table based on search condition string serachProduct = "Monitor 15"; LearnADO.TableOperation.SelectTableRecordProc selectTableRecordProc = new LearnADO.TableOperation.SelectTableRecordProc(); selectTableRecordProc.SearchProduct(serachProduct); //get data from the system table (list all procedures of the database) LearnADO.TableOperation.SelectInformationSchemaProc selectInformationSchemaProc = new LearnADO.TableOperation.SelectInformationSchemaProc(); selectInformationSchemaProc.ListAllStoredProceduresInDatabase(); //copy all data from a table to another table LearnADO.TableOperation.InsertIntoTable insertIntoTable = new LearnADO.TableOperation.InsertIntoTable(); insertIntoTable.CopyTableDataToAnotherTable(); //insert record to table using stored procedure LearnADO.TableOperation.InsertRecordStoredProcedure insertRecordStoredProcedure = new LearnADO.TableOperation.InsertRecordStoredProcedure(); insertRecordStoredProcedure.InsertNewRecordToTable(); //database manupulations string sqlQueryCreateDatabase = "CREATE DATABASE [LEARNDBMP02]"; string sqlQueryRenameDatabase = "ALTER DATABASE LEARNDBMP02 MODIFY NAME = LEARNDBMP04"; string sqlQueryDeleteDatabase = "DROP DATABASE [LEARNDBMP04]"; string message = "Action Completed Successfully"; //table manipulations string sqlQueryCreateTable = @" CREATE TABLE LEARNDBMP01.dbo.Products( ID INT IDENTITY(1, 1) NOT NULL , [Name] NVARCHAR(50) NULL , Price NVARCHAR(50) NULL , [Date] DATETIME NULL CONSTRAINT pk_id PRIMARY KEY(ID) )"; string sqlQueryRenameTable = "Exec sp_rename 'Products', 'Accessories'"; string sqlQueryAddColumn = "ALTER TABLE Accessories ADD Stock NVARCHAR(50)"; string sqlQueryModifyColumn = "ALTER TABLE Accessories ALTER COLUMN Stock INT"; string sqlQueryRemoveColumn = "ALTER TABLE Accessories DROP COLUMN Stock"; string sqlQueryRemoveTable = "DROP TABLE Accessories"; string sqlQueryInsertRecord = "INSERT INTO dbo.Products (NAME, Price, [Date]) VALUES ('LED TV', '$ 120.00', '27-January-2019')"; LearnADO.DatabaseManipulation databaseManipulation = new LearnADO.DatabaseManipulation(); //adding record to table databaseManipulation.DatabaseAction(sqlQueryInsertRecord, message); //table manipulation databaseManipulation.DatabaseAction(sqlQueryRemoveTable, message); databaseManipulation.DatabaseAction(sqlQueryRemoveColumn, message); databaseManipulation.DatabaseAction(sqlQueryModifyColumn, message); databaseManipulation.DatabaseAction(sqlQueryAddColumn, message); databaseManipulation.DatabaseAction(sqlQueryRenameTable, message); databaseManipulation.DatabaseAction(sqlQueryCreateTable, message); //database manupulation databaseManipulation.DatabaseAction(sqlQueryCreateDatabase, message); databaseManipulation.DatabaseAction(sqlQueryRenameDatabase, message); databaseManipulation.DatabaseAction(sqlQueryDeleteDatabase, message); //adding record to table LearnADO.TableOperation.InsertTableRecord insertTableRecord = new LearnADO.TableOperation.InsertTableRecord(); insertTableRecord.InsertNewRecordToTable(); LearnADO.TableOperation.InsertTableRecordParameterized insertTableRecordParameterized = new LearnADO.TableOperation.InsertTableRecordParameterized(); insertTableRecordParameterized.InsertNewRecordToTable(); //table manipulation LearnADO.TableOperation.RenameTable renameTable = new LearnADO.TableOperation.RenameTable(); renameTable.RenameExistingTable(); LearnADO.TableOperation.CreateTable createTable = new LearnADO.TableOperation.CreateTable(); createTable.CreateNewTable(); //... //database manipulation LearnADO.DatabaseOperation.DeleteDatabase deleteDatabase = new LearnADO.DatabaseOperation.DeleteDatabase(); deleteDatabase.RemoveDatabase(); LearnADO.DatabaseOperation.RenameDatabase renameDatabase = new LearnADO.DatabaseOperation.RenameDatabase(); renameDatabase.RenameTheDatabase(); LearnADO.DatabaseOperation.CreateDatabase createDatabase = new LearnADO.DatabaseOperation.CreateDatabase(); createDatabase.CreateNewDatabase(); //table reading LearnADO.TableOperation.RetrieveRecord retrieveRecord = new LearnADO.TableOperation.RetrieveRecord(); retrieveRecord.RetrieveRecordSelect(); #endregion #region "Collections" SortedDictionaryCollection sortedDictionaryCollection = new SortedDictionaryCollection(); sortedDictionaryCollection.GenericSortedDictionary(); HashSetCollection hashSetCollection = new HashSetCollection(); hashSetCollection.StoreElementsToHashSet(); StackCollection stackCollection = new StackCollection(); stackCollection.StackManipulations(); QueueCollection queueCollection = new QueueCollection(); queueCollection.QueueManipulation(); DictionaryCollection dictionaryCollections = new DictionaryCollection(); dictionaryCollections.DictionaryOperations(); SortedListCollection sortedListCollection = new SortedListCollection(); sortedListCollection.SortedList(); ArrayListCollection arrayListCollections = new ArrayListCollection(); arrayListCollections.AddArrayListElement(); ListCollection listCollection = new ListCollection(); Console.ReadLine(); #endregion #region "File Handing in C#" FileIO fileIO = new FileIO(); fileIO.StreamWriterInFiles(); fileIO.StreamReaderInFiles(); fileIO.UnderstandFileDelete(); fileIO.UnderstandFileCopy(); fileIO.UnderstandFileReadAllText(); fileIO.UnderstandFileReadAllLines(); fileIO.UnderstandFileExists(); #endregion #region "Understanding Arrays" Arrays objArrays = new Arrays(); objArrays.MultiDiamentionalArray(); objArrays.AccessingValuesFromArray(); objArrays.AcceptValuesFromUserAndDisplayOutput(); objArrays.ArrayDeclarationAndInitilization(); #endregion #region "StringBuilder and their methods" StringBuilders objStringBuilders = new StringBuilders(); objStringBuilders.StringBuilderFunctions(); #endregion #region "Data types: Value and Reference type" ValueTypeReferenceType objValueTypeReferenceType = new ValueTypeReferenceType(); objValueTypeReferenceType.UnderstandingReferenceType(); //objValueTypeReferenceType.UnderstandingValueType(); #endregion #region "Understanding Loop Statements" LoopStatements objLoopStatements = new LoopStatements(); objLoopStatements.UnderstandingForLoop(); objLoopStatements.UnderstandingForLoopCondStmt(); objLoopStatements.UnderstandingWhileLoop(); objLoopStatements.WhileLoopWithBreakStmt(); objLoopStatements.UnderstandingDoWhileLoop(); objLoopStatements.UnderstandingDoWhileLoopFalseCondition(); objLoopStatements.DoWhileLoopWithBreakStmt(); #endregion #region "Understanding Conditional Statements" //switch statement ConditionalStatements objConditionalStatements = new ConditionalStatements(); objConditionalStatements.SwitchStatement(); objConditionalStatements.GoToInSwitchStatement(); #endregion #region "How to call a Class" //<name of class> <object of the class> <new - allocating memory> <name of the class> //MyClass: is class --> Blue Print --> car //myClass: is object --> Benz, BMW, Audi, Ford, etc.. //MyClass myClass = new MyClass(); MyClass objMyClass = new MyClass(); //Lets set the value to a property and they get the value from the property int valueFromProperty = 0; //Set the value to the property objMyClass.Counter = 4; //Get the value from the property valueFromProperty = objMyClass.Counter; Console.WriteLine(valueFromProperty); objMyClass.PropVariable = 6; //(setter) Console.WriteLine(objMyClass.PropVariable); //(getter) the return value of the private class variable _propVariable //try to see if we are able to access 'Count' and private in scope //objMyClass.Count; (error since its scope is private) //Create an object of newly created class (AnotherClass) //Any new class created will have default methods available AnotherClass objAnotherClass = new AnotherClass(); //objAnotherClass. //Properties with only getter //objMyClass.MarkSheetGrade = "India"; (not possible since it is getter only property) //Properties with only setter objMyClass.CollegeName = "National Engineering College"; //Console.WriteLine(objMyClass.CollegeName); get accessor is not exposed for this propery hence data can not be viewed #endregion #region "Call - Understanding Variables" //Understand C# variables and their declarations UnderstandVariables(); //Understanding C# datatypes in detail UnderstandDataTypes(); #endregion //Purpose of command: to display the output visiable to user until user selects any key in the keyboard Console.ReadKey(); }
public void AddDictionaryCollection(DictionaryCollection col) { Dictionary dict = new Dictionary(); dict.AddDictionaryCollection(col); }