DidiMini510.Util.ClassLibrary2
1.0.0
dotnet add package DidiMini510.Util.ClassLibrary2 --version 1.0.0
NuGet\Install-Package DidiMini510.Util.ClassLibrary2 -Version 1.0.0
<PackageReference Include="DidiMini510.Util.ClassLibrary2" Version="1.0.0" />
<PackageVersion Include="DidiMini510.Util.ClassLibrary2" Version="1.0.0" />
<PackageReference Include="DidiMini510.Util.ClassLibrary2" />
paket add DidiMini510.Util.ClassLibrary2 --version 1.0.0
#r "nuget: DidiMini510.Util.ClassLibrary2, 1.0.0"
#:package DidiMini510.Util.ClassLibrary2@1.0.0
#addin nuget:?package=DidiMini510.Util.ClassLibrary2&version=1.0.0
#tool nuget:?package=DidiMini510.Util.ClassLibrary2&version=1.0.0
try
{
sql.OpenConnect();
SqlCommand command = new SqlCommand($"SELECT idUser, typeUser " +
$"FROM [User] " +
$"WHERE login = '{LoginTB.Text}' AND password = '{PasswordTB.Text}' ", sql.str);
SqlDataReader reader = command.ExecuteReader();
reader.Read();
int idUser = Convert.ToInt32(reader["idUser"].ToString());
object result = reader["typeUser"].ToString();
reader.Close();
sql.CloseConnect();
if (LoginTB.Text == "" || PasswordTB.Text == "")
{
MessageBox.Show("Введите логин или пароль");
}
else if (result != null)
{
int typeUser = Convert.ToInt32(result);
if (typeUser == 1)
{
Forms.AdminWin adminWin = new Forms.AdminWin();
adminWin.Show();
this.Close();
}
else if (typeUser == 2)
{
Forms.ExcuetWin excuetWin = new Forms.ExcuetWin(idUser);
excuetWin.Show();
this.Close();
}
}
else
{
MessageBox.Show("Неверный Логин или Пароль");
}
}
catch (Exception ex)
{
MessageBox.Show($"Error: {ex}");
}
private List<Equipment> equipmentList;
private Equipment equipmentSelect;
private void LoadEquipmentList()
{
equipmentList = new List<Equipment>();
try
{
sql.OpenConnection();
string query = "SELECT Код_Оборудования, Наименование FROM Оборудование";
SqlCommand command = new SqlCommand(query, sql.str);
SqlDataReader reader = command.ExecuteReader();
while (reader.Read())
{
Equipment equipment = new Equipment
{
EquipmentCode = reader.GetInt32(reader.GetOrdinal("Код_Оборудования")),
Name = reader.GetString(reader.GetOrdinal("Наименование"))
};
equipmentList.Add(equipment);
}
// Установка списка в качестве источника данных для ComboBox
OborudCB.ItemsSource = equipmentList;
OborudCB.DisplayMemberPath = "Name"; // Отображение наименования в ComboBox
}
catch (Exception ex)
{
MessageBox.Show($"Ошибка: {ex.Message}");
}
finally
{
sql.CloseConnection();
}
}
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp3.1 is compatible. |
-
.NETCoreApp 3.1
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 190 | 4/17/2024 |
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="3*"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Background="Lavender">
<Label Content="Меню" Grid.Column="1" HorizontalAlignment="Center" Margin="10" VerticalAlignment="Top"/>
<Button Content="Исполнение заявки" HorizontalAlignment="Center" Margin="10" VerticalAlignment="Top" Width="220" Click="Button_Click"/>
<Button Content="Отчетность и информатирование" HorizontalAlignment="Center" Margin="10" VerticalAlignment="Top" Width="220" Click="Button_Click_1"/>
<Button Grid.ColumnSpan="2" Content="Выход" HorizontalAlignment="Center" Margin="10" VerticalAlignment="Top" Width="220" Click="Button_Click_3"/>
</StackPanel>
<Frame x:Name="mainFrame" NavigationUIVisibility="Hidden" Grid.Column="1"/>
<ListView HorizontalAlignment="Center" Height="100" Margin="0,10,0,0" VerticalAlignment="Top" Width="720">
<ListView.View>
<GridView>
<GridViewColumn Header="Оборудование" Width="150" DisplayMemberBinding="{Binding object}"/>
<GridViewColumn Header="Тип неисправности" Width="150" DisplayMemberBinding="{Binding typeProblem}"/>
<GridViewColumn Header="Клиент" Width="250" DisplayMemberBinding="{Binding clientFullName}"/>
<GridViewColumn Header="Статус" Width="150" DisplayMemberBinding="{Binding status}"/>
</GridView>
</ListView.View>
</ListView>
<Label Content="Статус" HorizontalAlignment="Left" Margin="40,133,0,0" VerticalAlignment="Top" Width="150"/>
<ComboBox HorizontalAlignment="Left" Margin="40,165,0,0" VerticalAlignment="Top" Width="194" />
<Label Content="Что исправлено\сделано" HorizontalAlignment="Left" Margin="40,200,0,0" VerticalAlignment="Top" Width="194"/>
<TextBox HorizontalAlignment="Left" Margin="40 230 0 0" VerticalAlignment="Top" Width="720" Height="53" />
<Label Content="Заказать запчасти" HorizontalAlignment="Left" Margin="40,290,0,0" VerticalAlignment="Top" Width="194"/>
<TextBox HorizontalAlignment="Left" Margin="40 320 0 0" VerticalAlignment="Top" Width="720" Height="22" />
<Label Content="Добавить исполнителя" HorizontalAlignment="Left" Margin="40,360,0,0" VerticalAlignment="Top" Width="150"/>
<ComboBox HorizontalAlignment="Left" Margin="40,390,0,0" VerticalAlignment="Top" Width="194" />
<Button Content="Сохранить" HorizontalAlignment="Left" Margin="601,397,0,0" VerticalAlignment="Top" Width="159"/>
public class Equipment
{
public int EquipmentCode { get; set; }
public string Name { get; set; }
}
SqlCommand commandTime = new SqlCommand(
$"SELECT SUM(DATEDIFF(HOUR, Дата_добавления, Дата_окончания)) " +
$"FROM Заявки " +
$"WHERE Код_Статуса = 3 AND Дата_окончания IS NOT NULL", sql.str);
// Получаем общее время выполнения
object totalTimeObj = commandTime.ExecuteScalar();
if (totalTimeObj != DBNull.Value && totalTimeObj != null)
{
int totalTime = Convert.ToInt32(totalTimeObj);
// Запрос для получения количества выполненных заявок
SqlCommand commandCount = new SqlCommand($"SELECT COUNT(*) FROM Заявки WHERE Код_Статуса = 3 AND Дата_окончания IS NOT NULL", sql.str);
int _executedRequestsCount = (int)commandCount.ExecuteScalar();
ExecutedRequestsCount.Text = Convert.ToString(_executedRequestsCount);
// Рассчитываем среднее время выполнения
if (_executedRequestsCount > 0)
{
double averageTime = totalTime / (double)_executedRequestsCount;
AverageTime.Text = $"{averageTime:F2} ч.";
}
else
{
AverageTime.Text = "Нет выполненных заявок";
}
}
else
{
AverageTime.Text = "Нет выполненных заявок";
}