public ActionResult CreateEmployeeGroup(EmployeeGroup eg) { if (!ModelState.IsValid) { return(View("CreateEmployeeGroup", eg)); } else { HorseplayContext db = new HorseplayContext(); int tenantId = (int)Session["TenantId"]; if (db.EmployeeGroups.Any(x => x.Name == eg.Name && x.TenantId == tenantId)) { ModelState.AddModelError(string.Empty, "Grupa o takiej nazwie już istnieje. Podaj unikatową nazwę grupy"); return(View("CreateEmployeeGroup", eg)); } else { eg.addedBy = (int)Session["UserId"]; eg.dateAdded = DateTime.Now; eg.TenantId = tenantId; db.EmployeeGroups.Add(eg); db.SaveChanges(); return(RedirectToAction("GetEmployeeGroups")); } } }
public async Task <ApiResult <IEnumerable <PurchaseOrderPaymentsDto> > > GetPurchaseOrderPaymentHistory(string purchaseOrderId) { var checkPurchaseOrder = await _context.PurchaseOrders.Where(x => x.Id == purchaseOrderId).SingleOrDefaultAsync(); if (checkPurchaseOrder == null) { return(new ApiResult <IEnumerable <PurchaseOrderPaymentsDto> >(HttpStatusCode.NotFound, $"Không tìm thấy phiếu nhập hàng có mã: {purchaseOrderId}")); } var getPaymentHistories = await(from pv in _context.PaymentVouchers join pm in _context.PaymentMethods on pv.PaymentMethodId equals pm.Id join employee in _context.Employees on pv.EmployeeId equals employee.Id into EmployeeGroup from e in EmployeeGroup.DefaultIfEmpty() where pv.PurchaseOrderId == purchaseOrderId select new PurchaseOrderPaymentsDto() { Id = pv.Id, Paid = pv.Paid, EmployeeName = e.Name, PaymentDate = pv.PaymentDate, PaymentMethodName = pm.Name }).ToListAsync(); return(new ApiResult <IEnumerable <PurchaseOrderPaymentsDto> >(HttpStatusCode.OK, getPaymentHistories)); }
public async Task <ApiResult <PagedResult <SuppliersDto> > > GetSuppliersPagingAsync(int pageIndex, int pageSize) { var suppliers = await(from s in _context.Suppliers join employee in _context.Employees on s.EmployeeId equals employee.Id into EmployeeGroup from e in EmployeeGroup.DefaultIfEmpty() where s.IsDelete == false select new SuppliersDto() { Id = s.Id, Name = s.Name, Address = s.Address, EmployeeName = e.Name, PhoneNumber = s.PhoneNumber }).GetPagedAsync(pageIndex, pageSize); if (suppliers == null) { return(new ApiResult <PagedResult <SuppliersDto> >(HttpStatusCode.NoContent)); } foreach (var sup in suppliers.Results) { sup.TotalDebt = await getSupplierDebt(sup.Id); } return(new ApiResult <PagedResult <SuppliersDto> >(HttpStatusCode.OK, suppliers)); }
public async Task AcceptShiftChangeByOriginalEmployeeAsyncShouldWorkCorrectlyIfGivenProperParameters() { const string id = "Test"; // Arrange var originalEmployee = new EmployeeGroup { UserId = OriginalEmployeeId }; var shiftChange = new ShiftChange() { Id = id, ShiftId = ShiftId, OriginalEmployee = originalEmployee, PendingEmployeeId = PendingEmployeeId, Status = ShiftApplicationStatus.Pending, }; this.FakeDb.Add(shiftChange); this.shiftChangeService = new ShiftChangeService(this.GetMockedRepositoryAll()); // Act await this.shiftChangeService.AcceptShiftChangeByOriginalEmployeeAsync(OriginalEmployeeId, id, true); // Assert Assert.Contains(this.FakeDb, sc => sc.Id == id && sc.IsApprovedByOriginalEmployee == true); }
public ActionResult EditEmployeeGroup(EmployeeGroup eg) { if (!ModelState.IsValid) { return(View("EditEmployeeGroup", eg)); } else { HorseplayContext db = new HorseplayContext(); int tenantId = (int)Session["TenantId"]; int userId = (int)Session["UserId"]; if (db.EmployeeGroups.Any(x => x.Name == eg.Name && x.TenantId == tenantId && x.EmployeeGroupId != eg.EmployeeGroupId)) { ModelState.AddModelError(string.Empty, "Grupa o takiej nazwie już istnieje. Podaj unikatową nazwę grupy"); return(View("EditEmployeeGroup", eg)); } else { var oldEg = db.EmployeeGroups.FirstOrDefault(e => e.EmployeeGroupId == eg.EmployeeGroupId && e.TenantId == tenantId); if (oldEg == null) { return(new HttpNotFoundResult("Wystąpił nieoczekiwany błąd")); } else { oldEg.Name = eg.Name; oldEg.dateModified = DateTime.Now; oldEg.modifiedBy = userId; db.Entry(oldEg).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("GetEmployeeGroups")); } } } }
public async Task <ApiResult <PagedResult <GoodsDeliveryNotesDto> > > GetGoodsDeliveryNotePagingAsync(int pageIndex, int pageSize) { var goodsDeliveryNotes = await(from gdn in _context.GoodsDeliveryNotes join order in _context.Orders on gdn.OrderId equals order.Id into OrderGroup from o in OrderGroup.DefaultIfEmpty() join employee in _context.Employees on gdn.EmployeeId equals employee.Id into EmployeeGroup from e in EmployeeGroup.DefaultIfEmpty() join sa in _context.StockActions on gdn.StockActionId equals sa.Id join w in _context.Warehouses on gdn.WarehouseId equals w.Id join b in _context.Branches on w.BranchId equals b.Id orderby gdn.Id descending select new GoodsDeliveryNotesDto() { Id = gdn.Id, BranchName = b.Name, EmployeeName = e.Name, ExportDate = gdn.ExportDate, OrderId = o.Id, WarehouseName = w.Name, StockActionId = sa.Name }).GetPagedAsync(pageIndex, pageSize); return(new ApiResult <PagedResult <GoodsDeliveryNotesDto> >(HttpStatusCode.OK, goodsDeliveryNotes)); }
public async Task <ApiResult <PagedResult <AccountsDto> > > GetAccountsPagingAsync(int pageIndex, int pageSize) { var accounts = await(from au in _context.AppUsers join emp in _context.Employees on au.Id equals emp.AppuserId into EmployeeGroup from e in EmployeeGroup.DefaultIfEmpty() join cus in _context.Customers on au.Id equals cus.AppUserId into CustomerGroup from c in CustomerGroup.DefaultIfEmpty() join sup in _context.Suppliers on au.Id equals sup.AppUserId into SupplierGroup from s in SupplierGroup.DefaultIfEmpty() select new AccountsDto() { Id = au.Id, UserName = au.UserName, Email = au.Email, EmployeeName = e.Name, CustomerName = c.Name, SupplierName = s.Name, PhoneNumber = au.PhoneNumber }).GetPagedAsync(pageIndex, pageSize); return(new ApiResult <PagedResult <AccountsDto> >(HttpStatusCode.OK, accounts)); }
public void AcceptShiftChangeByOriginalEmployeeAsyncShouldThrowIfNoSuchShiftFound() { const string id = "Test"; const string fakeId = "Fake"; // Arrange var originalEmployee = new EmployeeGroup { UserId = OriginalEmployeeId }; var shiftChange = new ShiftChange() { Id = id, ShiftId = ShiftId, OriginalEmployee = originalEmployee, PendingEmployeeId = PendingEmployeeId, Status = ShiftApplicationStatus.Pending, }; this.FakeDb.Add(shiftChange); this.shiftChangeService = new ShiftChangeService(this.GetMockedRepositoryAll()); // Act // Assert Assert.ThrowsAsync <ArgumentException>(() => this.shiftChangeService.AcceptShiftChangeByOriginalEmployeeAsync(OriginalEmployeeId, fakeId, true)); }
public async Task <IActionResult> AddMember(EmployeeGroup item) { _context.EmployeeGroups.Add(item); await _context.SaveChangesAsync(); return(RedirectToAction("MembersList", new { id = item.GenericSubGroupId })); }
static void Main(string[] args) { List <Employee> employees = new List <Employee>(5); employees.Add(new Employee(1, 30000, 2)); employees.Add(new Employee(2, 20000, 1)); employees.Add(new Employee(3, 5000, 3)); employees.Add(new Employee(4, 30000, 2)); employees.Add(new Employee(5, 4000, 3)); var Result = from employee in employees where employee.Salary >= 10000 group employee by employee.Department into EmployeeGroup select new { count = EmployeeGroup.Count(), key = EmployeeGroup.Key }; foreach (var Answer in Result) { Console.WriteLine(Answer); } Console.ReadKey(); }
public async Task <ApiResult <PagedResult <CustomersDto> > > GetCustomersPagingAsync(int pageIndex, int pageSize) { var customers = await(from c in _context.Customers join employee in _context.Employees on c.EmployeeId equals employee.Id into EmployeeGroup from e in EmployeeGroup.DefaultIfEmpty() join appuser in _context.AppUsers on c.AppUserId equals appuser.Id into AppUserGroup from au in AppUserGroup.DefaultIfEmpty() where c.IsDelete == false select new CustomersDto() { Id = c.Id, Name = c.Name, EmployeeName = e.Name, PhoneNumber = c.PhoneNumber, UserName = au.UserName }).GetPagedAsync(pageIndex, pageSize); if (customers == null) { return(new ApiResult <PagedResult <CustomersDto> >(HttpStatusCode.NoContent)); } return(new ApiResult <PagedResult <CustomersDto> >(HttpStatusCode.OK, customers)); }
//Map from Entity to Dto public static EmployeeGroupDto MappingDto(this EmployeeGroup employeeGroup) { return(new EmployeeGroupDto { Id = employeeGroup.Id, Name = employeeGroup.Name, }); }
public Employee(string name, DateTime hireDate, EmployeeGroup group, double baseSalary, int?chiefId = null) { Name = name; HireDate = hireDate; Group = group; BaseSalary = baseSalary; ChiefId = chiefId; }
public GroupAddViewModel(EmployeeGroup model, IEnumerable <DomainModelService.Employee> allEmployees, IEmployeeRepository employeeRepository) { m_Model = model; m_AllEmployees = allEmployees; m_EmployeeRepository = employeeRepository; DisplayName = TranslationProvider.Translate("TitleGroupAddViewModel"); CreateSelectableEmployeeViewModels(); }
public async Task <IActionResult> Post([FromBody] EmployeeGroup nEmployeeGroup) { if (nEmployeeGroup != null) { return(new JsonResult(await this.repository.AddAsync(nEmployeeGroup), this.DefaultJsonSettings)); } return(NotFound(new { Error = "Not found EmployeeGroup data !!!" })); }
public ActionResult Index(DateTime?startTime, DateTime?endTime, EmployeeGroup employeeGroup) { IList <CheckHistory> entities = _checkHistoryDao.GetCheckHistoryDao() .GetList(employeeGroup, startTime ?? DateTime.Now, endTime ?? DateTime.Now); return(View(entities)); }
public ActionResult Create(EmployeeGroup group, FormCollection form) { if (ModelState.IsValid) { FillWeekDay(group.Options, form); FillSpecialWorkDay(group.Options, form); _attendanceFactory.GetEmployeeGroup().Save(group); return(Redirect("Index")); } return(View(group)); }
public ActionResult Edit([ModelBinder(typeof(NHModelBinder))] EmployeeGroup group, FormCollection form) { if (ModelState.IsValid) { FillWeekDay(group.Options, form); FillSpecialWorkDay(group.Options, form); _attendanceFactory.GetEmployeeGroup().Update(group); return(RedirectToAction("Index")); } return(View(group)); }
public async Task <ApiResult <AccountDto> > GetAccountAsync(Guid userId) { var checkAccount = await _userManager.FindByIdAsync(userId.ToString(("D"))); if (checkAccount == null) { return(new ApiResult <AccountDto>(HttpStatusCode.NotFound, $"Không tìm thấy tài khoản có mã: {userId}")); } var roles = await _userManager.GetRolesAsync(checkAccount); var accountRoles = new List <AccountRolesDto>(); foreach (var r in roles) { var role = await _roleManager.FindByNameAsync(r); if (role != null) { accountRoles.Add(ObjectMapper.Mapper.Map <AppRole, AccountRolesDto>(role)); } } var accountDetail = await(from au in _context.AppUsers join emp in _context.Employees on au.Id equals emp.AppuserId into EmployeeGroup from e in EmployeeGroup.DefaultIfEmpty() join cus in _context.Customers on au.Id equals cus.AppUserId into CustomerGroup from c in CustomerGroup.DefaultIfEmpty() join sup in _context.Suppliers on au.Id equals sup.AppUserId into SupplierGroup from s in SupplierGroup.DefaultIfEmpty() where au.Id == userId select new AccountDto() { Id = au.Id, Address = e.Address != null ? e.Address : (c.Address != null ? c.Address : (s.Address != null ? s.Address : "")), Email = au.Email, Name = e.Name != null ? e.Name : (c.Name != null ? c.Name : (s.Name != null ? s.Name : "")), PhoneNumber = au.PhoneNumber != null ? au.PhoneNumber : (e.PhoneNumber != null ? e.PhoneNumber : (c.PhoneNumber != null ? c.PhoneNumber : ( s.PhoneNumber != null ? s.PhoneNumber : ""))), UserName = au.UserName, InRoles = accountRoles }).SingleOrDefaultAsync(); return(new ApiResult <AccountDto>(HttpStatusCode.OK, accountDetail)); }
public ActionResult Create(EmployeeGroup group, FormCollection form) { if (ModelState.IsValid) { FillWeekDay(group.Options, form); FillSpecialWorkDay(group.Options, form); _attendanceFactory.GetEmployeeGroup().Save(group); return Redirect("Index"); } return View(group); }
public async Task GetUpcomingShiftForUserShouldReturnAllApprovedShiftsPerUser() { const int expectedResult = 2; const string businessId = "Test"; const string userId = "Test"; // Arrange var group = new Group { BusinessId = businessId }; var employee = new EmployeeGroup() { UserId = userId }; var shift = new Shift() { Start = this.start, End = DateTime.UtcNow.AddDays(1), ShiftCreatorId = ShiftCreatorId, GroupId = GroupId, Description = Description, BonusPayment = BonusPayment, ShiftStatus = ShiftStatus.Approved, Group = group, Employee = employee, }; var shift2 = new Shift() { Start = this.start, End = DateTime.UtcNow.AddDays(1), ShiftCreatorId = ShiftCreatorId, GroupId = GroupId, Description = Description, BonusPayment = BonusPayment, ShiftStatus = ShiftStatus.Approved, Group = group, Employee = employee, }; this.FakeDb.Add(shift); this.FakeDb.Add(shift2); this.shiftService = new ShiftService(this.GetMockedRepositoryReturningAllAsNoTracking()); // Act var employeeUpcomingShifts = await this.shiftService.GetUpcomingShiftForUserAsync <ShiftTestViewModel>(businessId, userId); // Assert Assert.Equal(expectedResult, employeeUpcomingShifts.Count()); Assert.All(employeeUpcomingShifts, model => Equals(model.EmployeeId, userId)); Assert.All(employeeUpcomingShifts, model => Equals(model.ShiftStatus, ShiftStatus.Approved)); }
public async Task GetOpenShiftsAvailableForUserShouldReturnAllShiftsOpenForUserToApply() { const int expectedCount = 2; const string businessId = "Test"; const string userId = "Test"; // Arrange var group = new Group { BusinessId = businessId }; var employee = new EmployeeGroup() { UserId = userId }; group.Employees.Add(employee); var shift = new Shift() { Start = this.start, End = this.end, ShiftCreatorId = ShiftCreatorId, GroupId = GroupId, Description = Description, BonusPayment = BonusPayment, ShiftStatus = ShiftStatus.Open, Group = group, }; var shift2 = new Shift() { Start = this.start, End = this.end, ShiftCreatorId = ShiftCreatorId, GroupId = GroupId, Description = Description, BonusPayment = BonusPayment, ShiftStatus = ShiftStatus.Open, Group = group, }; this.FakeDb.Add(shift); this.FakeDb.Add(shift2); this.shiftService = new ShiftService(this.GetMockedRepositoryReturningAllAsNoTracking()); // Act var availableShifts = await this.shiftService.GetOpenShiftsAvailableForUserAsync <ShiftTestViewModel>(businessId, userId); // Assert Assert.NotEmpty(availableShifts); Assert.Equal(expectedCount, availableShifts.Count()); }
public async Task <IActionResult> PutByNumber(string key, [FromBody] EmployeeGroup uEmployeeGroup) { if (uEmployeeGroup != null) { if (uEmployeeGroup.OverTimeMasters != null) { uEmployeeGroup.OverTimeMasters = null; } return(new JsonResult(await this.repository.UpdateAsync(uEmployeeGroup, key), this.DefaultJsonSettings)); } return(NotFound(new { Error = "EmployeeGroup not found. " })); }
public async Task <IActionResult> Post([FromBody] EmployeeGroup nEmployeeGroup) { if (nEmployeeGroup != null) { if (nEmployeeGroup.OverTimeMasters != null) { nEmployeeGroup.OverTimeMasters = null; } return(new JsonResult(await this.repository.AddAsync(nEmployeeGroup), this.DefaultJsonSettings)); } return(NotFound(new { Error = "EmployeeGroup not found. " })); }
public async Task GetTakenShiftsPerUserAsyncShouldReturnAllShiftsEmployeeNotTheUser() { const int expectedCount = 2; const string businessId = "Test"; const string userId = "Test"; // Arrange var group = new Group { BusinessId = businessId }; var employeeGroup = new EmployeeGroup { UserId = "some other userId" }; var shift = new Shift() { Start = this.start, End = this.end, ShiftCreatorId = ShiftCreatorId, GroupId = GroupId, Description = Description, BonusPayment = BonusPayment, ShiftStatus = ShiftStatus.Approved, Group = group, Employee = employeeGroup, }; var shift2 = new Shift() { Start = this.start, End = this.end, ShiftCreatorId = ShiftCreatorId, GroupId = GroupId, Description = Description, BonusPayment = BonusPayment, ShiftStatus = ShiftStatus.Approved, Group = group, Employee = employeeGroup, }; this.FakeDb.Add(shift); this.FakeDb.Add(shift2); this.shiftService = new ShiftService(this.GetMockedRepositoryReturningAllAsNoTracking()); // Act var pendingShifts = await this.shiftService.GetTakenShiftsPerUserAsync <ShiftTestViewModel>(businessId, userId); // Assert Assert.NotEmpty(pendingShifts); Assert.Equal(expectedCount, pendingShifts.Count()); }
public async Task <ApiResult <IEnumerable <CustomerDto> > > SearchCustomerAsync(string customerName) { var customers = await(from c in _context.Customers join employee in _context.Employees on c.EmployeeId equals employee.Id into EmployeeGroup from e in EmployeeGroup.DefaultIfEmpty() join appuser in _context.AppUsers on c.AppUserId equals appuser.Id into AppUserGroup from au in AppUserGroup.DefaultIfEmpty() join customertype in _context.CustomerTypes on c.CustomerTypeId equals customertype.Id into CustomerTypeGroup from ct in CustomerTypeGroup.DefaultIfEmpty() let customerDebt = (_context.Orders.Where(x => x.CustomerId == c.Id && x.TransactionStatusId != GlobalProperties.CancelTransactionId && x.TransactionStatusId != GlobalProperties.WaitingTransactionId) .Sum(x => (decimal?)x.TotalAmount) ?? 0) + (_context.PaymentVouchers.Where(x => x.CustomerId == c.Id) .Sum(x => (decimal?)x.Paid) ?? 0) - (_context.ReceiptVouchers.Where(x => x.CustomerId == c.Id) .Sum(x => (decimal?)x.Received) ?? 0) where c.Name.ToLower().Contains(customerName.ToLower()) && c.IsDelete == false select new CustomerDto() { Address = c.Address, Description = c.Description, Dob = c.Dob, Fax = c.Fax, Gender = c.Gender, Id = c.Id, Name = c.Name, Website = c.Website, EmployeeName = e.Name, IsDelete = c.IsDelete, UserName = au.UserName, PhoneNumber = c.PhoneNumber, CustomerTypeName = ct.Name, TotalDebt = customerDebt, Email = string.IsNullOrEmpty(c.Email)?au.Email:c.Email }).ToListAsync(); return(new ApiResult <IEnumerable <CustomerDto> >() { Code = HttpStatusCode.OK, ResultObj = customers }); }
public async Task <string> AddEmployeeToGroupAsync(string userId, string groupId, decimal salary, string position) { var employeeGroup = new EmployeeGroup() { UserId = userId, GroupId = groupId, Salary = salary, Position = position, }; await this.employeeGroupRepository.AddAsync(employeeGroup); await this.employeeGroupRepository.SaveChangesAsync(); return(employeeGroup.Id); }
public IList <CheckHistory> GetList(EmployeeGroup employeeGroup, DateTime startTime, DateTime endTime) { var start = new DateTime(startTime.Year, startTime.Month, startTime.Day); var end = new DateTime(endTime.Year, endTime.Month, endTime.Day, 23, 59, 59); DetachedCriteria employeeGroupId = DetachedCriteria.For <Employee>() .Add(Restrictions.Eq(EmployeeGroup, employeeGroup)) .SetProjection(Projections.Property <Employee>(s => s.Id)); return(CreateDetachedCriteria() .Add(Restrictions.Le(SignTime, end)) .Add(Restrictions.Ge(SignTime, start)) .Add(Subqueries.PropertyIn("Employee", employeeGroupId)) .GetExecutableCriteria(CurrentSession) .List <CheckHistory>()); }
public ActionResult DeleteEmployeeGroup(EmployeeGroup eg) { HorseplayContext db = new HorseplayContext(); int tenantId = (int)Session["TenantId"]; var oldEg = db.EmployeeGroups.FirstOrDefault(e => e.EmployeeGroupId == eg.EmployeeGroupId && e.TenantId == tenantId); if (oldEg == null) { return(new HttpNotFoundResult("Wystąpił nieoczekiwany błąd")); } else { db.EmployeeGroups.Remove(oldEg); db.SaveChanges(); return(RedirectToAction("GetEmployeeGroups")); } }
public async Task <ApiResult <CustomerDto> > GetCustomerAsync(string customerId) { var totalAmountOrders = await _context.Orders.Where(x => x.CustomerId == customerId && x.TransactionStatusId != GlobalProperties.CancelTransactionId && x.TransactionStatusId != GlobalProperties.WaitingTransactionId).SumAsync(x => x.TotalAmount); var totalPaymentVouchers = await _context.PaymentVouchers.Where(x => x.CustomerId == customerId).SumAsync(x => x.Paid); var totalReceiptVouchers = await _context.ReceiptVouchers.Where(x => x.CustomerId == customerId).SumAsync(x => x.Received); var customer = await(from c in _context.Customers join employee in _context.Employees on c.EmployeeId equals employee.Id into EmployeeGroup from e in EmployeeGroup.DefaultIfEmpty() join appuser in _context.AppUsers on c.AppUserId equals appuser.Id into AppUserGroup from au in AppUserGroup.DefaultIfEmpty() join customertype in _context.CustomerTypes on c.CustomerTypeId equals customertype.Id into CustomerTypeGroup from ct in CustomerTypeGroup.DefaultIfEmpty() where c.Id == customerId && c.IsDelete == false select new CustomerDto() { Address = c.Address, Description = c.Description, Dob = c.Dob, Fax = c.Fax, Gender = c.Gender, Id = c.Id, Name = c.Name, Website = c.Website, EmployeeName = e.Name, PhoneNumber = c.PhoneNumber, IsDelete = c.IsDelete, UserName = au.UserName, CustomerTypeName = ct.Name, TotalDebt = totalAmountOrders + totalPaymentVouchers - totalReceiptVouchers }).SingleOrDefaultAsync(); if (customer == null) { return(new ApiResult <CustomerDto>(HttpStatusCode.NotFound, $"Không tìm thấy khách hàng có mã: {customerId}")); } return(new ApiResult <CustomerDto>(HttpStatusCode.OK, customer)); }
public async Task <ApiResult <ReportCustomerSupplierDebtDto> > GetAllCustomerDebtAsync(int pageIndex, int pageSize) { var customers = from c in _context.Customers join employee in _context.Employees on c.EmployeeId equals employee.Id into EmployeeGroup from e in EmployeeGroup.DefaultIfEmpty() join appuser in _context.AppUsers on c.AppUserId equals appuser.Id into AppUserGroup from au in AppUserGroup.DefaultIfEmpty() join ct in _context.CustomerTypes on c.CustomerTypeId equals ct.Id let customerDebt = (_context.Orders.Where(x => x.CustomerId == c.Id && x.TransactionStatusId != GlobalProperties.CancelTransactionId && x.TransactionStatusId != GlobalProperties.WaitingTransactionId) .Sum(x => (decimal?)x.TotalAmount) ?? 0) + (_context.PaymentVouchers.Where(x => x.CustomerId == c.Id) .Sum(x => (decimal?)x.Paid) ?? 0) - (_context.ReceiptVouchers.Where(x => x.CustomerId == c.Id) .Sum(x => (decimal?)x.Received) ?? 0) where (int)customerDebt != 0 select new CustomersSuppliersForReportDto() { Id = c.Id, Name = c.Name, PhoneNumber = c.PhoneNumber, TotalDebt = customerDebt, Address = c.Address, Email = au.Email, }; decimal totalDebt = 0; foreach (var c in await customers.ToListAsync()) { totalDebt += c.TotalDebt; } var reportCustomer = new ReportCustomerSupplierDebtDto() { Targets = await customers.GetPagedAsync(pageIndex, pageSize), TotalDebt = totalDebt }; return(new ApiResult <ReportCustomerSupplierDebtDto>(HttpStatusCode.OK, reportCustomer)); }
public async Task<EmployeeGroup> CreateGroupAsync(string userId, string name, IList<string> employeeIds) { Guard.NotNullOrWhiteSpace(userId, nameof(userId)); Guard.NotNullOrWhiteSpace(name, nameof(name)); Guard.NotNullOrEmpty(employeeIds, nameof(employeeIds)); var group = new EmployeeGroup { Id = Guid.NewGuid().ToString("N"), Name = name, EmployeeIds = employeeIds, }; var groups = this.GetEmployeeGroupsForUser(userId); groups.Add(group); this.SetEmployeeGroupsForUser(userId, groups); this._eventAggregator.PublishOnUIThread(new EmployeeGroupCreated(group)); return group; }
/// <summary> /// Calc work time for the month and for the employee group /// </summary> /// <param name="year">Year</param> /// <param name="month">Month</param> /// <param name="planWorkday">Employee group</param> /// <returns>PlanWorkmonth</returns> public Double CalcMonth(Int32 year, Int32 month, EmployeeGroup group) { var planWorkday = _planWorkDayRepository.Query().FirstOrDefault(x => x.EmployeeGroup == group); return CalcMonth(year, month, planWorkday.Hours); }
public void AddToEmployeeGroups(EmployeeGroup employeeGroup) { base.AddObject("EmployeeGroups", employeeGroup); }
public EmployeeGroupDeleted(EmployeeGroup employeeGroup) { this.EmployeeGroup = employeeGroup; }
public EmployeeGroupCreated(EmployeeGroup employeeGroup) { this.EmployeeGroup = employeeGroup; }
public static EmployeeGroup CreateEmployeeGroup(int ID, string employeeGroupName, byte[] rowVersion) { EmployeeGroup employeeGroup = new EmployeeGroup(); employeeGroup.Id = ID; employeeGroup.EmployeeGroupName = employeeGroupName; employeeGroup.RowVersion = rowVersion; return employeeGroup; }