-
Notifications
You must be signed in to change notification settings - Fork 0
/
NewCustomerForm.cs
120 lines (103 loc) · 3.3 KB
/
NewCustomerForm.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using TCPOS.FrontEnd.UserInterface.Interfaces;
using TCPOS.FrontEnd.BusinessLogic;
using TCPOS.FrontEnd.UserInterface;
using TCPOS.FrontEnd.DataClasses;
using TCPOS.Debug;
namespace Plugin.BES.FrontEnd.FacturacionElectronica
{
public partial class NewCustomerForm : Form, IObjectResult
{
private BLogic BL;
//private DbCustomer customer;
private string cardNum;
public NewCustomerForm()
{
InitializeComponent();
}
public void SetupForm(BLogic BL, string cardNum)
{
this.BL = BL;
this.cardNum = cardNum;
UserInterfaceHelper.CenterWindow(this);
UserInterfaceHelper.VisibleForms.Add(this);
}
public bool AcceptObject(object o)
{
throw new NotImplementedException();
}
public object ObjectResult
{
get
{
throw new NotImplementedException();
}
set
{
throw new NotImplementedException();
}
}
private void NewCustomerForm_Load(object sender, EventArgs e)
{
}
private void btnCancelar_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
UserInterfaceHelper.VisibleForms.Remove(this);
}
private void btnAceptar_Click(object sender, EventArgs e)
{
try
{
if (ingresoCliente())
{
this.DialogResult = DialogResult.OK;
UserInterfaceHelper.VisibleForms.Remove(this);
}
else
{
this.DialogResult = DialogResult.Cancel;
UserInterfaceHelper.VisibleForms.Remove(this);
}
}
catch (Exception ex)
{
Trace.LogException(ex);
}
}
public bool ingresoCliente()
{
DbCustomer customer = new DbCustomer();
customer.CardNum = cardNum;
customer.Description = txtRazonSocial.Text;
customer.Street = txtDireccion.Text;
customer.Notes1 = txtComuna.Text;
customer.City = txtCiudad.Text;
customer.Notes2 = txtDirecPostal.Text;
customer.Notes3 = txtComPostal.Text;
customer.Notes4 = txtCiudadPostal.Text;
customer.Type = DbCustomer.Types.Identification;
customer.VisibilityCriteriaID = 1;
customer.PrepayPaymentID = 4;
customer.PrepayPricelevelID = 1;
customer.CreditPaymentID = 4;
customer.CreditPricelevelID = 1;
customer.IdentificationPricelevelID = 1;
customer["passwd"] = "*";
BL.DB.InsertCustomer(customer);
if (BL.AddCustomer(null, customer.CardNum, true) == BLogic.AddCustomerResult.Ok)
{
BL.RefreshTransactionItems();
return true;
}
return false;
}
}
}