public MemberMetadataInfo(MemberMetadataInfo other) { Names = other.Names; MethodSignature = other.MethodSignature; Module = other.Module; ArrayTypeInfo = other.ArrayTypeInfo; IsTypeDef = other.IsTypeDef; IsPrimitiveType = other.IsPrimitiveType; Kind = other.Kind; IsGenericInstance = other.IsGenericInstance; IsEnclosedType = other.IsEnclosedType; IsPointer = other.IsPointer; Modifiers = new StackCollection <string>(other.Modifiers); Name = other.Name; Namespace = other.Namespace; DefinedInAssembly = other.DefinedInAssembly; if (other.ParentType != null) { ParentType = new MemberMetadataInfo(other.ParentType); } if (other.GenericTypeArgs != null) { GenericTypeArgs = other.GenericTypeArgs.Select(o => new MemberMetadataInfo(o)).ToList(); } }
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) ; */ }
public static void getStack() { StackCollection <int> stack = new StackCollection <int>(10); Console.WriteLine(); Console.WriteLine(); Console.WriteLine("*******Stack Collection*******"); stack.push(25); stack.push(29); stack.push(51); stack.push(67); int[] Values = stack.GetAllStackValues(); Console.WriteLine("Below is the complete collection after push: "); foreach (int value in Values) { Console.WriteLine(); Console.WriteLine(value); } stack.pop(); stack.pop(); int[] Values1 = stack.GetAllStackValues(); Console.WriteLine(); Console.WriteLine("Below is the complete collection after pop: "); foreach (int value1 in Values1) { Console.WriteLine(); Console.WriteLine(value1); } stack.push(88); int[] Values2 = stack.GetAllStackValues(); Console.WriteLine(); Console.WriteLine("Below is the complete collection after more push: "); foreach (int value2 in Values2) { Console.WriteLine(); Console.WriteLine(value2); } stack.peep(0); stack.peep(1); stack.peep(2); int[] Values3 = stack.GetAllStackValues(); Console.WriteLine(); Console.WriteLine("Below is the final collection: "); foreach (int value3 in Values3) { Console.WriteLine(); Console.WriteLine(value3); } }
public static StackCollection ToStackCollection(this Stack stack) { if (stack == null) { return(null); } StackCollection model = new StackCollection(stack.Message?.Text); if (stack.Frames != null) { foreach (StackFrame frame in stack.Frames) { model.Add(frame.ToStackFrameModel()); } } return(model); }
public static StackCollection ToStackCollection(this Stack stack) { if (stack == null) { return null; } StackCollection model = new StackCollection(stack.Message); if (stack.Frames != null) { foreach (StackFrame frame in stack.Frames) { model.Add(frame.ToStackFrameModel()); } } return model; }
public static StackCollection ToStackCollection(this Stack stack, int resultId, int runIndex) { if (stack == null) { return(null); } var model = new StackCollection(stack.Message?.Text); if (stack.Frames != null) { foreach (StackFrame frame in stack.Frames) { model.Add(frame.ToStackFrameModel(resultId, runIndex)); } } return(model); }
protected void btnAdd_Click(object sender, EventArgs e) { string Titles = txtTitle.Text.Trim(); string Sequences = txtSequence.Text.Trim(); StackCollection StackColl = DAL.PE_DAL.GetFeaturedStacks(0, ""); //Original Stack foreach (Stack StackItem in StackColl) { if (string.Compare(Titles, StackItem.StackTitle, true) == 0) { ReqFieldValTitle.Text = "The title already exists."; ReqFieldValTitle.IsValid = false; return; } } DAL.PE_DAL.SetFeaturedStacks("ADD", "", Titles, Sequences, ""); BindGrid(); txtTitle.Text = ""; txtSequence.Text = ""; }
public void CheckStackCollection() { StackCollection <int> q = new StackCollection <int>(); q.Push(1); q.Push(2); q.Push(1); q.Push(3); q.Push(1); var expected = new int[] { 1, 2, 1, 3, 1 }; CollectionAssert.AreEqual(expected, q); q.Pop(); expected = new int[] { 1, 2, 1, 3 }; CollectionAssert.AreEqual(expected, q); q.Pop(); expected = new int[] { 1, 2, 1 }; CollectionAssert.AreEqual(expected, q); q.Pop(); expected = new int[] { 1, 2 }; CollectionAssert.AreEqual(expected, q); Assert.AreEqual(2, q.Peek()); }
public StackUpdateEventArgs(StackCollection stack) { this.stack = stack; }
//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(); }
private static SarifErrorListItem GetDesignTimeViewModel1() { SarifErrorListItem viewModel = new SarifErrorListItem(); viewModel.Message = "Potential mismatch between sizeof and countof quantities. Use sizeof() to scale byte sizes."; viewModel.Tool = new ToolModel() { Name = "FxCop", Version = "1.0.0.0", }; viewModel.Rule = new RuleModel() { Id = "CA1823", Name = "Avoid unused private fields", HelpUri = "http://aka.ms/analysis/ca1823", DefaultLevel = "Unknown" }; viewModel.Invocation = new InvocationModel() { CommandLine = @"""C:\Temp\Foo.exe"" target.file /o out.sarif", FileName = @"C:\Temp\Foo.exe", }; viewModel.Locations.Add(new Models.AnnotatedCodeLocationModel() { FilePath = @"D:\GitHub\NuGet.Services.Metadata\src\Ng\Catalog2Dnx.cs", Region = new CodeAnalysis.Sarif.Region(11, 1, 11, 2, 0, 0), }); viewModel.Locations.Add(new Models.AnnotatedCodeLocationModel() { FilePath = @"D:\GitHub\NuGet.Services.Metadata\src\Ng\Catalog2Dnx.cs", Region = new CodeAnalysis.Sarif.Region(12, 1, 12, 2, 0, 0), }); viewModel.RelatedLocations.Add(new Models.AnnotatedCodeLocationModel() { FilePath = @"D:\GitHub\NuGet.Services.Metadata\src\Ng\Catalog2Dnx.cs", Region = new CodeAnalysis.Sarif.Region(21, 1, 21, 2, 0, 0), }); viewModel.RelatedLocations.Add(new Models.AnnotatedCodeLocationModel() { FilePath = @"D:\GitHub\NuGet.Services.Metadata\src\Ng\Catalog2Dnx.cs", Region = new CodeAnalysis.Sarif.Region(22, 1, 22, 2, 0, 0), }); viewModel.RelatedLocations.Add(new Models.AnnotatedCodeLocationModel() { FilePath = @"D:\GitHub\NuGet.Services.Metadata\src\Ng\Catalog2Dnx.cs", Region = new CodeAnalysis.Sarif.Region(23, 1, 23, 2, 0, 0), }); viewModel.CallTrees.Add(new CallTree( new List<CallTreeNode> { new CallTreeNode { Location = new AnnotatedCodeLocation { Kind = AnnotatedCodeLocationKind.Assignment } }, new CallTreeNode { Location = new AnnotatedCodeLocation { Kind = AnnotatedCodeLocationKind.Call, Target = "my_func" }, Children = new List<CallTreeNode> { new CallTreeNode { Location = new AnnotatedCodeLocation { Kind = AnnotatedCodeLocationKind.CallReturn } } } } })); StackCollection stack1 = new StackCollection("Stack A1"); stack1.Add(new StackFrameModel() { Message = "Message A1.1", FilePath = @"D:\GitHub\NuGet.Services.Metadata\src\Ng\Catalog2Dnx.cs", Line = 11, Column = 1, FullyQualifiedLogicalName ="My.Assembly.Main(string[] args)", Module = "My.Module.dll", }); stack1.Add(new StackFrameModel() { Message = "Message A1.2", FilePath = @"D:\GitHub\NuGet.Services.Metadata\src\Ng\Catalog2Dnx.cs", Line = 12, Column = 1, FullyQualifiedLogicalName = "Our.Shared.Library.Method(int param)", Module = "My.Module.dll", }); stack1.Add(new StackFrameModel() { Message = "Message A1.3", FilePath = @"D:\GitHub\NuGet.Services.Metadata\src\Ng\Catalog2Dnx.cs", Line = 1, Column = 1, FullyQualifiedLogicalName = "Your.PIA.External()", }); viewModel.Stacks.Add(stack1); FixModel fix1 = new FixModel("Replace *.Close() with *.Dispose()."); FileChangeModel fileChange11 = new FileChangeModel(); fileChange11.FilePath = @"D:\GitHub\NuGet.Services.Metadata\src\Ng\Catalog2Dnx.cs"; fileChange11.Replacements.Add(new ReplacementModel() { Offset = 1234, DeletedLength = ".Close()".Length, InsertedString = ".Dispose()", }); fix1.FileChanges.Add(fileChange11); viewModel.Fixes.Add(fix1); return viewModel; }
public MemberMetadataInfo() { Kind = MemberKind.Type; Names = new List <string>(); Modifiers = new StackCollection <string>(); }
private static SarifErrorListItem GetDesignTimeViewModel1() { ThreadHelper.ThrowIfNotOnUIThread(); var viewModel = new SarifErrorListItem { Message = "Potential mismatch between sizeof and countof quantities. Use sizeof() to scale byte sizes.", Tool = new ToolModel() { Name = "FxCop", Version = "1.0.0.0", }, Rule = new RuleModel() { Id = "CA1823", Name = "Avoid unused private fields", HelpUri = "http://aka.ms/analysis/ca1823", DefaultFailureLevel = FailureLevel.None, }, Invocation = new InvocationModel() { CommandLine = @"""C:\Temp\Foo.exe"" target.file /o out.sarif", FileName = @"C:\Temp\Foo.exe", }, }; viewModel.Locations.Add(new LocationModel(resultId: 0, runIndex: 0) { FilePath = @"D:\GitHub\NuGet.Services.Metadata\src\Ng\Catalog2Dnx.cs", Region = new Region(11, 1, 11, 2, 0, 0, 0, 0, snippet: null, message: null, sourceLanguage: "en-US", properties: null), }); viewModel.Locations.Add(new LocationModel(resultId: 0, runIndex: 0) { FilePath = @"D:\GitHub\NuGet.Services.Metadata\src\Ng\Catalog2Dnx.cs", Region = new Region(12, 1, 12, 2, 0, 0, 0, 0, snippet: null, message: null, sourceLanguage: "en-US", properties: null), }); viewModel.RelatedLocations.Add(new LocationModel(resultId: 0, runIndex: 0) { FilePath = @"D:\GitHub\NuGet.Services.Metadata\src\Ng\Catalog2Dnx.cs", Region = new Region(21, 1, 21, 2, 0, 0, 0, 0, snippet: null, message: null, sourceLanguage: "en-US", properties: null), }); viewModel.RelatedLocations.Add(new LocationModel(resultId: 0, runIndex: 0) { FilePath = @"D:\GitHub\NuGet.Services.Metadata\src\Ng\Catalog2Dnx.cs", Region = new Region(22, 1, 22, 2, 0, 0, 0, 0, snippet: null, message: null, sourceLanguage: "en-US", properties: null), }); viewModel.RelatedLocations.Add(new LocationModel(resultId: 0, runIndex: 0) { FilePath = @"D:\GitHub\NuGet.Services.Metadata\src\Ng\Catalog2Dnx.cs", Region = new Region(23, 1, 23, 2, 0, 0, 0, 0, snippet: null, message: null, sourceLanguage: "en-US", properties: null), }); viewModel.AnalysisSteps.Add(new AnalysisStep( new List <AnalysisStepNode> { new AnalysisStepNode(resultId: 0, runIndex: 0) { Location = new ThreadFlowLocation(), }, new AnalysisStepNode(resultId: 0, runIndex: 0) { Location = new ThreadFlowLocation(), Children = new List <AnalysisStepNode> { new AnalysisStepNode(resultId: 0, runIndex: 0) { Location = new ThreadFlowLocation(), }, }, }, })); var stack1 = new StackCollection("Stack A1") { new StackFrameModel(resultId: 0, runIndex: 0) { Message = "Message A1.1", FilePath = @"D:\GitHub\NuGet.Services.Metadata\src\Ng\Catalog2Dnx.cs", Line = 11, Column = 1, FullyQualifiedLogicalName = "My.Assembly.Main(string[] args)", Module = "My.Module.dll", }, new StackFrameModel(resultId: 0, runIndex: 0) { Message = "Message A1.2", FilePath = @"D:\GitHub\NuGet.Services.Metadata\src\Ng\Catalog2Dnx.cs", Line = 12, Column = 1, FullyQualifiedLogicalName = "Our.Shared.Library.Method(int param)", Module = "My.Module.dll", }, new StackFrameModel(resultId: 0, runIndex: 0) { Message = "Message A1.3", FilePath = @"D:\GitHub\NuGet.Services.Metadata\src\Ng\Catalog2Dnx.cs", Line = 1, Column = 1, FullyQualifiedLogicalName = "Your.PIA.External()", }, }; viewModel.Stacks.Add(stack1); return(viewModel); }
protected void ListFeatures_IDB(object sender, DataListItemEventArgs e) { ///Begin - JavaScript is turned off #region No_JS_Or_FeaturedImagesOff if (string.Compare(Session["JSTurnedOn"].ToString(), "False", true) == 0 || string.Compare(TurnOffFeaturedImages, "1", true) == 0) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { string litHTML = ""; Label lblStackTitle = (Label)e.Item.FindControl("lblStackTitle"); lblStackTitle.Text = ""; //initialize Literal litStackScript = (Literal)e.Item.FindControl("litStackScript"); //For JavaScript Literal litStackMarkup = (Literal)e.Item.FindControl("litStackMarkup"); //For HTML StackCollection StackColl = (StackCollection)e.Item.DataItem; lblStackTitle.Text = StackColl.StackCollTitle + " (" + StackColl.Count + ")"; litHTML = "<div class=" + "\"" + "slides_nojs" + "\"" + ">"; string newtempStr = ""; foreach (PubEnt.BLL.Stack StackItem in StackColl) { newtempStr += "<div style=" + "\"padding-top:2px;padding-bottom:2px;\"" + ">" + "<a href=" + "\"" + "detail.aspx?prodid=" + StackItem.StackPubProdId + "\"" + ">" + StackItem.StackPubShortTitle + "</a>" + "</div>"; } litHTML = litHTML + newtempStr + "</div>"; litStackMarkup.Text = litHTML; ///Release objects StackColl = null; lblStackTitle = null; litStackScript = null; litStackMarkup = null; } return; //Exit method } #endregion ///End - JavaScript is truned off int pubsincurrstack = 0; slidedivcount++; string ImgWidth = ""; int initWidth = 0; int divWidth = 0; string ImgHeight = ""; int initHeight = 0; string PubFeaturedImagesURL = ""; #region GetConfigValues ImgWidth = ConfigurationManager.AppSettings["FeaturedImageWidth"]; if (ImgWidth.Length > 0) { initWidth = Int32.Parse(ImgWidth); } ImgHeight = ConfigurationManager.AppSettings["FeaturedImageHeight"]; if (ImgHeight.Length > 0) { initHeight = Int32.Parse(ImgHeight); } PubFeaturedImagesURL = ConfigurationManager.AppSettings["PubFeaturedImagesURL"]; #endregion if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { string litHTML = ""; /*string litScript = "";*/ string tempStr = ""; Label lblStackTitle = (Label)e.Item.FindControl("lblStackTitle"); lblStackTitle.Text = ""; //initialize Literal litStackScript = (Literal)e.Item.FindControl("litStackScript"); //For JavaScript Literal litStackMarkup = (Literal)e.Item.FindControl("litStackMarkup"); //For HTML StackCollection StackColl = (StackCollection)e.Item.DataItem; //Moved to DAL StackColl.Sort(StackCollection.StackFields.LongTitle, true); //Each collection needs to be sorted by the pubs long title lblStackTitle.Text = StackColl.StackCollTitle + " (" + StackColl.Count + ")"; divWidth = initWidth * StackColl.Count; ///Count times one image width tempStr = "slides_" + slidedivcount.ToString(); litHTML = "<div id=" + "\"" + tempStr + "\"" + ">" + "<div class=" + "\"" + "slides_container" + "\"" + ">"; arrStackDivIds.Add(tempStr); string newtempStr = ""; tempStr = ""; //clear for re-use foreach (PubEnt.BLL.Stack StackItem in StackColl) { newtempStr += "<div" + ">" + "<a href=" + "\"" + "detail.aspx?prodid=" + StackItem.StackPubProdId + "\"" + ">" + "<img src=" + "\"" + PubFeaturedImagesURL + "/" + StackItem.StackPubFeaturedImage + "\"" + " alt=\"" + StackItem.StackPubShortTitle + "\"" + "/>" + "</a>" + "</div>"; if (!arrStackIds.Contains(StackItem.StackId)) //maintain the list of unique stack ids { arrStackIds.Add(StackItem.StackId); } pubsincurrstack++; } tempStr = "<div" + " class='slidesnavlinks'" + ">" + "<a href=\"#\" class=\"prev\"><img class=\"btn_sliderprev\" alt=\"Previous\"></a>" + "<a href=\"#\" class=\"next\"><img class=\"btn_slidernext\" alt=\"Next\"></a>" + "</div>"; if (pubsincurrstack <= 1) //add the slider buttons html only if there is more than one pub in the slider { tempStr = ""; } litHTML = litHTML + newtempStr + "</div>" + tempStr + "</div>"; litStackMarkup.Text = litHTML; ///Release objects StackColl = null; lblStackTitle = null; litStackScript = null; litStackMarkup = null; } }
protected void btnSaveChanges_Click(object sender, EventArgs e) { #region Screen_Check System.Collections.ArrayList arrStackIdList = new System.Collections.ArrayList(); System.Collections.ArrayList arrTitleList = new System.Collections.ArrayList(); System.Collections.ArrayList arrSequenceList = new System.Collections.ArrayList(); #region Add_to_ArrayList foreach (GridViewRow Item in gvStacks.Rows) { HiddenField hidStackId = (HiddenField)Item.FindControl("hidStackId"); TextBox txtStackTitle = (TextBox)Item.FindControl("txtStackTitle"); TextBox txtStackSequence = (TextBox)Item.FindControl("txtStackSequence"); arrStackIdList.Add(hidStackId.Value); arrTitleList.Add(txtStackTitle.Text); arrSequenceList.Add(txtStackSequence.Text); } #endregion foreach (GridViewRow Item in gvStacks.Rows) { HiddenField hidStackId = (HiddenField)Item.FindControl("hidStackId"); TextBox txtStackTitle = (TextBox)Item.FindControl("txtStackTitle"); TextBox txtStackSequence = (TextBox)Item.FindControl("txtStackSequence"); Label lblMessage = (Label)Item.FindControl("lblMessage"); //Check for duplicate title on the grid for (int i = 0; i < arrStackIdList.Count; i++) { if (string.Compare(hidStackId.Value, arrStackIdList[i].ToString(), true) != 0 && string.Compare(txtStackTitle.Text.Trim(), arrTitleList[i].ToString().Trim(), true) == 0 ) { //lblMessage.Text = "Duplicate Title found. Please provide unique titles."; lblMessage.Text = "Duplicate Title found."; return; } else { lblMessage.Text = ""; } } //Check for duplicate stack id on the grid for (int i = 0; i < arrStackIdList.Count; i++) { if (string.Compare(hidStackId.Value, arrStackIdList[i].ToString(), true) != 0 && string.Compare(txtStackSequence.Text.Trim(), arrSequenceList[i].ToString().Trim(), true) == 0 ) { //lblMessage.Text = "Duplicate Sequence Number found. Please provide unique numbers."; lblMessage.Text = "Duplicate Sequence Number found."; return; } else { lblMessage.Text = ""; } } } //int f; #endregion StackCollection StackColl = DAL.PE_DAL.GetFeaturedStacks(0, ""); //Original Stack string StackIds = ""; string Titles = ""; string Sequences = ""; string Delim = PubEntAdminManager.stringDelim; foreach (GridViewRow Item in gvStacks.Rows) { HiddenField hidStackId = (HiddenField)Item.FindControl("hidStackId"); TextBox txtStackTitle = (TextBox)Item.FindControl("txtStackTitle"); TextBox txtStackSequence = (TextBox)Item.FindControl("txtStackSequence"); Label lblMessage = (Label)Item.FindControl("lblMessage"); foreach (Stack StackItem in StackColl) { //Check for empty title if (string.Compare(txtStackTitle.Text.Trim(), "", true) == 0) { lblMessage.Text = "Empty Title found."; return; } else { lblMessage.Text = ""; } //Check for empty sequence number if (string.Compare(txtStackSequence.Text.Trim(), "", true) == 0) { lblMessage.Text = "Empty Sequence Number found."; return; } else { lblMessage.Text = ""; } ////Check for duplicate stack title //if (string.Compare(txtStackTitle.Text.Trim(), StackItem.StackTitle, true) == 0 // && string.Compare(hidStackId.Value, StackItem.StackId.ToString(), true) != 0) //{ // //lblMessage.Text = "Duplicate Title found. Please provide unique titles."; // lblMessage.Text = "Duplicate Title found."; // return; //} //else // lblMessage.Text = ""; ////Check for duplicate sequence number //if (string.Compare(txtStackSequence.Text.Trim(), StackItem.StackSequence.ToString(), true) == 0 // && string.Compare(hidStackId.Value, StackItem.StackId.ToString(), true) != 0) //{ // //lblMessage.Text = "Duplicate Sequence Number found. Please provide unique numbers."; // lblMessage.Text = "Duplicate Sequence Number found."; // return; //} //else // lblMessage.Text = ""; //Check for duplicate stack title if (string.Compare(txtStackTitle.Text.Trim(), StackItem.StackTitle, true) == 0 && !arrStackIdList.Contains(StackItem.StackId.ToString())) { //lblMessage.Text = "Duplicate Title found. Please provide unique titles."; lblMessage.Text = "Duplicate Title found in the database table."; return; } else { lblMessage.Text = ""; } //Check for duplicate sequence number if (string.Compare(txtStackSequence.Text.Trim(), StackItem.StackSequence.ToString(), true) == 0 && !arrStackIdList.Contains(StackItem.StackId.ToString())) { //lblMessage.Text = "Duplicate Sequence Number found. Please provide unique numbers."; lblMessage.Text = "Duplicate Sequence Number found in the database table."; return; } else { lblMessage.Text = ""; } } if (StackIds.Length > 0) { StackIds += Delim + hidStackId.Value; } else { StackIds = hidStackId.Value; } if (Titles.Length > 0) { Titles += Delim + txtStackTitle.Text.Trim(); } else { Titles = txtStackTitle.Text.Trim(); } if (Sequences.Length > 0) { Sequences += Delim + txtStackSequence.Text.Trim(); } else { Sequences = txtStackSequence.Text.Trim(); } } //Execute the update DAL.PE_DAL.SetFeaturedStacks("UPD", StackIds, Titles, Sequences, Delim); BindGrid(); }
private static SarifErrorListItem GetDesignTimeViewModel1() { SarifErrorListItem viewModel = new SarifErrorListItem(); viewModel.Message = "Potential mismatch between sizeof and countof quantities. Use sizeof() to scale byte sizes."; viewModel.Tool = new ToolModel() { Name = "FxCop", Version = "1.0.0.0", }; viewModel.Rule = new RuleModel() { Id = "CA1823", Name = "Avoid unused private fields", HelpUri = "http://aka.ms/analysis/ca1823", DefaultLevel = "Unknown" }; viewModel.Invocation = new InvocationModel() { CommandLine = @"""C:\Temp\Foo.exe"" target.file /o out.sarif", FileName = @"C:\Temp\Foo.exe", }; viewModel.Locations.Add(new Models.AnnotatedCodeLocationModel() { FilePath = @"D:\GitHub\NuGet.Services.Metadata\src\Ng\Catalog2Dnx.cs", Region = new CodeAnalysis.Sarif.Region(11, 1, 11, 2, 0, 0), }); viewModel.Locations.Add(new Models.AnnotatedCodeLocationModel() { FilePath = @"D:\GitHub\NuGet.Services.Metadata\src\Ng\Catalog2Dnx.cs", Region = new CodeAnalysis.Sarif.Region(12, 1, 12, 2, 0, 0), }); viewModel.RelatedLocations.Add(new Models.AnnotatedCodeLocationModel() { FilePath = @"D:\GitHub\NuGet.Services.Metadata\src\Ng\Catalog2Dnx.cs", Region = new CodeAnalysis.Sarif.Region(21, 1, 21, 2, 0, 0), }); viewModel.RelatedLocations.Add(new Models.AnnotatedCodeLocationModel() { FilePath = @"D:\GitHub\NuGet.Services.Metadata\src\Ng\Catalog2Dnx.cs", Region = new CodeAnalysis.Sarif.Region(22, 1, 22, 2, 0, 0), }); viewModel.RelatedLocations.Add(new Models.AnnotatedCodeLocationModel() { FilePath = @"D:\GitHub\NuGet.Services.Metadata\src\Ng\Catalog2Dnx.cs", Region = new CodeAnalysis.Sarif.Region(23, 1, 23, 2, 0, 0), }); viewModel.CallTrees.Add(new CallTree( new List <CallTreeNode> { new CallTreeNode { Location = new AnnotatedCodeLocation { Kind = AnnotatedCodeLocationKind.Assignment } }, new CallTreeNode { Location = new AnnotatedCodeLocation { Kind = AnnotatedCodeLocationKind.Call, Target = "my_func" }, Children = new List <CallTreeNode> { new CallTreeNode { Location = new AnnotatedCodeLocation { Kind = AnnotatedCodeLocationKind.CallReturn } } } } }, SarifViewerPackage.SarifToolWindow)); StackCollection stack1 = new StackCollection("Stack A1"); stack1.Add(new StackFrameModel() { Message = "Message A1.1", FilePath = @"D:\GitHub\NuGet.Services.Metadata\src\Ng\Catalog2Dnx.cs", Line = 11, Column = 1, FullyQualifiedLogicalName = "My.Assembly.Main(string[] args)", Module = "My.Module.dll", }); stack1.Add(new StackFrameModel() { Message = "Message A1.2", FilePath = @"D:\GitHub\NuGet.Services.Metadata\src\Ng\Catalog2Dnx.cs", Line = 12, Column = 1, FullyQualifiedLogicalName = "Our.Shared.Library.Method(int param)", Module = "My.Module.dll", }); stack1.Add(new StackFrameModel() { Message = "Message A1.3", FilePath = @"D:\GitHub\NuGet.Services.Metadata\src\Ng\Catalog2Dnx.cs", Line = 1, Column = 1, FullyQualifiedLogicalName = "Your.PIA.External()", }); viewModel.Stacks.Add(stack1); FixModel fix1 = new FixModel("Replace *.Close() with *.Dispose()."); FileChangeModel fileChange11 = new FileChangeModel(); fileChange11.FilePath = @"D:\GitHub\NuGet.Services.Metadata\src\Ng\Catalog2Dnx.cs"; fileChange11.Replacements.Add(new ReplacementModel() { Offset = 1234, DeletedLength = ".Close()".Length, InsertedString = ".Dispose()", }); fix1.FileChanges.Add(fileChange11); viewModel.Fixes.Add(fix1); return(viewModel); }
protected void dgInfoViewNCIPL_ItemDataBound(object sender, DataGridItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { if (String.Compare(((DataRowView)e.Item.DataItem).Row[0].ToString(), "Display Status:", true) == 0) { DataSet iSet = PE_DAL.GetNCIPLDisplayStatusView(this.PubID); if (iSet.Tables[0].Rows.Count > 0) { Label l_displayStatus = new Label(); foreach (DataRow s in iSet.Tables[0].Rows) { if (l_displayStatus.Text.Length > 0) { l_displayStatus.Text += ", "; } l_displayStatus.Text += s.ItemArray[1].ToString(); } l_displayStatus.Text.Trim(); ((DataRowView)e.Item.DataItem).Row[0] = ""; e.Item.Cells[1].Controls.Clear(); e.Item.Cells[1].Controls.Add(l_displayStatus); } else { Label errLbl = new Label(); errLbl.Text = " - "; e.Item.Cells[1].Controls.Clear(); e.Item.Cells[1].Controls.Add(errLbl); } } else if (String.Compare(((DataRowView)e.Item.DataItem).Row[0].ToString(), "Subject:", true) == 0) { DataGrid dgRegReimb2 = new DataGrid(); dgRegReimb2.ID = "innerDgRegReimb"; //Format the DataGrid to look cool. dgRegReimb2.BorderWidth = (Unit)0; dgRegReimb2.CellPadding = 4; dgRegReimb2.CellSpacing = 0; dgRegReimb2.GridLines = GridLines.None; dgRegReimb2.BorderColor = Color.FromName("#E0E0E0"); dgRegReimb2.ItemStyle.BackColor = Color.White; dgRegReimb2.AlternatingItemStyle.BackColor = Color.FromName("LightGray"); dgRegReimb2.ShowHeader = false; dgRegReimb2.HeaderStyle.CssClass = "fieldLabel"; dgRegReimb2.HeaderStyle.BackColor = Color.FromName("#ffff00"); dgRegReimb2.AutoGenerateColumns = false; //****Add a series of BoundColumns****// //***Region Name***// BoundColumn bc = new BoundColumn(); //Set the BoundColumn Values bc.DataField = "Description"; //bc.HeaderText = "Region(s)"; bc.ItemStyle.Wrap = false; bc.ItemStyle.CssClass = "fieldLabel"; dgRegReimb2.Columns.Add(bc); //****End BoundColumns****// DataSet iSet = PE_DAL.GetNCIPLSubjectView(this.PubID); if (iSet != null) { dgRegReimb2.DataSource = iSet; dgRegReimb2.DataBind(); ((DataRowView)e.Item.DataItem).Row[0] = ""; e.Item.Cells[1].Controls.Clear(); e.Item.Cells[1].Controls.Add(dgRegReimb2); } else { Label errLbl = new Label(); errLbl.Text = " - "; e.Item.Cells[1].Controls.Clear(); e.Item.Cells[1].Controls.Add(errLbl); } } else if (String.Compare(((DataRowView)e.Item.DataItem).Row[0].ToString(), "Image Stack:", true) == 0) { //For Displaying Featured Pub Stacks DataGrid dgStackView = new DataGrid(); dgStackView.ID = "innerdgStackView"; //Format the DataGrid to look cool. dgStackView.BorderWidth = (Unit)0; dgStackView.CellPadding = 4; dgStackView.CellSpacing = 0; dgStackView.GridLines = GridLines.None; dgStackView.BorderColor = Color.FromName("#E0E0E0"); dgStackView.ItemStyle.BackColor = Color.White; dgStackView.AlternatingItemStyle.BackColor = Color.FromName("LightGray"); dgStackView.ShowHeader = false; dgStackView.HeaderStyle.CssClass = "fieldLabel"; dgStackView.HeaderStyle.BackColor = Color.FromName("#ffff00"); dgStackView.AutoGenerateColumns = false; //****Add a series of BoundColumns****// //***Region Name***// BoundColumn bc = new BoundColumn(); //Set the BoundColumn Values //bc.DataField = "Description"; bc.DataField = "stacktitle"; //bc.HeaderText = "Region(s)"; bc.ItemStyle.Wrap = false; bc.ItemStyle.CssClass = "fieldLabel"; dgStackView.Columns.Add(bc); //****End BoundColumns****// //DataSet iSet = PE_DAL.GetNCIPLStacksView(this.PubID); StackCollection iSet = PE_DAL.GetNCIPLStacksView(this.PubID); //if (iSet != null) if (iSet.Count > 0) { dgStackView.DataSource = iSet; dgStackView.DataBind(); ((DataRowView)e.Item.DataItem).Row[0] = ""; e.Item.Cells[1].Controls.Clear(); e.Item.Cells[1].Controls.Add(dgStackView); } else { Label errLbl = new Label(); errLbl.Text = " - "; e.Item.Cells[1].Controls.Clear(); e.Item.Cells[1].Controls.Add(errLbl); } } //NCIPL_CC - Part of changes to have collections on NCIPL tab and ROO tab else if (String.Compare(((DataRowView)e.Item.DataItem).Row[0].ToString(), "Collections:", true) == 0) { //For Displaying Collections DataGrid dgCollectionsView = new DataGrid(); dgCollectionsView.ID = "innerdgCollectionsView"; //Format the DataGrid to look cool. dgCollectionsView.BorderWidth = (Unit)0; dgCollectionsView.CellPadding = 4; dgCollectionsView.CellSpacing = 0; dgCollectionsView.GridLines = GridLines.None; dgCollectionsView.BorderColor = Color.FromName("#E0E0E0"); dgCollectionsView.ItemStyle.BackColor = Color.White; dgCollectionsView.AlternatingItemStyle.BackColor = Color.FromName("LightGray"); dgCollectionsView.ShowHeader = false; dgCollectionsView.HeaderStyle.CssClass = "fieldLabel"; dgCollectionsView.HeaderStyle.BackColor = Color.FromName("#ffff00"); dgCollectionsView.AutoGenerateColumns = false; //****Add a series of BoundColumns****// //***Region Name***// BoundColumn bc = new BoundColumn(); //Set the BoundColumn Values //bc.DataField = "Description"; bc.DataField = "SeriesName"; //bc.HeaderText = "Region(s)"; bc.ItemStyle.Wrap = false; bc.ItemStyle.CssClass = "fieldLabel"; dgCollectionsView.Columns.Add(bc); //****End BoundColumns****// //DataSet iSet = PE_DAL.GetNCIPLStacksView(this.PubID); SeriesCollection iSet = PE_DAL.GetCollectionsByInterfaceByPubId("NCIPL", this.PubID); //if (iSet != null) if (iSet.Count > 0) { dgCollectionsView.DataSource = iSet; dgCollectionsView.DataBind(); ((DataRowView)e.Item.DataItem).Row[0] = ""; e.Item.Cells[1].Controls.Clear(); e.Item.Cells[1].Controls.Add(dgCollectionsView); } else { Label errLbl = new Label(); errLbl.Text = " - "; e.Item.Cells[1].Controls.Clear(); e.Item.Cells[1].Controls.Add(errLbl); } } } }