-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCreateNot.cs
97 lines (79 loc) · 2.71 KB
/
CreateNot.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
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 Vet_Clinic;
using Project1;
namespace Vet_Clinic
{
public partial class CreateNot : Form
{
private int notNum;
private Start startLoc;
public CreateNot(Start start)
{
InitializeComponent();
toDateDateTimePicker.MinDate = fromDateDateTimePicker.Value.AddDays(1);
startLoc = start;
try
{
notNum = (int)tblnotificationsTableAdapter.LastNotScalarQuery();
}
catch( Exception NoNotifications)
{
notNum = 0;
}
notNum++;
notNumLabel1.Text = notNum.ToString();
if (start.label63.Text == "לא נבחר לקוח")
{
custNumLabel1.Text = "";
}
else
{
custNumLabel1.Text = start.label63.Text;
}
if (start.label36.Text == "לא נבחרה חיה")
{
aNameLabel1.Text = "";
}
else
{
aNameLabel1.Text = start.label36.Text;
}
fromDateDateTimePicker.MinDate = DateTime.Today;
}
private void button2_Click(object sender, EventArgs e)
{
this.Close();
}
private void button1_Click(object sender, EventArgs e)
{
if (detailsTextBox.Text == "") label1.Visible = true;
else
{
vetclinicDataSet.tblnotificationsRow notRow = vetclinicDataSet.tblnotifications.NewtblnotificationsRow();
notRow.NotNum = int.Parse(notNumLabel1.Text);
notRow.fromDate = fromDateDateTimePicker.Value;
notRow.toDate = toDateDateTimePicker.Value;
if (aNameLabel1.Text == "") notRow.aName = null;
else notRow.aName = aNameLabel1.Text;
if (custNumLabel1.Text == "") notRow.custNum = 0;
else notRow.custNum = int.Parse(custNumLabel1.Text);
notRow.details = detailsTextBox.Text;
vetclinicDataSet.tblnotifications.Rows.Add(notRow);
this.tblnotificationsTableAdapter.Update(vetclinicDataSet.tblnotifications);
startLoc.GetNotifications();
this.Close();
}
}
private void fromDateDateTimePicker_ValueChanged(object sender, EventArgs e)
{
toDateDateTimePicker.MinDate = fromDateDateTimePicker.Value.AddDays(1);
}
}
}