Guns
Guns
CC#
Created by Guns on 3/29/2023 in #help
C# Data Table issue
https://pastebin.com/DSHwSh0M based on this program, I need to set the values of the Old PS A11Y State in the mergedDataTable to the values from the initial target file/worksheet and technically the targetDataTable. what do i need to changed? Rn this is how it is being done, but for unknown reasons, even after updating the file the values for that column (Old PS A11Y State) are not being updated;
foreach (DataRow targetRow in targetRows)
{
targetRow.SetField("Status", updatedStatus);

DataRow updatedRow = syncedDataTable.NewRow();
updatedRow["Finding ID"] = findingId;
updatedRow["Status"] = updatedStatus;
syncedDataTable.Rows.Add(updatedRow);

DataRow mergedRow = mergedDataTable.NewRow();
mergedRow["Finding ID"] = findingId;
mergedRow["eA State"] = sourceDataTable.Rows[i].Field<string>("Status");
// assuming the issue is here;
mergedRow["old PS A11Y State"] = targetDataTable.Rows[i].Field<string>("Status");

mergedRow["new PS A11Y State"] = updatedStatus;
mergedDataTable.Rows.Add(mergedRow);
}
foreach (DataRow targetRow in targetRows)
{
targetRow.SetField("Status", updatedStatus);

DataRow updatedRow = syncedDataTable.NewRow();
updatedRow["Finding ID"] = findingId;
updatedRow["Status"] = updatedStatus;
syncedDataTable.Rows.Add(updatedRow);

DataRow mergedRow = mergedDataTable.NewRow();
mergedRow["Finding ID"] = findingId;
mergedRow["eA State"] = sourceDataTable.Rows[i].Field<string>("Status");
// assuming the issue is here;
mergedRow["old PS A11Y State"] = targetDataTable.Rows[i].Field<string>("Status");

mergedRow["new PS A11Y State"] = updatedStatus;
mergedDataTable.Rows.Add(mergedRow);
}
e.g; on the fist run i.e when the file is not yet synced the data grid view should look like this; v1;
finding id, ea state,old, new
1a, closed, open, closed
finding id, ea state,old, new
1a, closed, open, closed
then after updating the file and re opening the updated file, the data grid view should look like this; v2;
finding id, ea state,old, new
1a, closed, **closed**, closed
finding id, ea state,old, new
1a, closed, **closed**, closed
but instead the datagrid view is still looking like the first version...
2 replies
CC#
Created by Guns on 3/17/2023 in #help
❔ CSV Read data
red,blue,green
1, 2, 3
4, 5, 6
red,blue,green
1, 2, 3
4, 5, 6
I have a csv file like this, using stream reader or something better if there is idk, how can i grab all the values from the column Green using a memory efficient method. That is: I want to get 3 and 6 from the csv file
3 replies
CC#
Created by Guns on 3/13/2023 in #help
need help with a stack class implementation
using System;
namespace CustomStackApp
{
class Program
{
static void Main ()
{
CustomStack<string>
testStack = new
CustomStack<string> 0;
testStack.Push("Jedi-X");
testStack.Pop ();
testStack.Push("Jedi");
testStack.Push("SkillsLab");
while (testStack.Count()
> 0)
Console.WriteLine(testStack.Po
p();
Console. ReadLine();

CustomStack<Jedi>
testStack2 = new
CustomStack<Jedi> (;
testStack2.Push("Skylord", "001");
testStack2.Push("Dark
Vador", "O02");
testStack2.Push("Han
Solo", "003");
}
}
class CustomStack <T>
{
static int MAXSIZE = 10;
string I stack = new
string [MAXSIZE];
int index;
public void Push (string value)
{
stack[index] = value;
index++;
}

public string Pop ()
{ index--;
return stack[index];;
}
public int Count ()
{
return stack.Length;
}
}
class Jedi
{
private string name;
private string ld;
public string Nameld
{
get
{
return $"Jedi -{name} :
{ld}";
}
set
{
Nameld = value;}}

class Jedi
{
private string name;
private string Id;
public string Nameld
{
get
{
return $"Jedi -{name} :
{ld'";
}
set
{
Nameld = value;
}
public Jedi (string _name, string.
Id)
{
name = _name;
ld = _Id;
}
}
using System;
namespace CustomStackApp
{
class Program
{
static void Main ()
{
CustomStack<string>
testStack = new
CustomStack<string> 0;
testStack.Push("Jedi-X");
testStack.Pop ();
testStack.Push("Jedi");
testStack.Push("SkillsLab");
while (testStack.Count()
> 0)
Console.WriteLine(testStack.Po
p();
Console. ReadLine();

CustomStack<Jedi>
testStack2 = new
CustomStack<Jedi> (;
testStack2.Push("Skylord", "001");
testStack2.Push("Dark
Vador", "O02");
testStack2.Push("Han
Solo", "003");
}
}
class CustomStack <T>
{
static int MAXSIZE = 10;
string I stack = new
string [MAXSIZE];
int index;
public void Push (string value)
{
stack[index] = value;
index++;
}

public string Pop ()
{ index--;
return stack[index];;
}
public int Count ()
{
return stack.Length;
}
}
class Jedi
{
private string name;
private string ld;
public string Nameld
{
get
{
return $"Jedi -{name} :
{ld}";
}
set
{
Nameld = value;}}

class Jedi
{
private string name;
private string Id;
public string Nameld
{
get
{
return $"Jedi -{name} :
{ld'";
}
set
{
Nameld = value;
}
public Jedi (string _name, string.
Id)
{
name = _name;
ld = _Id;
}
}
56 replies
CC#
Created by Guns on 3/10/2023 in #help
❔ Need help with datetime
I need to create a class which has two fields; name and date. Then create objects of this class. I need to use datetime for the date field. anyone knows what im doing wrong? so basically; static void Main() { //create intances of Employee; Employee emp1 = new Employee("James", 25, new DateTime(2000, 5, 1)); //add employees to list List<Employee> employees = new List<Employee>(4); employees.Add(emp1); //LINQ Questions; //Q1. Return a List of employees that hired after the year 2005 var queryHiredAfter2005 = from emp in employees where emp.HireDate.Year > 2005 select emp.Name; foreach (var res in queryHiredAfter2005) { Console.WriteLine(res); } class Employee { public string name; public string Name { get { return name; } set { name = value; } } public DateTime hiredate; public DateTime HireDate { get; set; } //Constructor; public Employee(string _name, int _age, DateTime _hiredate) { _name = Name; _age = Age; _hiredate = HireDate; }
32 replies