private void cloudDesktopButton2_Click(object sender, EventArgs e) { //obj.Show(); Leave leave; leave = new Leave(); leave.Show(); }
protected void btnrequestleave_Click(object sender, EventArgs e) { DBFunctions db = new DBFunctions(); int empid=7; DateTime from=DateTime.Parse(dropdownfromyear.SelectedValue+"-"+dropdownfrommonth.SelectedValue+"-"+dropdownfromday.SelectedValue); DateTime to=DateTime.Parse(dropdownyears.SelectedValue+"-"+dropdownMonth.SelectedValue+"-"+dropdownDay.SelectedValue); Leave leave = new Leave { EmployeeID = empid, LeaveType = LeaveType.SelectedValue, Reason = Reason.Text, FromDate = from, ToDate = to,Status=0 }; db.sendleaverequest(leave); }
static void Main(string[] args) { var e1 = new Employee("Ionescu", "Andrei", new DateTime(1994,5,12), new DateTime(2009,11,2), 2360.00, 30); e1.DisplayInfo(); var l5 = new Leave(new DateTime(2016, 12, 20), 15, LeaveTypeEnum.Medical); //adaugam 3 concedii e1.AddNewLeave(new Leave(new DateTime(2016, 07, 15), 12, LeaveTypeEnum.Holiday)); e1.AddNewLeave(new Leave(new DateTime(2016, 08, 05), 17, LeaveTypeEnum.Holiday)); e1.AddNewLeave(new Leave(new DateTime(2015, 09, 20), 7, LeaveTypeEnum.Medical)); //afisam lista de concedii Console.WriteLine("\nLista dupa introducerea primelor 3 concedii:"); foreach (var item in e1.LeaveList) { Console.WriteLine(item); } Console.WriteLine(); e1.DisplayInfo(); //introducem al 4 lea concediu e1.AddNewLeave(new Leave(new DateTime(2016, 12, 31), 15, LeaveTypeEnum.Medical)); //afisam lista de concedii Console.WriteLine("\nLista dupa introducerea primelor 4 concedii:"); foreach (var item in e1.LeaveList) { Console.WriteLine(item); } Console.WriteLine(); // Concediul se suprapune cu altul (apare mesaj de eroare) //e1.AddNewLeave(new Leave(new DateTime(2016, 12, 20), 15, LeaveTypeEnum.Medical)); //arunca exceptia NegativeLeaveException //e1.AddNewLeave(new Leave(new DateTime(2016, 02, 03), 4, LeaveTypeEnum.Medical)); Console.WriteLine(); e1.DisplayInfo(); Console.WriteLine("\nConcediile din anul 2016 sunt: "); e1.DisplayLeaves(2016); Console.ReadKey(); }
private void InitializeBackingControl(Control textBox) { textBox.AllowDrop = true; textBox.DragEnter += SETextBox_DragEnter; textBox.DragDrop += SETextBox_DragDrop; textBox.GotFocus += (sender, args) => { _gotFocusTicks = DateTime.UtcNow.Ticks; }; textBox.MouseDown += SETextBox_MouseDown; textBox.MouseUp += SETextBox_MouseUp; textBox.TextChanged += TextChangedHighlight; Controls.Add(textBox); textBox.Dock = DockStyle.Fill; textBox.Enter += (sender, args) => { BackColor = SystemColors.Highlight; }; textBox.Leave += (sender, args) => { BackColor = SystemColors.WindowFrame; }; textBox.TextChanged += (sender, args) => { TextChanged?.Invoke(sender, args); }; textBox.KeyDown += (sender, args) => { KeyDown?.Invoke(sender, args); }; textBox.MouseClick += (sender, args) => { MouseClick?.Invoke(sender, args); }; textBox.Enter += (sender, args) => { Enter?.Invoke(sender, args); }; textBox.KeyUp += (sender, args) => { KeyUp?.Invoke(sender, args); }; textBox.Leave += (sender, args) => { Leave?.Invoke(sender, args); }; textBox.MouseMove += (sender, args) => { MouseMove?.Invoke(sender, args); }; }
// GET: Leaves/Edit/5 public async Task <ActionResult> Edit(decimal id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Leave leave = await db.Leaves.FindAsync(id); if (leave == null) { return(HttpNotFound()); } if (!(leave.IsAccepted1 == null || leave.IsAccepted2 == null)) { return(RedirectToAction("Index")); } List <AspNetUser> Seniors = GetSeniorStaff(); ViewBag.LineManagers = new SelectList(Seniors, "Id", "UserName"); ViewBag.UserName = User.Identity.Name;//"LoggedIn User"; //ViewBag.LeaveTypeId = new SelectList(db.LeaveTypes, "Id", "Name", leave.LeaveTypeId); string userId = User.Identity.GetUserId(); int policyId = db.AspNetUsers.FirstOrDefault(x => x.Id == userId).UserLeavePolicyId.GetValueOrDefault(); //List<UserLeavePolicyDetail> customLeaveTypes = db.UserLeavePolicyDetails.Where(x => x.UserLeavePolicyId == policyId).ToList<UserLeavePolicyDetail>(); //ViewBag.LeaveTypeId = new SelectList(customLeaveTypes, "Id", "Name"); ViewBag.LeaveTypeId = new SelectList(db.LeaveTypes.Where(x => x.UserLeavePolicyDetails.Any(y => y.UserLeavePolicyId == policyId) || x.Id == Consts.CompensatoryLeaveTypeId), "Id", "Name"); if (policyId > 0) { ViewBag.UserLeavePolicyId = policyId; } else { ViewBag.PolicyAlert = "No Policy is implemented for your account, Contact Admin"; } //ViewBag.UserLeavePolicyId = new SelectList(db.UserLeavePolicies, "Id", "UserId", leave.UserLeavePolicyId); return(View(leave)); }
public async Task <ActionResult> EditCompensatoryQuotaRequest([Bind(Include = "Id,UserId,LeaveTypeId,Reason,StartDate,EndDate,TotalDays,EmergencyContact,ResponseDate1,ResponseDate2,IsAccepted1,IsAccepted2,LineManager1Id,LineManager2Id,Remarks1,Remarks2,DateCreated,DateModified,UserLeavePolicyId")] Leave leave, decimal LastLeaveDaysCount) { leave.UserId = User.Identity.GetUserId(); leave.AspNetUser = db.AspNetUsers.FirstOrDefault(x => x.Id == leave.UserId); leave.DateModified = DateTime.Now; leave.IsQuotaRequest = true; if (ModelState.IsValid) { db.Entry(leave).State = EntityState.Modified; /////////////// LeaveBalance leaveBalance = CalculateLeaveBalanceQuota(ref leave); if (leaveBalance == null) { //new //leaveBalance = new LeaveBalance(ref leave); //leaveBalance.Taken = leave.TotalDays; //leaveBalance.Balance -= leave.TotalDays; //leaveBalance.UserId = leave.UserId; //leaveBalance.LeaveTypeId = leave.LeaveTypeId; //leaveBalance.UserLeavePolicyId = leave.AspNetUser.UserLeavePolicyId; //db.LeaveBalances.Add(leaveBalance); } else { //first reseting Balance to its correct state leaveBalance.Balance -= LastLeaveDaysCount;//leave.TotalDays; leaveBalance.Balance += leave.TotalDays; db.Entry(leaveBalance).State = EntityState.Modified; } /////////////// await db.SaveChangesAsync(); return(RedirectToAction("QuotaRequestHistory")); } ViewBag.LeaveTypeId = new SelectList(db.LeaveTypes, "Id", "Name", leave.LeaveTypeId); //ViewBag.UserLeavePolicyId = new SelectList(db.UserLeavePolicies, "Id", "UserId", leave.UserLeavePolicyId); return(View(leave)); }
// GET: Leaves/Edit/5 public async Task <ActionResult> Edit(decimal id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Leave leave = await db.Leaves.FindAsync(id); if (leave == null) { return(HttpNotFound()); } if (User.Identity.GetUserId() != leave.LineManager1Id || User.Identity.GetUserId() != leave.LineManager2Id) { return(RedirectToAction("Index")); } //ViewBag.LineManager1 = db.AspNetUsers.FirstOrDefault(x => x.Id == leave.LineManager1Id).UserName; //ViewBag.LineManager2 = db.AspNetUsers.FirstOrDefault(x => x.Id == leave.LineManager2Id).UserName; List <AspNetUser> Seniors = GetSeniorStaff(); bool IsLineManager1 = false; if (User.Identity.GetUserId() == leave.LineManager1Id) { IsLineManager1 = true; } else { IsLineManager1 = false; } ViewBag.IsLineManager1 = IsLineManager1; ViewBag.LineManagers = new SelectList(Seniors, "Id", "UserName"); ViewBag.LeaveTypeId = new SelectList(db.LeaveTypes, "Id", "Name", leave.LeaveTypeId); ViewBag.ApplicantName = db.AspNetUsers.FirstOrDefault(x => x.Id == leave.UserId).UserName; //ViewBag.UserLeavePolicyId = new SelectList(db.UserLeavePolicies, "Id", "UserId", leave.UserLeavePolicyId); ViewBag.UserLeavePolicyId = leave.AspNetUser.UserLeavePolicy.Id; ViewBag.LeaveUserId = leave.AspNetUser.Id; return(View(leave)); }
public List <Leave> GetAll() { List <Leave> leaves = new List <Leave>(); try { using (var sqlconnection = new SqlConnection(ConfigurationManager.ConnectionStrings["InstCon"].ConnectionString)) { int id = 0; sqlconnection.Open(); SqlCommand cmd = new SqlCommand("GetLeaves", sqlconnection); cmd.Parameters.Add(new SqlParameter("@LeaveID", id)); cmd.CommandType = CommandType.StoredProcedure; SqlDataReader sdr = cmd.ExecuteReader(); if (sdr.HasRows) { while (sdr.Read()) { var leave = new Leave(); leave.LoginID = Convert.ToInt32(sdr["Department_Name"]); leave.LeaveTypeID = Convert.ToInt32(sdr["LeaveTypeID"]); leave.Reason = sdr["Reason"].ToString(); leave.DateFrom = Convert.ToDateTime(sdr["DateFrom"]); leave.DateTo = Convert.ToDateTime(sdr["DateTo"]); leave.IsApproved = Convert.ToBoolean(sdr["IsApproved"]); leaves.Add(leave); //department.DepartmentStartDate = Convert.ToDateTime(sdr["DepartmentStartDate"]); //department.StudentCapacity = Convert.ToInt32(sdr["StudentCapacity"]); //department.DepartmentDetail = sdr["DepartmentDetail"].ToString(); } } sqlconnection.Close(); } } catch (Exception ex) { ex.Message.ToString(); } return(leaves); }
private void btnCancel_Click(object sender, RoutedEventArgs e) { try { db = new LetranIntegratedSystemEntities(); var x = ((OnProcessList)dgOnProcess.SelectedItem); Leave leaveapp = db.Leaves.Find(x.LeaveID); if (leaveapp != null) { // DISAPPROVED PART //leaveapp.LeaveApprovedStatusID = 4; //leaveapp.CancellationDate = DateTime.Now; // LEAVE DEDUCTION //if (leaveapp.LeaveTypeID == 5) //{ // var empid = db.Employees.Where(m => m.EmployeeNo == x.EmployeeNo).FirstOrDefault(); // HRiS.Model.LeaveBalance leavebal = db.LeaveBalances.Where(m => m.EmployeeID == empid.EmployeeID).FirstOrDefault(); // leavebal.VacationLeaveBalance = leavebal.VacationLeaveBalance - x.Days; //} db.SaveChanges(); MessageBox.Show("Leave Cancelled", "System Success!", MessageBoxButton.OK, MessageBoxImage.Information); GetLeave(); } else { MessageBox.Show("Cannot find leave transaction.", "System Warning", MessageBoxButton.OK, MessageBoxImage.Warning); } } catch (Exception) { MessageBox.Show("Something went wrong.", "System Error!", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void btnSubmit_Click(object sender, EventArgs e) { Leave l = new Leave(); l.empid = Global.CURRENT_USER.empid; l.reason = txtreason.Text; l.noofdays = Convert.ToDecimal(txtnoofdays.Text); l.leavedate = dtleavedate.Value; l.leavetype = cboleavetype.Text; l.datefiled = dtdatefiled.Value; l.status_ = "AWAITING_APPROVAL"; l.approvedby = ""; if (l.save()) { MessageBox.Show("Successful"); } else { MessageBox.Show("There was a problem saving leave :\n" + db.err.Message); } }
private void ODDatePicker_Leave(object sender, EventArgs e) { if (calendar.Focused) //Still using the calendar. { this.Focus(); //Spoof that we never left return; } if (HideCalendarOnLeave) { if (calendar.Visible) { HideCalendar(); if (_isParentChange) //Parent was not an ODForm, set back to original location and parent. { calendar.Location = _locationOrigCalendar; calendar.Parent = this; } CalendarClosed?.Invoke(this, new EventArgs()); } } Leave?.Invoke(sender, e); }
/// <summary> /// 申请请假 /// </summary> /// <param name="leave"></param> /// <param name="user"></param> /// <returns></returns> public ReturnViewModel <bool> AddLeave(LeaveViewModel leave, NewUser user) { try { DateTime LeaveStartTime = Convert.ToDateTime(leave.LeaveTimeSpan.First()); DateTime LeaveEndTime = Convert.ToDateTime(leave.LeaveTimeSpan.Last()); TimeSpan days = LeaveEndTime - LeaveStartTime; Leave aleave = new Leave { UserId = user.Id, RealName = user.RealName, DepartmentId = user.DepartmentId, LeaveStartTime = LeaveStartTime, LeaveEndTime = LeaveEndTime, LeaveReason = leave.LeaveReason, LeaveTime = leave.LeaveTime, LeaveHalfDay = leave.LeaveHalfDay, LeaveState = 3, LeaveDays = days.Days }; db.Leave.Add(aleave); db.SaveChanges(); } catch (Exception) { return(new ReturnViewModel <bool> { code = (int)codes.ApplyLeaveError, data = false, message = "申请失败,请检查是否填写正确" }); } return(new ReturnViewModel <bool> { code = (int)codes.Success, data = true, message = "申请成功" }); }
public IActionResult Put(int id, LeaveUpdateViewModels model) { var repo = this.Storage.GetRepository <ILeavesRepository>(); Leave leave = repo.WithKey(id); if (leave == null) { return(this.NotFound(new { success = false })); } if (this.ModelState.IsValid) { model.ToEntity(leave); repo.Edit(leave, GetCurrentUserName()); this.Storage.Save(); return(Ok(new { success = true })); } return(BadRequest(new { success = false })); }
private void CreateLeaves() { var user1 = (LeaveNotifierUser)_context.Users.First(user => user.UserName == "user1"); var firstLeave = new Leave() { DateCreated = DateTime.UtcNow, Justification = "first sample leave", Means = Means.EMAIL, Status = Status.UNFILED, User = user1, From = DateTime.Today.AddDays(-2), To = DateTime.Today.AddDays(3) }; var user2 = (LeaveNotifierUser)_context.Users.First(user => user.UserName == "user2"); var secondLeave = new Leave() { DateCreated = DateTime.UtcNow, Justification = "second sample leave", Means = Means.EMAIL, Status = Status.UNFILED, User = user2, From = DateTime.Today, To = DateTime.Today.AddDays(2) }; var thirdLeave = new Leave() { DateCreated = DateTime.UtcNow, Justification = "third sample leave", Means = Means.SMS, Status = Status.FILED, User = user1, From = DateTime.Today.AddDays(4), To = DateTime.Today.AddDays(4).AddHours(5) }; _context.Leaves.AddRange(firstLeave, secondLeave, thirdLeave); }
public IActionResult Create(LeaveViewModel model) { if (!ModelState.IsValid) { return(View(model)); } //context.Add(model); //context.SaveChanges(); var emp = context.Employees.Include("Leaves") .Where(e => e.Name.Equals(model.EmployeeName)) .FirstOrDefault(); Debug.WriteLine("emppp" + emp.Age); Leave leave = new Leave() { StartDate = model.StartDate, EndDate = model.EndDate, ApprovalStatus = model.ApprovalStatus }; emp.Leaves.Add(leave); context.SaveChanges(); return(RedirectToAction("index")); }
public IHttpActionResult PostLeave(string id, Leave leave) { //leave.Employee_ID = DBOperations.GetEmployeeID(id); leave.Submit_Date = DateTime.Now; if (!ModelState.IsValid) { return(BadRequest(ModelState)); } string message = " "; message = DBOperations.CheckLeaveexist(leave); if (message == "Leave Applied Successfully") { return(Ok("Leave Applied Successfully")); } else { return(Ok("Leave Not Applied Successfully")); } }
/// <summary> /// Returns true iff exit1 and exit2 are both exit instructions /// (branch or leave) and both represent the same exit. /// </summary> internal static bool CompatibleExitInstruction(ILInstruction exit1, ILInstruction exit2) { if (exit1 == null || exit2 == null || exit1.OpCode != exit2.OpCode) { return(false); } switch (exit1.OpCode) { case OpCode.Branch: Branch br1 = (Branch)exit1; Branch br2 = (Branch)exit2; return(br1.TargetBlock == br2.TargetBlock); case OpCode.Leave: Leave leave1 = (Leave)exit1; Leave leave2 = (Leave)exit2; return(leave1.TargetContainer == leave2.TargetContainer && leave1.Value.MatchNop() && leave2.Value.MatchNop()); default: return(false); } }
public ActionResult Index(Leave leave) { ViewBag.Categories = GetCategories(); // Validate date. if (leave.StartDate > leave.EndDate) { ModelState.AddModelError("DateError", "Start date cannot be greater than End date."); } else { // Validate duration. var totalDays = leave.EndDate.Subtract(leave.StartDate).Days + 1; if (leave.Duration > totalDays) { ModelState.AddModelError("DurationError", "Duration cannot be greater than the number of days in selected date range."); } } leave.Status = LeaveStatuses.Pending; if (ModelState.IsValid) { try { var upc = new LeaveProcessComponent(); leave = upc.Apply(leave); _clients.All.LeaveApplied(leave); } catch (ApplicationException ex) { ModelState.AddModelError(string.Empty, ex.Message); } } return(View(leave)); }
private void btnCancel_Click(object sender, RoutedEventArgs e) { try { db = new LetranIntegratedSystemEntities(); var x = ((DisapprovedList)dgDisapproved.SelectedItem); Leave leaveapp = db.Leaves.Find(x.LeaveID); var empid = db.Employees.Where(m => m.EmployeeNo == x.EmployeeNo).FirstOrDefault(); // HRiS.Model.LeaveBalance leavebal = db.LeaveBalances.Where(m => m.EmployeeID == empid.EmployeeID).FirstOrDefault(); if (leaveapp != null) { //if cancelled already //if(leaveapp.LeaveApprovedStatusID == 4 || leaveapp.LeaveApprovedStatusID == 5) //{ // MessageBox.Show("Leave already cancelled.","System Warning!",MessageBoxButton.OK,MessageBoxImage.Warning); // GetLeave(); // return; //} //leaveapp.LeaveApprovedStatusID = 4; //leaveapp.CancellationDate = DateTime.Now; db.SaveChanges(); MessageBox.Show("Leave Cancelled", "System Success!", MessageBoxButton.OK, MessageBoxImage.Information); GetLeave(); } else { MessageBox.Show("Cannot find leave transaction.", "System Warning", MessageBoxButton.OK, MessageBoxImage.Warning); } } catch (Exception) { MessageBox.Show("Something went wrong.", "System Error!", MessageBoxButton.OK, MessageBoxImage.Error); } }
public ActionResult AcceptLeave(int id = 1) { Leave l = dal.GetLeave(id); Collaborator coll = dal.GetCollaborator(System.Web.HttpContext.Current.User.Identity.Name); if (l.Status == LeaveStatus.PENDING_APPROVAL_1) { foreach (Collaborator c in dal.GetCollaborators()) { if (c.Role != Roles.CHIEF && c.Service.Name.Contains("RH")) { dal.AddNotification(new Notification(l.Collaborator, c, NotificationType.LEAVE)); } } l.Status = LeaveStatus.PENDING_APPROVAL_2; //send a notification dal.AddNotification(new Notification(coll, l.Collaborator, NotificationType.LEAVE, NotificationResult.VALIDATION)); } else { l.Status = LeaveStatus.APPROVED; //switch(l.Type) //{ // case LeaveType.PAID: // l.Collaborator.NbPaid -= l.ComputeLengthLeave(); // break; // case LeaveType.RTT: // l.Collaborator.NbRTT -= l.ComputeLengthLeave(); // break; //} //send a notification dal.AddNotification(new Notification(coll, l.Collaborator, NotificationType.LEAVE, NotificationResult.VALIDATION)); } dal.SaveChanges(); return(Redirect("/Leave/ProcessList")); }
/// <summary> /// Calls the Apply operation method in the LeaveWorkflowService. /// </summary> /// <param name="leave">A leave value.</param> public Leave Apply(Leave leave) { LeaveWorkflowServiceClient proxy = new LeaveWorkflowServiceClient(); Validations.ValidateLeaveDates(leave); try { leave.CorrelationID = Guid.NewGuid(); return(proxy.Apply(leave)); } catch (FaultException fex) { // TODO: Handle your exception here or raise it to the UI. // Do not display sensitive information to the UI. throw new ApplicationException(fex.Message); } finally { proxy.Close(); } }
public ActionResult RequestForLeave(FormCollection fc) { LeaveRequestListViewModel leaveRequestListViewModel = new LeaveRequestListViewModel(); TryUpdateModel(leaveRequestListViewModel); if (ModelState.IsValid) { LeaveRequestRepository repository = new LeaveRequestRepository(); LeaveRepository leaveRepository = new LeaveRepository(); foreach (var itemViewModel in leaveRequestListViewModel.LeaveRequests) { LeaveRequest leaveRequest = repository.GetById(itemViewModel.Id); Leave leave = leaveRepository.GetById(itemViewModel.LeaveId ?? 0); if (leaveRequest == null) { //insert if (itemViewModel.TotalCount > 0 && itemViewModel.Id == 0) { leaveRequest = new LeaveRequest(leave, itemViewModel.TotalCount); repository.SaveOrUpdate(leaveRequest); } } else { //update leaveRequest.Leave = leave; leaveRequest.TotalCount = itemViewModel.TotalCount; repository.SaveOrUpdate(leaveRequest); } } return(RedirectToAction("RequestForLeave")); } return(RequestForLeave()); }
//update Leave public bool Put(int Id, Leave _Leave) { var LeaveDetail = unitOfWork.LeaveRepository.GetById(Id); if (LeaveDetail == null) { return(false); } else { if (Id != LeaveDetail.Id) { return(false); } else { LeaveDetail.StuAdmNo = string.IsNullOrEmpty(_Leave.StuAdmNo)? LeaveDetail.StuAdmNo: _Leave.StuAdmNo; LeaveDetail.Description = string.IsNullOrEmpty(_Leave.Description) ? LeaveDetail.Description : _Leave.Description; LeaveDetail.Status = _Leave.Status ?? LeaveDetail.Status; LeaveDetail.Class = _Leave.Class ?? LeaveDetail.Class; LeaveDetail.FromDate = _Leave.FromDate ?? LeaveDetail.FromDate; LeaveDetail.ToDate = _Leave.ToDate ?? LeaveDetail.ToDate; LeaveDetail.Type = _Leave.Type ?? LeaveDetail.Type; LeaveDetail.Date = _Leave.Date ?? LeaveDetail.Date; } } try { unitOfWork.LeaveRepository.Update(LeaveDetail); unitOfWork.Save(); } catch (DbUpdateConcurrencyException ex) { throw ex; } return(true); }
protected void btn_Delete_Click(object sender, EventArgs e) { string ids = hf_CheckIDS.Value.ToString(); try { ids = ids.TrimEnd(',').TrimStart(','); using (IFMPDBContext db = new IFMPDBContext()) { foreach (string id in ids.Split(',')) { int selid = Convert.ToInt32(id); Leave Leave = db.Leave.FirstOrDefault(t => t.ID == selid && t.LeaveState == LeaveState.未审核); if (Leave != null) { Leave.IsDel = true; } else { ShowMessage("删除请假失败,审核中和已审核的请假信息无法删除"); return; } } db.SaveChanges(); ShowMessage("删除成功"); new SysLogDAO().AddLog(LogType.操作日志_删除, "删除请假信息", UserID); } DataBindList(); this.hf_CheckIDS.Value = ""; } catch (Exception ex) { new SysLogDAO().AddLog(LogType.系统日志, ex.Message, UserID); return; } }
public async Task SubmitApproval(Leave leave, Approver approver) { LeaveEvent leaveEvent = null; string eventKey = string.Empty; if (leave.CurrentApprovalInfo.ApprovalType == ApprovalType.REJECT) { eventKey = DomainEventKeys.LeaveRejectedEventKey; leave.Reject(approver); leaveEvent = new LeaveEvent(LeaveEventType.REJECT_EVENT, leave); } else { if (approver == null) { eventKey = DomainEventKeys.LeaveNeedsAgreeEventKey; leave.Approve(approver); leaveEvent = new LeaveEvent(LeaveEventType.AGREE_EVENT, leave); } else { eventKey = DomainEventKeys.LeaveApprovedEventKey; leave.Finish(); leaveEvent = new LeaveEvent(LeaveEventType.APPROVED_EVENT, leave); } } leave.AddHistoryApprovalInfo(leave.CurrentApprovalInfo); _leaveRepository.Save(_leaveFactory.CreateLeavePO(leave)); _leaveRepository.SaveEvent(_leaveFactory.CreateLeaveEventPO(leaveEvent)); var successCount = await _leaveRepository.UnitOfWork.SaveChangesAsync(); if (successCount > 0) { _eventPublisher.Publish(eventKey, leaveEvent); } }
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { int row = e.RowIndex; if (e.ColumnIndex == 0 && e.RowIndex > -1)//删除按钮操作 { int leaveId = Convert.ToInt32(dataGridView1.Rows[row].Cells["编号"].Value.ToString()); var result = MessageBox.Show("删除后不可恢复,继续?", "", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (result == DialogResult.OK) { bool b = new LeaveBll().DeleteById(leaveId); if (b) { MessageBox.Show("删除成功!"); QueryAll(this.Tag.ToString()); return; } return; } } if (e.ColumnIndex == 1 && e.RowIndex > -1)//更新按钮操作 { Leave le = new Leave(); le.Id = Convert.ToInt32(dataGridView1.Rows[row].Cells["编号"].Value.ToString());; le.EmployeeId = dataGridView1.Rows[row].Cells["员工号"].Value.ToString(); le.DateTimeStart = Convert.ToDateTime(dataGridView1.Rows[row].Cells["开始时间"].Value.ToString()); le.DateTimeEnd = Convert.ToDateTime(dataGridView1.Rows[row].Cells["结束时间"].Value.ToString()); le.Duration = (float)Convert.ToDouble(dataGridView1.Rows[row].Cells["时长"].Value.ToString()); le.Status = dataGridView1.Rows[row].Cells["状态"].Value.ToString(); le.Reason = dataGridView1.Rows[row].Cells["原因"].Value.ToString(); FrmLeaveAddOrUpdate leave = new FrmLeaveAddOrUpdate(le); leave.ShowDialog(); if (leave.DialogResult == DialogResult.OK) { QueryAll(this.Tag.ToString()); } } }
public IList <usp_getLeavApprovedList_Result> GetLeaveApprovedLiat(Leave objLeave, Int32 UserID) { IList <usp_getLeavApprovedList_Result> fetchedClient = null; try { //using (var Context = new Cubicle_EntityEntities()) //{ // IQueryable<usp_getLeavApprovedList_Result> query = Context.usp_getLeavApprovedList(UserID).AsQueryable<usp_getLeavApprovedList_Result>(); // if (objLeave.LeaveID != 0) // query = query.Where(p => p.LeaveID == objLeave.LeaveID); // if (objLeave.ApprovedBY != -1) // { // if (objLeave.ApprovedBY == 1) // query = query.Where(p => p.ApprovedBy > 0); // else // query = query.Where(p => p.ApprovedBy == 0); // } // if (objLeave.FromDate != DateTime.MinValue && objLeave.ToDate != DateTime.MinValue) // query = query.Where(p => (( // (p.FromDate <= objLeave.FromDate && objLeave.FromDate <= p.ToDate) || // (p.FromDate <= objLeave.ToDate && objLeave.ToDate <= p.ToDate) || // (objLeave.FromDate <= p.FromDate && p.FromDate <= objLeave.ToDate) || // (objLeave.FromDate <= p.ToDate && p.ToDate <= objLeave.ToDate) // ))); // fetchedClient = query.ToList(); //} } catch (Exception ex) { //bool false = BusinessLogicExceptionHandler.HandleException(ref ex); if (false) { throw ex; } } return(fetchedClient); }
static void Main(string[] args) { var methods = new Menu(); methods.FirstMethod = "1"; methods.SecondMethod = "2"; methods.ThirdMethod = "3"; methods.Leave = "Leave"; methods.Choice(); var method1 = new Method1(); method1.One(); var method2 = new Method2(); method2.Two(); var method3 = new Method3(); method3.Three(); var leave = new Leave(); leave.Four(); }
public LeaveViewModel(Leave leave) { employeeID = leave.EmployeeID; name = leave.employee.Name; surname = leave.employee.Surname; localPlus = leave.employee.LocalPlus?.Description; technicalID = leave.employee.UserId; workingLocation = leave.employee.location?.Description; employeeCategory = leave.employee.standardEmployeeCategory?.Description; costCentre = leave.employee.workingCostCentre?.ID + " | " + leave.employee.workingCostCentre?.Description; familyStatus = leave.employee.familyStatus?.Description; followingPartner = leave.employee.FollowingPartner; followingChildren = leave.employee.FollowingChildren; activityStatus = leave.employee.activityStatus?.Description; leaveID = leave.LeaveID; fromDate = leave.FromDate; untilDate = leave.UntilDate; countedDays = leave.CountedDays; leaveType = leave.LeaveType; comment = leave.Comment; attachmentUrl = leave.AttachmentUrl; registeredDateTime = leave.RegisteredDataTime; }
/// <summary> /// Inserts a new leave. /// </summary> public void leaveForm_InsertItem() { var leave = new Leave(); TryUpdateModel(leave); if (ModelState.IsValid) { var upc = new LeaveController(); try { upc.Apply(leave); } catch (ApplicationException ex) { ModelState.AddModelError(string.Empty, ex.Message); return; } leaveGrid.DataBind(); } }
public ActionResult AcceptLeaveDHR(int id = 1) { Leave l = dal.GetLeave(id); l.Status = LeaveStatus.APPROVED; //switch (l.Type) //{ // case LeaveType.PAID: // l.Collaborator.NbPaid -= l.ComputeLengthLeave(); // break; // case LeaveType.RTT: // l.Collaborator.NbRTT -= l.ComputeLengthLeave(); // break; //} //send a notification Collaborator coll = dal.GetCollaborator(System.Web.HttpContext.Current.User.Identity.Name); dal.AddNotification(new Notification(coll, l.Collaborator, NotificationType.LEAVE, NotificationResult.VALIDATION)); dal.SaveChanges(); return(Redirect("/Leave/ProcessList")); }
/// <summary> /// Method to calculate the week ends and holidays count /// </summary> /// <param name="leave"></param> /// <returns>The week end count</returns> #region Private Methods private static int CheckIfWeekendsAreThere(Leave leave) { DateTime startDateVal = leave.StartDate; DateTime endDateVal = leave.EndDate; int weekendCountCheck = 0; List <string> weekendVal = new List <string>() { "saturday", "sunday" }; LeaveService leaveService = new LeaveService(); List <string> holiday = leaveService.GetHolidayList(); while (startDateVal <= endDateVal) { if (weekendVal.Contains(Enum.GetName(typeof(DayOfWeek), startDateVal.DayOfWeek).ToLower()) || holiday.Contains(startDateVal.ToString("MM/dd/yyyy"))) { weekendCountCheck += 1; } startDateVal = startDateVal.AddDays(1); } return(weekendCountCheck); }
public IHttpActionResult CreateLeave(Leave model) { if (model == null) { return(BadRequest("Model cannot be null")); } if (!ModelState.IsValid) { return(BadRequest(ModelState)); } int.TryParse(((ClaimsIdentity)User.Identity).Claims.FirstOrDefault(x => x.Type == "userid").Value, out var userId); int id = _uOWLeaves.CreateLeave(model, userId); if (id <= 0) { return(InternalServerError()); } return(Json(new { success = true, id })); }
void l1_Click(object sender, EventArgs e) { LinkLabel l1 = (LinkLabel)sender; if (l1.Tag.GetType() == typeof(KjqbService.LogInService)) { KjqbService.LogInService ll = (KjqbService.LogInService)l1.Tag; StaffLog ss = new StaffLog(); ss = (StaffLog)baseService.loadEntity(ss, ll.LogId); if (ss.State == 0) { writeLog wl = new writeLog(); wl.User = ss.Staff; wl.LogDate = new DateTime(ss.WriteTime); wl.IsComment = true; wl.CommentPersonName = this.User.KuName; wl.ShowDialog(); } else { MessageBox.Show("该篇日志作者已经删除"); } } else if (l1.Tag.GetType() == typeof(KjqbService.CommentInService)) { KjqbService.CommentInService ll = (KjqbService.CommentInService)l1.Tag; StaffLog ss = new StaffLog(); ss = (StaffLog)baseService.loadEntity(ss, ll.LogId); if (ss.State == 0) { writeLog wl = new writeLog(); wl.User = ss.Staff; wl.LogDate = new DateTime(ss.WriteTime); wl.IsComment = true; wl.CommentPersonName = this.User.KuName; wl.ShowDialog(); } else { MessageBox.Show("该篇日志作者已经删除"); } } else if (l1.Tag.GetType() == typeof(KjqbService.ScheduleInService)) { KjqbService.ScheduleInService ll = (KjqbService.ScheduleInService)l1.Tag; StaffSchedule ss = new StaffSchedule(); ss = (StaffSchedule)baseService.loadEntity(ss, ll.ScheduleId); DateTime dt = new DateTime(ss.ScheduleTime); MessageBox.Show(dt.ToString("yyyy-MM-dd HH:mm:ss") + " :" + ss.Content); } else if (l1.Tag.GetType() == typeof(KjqbService.LeaveInService)) { //KjqbService.LeaveInService ll = (KjqbService.LeaveInService)l1.Tag; //LeaveManage tt = new LeaveManage(); //tt = (LeaveManage)baseService.loadEntity(tt, ll.LeaveId); if (leaveWindow == null || leaveWindow.IsDisposed) { leaveWindow = new Leave(); leaveWindow.Leaveman = this.user; leaveWindow.Role = role; } if (!leaveWindow.Created) { leaveWindow.Show(); } else { leaveWindow.WindowState = FormWindowState.Normal; leaveWindow.Focus(); } } else if (l1.Tag.GetType() == typeof(KjqbService.BusinessService)) { if (businessManagement == null || businessManagement.IsDisposed) { businessManagement = new BusinessManagement(); } if (!businessManagement.Created) { businessManagement.User = this.User; businessManagement.Role = this.Role; businessManagement.Show(); } else { businessManagement.WindowState = FormWindowState.Normal; businessManagement.Focus(); } } }
private void qjgl_pictureBox_Click(object sender, EventArgs e) { Leave leaveForm = new Leave(); leaveForm.Show(); }
public void sendleaverequest(Leave leave) { db=new CollegeERPDBEntities(); db.Leaves.Add(leave); db.SaveChanges(); }
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) { global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); Leave ds = new Leave(); global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny(); any1.Namespace = "http://www.w3.org/2001/XMLSchema"; any1.MinOccurs = new decimal(0); any1.MaxOccurs = decimal.MaxValue; any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; sequence.Items.Add(any1); global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny(); any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1"; any2.MinOccurs = new decimal(1); any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; sequence.Items.Add(any2); global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute(); attribute1.Name = "namespace"; attribute1.FixedValue = ds.Namespace; type.Attributes.Add(attribute1); global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute(); attribute2.Name = "tableTypeName"; attribute2.FixedValue = "LeaveRegisterDataTable"; type.Attributes.Add(attribute2); type.Particle = sequence; global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); if (xs.Contains(dsSchema.TargetNamespace)) { global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); try { global::System.Xml.Schema.XmlSchema schema = null; dsSchema.Write(s1); for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) { schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); s2.SetLength(0); schema.Write(s2); if ((s1.Length == s2.Length)) { s1.Position = 0; s2.Position = 0; for (; ((s1.Position != s1.Length) && (s1.ReadByte() == s2.ReadByte())); ) { ; } if ((s1.Position == s1.Length)) { return type; } } } } finally { if ((s1 != null)) { s1.Close(); } if ((s2 != null)) { s2.Close(); } } } xs.Add(dsSchema); return type; }
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) { Leave ds = new Leave(); global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); global::System.Xml.Schema.XmlSchemaAny any = new global::System.Xml.Schema.XmlSchemaAny(); any.Namespace = ds.Namespace; sequence.Items.Add(any); type.Particle = sequence; global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); if (xs.Contains(dsSchema.TargetNamespace)) { global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); try { global::System.Xml.Schema.XmlSchema schema = null; dsSchema.Write(s1); for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) { schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); s2.SetLength(0); schema.Write(s2); if ((s1.Length == s2.Length)) { s1.Position = 0; s2.Position = 0; for (; ((s1.Position != s1.Length) && (s1.ReadByte() == s2.ReadByte())); ) { ; } if ((s1.Position == s1.Length)) { return type; } } } } finally { if ((s1 != null)) { s1.Close(); } if ((s2 != null)) { s2.Close(); } } } xs.Add(dsSchema); return type; }
public virtual int Fill(Leave.LeaveRegisterDataTable dataTable) { this.Adapter.SelectCommand = this.CommandCollection[0]; if ((this.ClearBeforeFill == true)) { dataTable.Clear(); } int returnValue = this.Adapter.Fill(dataTable); return returnValue; }
public virtual int Update(Leave dataSet) { return this.Adapter.Update(dataSet, "LeaveRegister"); }
public virtual int Update(Leave.LeaveRegisterDataTable dataTable) { return this.Adapter.Update(dataTable); }
public void AddNewLeave(DateTime startingDate, int duration, LeaveType vacation) { if (duration > availableDaysOff) { throw new NegativeLeaveDays();//lansare exceptie manuala } try { Leave newleave = new Leave(startingDate, duration, vacation); newleave.employee = this.lastName + " " + this.firstName; SubstractDays(duration); listLeave.Add(newleave);//adaugare concedii in lista de concedii } catch (NegativeLeaveDays) { Console.WriteLine("Numarul de zile ramase nu poate fi mai mare decat durata concediului!"); } }
public static Leave GetById(int Id) { DataTable dt = Database.ExecuteQuery("SELECT * FROM Leave WHERE Id = " + Id); if (dt != null && dt.Rows.Count == 1) { Leave l = new Leave(); l.Id = int.Parse(dt.Rows[0][0].ToString()); l.LeaveTypeId = int.Parse(dt.Rows[0][1].ToString()); l.ApplierId = dt.Rows[0][2].ToString(); l.ApproverId = dt.Rows[0][3].ToString(); l.FromDate = DateTime.Parse(dt.Rows[0][4].ToString()); l.FromSession = dt.Rows[0][5].ToString(); l.ToDate = DateTime.Parse(dt.Rows[0][6].ToString()); l.ToSession = dt.Rows[0][7].ToString(); l.Reason = dt.Rows[0][8].ToString(); l.PhoneNumber = dt.Rows[0][9].ToString(); l.Status = dt.Rows[0][10].ToString(); l.Comment = dt.Rows[0][11].ToString(); return l; } return null; }