ApathyErr
ApathyErr
CC#
Created by ApathyErr on 6/18/2024 in #help
QuestPDF Why does the document become empty after adding the table and how to fix it?
I have a pdf file that I generate using code, I'm trying to add a table to it that is contained in column.Item().Table, but when adding this pdf element, the file becomes empty, how do I add the table correctly
2 replies
CC#
Created by ApathyErr on 4/9/2024 in #help
Why can't I use the null propagation operator in lambda expressions?
using (ProfitCalculatorDataBaseContext db = new ProfitCalculatorDataBaseContext())
{
var customers = db.Customers.ToList();
var orders = db.Orders.Where(o => o.OrderStatus != "Готов")
.Select(o => new OrdView
{
oId = o.Id,
oData = o.Data,
oCustomersMail = customers.FirstOrDefault(c => c.CustomerId == o.CustomerId)?.Mail ?? "Не найдено",
oStartPoint = o.StartPoint,
oFinalPoint = o.FinalPoint,
oTrackNumber = o.TrackNumber,
oOrderStatus = o.OrderStatus,
oComment = o.Comment,
oMoneyPerOrder = o.MoneyPerOrder
})
.ToList();

activeOrdersGrid.ItemsSource = orders;
}
using (ProfitCalculatorDataBaseContext db = new ProfitCalculatorDataBaseContext())
{
var customers = db.Customers.ToList();
var orders = db.Orders.Where(o => o.OrderStatus != "Готов")
.Select(o => new OrdView
{
oId = o.Id,
oData = o.Data,
oCustomersMail = customers.FirstOrDefault(c => c.CustomerId == o.CustomerId)?.Mail ?? "Не найдено",
oStartPoint = o.StartPoint,
oFinalPoint = o.FinalPoint,
oTrackNumber = o.TrackNumber,
oOrderStatus = o.OrderStatus,
oComment = o.Comment,
oMoneyPerOrder = o.MoneyPerOrder
})
.ToList();

activeOrdersGrid.ItemsSource = orders;
}
10 replies
CC#
Created by ApathyErr on 4/6/2024 in #help
DataGridComboBoxColumn
No description
3 replies
CC#
Created by ApathyErr on 4/5/2024 in #help
✅ sqlite local db file
For some reason, sqlite works only when the full path to the database is specified. Like:
"Data Source= E:\\VS Projects\\ProfitCalculator\\ProfitCalculator\\DataBase\\Profit Calculator DataBase.db"
"Data Source= E:\\VS Projects\\ProfitCalculator\\ProfitCalculator\\DataBase\\Profit Calculator DataBase.db"
The code that accesses the database is located in another ViewModel folder How do I specify the local path to the database? And it doesn't work like that:
optionsBuilder.UseSqlite("Data Source=\\DataBase\\ProfitCalculatorDataBase.db");
optionsBuilder.UseSqlite("Data Source=\\DataBase\\ProfitCalculatorDataBase.db");
And that too:
optionsBuilder.UseSqlite("Data Source=" + System.AppContext.BaseDirectory + "\\DataBase\\ProfitCalculatorDataBase.db");
optionsBuilder.UseSqlite("Data Source=" + System.AppContext.BaseDirectory + "\\DataBase\\ProfitCalculatorDataBase.db");
1 replies
CC#
Created by ApathyErr on 4/5/2024 in #help
✅ WPF. Instance with the same key value for {'Id'} is already being tracked
I have two datagrids. They are filled with data from the database in this way:
using (ProfitCalculatorDataBaseContext db = new ProfitCalculatorDataBaseContext())
{
var ord = from order in db.Orders
where order.Completed == 0
select new OrdView
{
oId = order.Id,
oNum = order.Num,
oData = order.Data,
oCustomersMail = order.CustomersMail,
oStartPoint = order.StartPoint,
oFinalPoint = order.FinalPoint,
oTrackNumber = order.TrackNumber,
oOrderStatus = order.OrderStatus,
oComment = order.Comment,
oMoneyPerOrder = order.MoneyPerOrder,
oCompleted = order.Completed
};
activeOrdersGrid.ItemsSource = ord.ToList();
}
using (ProfitCalculatorDataBaseContext db = new ProfitCalculatorDataBaseContext())
{
var ord = from order in db.Orders
where order.Completed == 0
select new OrdView
{
oId = order.Id,
oNum = order.Num,
oData = order.Data,
oCustomersMail = order.CustomersMail,
oStartPoint = order.StartPoint,
oFinalPoint = order.FinalPoint,
oTrackNumber = order.TrackNumber,
oOrderStatus = order.OrderStatus,
oComment = order.Comment,
oMoneyPerOrder = order.MoneyPerOrder,
oCompleted = order.Completed
};
activeOrdersGrid.ItemsSource = ord.ToList();
}
using (ProfitCalculatorDataBaseContext db = new ProfitCalculatorDataBaseContext())
{
var ord = from order in db.Orders
where order.Completed == 1
select new OrdView
{
oNum = order.Num,
oData = order.Data,
oCustomersMail = order.CustomersMail,
oStartPoint = order.StartPoint,
oFinalPoint = order.FinalPoint,
oTrackNumber = order.TrackNumber,
oOrderStatus = order.OrderStatus,
oComment = order.Comment,
oMoneyPerOrder = order.MoneyPerOrder,
oCompleted = order.Completed
};
completedOrdersGrid.ItemsSource = ord.ToList();
using (ProfitCalculatorDataBaseContext db = new ProfitCalculatorDataBaseContext())
{
var ord = from order in db.Orders
where order.Completed == 1
select new OrdView
{
oNum = order.Num,
oData = order.Data,
oCustomersMail = order.CustomersMail,
oStartPoint = order.StartPoint,
oFinalPoint = order.FinalPoint,
oTrackNumber = order.TrackNumber,
oOrderStatus = order.OrderStatus,
oComment = order.Comment,
oMoneyPerOrder = order.MoneyPerOrder,
oCompleted = order.Completed
};
completedOrdersGrid.ItemsSource = ord.ToList();
87 replies
CC#
Created by ApathyErr on 8/29/2023 in #help
❔ Why does this code always return False?
public static bool IsPalindrome(int x)
{
return x.ToString().Reverse() == x.ToString();
}
static void Main(string[] args)
{
Console.Write("Enter a number:");
int x = Convert.ToInt32(Console.ReadLine());
Console.Write(IsPalindrome(x));
}
public static bool IsPalindrome(int x)
{
return x.ToString().Reverse() == x.ToString();
}
static void Main(string[] args)
{
Console.Write("Enter a number:");
int x = Convert.ToInt32(Console.ReadLine());
Console.Write(IsPalindrome(x));
}
18 replies
CC#
Created by ApathyErr on 8/26/2023 in #help
what event should be added for the datagrid so that when the line stops being highlighted, track it?
4 replies
CC#
Created by ApathyErr on 8/24/2023 in #help
✅ How to get data from the first cell of a selected row?
8 replies
CC#
Created by ApathyErr on 5/1/2023 in #help
✅ System.StackOverflowException
10 replies
CC#
Created by ApathyErr on 5/1/2023 in #help
❔ "Items collection must be empty before using ItemsSource."
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace WPF_LoginForm.Views
{
/// <summary>
/// Interaction logic for CustomerView.xaml
/// </summary>
public partial class CustomerView : UserControl
{
public CustomerView()
{
InitializeComponent();

DGridCustomer.ItemsSource = CRMBaseEntities.GetContext().Customers.ToList();
}

private void Button_Click(object sender, RoutedEventArgs e)
{

}
private void BtnEdit_Click(object sender, RoutedEventArgs e)
{

}

private void BtnAdd_Click(object sender, RoutedEventArgs e)
{

}
private void BtnDelete_Click(object sender, RoutedEventArgs e)
{

}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace WPF_LoginForm.Views
{
/// <summary>
/// Interaction logic for CustomerView.xaml
/// </summary>
public partial class CustomerView : UserControl
{
public CustomerView()
{
InitializeComponent();

DGridCustomer.ItemsSource = CRMBaseEntities.GetContext().Customers.ToList();
}

private void Button_Click(object sender, RoutedEventArgs e)
{

}
private void BtnEdit_Click(object sender, RoutedEventArgs e)
{

}

private void BtnAdd_Click(object sender, RoutedEventArgs e)
{

}
private void BtnDelete_Click(object sender, RoutedEventArgs e)
{

}
}
}
6 replies
CC#
Created by ApathyErr on 5/1/2023 in #help
❔ What is better to use instead ADO.NET Entity Framework?
21 replies
CC#
Created by ApathyErr on 4/28/2023 in #help
❔ "Call site reachable by all platforms" but "only supported on: 'windows'"?
5 replies
CC#
Created by ApathyErr on 4/27/2023 in #help
❔ how to transfer your project from .NET Framework 4.8 to the latest version?
HELP
26 replies
CC#
Created by ApathyErr on 4/26/2023 in #help
❔ How do I close the authorization window after the user has logged in?
I implemented it this way, but in this case my memory is heavily loaded, so a new window is created every time
IKD IKD = new IKD();
IKD.Show();
Hide();
IKD IKD = new IKD();
IKD.Show();
Hide();
52 replies
CC#
Created by ApathyErr on 4/22/2023 in #help
❔ WPF how do I recolor the icon on hover?
I repainted the background of the button that uses the icon using this code, but I can't apply it to the icon.
10 replies
CC#
Created by ApathyErr on 4/21/2023 in #help
❔ Repeating Error: XLS0305: Closing tag for element '<Border>' was not found
10 replies
CC#
Created by ApathyErr on 4/21/2023 in #help
❔ WPF Inserting a color from the ResourceDictionary into the button code gives an error
6 replies
CC#
Created by ApathyErr on 4/18/2023 in #help
❔ WPF How do I make transparency only for the gradient background, and not for all elements?
8 replies