-
Notifications
You must be signed in to change notification settings - Fork 1
/
updatePaymode.cs
147 lines (133 loc) · 4.21 KB
/
updatePaymode.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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using MundoMusical.CUSTOM_CONTROLS;
namespace MundoMusical.PAYMODE
{
public partial class updatePaymode : addPayMode
{
public updatePaymode()
{
InitializeComponent();
this.Text = "Actualizar Modo De Pago";
this.txtname.KeyPress += (sender, args) =>
{
if (this.txtname.Text.Trim() != "" && args.KeyChar == (char)Keys.Enter)
{
this.check();
}
};
behaviorDefinitions.txtUPPER(this.txtname);
}
public updatePaymode(Central2 central)
{
InitializeComponent();
this.central = central;
this.Text = "Actualizar Modo De Pago";
this.txtname.KeyPress += (sender, args) =>
{
if (this.txtname.Text.Trim() != "" && args.KeyChar == (char)Keys.Enter)
{
this.check();
}
};
behaviorDefinitions.txtUPPER(this.txtname);
this.stopBounds();
this.FormClosed += (sender, args) => { this.onclosed(); };
}
protected override void oncancel()
{
this.initvals();
}
protected override void onaccept()
{
if(this.txtnombre.Text == "" || this.rtb.Text == "")
{
genericDefinitions.error("Llene todos los campos", "Error");
}
else if(this.txtnombre.Text == this.modo.nombre)
{
this.modo.otros_detalles = this.rtb.Text;
this.update();
}
else if(this.db.existmodopago(this.txtnombre.Text))
{
genericDefinitions.error("Este modo de pago ya existe!", "Error");
this.txtnombre.Focus();
}
else
{
this.modo.nombre = this.txtnombre.Text;
this.modo.otros_detalles = this.rtb.Text;
this.update();
}
}
private void update()
{
if (this.db.updatemodopago(this.modo))
{
genericDefinitions.ok("Listo", "Echo");
this.initvals();
}
else
{
this.txtnombre.Focus();
}
}
protected override void onclosed()
{
this.central.updpay = null;
}
private void updatePaymode_Load(object sender, EventArgs e)
{
this.initvals();
}
protected void initvals()
{
this.Size = new Size(502,312);
this.panel.Parent = this;
this.panel.Visible = true;
this.gb.Visible = false;
this.ActiveControl = this.txtname;
this.txtname.Text = null;
}
protected void secondvals()
{
this.Size = new Size(502, 467);
this.panel.Visible = false;
this.gb.Visible = true;
this.txtnombre.Focus();
this.filldata();
}
protected void filldata()
{
this.txtnombre.Text = this.modo.nombre;
this.rtb.Text = this.modo.otros_detalles;
}
protected void check()
{
if (this.db.existmodopago(this.txtname.Text))
{
this.modo = this.db.getmodopago(this.txtname.Text);
this.secondvals();
}
else
{
genericDefinitions.error("No existe modo de pago", "Error");
this.txtname.Text = null;
this.txtname.Focus();
}
}
private void btnclear_Click(object sender, EventArgs e)
{
this.txtname.Text = null;
this.txtname.Focus();
}
}
}