182 lines
5.5 KiB
C#
182 lines
5.5 KiB
C#
using System;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Windows;
|
|
using System.Windows.Controls.Primitives;
|
|
using System.Windows.Documents;
|
|
using System.Windows.Forms;
|
|
using System.Windows.Forms.VisualStyles;
|
|
using System.Windows.Input;
|
|
using System.Windows.Media;
|
|
using System.Windows.Navigation;
|
|
using System.Windows.Threading;
|
|
|
|
using BeWo.Core;
|
|
using BeWo.Core.Service;
|
|
using BeWo.ViewModel;
|
|
using BeWo.ServiceProxy;
|
|
using BeWo.View.Detail;
|
|
using BS.Shared.DataContracts;
|
|
using BS.Shared.Extensions;
|
|
using BS.Shared;
|
|
using BS.Shared.Core;
|
|
|
|
using Microsoft.Win32;
|
|
using CheckBox = System.Windows.Controls.CheckBox;
|
|
using MessageBox = System.Windows.MessageBox;
|
|
|
|
namespace BeWo.View
|
|
{
|
|
public partial class ChatServiceCustomer
|
|
{
|
|
|
|
private CustomerVM _ViewModel;
|
|
|
|
// TableID tableid;
|
|
long? customerOid;
|
|
|
|
public ChatServiceCustomer(TableID pObjectTid, long? oid)
|
|
{
|
|
InitializeComponent();
|
|
|
|
customerOid = oid;
|
|
// tableid = pObjectTid;
|
|
|
|
LaodInfostoView();
|
|
|
|
}
|
|
|
|
|
|
public CustomerVM PublicViewModel { get { return _ViewModel; } }
|
|
|
|
|
|
|
|
|
|
public override bool IsDirty
|
|
{
|
|
get
|
|
{
|
|
return ViewModel != null && ViewModel.IsDirty;
|
|
}
|
|
}
|
|
|
|
private CustomerVM ViewModel
|
|
{
|
|
get { return _ViewModel; }
|
|
|
|
set
|
|
{
|
|
DataContext = value;
|
|
_ViewModel = value;
|
|
}
|
|
}
|
|
|
|
//TODO Speicher Button Aktivieren
|
|
|
|
/* private bool DoSaveCheck()
|
|
{
|
|
Cache.GetInstance().GetActiveSupportConceptCostbearer(scList =>
|
|
VMFactory.CreateServiceRecordVMAsync(
|
|
BeWoApp.LoggedOnUser.Employee.EmployeeOid,
|
|
vm => this.Dispatch(
|
|
delegate
|
|
{
|
|
ChatServiceCustomer newView = new ChatServiceCustomer(tableid, customerOid);
|
|
|
|
if (newView.CommandBindings.Count == 0)
|
|
{
|
|
newView.CommandBindings.Add(
|
|
new CommandBinding(
|
|
ApplicationCommands.Close,
|
|
(s, e) =>
|
|
{
|
|
if (!newView.DoSaveCheck())
|
|
{
|
|
return;
|
|
}
|
|
|
|
}));
|
|
newView.CommandBindings.Add(
|
|
new CommandBinding(
|
|
ApplicationCommands.Save,
|
|
(s, e) =>
|
|
{
|
|
bool save = true;
|
|
|
|
if (!save)
|
|
{
|
|
return;
|
|
}
|
|
|
|
newView.SaveData();
|
|
|
|
}));
|
|
}
|
|
})));
|
|
|
|
}
|
|
*/
|
|
|
|
|
|
|
|
private void GenerateCodeClick(object sender, RoutedEventArgs e)
|
|
{
|
|
if (!GeneratetTexfield.Text.Equals(""))
|
|
{
|
|
if (MessageBox.Show("Wollen sie wirklich ihren Code ändern?", "Achtung", MessageBoxButton.YesNo,
|
|
MessageBoxImage.Question) == MessageBoxResult.Yes)
|
|
{
|
|
var result =
|
|
ServiceFacade.DoOperationsServiceSync(s => s.CreateNewCustomerAPPCodeDC(customerOid.Value));
|
|
|
|
GeneratetTexfield.Text = result.CustomerCode;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
var result = ServiceFacade.DoOperationsServiceSync(s => s.CreateNewCustomerAPPCodeDC(customerOid.Value));
|
|
|
|
GeneratetTexfield.Text = result.CustomerCode;
|
|
}
|
|
}
|
|
|
|
private void CheckBox_Checked(object sender, RoutedEventArgs e)
|
|
{
|
|
ServiceFacade.DoOperationsServiceSync(s => s.UpdateIsChatActiveCustomerAPPCodeDC(customerOid.Value, 1));
|
|
}
|
|
|
|
private void CheckBox_Unchecked(object sender, RoutedEventArgs e)
|
|
{
|
|
ServiceFacade.DoOperationsServiceSync(s => s.UpdateIsChatActiveCustomerAPPCodeDC(customerOid.Value, 0));
|
|
}
|
|
|
|
|
|
private void LaodInfostoView()
|
|
{
|
|
|
|
var getCustomerAppCode = ServiceFacade.DoOperationsServiceSync(s => s.GetIsChatActiveCustomerAPPCodeDC(customerOid.Value, 0));
|
|
|
|
int x ;
|
|
|
|
if (getCustomerAppCode.Count > 0)
|
|
{
|
|
x = getCustomerAppCode[getCustomerAppCode.Count - 1].IsChatAktive;
|
|
|
|
GeneratetTexfield.Text = getCustomerAppCode[getCustomerAppCode.Count - 1].CustomerCode;
|
|
}
|
|
else
|
|
x = 0;
|
|
|
|
if (x == 0)
|
|
{
|
|
ChatAktive.SetCurrentValue(CheckBox.IsCheckedProperty, false);
|
|
}
|
|
else
|
|
{
|
|
ChatAktive.SetCurrentValue(CheckBox.IsCheckedProperty, true);
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
} |