123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- using System;
- using System.Collections.Generic;
- using System.Data;
- 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.Shapes;
- namespace Practics.Views
- {
-
- /// <summary>
- /// Interaction logic for TicketProcessing.xaml
- /// </summary>
- public partial class TicketProcessing : Window
- {
- public DataRow DataRowProblem { get; private set; }
- Model.Model model = Model.Model.ModelInstance;
- Practics.Model.User user;
- public TicketProcessing(DataRow dataRow, Practics.Model.User user)
- {
- InitializeComponent();
- this.user = user;
- DataRowProblem= dataRow;
- this.DataContext = DataRowProblem;
-
- cbProblemStatus.ItemsSource = model.DataTableStatuses.DefaultView;
- cbProblemStatus.DisplayMemberPath = "name";
- cbProblemStatus.SelectedValuePath = "Id";
- cbProblemType.ItemsSource=model.DataTableProblemTypes.DefaultView;
- cbProblemType.DisplayMemberPath = "NameProblemType";
- cbProblemType.SelectedValuePath = "ID";
- cbSolvedAdmin.ItemsSource=model.DataTableAdmins.DefaultView;
- cbSolvedAdmin.DisplayMemberPath = "LastName";
- cbSolvedAdmin.SelectedValuePath="ID";
-
- }
- void SetWindow()
- {
-
- }
- private void btnSendMessage_Click(object sender, RoutedEventArgs e)
- {
-
- string currentTime = DateTime.Now.ToString("dd-MM-yyyy HH:mm:ss");
- Paragraph paragraph = new Paragraph();
- Run timeRun = new Run("Admin".ToString() + ":" + currentTime)
- {
- FontWeight = FontWeights.Bold,
- Foreground = new SolidColorBrush(Colors.Red)
- };
- paragraph.Inlines.Add(timeRun);
- Run message = new Run("\r\n" + tbMessage.Text);
- paragraph.Inlines.Add(message);
- rtbChat.Document.Blocks.Add(paragraph);
- string documentContent = model.RichTextBoxContentToString(rtbChat);
- DataRowProblem["Chat"] = documentContent;
- model.ChatUpdate2(Convert.ToInt32(DataRowProblem["ID"]), documentContent);
- }
- private void Window_Loaded(object sender, RoutedEventArgs e)
- {
- tbProblemName.Text = DataRowProblem["ProblemName"].ToString();
- tbPCNumber.Text = DataRowProblem["PCNumber"].ToString();
- tbProblemDescribe.Text = DataRowProblem["ProblemDescribe"].ToString();
- dtpProblemTime.Value = Convert.ToDateTime(DataRowProblem["ProblemTime"]);
- //System.Diagnostics.Debug.WriteLine(dtpSolvedTime.Value);
- object temp = DataRowProblem["SolvedTime"];
- if (!Convert.IsDBNull(temp))
- dtpSolvedTime.Value = Convert.ToDateTime(DataRowProblem["SolvedTime"]);
- temp = DataRowProblem["ProblemStatusID"];
- if (!Convert.IsDBNull(temp))
- cbProblemStatus.SelectedValue = Convert.ToInt32(DataRowProblem["ProblemStatusID"]);
- cbProblemType.SelectedValue = Convert.ToInt32(DataRowProblem["ProblemTypeID"]);
- cbSolvedAdmin.SelectedValue = Convert.ToInt32(DataRowProblem["ID"]);
- cbSolvedAdmin.SelectedValue = Convert.ToInt32(DataRowProblem["ResponsibleID"]);
- //cbProblemStatus.Text = "Done";
- //tbChat.Text = DataRowProblem["Chat"].ToString();
- model.LoadChatToRichTextBox(DataRowProblem, rtbChat);
-
- }
- private void btnTicketChange_Click(object sender, RoutedEventArgs e)
- {
- int id=Convert.ToInt32(DataRowProblem["ID"]);
- DateTime? solvedTime = dtpSolvedTime.Value;
- int problemStatusID = Convert.ToInt32(cbProblemStatus.SelectedValue);
- int responsibleID = Convert.ToInt32(cbSolvedAdmin.SelectedValue);
- string problemSolvedDescribe=tbComment.Text.Trim();
- DataRowProblem["ProblemStatusID"] = problemStatusID;
- DataRowProblem["ResponsibleID"] = responsibleID;
- DataRowProblem["ProblemSolvedDescribe"]=problemSolvedDescribe;
- model.ProblemAdminUpdate(id, solvedTime, problemStatusID, responsibleID, problemSolvedDescribe);
- model.RefillProblems();
- //AdminTicketWindow adminTicketWindow = new AdminTicketWindow(user);
- //adminTicketWindow.Show();
- this.Close();
- //DataRowProblem["SolvedTime"]
- }
- }
- }
|