示例#1
0
        public async Task <IActionResult> Create([Bind("AttendanceId,EmployeeId,AttDate,EntryTime,Status,Remarks,IsTailoring,StoreId,UserId,EntryStatus,IsReadOnly")] Attendance attendance)
        {
            if (ModelState.IsValid)
            {
                if (DBValidation.AttendanceDuplicateCheck(_context, attendance))
                {
                    ViewBag.ErrorMessage   = "Attendance already added!. Possible duplicate entry.";
                    ViewData["EmployeeId"] = new SelectList(_context.Employees, "EmployeeId", "StaffName", attendance.EmployeeId);
                    StoreInfo storeInfo1 = PostLogin.ReadStoreInfo(HttpContext.Session);
                    ViewData["StoreId"]  = storeInfo1.StoreId;
                    ViewData["UserName"] = storeInfo1.UserName;
                    return(View(attendance));
                }
                _context.Add(attendance);
                await _context.SaveChangesAsync();

                new PayrollManager().ONInsertOrUpdate(_context, attendance, false, false);
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EmployeeId"] = new SelectList(_context.Employees, "EmployeeId", "StaffName", attendance.EmployeeId);
            StoreInfo storeInfo = PostLogin.ReadStoreInfo(HttpContext.Session);

            ViewData["StoreId"]  = storeInfo.StoreId;
            ViewData["UserName"] = storeInfo.UserName;
            return(View(attendance));
        }
示例#2
0
        public async Task <IActionResult> Edit(int id, [Bind("EmployeeId,FirstName,LastName,MobileNo,JoiningDate,LeavingDate,IsWorking,Category,IsTailors,EMail,DateOfBirth,AdharNumber,PanNo,OtherIdDetails,Address,City,State,FatherName,HighestQualification,StoreId,UserId,EntryStatus,IsReadOnly")] Employee employee)
        {
            if (id != employee.EmployeeId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(employee);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EmployeeExists(employee.EmployeeId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            // ViewData["StoreId"] = new SelectList(_context.Stores, "StoreId", "StoreName", employee.StoreId);
            StoreInfo storeInfo = PostLogin.ReadStoreInfo(HttpContext.Session);

            ViewData["StoreId"]  = storeInfo.StoreId;
            ViewData["UserName"] = storeInfo.UserName;

            return(PartialView(employee));
        }
示例#3
0
        // GET: Payrolls/Attendances/Create
        public IActionResult Create()
        {
            ViewData["EmployeeId"] = new SelectList(_context.Employees, "EmployeeId", "StaffName");
            StoreInfo storeInfo = PostLogin.ReadStoreInfo(HttpContext.Session);

            ViewData["StoreId"]  = storeInfo.StoreId;
            ViewData["UserName"] = storeInfo.UserName;
            return(PartialView());
        }
示例#4
0
        // GET: Payrolls/Employees/Create
        public IActionResult Create()
        {
            StoreInfo storeInfo = PostLogin.ReadStoreInfo(HttpContext.Session);

            ViewData["StoreId"]  = storeInfo.StoreId;
            ViewData["UserName"] = storeInfo.UserName;

            return(PartialView());
        }
示例#5
0
        public async Task <IActionResult> Create([Bind("EmployeeId,FirstName,LastName,MobileNo, JoiningDate,LeavingDate,IsWorking,Category,IsTailors,EMail,DateOfBirth,AdharNumber,PanNo,OtherIdDetails,Address,City,State,FatherName,HighestQualification,StoreId,UserId,EntryStatus,IsReadOnly")] Employee employee)
        {
            if (ModelState.IsValid)
            {
                _context.Add(employee);
                await _context.SaveChangesAsync();

                await EmployeeManager.PostEmployeeAdditionAsync(_context, employee, _userManager);

                return(RedirectToAction(nameof(Index)));
            }
            //ViewData["StoreId"] = new SelectList(_context.Stores, "StoreId", "StoreName", employee.StoreId);
            StoreInfo storeInfo = PostLogin.ReadStoreInfo(HttpContext.Session);

            ViewData["StoreId"]  = storeInfo.StoreId;
            ViewData["UserName"] = storeInfo.UserName;
            return(View(employee));
        }
        // GET: StoreOperations
        public async Task <IActionResult> Index()
        {
            StoreInfo storeInfo    = PostLogin.ReadStoreInfo(HttpContext.Session);
            int       CurrentStore = storeInfo.StoreId;

            ViewData["UserName"] = storeInfo.UserName;

            var store = await _context.Stores.FindAsync(CurrentStore);

            if (store != null)
            {
                ViewBag.StoreName = store.StoreName;
                ViewBag.StoreCity = store.City;
            }
            else
            {
                ViewBag.StoreName = "N/A";
                ViewBag.StoreCity = "N/A";
            }
            ViewBag.StoreId = CurrentStore;

            // Check for Today Close and Openning Entry
            DateTime date = DateTime.Today.Date;
            //TODO: Update to IST Time zone
            //TODO: either of one should be shown
            var openToday = await _context.StoreOpens.Where(c => c.OpenningTime.Date == date.Date && c.StoreId == CurrentStore).FirstOrDefaultAsync();

            var closeToday = await _context.StoreCloses.Where(c => c.ClosingDate.Date == date.Date && c.StoreId == CurrentStore).FirstOrDefaultAsync();

            ViewBag.Open  = "true";
            ViewBag.Close = "true";
            if (openToday != null)
            {
                ViewBag.Open = "false";
            }
            if (closeToday != null)
            {
                ViewBag.Close = "false";
            }

            return(View());
        }
示例#7
0
        // GET: Payrolls/Attendances/Edit/5
        public async Task <IActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var attendance = await _context.Attendances.FindAsync(id);

            if (attendance == null)
            {
                return(NotFound());
            }
            ViewData["EmployeeId"] = new SelectList(_context.Employees, "EmployeeId", "StaffName", attendance.EmployeeId);
            StoreInfo storeInfo = PostLogin.ReadStoreInfo(HttpContext.Session);

            ViewData["StoreId"]  = attendance.StoreId;
            ViewData["UserName"] = storeInfo.UserName;
            return(PartialView(attendance));
        }
示例#8
0
        public async Task <IActionResult> Edit(int id, [Bind("AttendanceId,EmployeeId,AttDate,EntryTime,Status,Remarks,IsTailoring,StoreId,UserId,EntryStatus,IsReadOnly")] Attendance attendance)
        {
            if (id != attendance.AttendanceId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(attendance);
                    await _context.SaveChangesAsync();

                    new PayrollManager().ONInsertOrUpdate(_context, attendance, false, true);
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AttendanceExists(attendance.AttendanceId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EmployeeId"] = new SelectList(_context.Employees, "EmployeeId", "StaffName", attendance.EmployeeId);
            StoreInfo storeInfo = PostLogin.ReadStoreInfo(HttpContext.Session);

            ViewData["StoreId"]  = attendance.StoreId;
            ViewData["UserName"] = storeInfo.UserName;
            return(View(attendance));
        }