public ActionResult DeleteConfirmed(int id)
        {
            AttProcessorScheduler attprocessor = context.AttProcessorSchedulers.Single(x => x.AttProcesserSchedulerID == id);

            context.AttProcessorSchedulers.Remove(attprocessor);
            context.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit(AttProcessorScheduler attprocessor)
 {
     if (ModelState.IsValid)
     {
         context.Entry(attprocessor).State = EntityState.Modified;
         context.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(attprocessor));
 }
Exemplo n.º 3
0
        public ActionResult DeleteConfirmed(int?id)
        {
            AttProcessorScheduler attprocessor = context.AttProcessorSchedulers.Find(id);

            context.AttProcessorSchedulers.Remove(attprocessor);
            context.SaveChanges();
            int _userID = Convert.ToInt32(Session["LogedUserID"].ToString());

            HelperClass.MyHelper.SaveAuditLog(_userID, (byte)MyEnums.FormName.Designation, (byte)MyEnums.Operation.Delete, DateTime.Now);
            return(RedirectToAction("Index"));
        }
Exemplo n.º 4
0
        public ActionResult Create(AttProcessorScheduler attprocessor)
        {
            string d = Request.Form["CriteriaID"].ToString();

            switch (d)
            {
            case "C":
                attprocessor.Criteria = "C";
                break;

            case "L": attprocessor.Criteria = "L"; break;

            case "A": attprocessor.Criteria = "A"; break;

            case "E":
            {
                attprocessor.Criteria   = "E";
                attprocessor.ProcessCat = false;
                string     ee    = Request.Form["EmpNo"].ToString();
                int        cc    = Convert.ToInt16(Request.Form["CompanyIDForEmp"].ToString());
                List <Emp> empss = new List <Emp>();
                empss = context.Emps.Where(aa => aa.EmpNo == ee && aa.CompanyID == cc).ToList();
                if (empss.Count() > 0)
                {
                    attprocessor.EmpID = empss.First().EmpID;
                    attprocessor.EmpNo = empss.First().EmpNo;
                }
            }
            break;
            }
            int a = Convert.ToInt16(Request.Form["ProcessCats"].ToString());

            if (a == 1)
            {
                attprocessor.ProcessCat = true;
            }
            else
            {
                attprocessor.ProcessCat = false;
            }
            attprocessor.ProcessingDone = false;
            attprocessor.WhenToProcess  = DateTime.Today;
            attprocessor.CreatedDate    = DateTime.Now;
            int _userID = Convert.ToInt32(Session["LogedUserID"].ToString());

            if (ModelState.IsValid)
            {
                attprocessor.UserID = _userID;
                context.AttProcessorSchedulers.Add(attprocessor);
                context.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(attprocessor));
        }
Exemplo n.º 5
0
 private void ProcessManualAttendanceMonthly(List <Emp> emps, AttProcessorScheduler req)
 {
     if (req.DateFrom.Date.Day == 21)
     {
         DateTime dt1 = new DateTime(req.DateFrom.Year, req.DateFrom.Month + 1, 20);
         ProcessMonthlyPermanent(req.DateFrom, dt1);
     }
     if (req.DateFrom.Date.Day == 1)
     {
         int      daysInMonths = System.DateTime.DaysInMonth(req.DateFrom.Year, req.DateFrom.Month);
         DateTime dt1          = new DateTime(req.DateFrom.Year, req.DateFrom.Month, daysInMonths);
         ProcessMonthlyPermanent(req.DateFrom, dt1);
     }
 }
Exemplo n.º 6
0
        //
        // GET: /AttProcessors/Delete/5

        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            AttProcessorScheduler attprocessor = context.AttProcessorSchedulers.Find(id);

            context.AttProcessorSchedulers.Remove(attprocessor);
            context.SaveChanges();
            if (id == null)
            {
                return(HttpNotFound());
            }
            return(RedirectToAction("Index"));
        }
