Exemple #1
0
        public ActionResult ConfirmAddBranch(string Branch_Location, string Pass)
        {
            if (Session["Password"].ToString() == Pass)
            {
                BranchRepository repo = new BranchRepository();
                repo.Get(Branch_Location);

                if (repo.Get(Branch_Location) == null)
                {
                    Branch br = new Branch();
                    br.Branch_Location = Branch_Location;
                    repo.Insert(br);

                    ViewData["Message"] = "Branch inserted successfully";
                }
                else
                {
                    ViewData["Message"] = "Branch alread Exist";
                }
            }
            else
            {
                ViewData["Message"] = "Wrong Password";
            }


            return(View("Empty"));
        }
Exemple #2
0
        public ActionResult Create()
        {
            var viewModel = new CarCreateViewModel();

            viewModel.AvailableBranches = branchRepo.Get();

            return(View(viewModel));
        }
Exemple #3
0
        //
        // GET: /Employee/Create

        public ActionResult Create()
        {
            var shifts = _shiftRepository.Get();

            ViewBag.Dept   = _deptRepository.Get();
            ViewBag.Branch = _branchRepository.Get();
            return(View(shifts));
        }
        public IHttpActionResult DiscountReportByBranch()
        {
            List <DiscountViewModel>       discountModels = new List <DiscountViewModel>();
            List <DiscountReportViewModel> model          = new List <DiscountReportViewModel>();

            model = invoiceRepository.DiscountReportByBranch();
            foreach (var item in model)
            {
                DiscountViewModel discount = new DiscountViewModel();
                discount.Branch_Id = item.BranchId;
                discount.Column1   = item.Discount;
                discountModels.Add(discount);
            }

            List <BarChartModel> barCharts = new List <BarChartModel>();

            foreach (DiscountViewModel item in discountModels)
            {
                DiscountViewModel dvm        = new DiscountViewModel();
                BranchRepository  branch     = new BranchRepository();
                string            branchName = branch.Get(item.Branch_Id).Name;
                dvm.Column1 = item.Column1;

                BarChartModel barChart = new BarChartModel(branchName, (double)dvm.Column1);
                barCharts.Add(barChart);
            }
            var lsitOfData = Newtonsoft.Json.JsonConvert.SerializeObject(barCharts);

            return(Ok(barCharts));
        }
 public ActionResult ViewBranch(int id)
 {
     if (Session["uid"] == null || Convert.ToInt32(Session["type"]) != 0)
     {
         TempData["errmsg"] = "You are not allowed to see the page without login";
         return(RedirectToAction("index", "login"));
     }
     return(View(branchRepo.Get(id)));
 }
        public List <Product> serviceHistory(int id)
        {
            List <Product> products = GetAll().Where <Product>(x => (x.Sending_Manager_id == id || x.Receiving_Manager_id == id) && x.Product_State == 4).ToList();

            foreach (var item in products)
            {
                item.Branch  = branchRepo.Get(item.Sending_B_id);
                item.Branch1 = branchRepo.Get(item.Receiving_B_id);
            }
            return(products);
        }
Exemple #7
0
        public List <Employee_Problems> GetAllProblems()
        {
            List <Employee_Problems> employee_Problems = GetAll();

            foreach (var item in employee_Problems)
            {
                item.Branch        = branchRepo.Get(item.Branch_id);
                item.User.Employee = empRepo.Get(item.Id);
            }

            return(employee_Problems);
        }
Exemple #8
0
        public IHttpActionResult SalesInfoByBranch()
        {
            BranchRepository branchRepository = new BranchRepository();
            var list = branchRepository.AllBranchSales();
            List <BranchSalesViewModel> branchList = new List <BranchSalesViewModel>();

            foreach (SumGroupByModel sgm in list)
            {
                BranchRepository repository = new BranchRepository();

                Branch branchDetails      = repository.Get(sgm.Id);
                BranchSalesViewModel bsvm = new BranchSalesViewModel();

                bsvm.Id               = sgm.Id;
                bsvm.BranchName       = branchDetails.Name;
                bsvm.TotalSalesAmount = sgm.Column1;

                branchList.Add(bsvm);
            }

            return(Ok(branchList));
        }
