protected void btnApply_Click(object sender, EventArgs e) { try { int holidayID =hdnHolidayID.Value==""?0:Convert.ToInt32(hdnHolidayID.Value); DateTime HolidayDt = Convert.ToDateTime(hdnHolidayDt.Value); string Holidayname =GeneralFunction.ToProper(txtHolidayName.Text.Trim()); bool IsHoliday = true; if (rdWorkingday.Checked) { IsHoliday = false; } int DeptID = 0; if (ddlPopDept.SelectedItem.Value != "0") { DeptID = Convert.ToInt32(ddlPopDept.SelectedItem.Value); } int LocationID = 0; if (ddlPopLoc.SelectedItem.Value != "0") { LocationID = Convert.ToInt32(ddlPopLoc.SelectedItem.Value); } string shiftName ="0"; if (ddlHolshift.SelectedItem.Value != "0") { shiftName = ddlHolshift.SelectedItem.Value.ToString(); } int EnterBy = Convert.ToInt32(Session["UserID"]); string timezone = ""; if (Convert.ToInt32(Session["TimeZoneID"]) == 2) { timezone = "Eastern Standard Time"; } else { timezone = "India Standard Time"; } DateTime Enterdate = TimeZoneInfo.ConvertTime(DateTime.UtcNow, TimeZoneInfo.FindSystemTimeZoneById(timezone)); String strHostName = Request.UserHostAddress.ToString(); string IpAddress = System.Net.Dns.GetHostAddresses(strHostName).GetValue(0).ToString(); EmployeeBL obj = new EmployeeBL(); if (holidayID == 0) { bool bnew = obj.SaveandGetHolidayDet(IsHoliday, HolidayDt, LocationID, DeptID, shiftName, EnterBy, Enterdate, IpAddress, Holidayname, false); } else { bool bnew = obj.UpdateHolidayDet(IsHoliday, holidayID, LocationID, DeptID, shiftName, EnterBy, Enterdate, IpAddress); } GetCalender(Convert.ToDateTime(Session["MonthHolStart"]),Convert.ToDateTime(Session["MonthHolEnd"]),Convert.ToInt32(ddlLocation.SelectedItem.Value),Convert.ToInt32(ddlShift.SelectedValue),Convert.ToInt32(ddlDepartment.SelectedValue)); mdlHoliday.Hide(); } catch (Exception ex) { } }