Exemplo n.º 7
0
 public void SaveManualRequest(int empid, DateTime?dts, DateTime?dte)
 {
     using (var db = new TAS2013Entities())
     {
         AttProcessorScheduler atp = new AttProcessorScheduler();
         atp.WhenToProcess  = DateTime.Today;
         atp.PeriodTag      = "D";
         atp.EmpID          = empid;
         atp.EmpNo          = atp.EmpID.ToString();
         atp.DateFrom       = (DateTime)dts;
         atp.DateTo         = (DateTime)dte;
         atp.CompanyID      = 1;
         atp.CreatedDate    = DateTime.Now;
         atp.LocationID     = 1;
         atp.ProcessCat     = false;
         atp.ProcessingDone = false;
         atp.UserID         = 25;
         db.AttProcessorSchedulers.Add(atp);
         db.SaveChanges();
     }
 }
        public ActionResult Create(AttProcessorScheduler attprocessor)
        {
            string d = Request.Form["CriteriaID"].ToString();

            switch (d)
            {
            case "C":
                attprocessor.Criteria = "C";
                break;

            case "L": attprocessor.Criteria = "L"; break;

            case "A": attprocessor.Criteria = "A"; break;
            }
            int a = Convert.ToInt16(Request.Form["ProcessCats"].ToString());

            if (a == 1)
            {
                attprocessor.ProcessCat = true;
            }
            else
            {
                attprocessor.ProcessCat = false;
            }
            attprocessor.ProcessingDone = false;
            attprocessor.WhenToProcess  = DateTime.Today;
            int _userID = Convert.ToInt32(Session["LogedUserID"].ToString());

            if (ModelState.IsValid)
            {
                attprocessor.UserID = _userID;
                context.AttProcessorSchedulers.Add(attprocessor);
                context.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(attprocessor));
        }
        //
        // GET: /AttProcessors/Details/5

        public ViewResult Details(int id)
        {
            AttProcessorScheduler attprocessor = context.AttProcessorSchedulers.Single(x => x.AttProcesserSchedulerID == id);

            return(View(attprocessor));
        }
        //
        // GET: /AttProcessors/Delete/5

        public ActionResult Delete(int id)
        {
            AttProcessorScheduler attprocessor = context.AttProcessorSchedulers.Single(x => x.AttProcesserSchedulerID == id);

            return(View(attprocessor));
        }
        public ActionResult Create(AttProcessorScheduler attprocessor)
        {
            User   LoggedInUser = Session["LoggedUser"] as User;
            string d            = Request.Form["CriteriaID"].ToString();
            string Message      = "";

            switch (d)
            {
            case "C":
                attprocessor.Criteria = "C";
                break;

            case "L": attprocessor.Criteria = "L"; break;

            case "E":
            {
                TAS2013Entities db = new TAS2013Entities();
                attprocessor.Criteria = "E";
                string         EmpNo = Request.Form["EmpNo"].ToString();
                List <EmpView> emps  = new List <EmpView>();
                emps = db.EmpViews.Where(aa => aa.EmpNo == EmpNo && aa.Status == true).ToList();
                emps = AssistantQuery.GetFilteredEmps(emps, db.UserSections.Where(aa => aa.UserID == LoggedInUser.UserID).ToList());
                if (emps.Count() > 0)
                {
                    attprocessor.EmpID = emps.First().EmpID;
                    attprocessor.EmpNo = emps.First().EmpNo;
                }
                else
                {
                    Message           = "There is no employee found";
                    ViewBag.CMessage  = Message;
                    ViewBag.PeriodTag = new SelectList(new List <SelectListItem>
                        {
                            new SelectListItem {
                                Selected = true, Text = "Daily", Value = "D"
                            },
                            new SelectListItem {
                                Selected = false, Text = "Monthly", Value = "M"
                            },
                            new SelectListItem {
                                Selected = false, Text = "Summary", Value = "S"
                            },
                        }, "Value", "Text", 1);
                    ViewBag.CriteriaID = new SelectList(new List <SelectListItem>
                        {
                            new SelectListItem {
                                Selected = true, Text = "Company", Value = "C"
                            },
                            new SelectListItem {
                                Selected = false, Text = "Location", Value = "L"
                            },
                            new SelectListItem {
                                Selected = false, Text = "Employee", Value = "E"
                            },
                        }, "Value", "Text", 1);

                    ViewBag.LocationID = new SelectList(db.Locations.OrderBy(s => s.LocName), "LocID", "LocName");
                    return(View(attprocessor));
                }
            }
            break;
            }
            attprocessor.ProcessingDone = false;
            int _userID = Convert.ToInt32(Session["LogedUserID"].ToString());

            if (ModelState.IsValid)
            {
                attprocessor.UserID      = _userID;
                attprocessor.CreatedDate = DateTime.Today;
                context.AttProcessorSchedulers.Add(attprocessor);
                context.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(attprocessor));
        }
