/
Default.aspx.cs
119 lines (106 loc) · 3.81 KB
/
Default.aspx.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
using System;
using System.Data;
using System.Data.SqlClient;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Linq;
using System.Web.Security;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections;
public partial class _Default : System.Web.UI.Page
{
//Dim Obj As Connection = New Connection
//Dim SqlPass As String
//Dim empcode As String
//'DataTable Menus = New DataTable()
//Dim Dt_EmpData As DataTable
Connection Obj = new Connection();
string SqlPass;
string empcode;
DataTable Dt_EmpData;
Hashtable HolidayList;
protected void Page_Load(object sender, EventArgs e)
{
if (Session["Empcode"].ToString() == "")
{
Response.Redirect("~/login.aspx");
}
if (!IsPostBack)
{
HolidayList = Getholiday();
Calendar1.Caption = "Calender";
Calendar1.FirstDayOfWeek = FirstDayOfWeek.Sunday;
Calendar1.NextPrevFormat = NextPrevFormat.ShortMonth;
Calendar1.TitleFormat = TitleFormat.Month;
Calendar1.ShowGridLines = true;
Calendar1.DayStyle.Height = new Unit(50);
Calendar1.DayStyle.Width = new Unit(150);
Calendar1.DayStyle.HorizontalAlign = HorizontalAlign.Center;
Calendar1.DayStyle.VerticalAlign = VerticalAlign.Middle;
Calendar1.OtherMonthDayStyle.BackColor = System.Drawing.Color.AliceBlue;
}
//BindMenu();
//else
// Response.Redirect("~/Jct_Payroll_Employee_Personal_Info.aspx");
}
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
{
//Response.Write("" + e.Day.Date.ToShortDateString());
if (HolidayList[e.Day.Date.ToShortDateString()] != null)
{
Literal literal1 = new Literal();
literal1.Text = "<br/>";
e.Cell.Controls.Add(literal1);
Label label1 = new Label();
label1.Text = (string)HolidayList[e.Day.Date.ToShortDateString()];
label1.Font.Size = new FontUnit(FontSize.Small);
e.Cell.Controls.Add(label1);
}
}
protected void Calendar1_SelectionChanged(object sender, EventArgs e)
{
LabelAction.Text = "Date changed to :" + Calendar1.SelectedDate.ToShortDateString();
}
protected void Calendar1_VisibleMonthChanged(object sender, MonthChangedEventArgs e)
{
LabelAction.Text = "Month changed to :" + e.NewDate.ToShortDateString();
}
//private void BindMenu()
//{
// Dt_EmpData = GetData("Jct_Payroll_Emp_MonthlyCalender '" + Session["EmpCode"] + "','01','2018'");
// DataView view = new DataView(Dt_EmpData);
// this.dlstEmp.DataSource = view;
// this.dlstEmp.DataBind();
//}
//private DataTable GetData(string query)
//{
// SqlConnection con = new SqlConnection(Obj.Connection().ConnectionString);
// DataTable dt = new DataTable();
// SqlCommand cmd = new SqlCommand(query);
// SqlDataAdapter sda = new SqlDataAdapter();
// cmd.CommandType = CommandType.Text;
// cmd.Connection = con;
// sda.SelectCommand = cmd;
// sda.Fill(dt);
// con.Close();
// return dt;
//}
private Hashtable Getholiday()
{
Hashtable holiday = new Hashtable();
SqlCommand cmd = new SqlCommand("exec Jct_Payroll_Holiday_List_ashish '" + Session["Empcode"].ToString() + "'", Obj.Connection());
SqlDataReader dr;
dr = cmd.ExecuteReader();
while (dr.Read())
{
holiday[dr["Date"]] =dr["Ocassion"].ToString();
}
dr.Close();
return holiday;
}
}