-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfrmChangeEODTime.cs
101 lines (87 loc) · 3.67 KB
/
frmChangeEODTime.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
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 System.Data.SqlClient;
namespace SalesPurchase
{
public partial class frmChangeEODTime : Form
{
public frmChangeEODTime()
{
InitializeComponent();
}
SqlCommand cmd = new SqlCommand();
private void frmChangeEODTime_Load(object sender, EventArgs e)
{
try
{
cmbAMPM.Items.Add("AM");
cmbAMPM.Items.Add("PM");
string sRetVal = "";
cmd = new SqlCommand();
cmd.CommandText = "SP_MaintainDayEnd";
cmd.Connection = GlobalClass.gCon;
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@Flag", SqlDbType.VarChar, 20).Value = "GETEODTIME";
cmd.Parameters.Add("@EODDate", SqlDbType.VarChar, 20).Value = " ";
cmd.Parameters.Add("@EODTime", SqlDbType.VarChar, 20).Value = mskdboxTime.Text + ":00" + cmbAMPM.Text;
sRetVal = cmd.ExecuteScalar().ToString();
lblEODTime.Text = sRetVal;
}
catch (Exception ex)
{
MessageBox.Show("Exception in form load:"+ex.Message.ToString(), "Change Time", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
}
}
private void btnExit_Click(object sender, EventArgs e)
{
this.Close();
this.Dispose();
}
private void btnChange_Click(object sender, EventArgs e)
{
try
{ string sRetVal;
if (mskdboxTime.Text == "00:00")
{
MessageBox.Show("Please enter proper date", "Change Time", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
return;
}
if (cmbAMPM.Text == "")
{
MessageBox.Show("Please enter AM/PM date", "Change Time", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
return;
}
cmd = new SqlCommand();
cmd.CommandText = "SP_MaintainDayEnd";
cmd.Connection = GlobalClass.gCon;
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@Flag", SqlDbType.VarChar, 20).Value = "CHANGE";
cmd.Parameters.Add("@EODDate", SqlDbType.VarChar, 20).Value = " ";
cmd.Parameters.Add("@EODTime", SqlDbType.VarChar, 20).Value =mskdboxTime.Text +":00"+cmbAMPM.Text;
sRetVal = cmd.ExecuteScalar().ToString();
MessageBox.Show(sRetVal, "Change EOD Time", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
}
catch (Exception Ex)
{
GlobalClass.WriteLog("Error in btnChange_Click:" + Ex.Message.ToString());
}
}
private void mskdboxTime_TypeValidationCompleted(object sender, TypeValidationEventArgs e)
{
if (!e.IsValidInput)
{
MessageBox.Show("The Time is NOT in Valid format", "Report", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
return;
}
}
private void label3_Click(object sender, EventArgs e)
{
}
}
}