Exemple #9
0
        static void Main(string[] args)
        {
            var account = Radio7.ConfigReader.ConfigFactory.Instance.Resolve<AccountRepository>();
            var setttings = Radio7.ConfigReader.ConfigFactory.Instance.Resolve<Settings>();
            var logger = new ConsoleLogger();

            var branchRepository = new BranchRepository(account, logger);
            var branches = branchRepository.Get();

            var commitRepository = new CommitRepository(account, logger);
            var commits = commitRepository.Get(setttings.BranchName);

            var prRepository = new PullRequestRepository(account, logger);
            var pullRequests = prRepository.Get();

            var sql = new SqlRepository(setttings.ConnectionString);

            sql.LoadTable(branches);
            sql.LoadTable(commits);
            sql.LoadTable(pullRequests);



        }
        public ActionResult Index()
        {
            List <Branch> branches = _branchRepository.Get();

            return(View(branches));
        }
Exemple #11
0
 public IHttpActionResult Get(int id)
 {
     return(Ok(branchRepository.Get(id)));
 }
        public ActionResult Index(string from, string to, int shiftId = 0, int deptId = 0, int branchId = 0)
        {
            var events    = _eventLogRepository.Get();
            var employees = _employeeRepository.Get();
            var shifts    = _shiftRepository.Get();
            var depts     = _deptRepository.Get();
            var branches  = _branchRepository.Get();

            ViewBag.Shifts      = shifts;
            ViewBag.Departments = depts;
            ViewBag.Branches    = branches;

            var query = _attendanceService.GetUserAttendance(events, employees);
            List <Attendance> result;

            query = shiftId != 0 ? query.Where(_ => _.Shift.Id == shiftId) : query;
            query = deptId != 0 ? query.Where(_ => _.Department.Id == deptId) : query;
            query = branchId != 0 ? query.Where(_ => _.Branch.Id == branchId) : query;
            DateTime fromDate, toDate;

            if (from != null && DateTime.TryParse(from, out fromDate))
            {
                query = query.Where(_ => _.Date >= fromDate);
            }
            if (to != null && DateTime.TryParse(to, out toDate))
            {
                query = query.Where(_ => _.Date <= toDate);
            }

            var filterResult = query.ToList();
            var numberOfLeavesTakenByEmployee = _leaveCountRepository.GetLeaveCount(query);
            var leaveCountDictionary          = numberOfLeavesTakenByEmployee.ToDictionary(l => l.EmployeeId);
            var groupByUser         = filterResult.GroupBy(_ => _.UserId);
            var attendanceSummaries = new List <AttendanceSummary>();

            foreach (var g in groupByUser)
            {
                var totalPresents = g.Count();
                var totalLates    = g.Count(day => TimeSpan.Compare(day.FirstEntryTime.TimeOfDay,
                                                                    TimeSpan.Parse(day.Shift.GraceEntryTime).Add(TimeSpan.FromMinutes(1))) == 1);
                totalPresents -= totalLates;
                var totalDays = totalPresents + totalLates;
                if (leaveCountDictionary.Count > 0 && leaveCountDictionary.ContainsKey(g.FirstOrDefault().Employee.Id))
                {
                    attendanceSummaries.Add(new AttendanceSummary
                    {
                        Name                  = g.FirstOrDefault().Name,
                        TotalDays             = (int)totalDays,
                        TotalPresents         = totalPresents,
                        TotalLates            = totalLates,
                        ReamainingCasualLeave = leaveCountDictionary[g.FirstOrDefault().Employee.Id].CasualLeave,
                        ReamainingEarnLeave   = leaveCountDictionary[g.FirstOrDefault().Employee.Id].EarnLeave,
                        ReamainingSickLeave   = leaveCountDictionary[g.FirstOrDefault().Employee.Id].SickLeave
                    });
                }
                else
                {
                    attendanceSummaries.Add(new AttendanceSummary
                    {
                        Name                  = g.FirstOrDefault().Name,
                        TotalDays             = (int)totalDays,
                        TotalPresents         = totalPresents,
                        TotalLates            = totalLates,
                        ReamainingCasualLeave = 0,
                        ReamainingEarnLeave   = 0,
                        ReamainingSickLeave   = 0
                    });
                }
            }

            return(View(attendanceSummaries.OrderBy(_ => _.Name).ToList()));
        }