Exemplo n.º 12
0
        public ActionResult Create(AttProcessorScheduler attprocessor)
        {
            string d = Request.Form["CriteriaID"].ToString();

            switch (d)
            {
            case "C":
                attprocessor.Criteria = "C";
                break;

            case "L": attprocessor.Criteria = "L"; break;

            case "A": attprocessor.Criteria = "A"; break;

            case "E":
            {
                attprocessor.Criteria   = "E";
                attprocessor.ProcessCat = false;
                string     ee    = Request.Form["EmpNo"].ToString();
                int        cc    = Convert.ToInt16(Request.Form["CompanyIDForEmp"].ToString());
                List <Emp> empss = new List <Emp>();
                empss = context.Emps.Where(aa => aa.EmpNo == ee && aa.CompanyID == cc).ToList();
                if (empss.Count() > 0)
                {
                    attprocessor.EmpID = empss.First().EmpID;
                    attprocessor.EmpNo = empss.First().EmpNo;
                }
            }
            break;
            }
            int a = Convert.ToInt16(Request.Form["ProcessCats"].ToString());

            if (a == 1)
            {
                attprocessor.ProcessCat = true;
            }
            else
            {
                attprocessor.ProcessCat = false;
            }
            attprocessor.ProcessingDone = false;
            attprocessor.WhenToProcess  = DateTime.Today;
            attprocessor.CreatedDate    = DateTime.Now;
            int _userID = Convert.ToInt32(Session["LogedUserID"].ToString());

            if ((attprocessor.DateTo - attprocessor.DateFrom).Days > 3 & attprocessor.PeriodTag == "D")
            {
                ModelState.AddModelError("DateTo", "Date Difference must be between 3 days!");
            }
            if (ModelState.IsValid)
            {
                attprocessor.UserID = _userID;
                context.AttProcessorSchedulers.Add(attprocessor);
                context.SaveChanges();
                return(RedirectToAction("Index"));
            }
            TAS2013Entities db           = new TAS2013Entities();
            User            LoggedInUser = Session["LoggedUser"] as User;
            QueryBuilder    qb           = new QueryBuilder();
            String          query        = qb.QueryForCompanyViewLinq(LoggedInUser);

            ViewBag.PeriodTag = new SelectList(new List <SelectListItem>
            {
                new SelectListItem {
                    Selected = false, Text = "Monthly", Value = "M"
                },
                new SelectListItem {
                    Selected = true, Text = "Daily", Value = "D"
                },
                new SelectListItem {
                    Selected = false, Text = "Summary", Value = "S"
                },
            }, "Value", "Text", 1);
            ViewBag.CriteriaID = new SelectList(new List <SelectListItem>
            {
                new SelectListItem {
                    Selected = true, Text = "Company", Value = "C"
                },
                new SelectListItem {
                    Selected = false, Text = "Location", Value = "L"
                },
                new SelectListItem {
                    Selected = false, Text = "Employee", Value = "E"
                },
            }, "Value", "Text", 1);
            ViewBag.ProcessCats = new SelectList(new List <SelectListItem>
            {
                new SelectListItem {
                    Selected = true, Text = "Yes", Value = "1"
                },
                new SelectListItem {
                    Selected = false, Text = "No", Value = "0"
                },
            }, "Value", "Text", 1);
            if (LoggedInUser.RoleID == 1)
            {
                ViewBag.CompanyID       = new SelectList(CustomFunction.GetCompanies(db.Companies.ToList(), LoggedInUser), "CompID", "CompName", LoggedInUser.CompanyID);
                ViewBag.CompanyIDForEmp = new SelectList(CustomFunction.GetCompanies(db.Companies.ToList(), LoggedInUser), "CompID", "CompName", LoggedInUser.CompanyID);
                query = qb.QueryForLocationTableSegerationForLinq(LoggedInUser);
                ViewBag.LocationID = new SelectList(CustomFunction.GetLocations(db.Locations.ToList(), db.UserLocations.Where(aa => aa.UserID == LoggedInUser.UserID).ToList()), "LocID", "LocName");
            }
            else
            {
                ViewBag.CompanyID       = new SelectList(CustomFunction.GetCompanies(db.Companies.ToList(), LoggedInUser), "CompID", "CompName", LoggedInUser.CompanyID);
                ViewBag.CompanyIDForEmp = new SelectList(CustomFunction.GetCompanies(db.Companies.ToList(), LoggedInUser), "CompID", "CompName", LoggedInUser.CompanyID);
                query = qb.QueryForLocationTableSegerationForLinq(LoggedInUser);
                ViewBag.LocationID = new SelectList(CustomFunction.GetLocations(db.Locations.ToList(), db.UserLocations.Where(aa => aa.UserID == LoggedInUser.UserID).ToList()), "LocID", "LocName");
            }



            ViewBag.CatID = new SelectList(db.Categories.OrderBy(s => s.CatName), "CatID", "CatName");
            return(View(attprocessor));
        }