private void leaveManagementSubMenuItemSelect(object sender, RoutedEventArgs e) { switch ((sender as MenuItem).Tag.ToString()) { case "0": Leave_Application leaveApplication = new Leave_Application(this); leaveApplication.Owner = this; leaveApplication.Show(); break; case "1": Leave_Cancellation leaveCancellation = new Leave_Cancellation(this); leaveCancellation.Owner = this; leaveCancellation.Show(); break; case "2": Negative_Leave_Form negativeLeaveForm = new Negative_Leave_Form(this); negativeLeaveForm.Owner = this; negativeLeaveForm.Show(); break; case "3": break; case "4": Add_Leave addLeave = new Add_Leave(this); addLeave.Owner = this; addLeave.Show(); break; case "5": Leave_Adjust leaveAdjust = new Leave_Adjust(this); leaveAdjust.Owner = this; leaveAdjust.Show(); break; } }
protected void BtnSave_Click(object sender, EventArgs e) { try { if (ddlEmployee.SelectedValue == "") { // ddlEmployee.Focus(); return; } if (TxtDate.Text.Length == 0) { //TxtDate.Focus(); return; } if (TxtFromDate.Text.Length == 0) { // TxtFromDate.Focus(); return; } if (TxtToDate.Text.Length == 0) { //TxtToDate.Focus(); return; } if (TxtReason.Text.Length == 0) { //TxtReason.Focus(); return; } if (HidFldId.Value.Length == 0) { Leave_Application LI = new Leave_Application(); LI.EmpId = int.Parse(ddlEmployee.SelectedValue); LI.Application_Date = ValueConvert.ToDate(TxtDate.Text.ToString()); LI.FromDate = ValueConvert.ToDate(TxtFromDate.Text.ToString()); LI.ToDate = ValueConvert.ToDate(TxtToDate.Text.ToString()); LI.TotalDays = int.Parse(TxtTotDays.Text); LI.LeaveType = DDLLeaveType.SelectedValue; LI.Reason = TxtReason.Text; LI.LeaveStatus = DDLStatus.SelectedValue; LI.Remark = TxtRemark.Text; LI.UPDFLAG = 0; LI.Entry_Date = DateTime.Today.Date; LI.Entry_Time = DateTime.Parse(DateTime.Now.TimeOfDay.ToString()); LI.Entry_UID = HidFldUID.Value.ToString(); HRMLinQ.Leave_Applications.InsertOnSubmit(LI); HRMLinQ.SubmitChanges(); LblMsg.Text = "Entry insert successfully..."; } else { int IntId = int.Parse(HidFldId.Value.ToString()); //Get Single record which need to update Leave_Application LI = HRMLinQ.Leave_Applications.Single(Leave => Leave.Id == IntId); LI.EmpId = int.Parse(ddlEmployee.SelectedValue); LI.Application_Date = ValueConvert.ToDate(TxtDate.Text.ToString()); LI.FromDate = ValueConvert.ToDate(TxtFromDate.Text.ToString()); LI.ToDate = ValueConvert.ToDate(TxtToDate.Text.ToString()); LI.TotalDays = int.Parse(TxtTotDays.Text); LI.LeaveType = DDLLeaveType.SelectedValue; LI.Reason = TxtReason.Text; LI.LeaveStatus = DDLStatus.SelectedValue; LI.Remark = TxtRemark.Text; int updflg = int.Parse(LI.UPDFLAG.ToString()) + 1; LI.UPDFLAG = byte.Parse(updflg.ToString()); LI.MEntry_Date = DateTime.Today.Date; LI.MEntry_Time = DateTime.Parse(DateTime.Today.TimeOfDay.ToString()); LI.MEntry_UID = HidFldUID.Value.ToString(); HRMLinQ.SubmitChanges(); LblMsg.Text = "Entry update successfully..."; } FillGrid(); ClearAll(); MyMenu.Items[0].Selected = true; MyMenu.Items[0].ImageUrl = "~/Images/ViewEnable.jpg"; MyMenu.Items[1].ImageUrl = "~/Images/NewOrEditDisable.jpg"; MyMultiView.ActiveViewIndex = 0; } catch //(Exception ex) { Response.Redirect("~/ErrorPage.aspx"); } }