//
        // GET: /AttProcessors/Create
        public ActionResult Create()
        {
            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 = 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"},

            }, "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);
            ViewBag.CompanyID = new SelectList(db.Companies.Where(query).OrderBy(s=>s.CompName), "CompID", "CompName");
            query = qb.QueryForLocationTableSegerationForLinq(LoggedInUser);
            ViewBag.LocationID = new SelectList(db.Locations.Where(query).OrderBy(s=>s.LocName), "LocID", "LocName");

            ViewBag.CatID = new SelectList(db.Categories.OrderBy(s=>s.CatName), "CatID", "CatName");
             return View();
        }
Beispiel #2
0
        public ActionResult Create()
        {
            ViewBag.DayOff1 = new SelectList(db.DaysNames.OrderBy(s=>s.Name), "ID", "Name");
            ViewBag.DayOff2 = new SelectList(db.DaysNames.OrderBy(s=>s.Name), "ID", "Name");
            QueryBuilder qb = new QueryBuilder();
            User LoggedInUser = Session["LoggedUser"] as User;
            string query = qb.QueryForLocationTableSegerationForLinq(LoggedInUser);

            ViewBag.LocationID = new SelectList(db.Locations.Where(query).OrderBy(s=>s.LocName), "LocID", "LocName");
            ViewBag.RosterType = new SelectList(db.RosterTypes.OrderBy(s=>s.Name), "ID", "Name");
            return View();
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         String reportName = Request.QueryString["reportname"];
         List<string> list = Session["ReportSession"] as List<string>;
         FiltersModel fm = Session["FiltersModel"] as FiltersModel;
         User LoggedInUser = HttpContext.Current.Session["LoggedUser"] as User;
         QueryBuilder qb = new QueryBuilder();
         string query = qb.MakeCustomizeQuery(LoggedInUser);
         _dateFrom = list[0];
         string _dateTo = list[1];
         DateTime DateFrom = Convert.ToDateTime(list[0]);
         DateTime DateTo = Convert.ToDateTime(list[1]);
         string PathString = "";
         string consolidatedMonth = "";
         switch (reportName)
         {
             case "Strength":
                 List<DailySummary> _BadliList = contex.DailySummaries.Where(aa => aa.Date >= DateFrom && aa.Date <= DateTo).ToList();
                 List<DailySummary> _TempBadliList = new List<DailySummary>();
                 title = "Badli Report";
                 if (GlobalVariables.DeploymentType == false)
                     PathString = "/Reports/RDLC/DSEmpStrength.rdlc";
                 else
                     PathString = "/WMS/Reports/RDLC/DSEmpStrength.rdlc";
                 LoadReport(PathString, ReportsFilterImplementation(fm, _TempBadliList, _BadliList),_dateFrom+" TO "+_dateTo);
                 break;
             case "WorkTime":
                 _BadliList = contex.DailySummaries.Where(aa => aa.Date >= DateFrom && aa.Date <= DateTo).ToList();
                 _TempBadliList = new List<DailySummary>();
                 title = "Badli Report";
                 if (GlobalVariables.DeploymentType == false)
                     PathString = "/Reports/RDLC/DSWorkSummary.rdlc";
                 else
                     PathString = "/WMS/Reports/RDLC/DSWorkSummary.rdlc";
                 LoadReport(PathString, ReportsFilterImplementation(fm, _TempBadliList, _BadliList), _dateFrom + " TO " + _dateTo);
                 break;
             case "Consolidated":
                 _BadliList = contex.DailySummaries.Where(aa => aa.Date >= DateFrom && aa.Date <= DateTo).ToList();
                 _TempBadliList = new List<DailySummary>();
                 title = "Badli Report";
                 if (GlobalVariables.DeploymentType == false)
                     PathString = "/Reports/RDLC/DSConsolidated.rdlc";
                 else
                     PathString = "/WMS/Reports/RDLC/DSConsolidated.rdlc";
                 LoadReport(PathString, ReportsFilterImplementation(fm, _TempBadliList, _BadliList), _dateFrom + " TO " + _dateTo);
                 break;
         }
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            String reportName = Request.QueryString["reportname"];
            String type = Request.QueryString["type"];
            if (!Page.IsPostBack)
            {
                List<string> list = Session["ReportSession"] as List<string>;
                FiltersModel fm = Session["FiltersModel"] as FiltersModel;
                CreateDataTable();
                User LoggedInUser = HttpContext.Current.Session["LoggedUser"] as User;
                QueryBuilder qb = new QueryBuilder();
                string query = qb.MakeCustomizeQuery(LoggedInUser);
                _dateFrom = list[0];
                string _dateTo = list[1];
                companyimage = GetCompanyImages(fm);
                string PathString = "";
                string consolidatedMonth = "";
                switch (reportName)
                {
                    case "badli_report":
                        DataTable badlidt = qb.GetValuesfromDB("select * from ViewBadli where (AttDate >= " + "'" + _dateFrom + "'" + " and AttDate <= " + "'" + _dateTo + "'" + " )");
                        List<ViewBadli> _BadliList = badlidt.ToList<ViewBadli>();
                        List<ViewBadli> _TempBadliList = new List<ViewBadli>();
                        title = "Badli Report";
                        if (GlobalVariables.DeploymentType == false)
                            PathString = "/Reports/RDLC/BadliReport.rdlc";
                        else
                            PathString = "/WMS/Reports/RDLC/BadliReport.rdlc";
                        LoadReport(PathString, ReportsFilterImplementation(fm, _TempBadliList, _BadliList), _dateFrom + " TO " + _dateTo);
                        break;
                    //please modify the first case
                    case "summarized_monthly_report":
                        List<TASReportDataSet.SummarizedMonthlyReportDataTable> AttDeptdummy = new List<TASReportDataSet.SummarizedMonthlyReportDataTable>().ToList();
                        title = "Department Attendace Summary";
                        if (GlobalVariables.DeploymentType == false)
                            PathString = "/Reports/RDLC/SummarizedMonthlyReport.rdlc";
                        else
                            PathString = "/WMS/Reports/RDLC/SummarizedMonthlyReport.rdlc";

                        LoadReport(PathString, AttDeptdummy, _dateFrom + " TO " + _dateTo);

                        break;
                    case "Employee_Att_Summary_New_report": DataTable dt4  = qb.GetValuesfromDB("select * from ViewAttData " + query + " and Status=1" + " and (AttDate >= " + "'" + _dateFrom + "'" + " and AttDate <= " + "'" + _dateTo + "'" + " )");
                        List<ViewAttData> ListOfAttDate = new List<ViewAttData>();
                        List<ViewAttData> TempList = new List<ViewAttData>();
                        title = "Employee Attendace Summary New";
                        if (GlobalVariables.DeploymentType == false)
                            PathString = "/Reports/RDLC/EmpAttSummaryNew.rdlc";
                        else
                            PathString = "/WMS/Reports/RDLC/EmpAttSummaryNew.rdlc";
                        ListOfAttDate = dt4.ToList<ViewAttData>();
                        TempList = new List<ViewAttData>();

                        LoadReport(PathString, ReportsFilterImplementation(fm, TempList, ListOfAttDate), _dateFrom + " TO " + _dateTo);

                        break;
                    //case "department_attendance_summary": HRReportsMaker hrm = new HRReportsMaker();
                    //    List<AttDeptSummary> AttDept = hrm.GetListForAttDepartmentsSummary(Session["FiltersModel"] as FiltersModel, _dateFrom, _dateTo);
                    //    title = "Department Attendace Summary";
                    //    if (GlobalVariables.DeploymentType == false)
                    //        PathString = "/Reports/RDLC/AttDepartmentSummary.rdlc";
                    //    else
                    //        PathString = "/WMS/Reports/RDLC/AttDepartmentSummary.rdlc";

                    //    LoadReport(PathString, AttDept, _dateFrom + " TO " + _dateTo);

                    //    break;
                    case "emp_record": DataTable dt = qb.GetValuesfromDB("select * from EmpView " + query + " and Status=1 ");
                        List<EmpView> _ViewList = dt.ToList<EmpView>();
                        List<EmpView> _TempViewList = new List<EmpView>();
                        title = "Employee Record Report";
                        if (GlobalVariables.DeploymentType == false)
                            PathString = "/Reports/RDLC/Employee.rdlc";
                        else
                            PathString = "/WMS/Reports/RDLC/Employee.rdlc";

                        LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewList, _ViewList), _dateFrom + " TO " + _dateTo);

                        break;
                    case "emp_record_active": dt = qb.GetValuesfromDB("select * from EmpView " + query+ " and Status=1 ");
                        _ViewList = dt.ToList<EmpView>();
                        _TempViewList = new List<EmpView>();
                        title = "Active Employees Record Report";
                        if (GlobalVariables.DeploymentType == false)
                            PathString = "/Reports/RDLC/Employee.rdlc";
                        else
                            PathString = "/WMS/Reports/RDLC/Employee.rdlc";

                        LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewList, _ViewList), _dateFrom + " TO " + _dateTo);

                        break;
                    case "emp_record_inactive": dt = qb.GetValuesfromDB("select * from EmpView " + query + " and Status=0 ");
                        _ViewList = dt.ToList<EmpView>();
                        _TempViewList = new List<EmpView>();
                        title = "Inactive Employees Record Report";
                        if (GlobalVariables.DeploymentType == false)
                            PathString = "/Reports/RDLC/Employee.rdlc";
                        else
                            PathString = "/WMS/Reports/RDLC/Employee.rdlc";

                        LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewList, _ViewList), _dateFrom + " TO " + _dateTo);
                        break;
                    case "emp_detail_excel": DataTable dt1 = qb.GetValuesfromDB("select * from EmpView " + query + " and Status=1 ");
                        List<EmpView> _ViewList1 = dt1.ToList<EmpView>();
                        List<EmpView> _TempViewList1 = new List<EmpView>();
                        title = "Employee Detail Report";
                        if (GlobalVariables.DeploymentType == false)
                            PathString = "/Reports/RDLC/EmployeeDetail.rdlc";
                        else
                            PathString = "/WMS/Reports/RDLC/EmployeeDetail.rdlc";
                        LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewList1, _ViewList1), _dateFrom + " TO " + _dateTo);

                        break;
                    case "leave_application": dt1 = qb.GetValuesfromDB("select * from ViewLvApplication " + query + " and (FromDate >= '" + _dateFrom + "' and ToDate <= '" + _dateTo + "' )");
                        List<ViewLvApplication> _ViewListLvApp = dt1.ToList<ViewLvApplication>();
                        List<ViewLvApplication> _TempViewListLvApp = new List<ViewLvApplication>();
                        title = "Leave Application Report";
                        if (GlobalVariables.DeploymentType == false)
                            PathString = "/Reports/RDLC/DRLeave.rdlc";
                        else
                            PathString = "/WMS/Reports/RDLC/DRLeave.rdlc";
                        LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewListLvApp, _ViewListLvApp), _dateFrom + " TO " + _dateTo);

                        break;
                    case "detailed_att": DataTable dt2 = qb.GetValuesfromDB("select * from ViewDetailAttData " + query + " and (AttDate >= " + "'" + _dateFrom + "'" + " and AttDate <= " + "'"
                                                     + _dateTo + "'" + " )");
                        List<ViewDetailAttData> _ViewList2 = dt2.ToList<ViewDetailAttData>();
                        List<ViewDetailAttData> _TempViewList2 = new List<ViewDetailAttData>();
                        title = "Detailed Attendence";
                        if (GlobalVariables.DeploymentType == false)
                            PathString = "/Reports/RDLC/DRdetailed.rdlc";
                        else
                            PathString = "/WMS/Reports/RDLC/DRdetailed.rdlc";

                        LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewList2, _ViewList2), _dateFrom + " TO " + _dateTo);

                        break;
                    case "consolidated_att": DataTable dt3 = qb.GetValuesfromDB("select * from ViewAttData " + query + " and Status=1 " + " and (AttDate >= " + "'" + _dateFrom + "'" + " and AttDate <= " + "'"
                                                     + _dateTo + "'" + " )");
                        List<ViewAttData> _ViewList3 = dt3.ToList<ViewAttData>();
                        List<ViewAttData> _TempViewList3 = new List<ViewAttData>();
                        title = "Consolidated Attendence Report";
                        if (GlobalVariables.DeploymentType == false)
                            PathString = "/Reports/RDLC/DRAttendance.rdlc";
                        else
                            PathString = "/WMS/Reports/RDLC/DRAttendance.rdlc";

                        LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewList3, _ViewList3), _dateFrom + " TO " + _dateTo);

                        break;
                    case "present": DataTable datatable = qb.GetValuesfromDB("select * from ViewAttData " + query + " and Status=1 " + " and (AttDate >= " + "'" + _dateFrom + "'" + " and AttDate <= " + "'"
                                                     + _dateTo + "'" + " )" + " and StatusP = 1 ");
                        List<ViewAttData> _ViewList4 = datatable.ToList<ViewAttData>();
                        List<ViewAttData> _TempViewList4 = new List<ViewAttData>();
                        title = "Present Employee Report";
                        if (GlobalVariables.DeploymentType == false)
                            PathString = "/Reports/RDLC/DRPresent.rdlc";
                        else
                            PathString = "/WMS/Reports/RDLC/DRPresent.rdlc";

                        LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewList4, _ViewList4), _dateFrom + " TO " + _dateTo);

                        break;
                    case "absent": DataTable dt5 = qb.GetValuesfromDB("select * from ViewAttData " + query + " and Status=1 " + " and (AttDate >= " + "'" + _dateFrom + "'" + " and AttDate <= " + "'"
                                                     + _dateTo + "'" + " )" + " and StatusAB = 1 ");
                        List<ViewAttData> _ViewList5 = dt5.ToList<ViewAttData>();
                        List<ViewAttData> _TempViewList5 = new List<ViewAttData>();
                        title = "Absent Employee Report";
                        if (GlobalVariables.DeploymentType == false)
                            PathString = "/Reports/RDLC/DRAbsent.rdlc";
                        else
                            PathString = "/WMS/Reports/RDLC/DRAbsent.rdlc";

                        LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewList5, _ViewList5), _dateFrom + " TO " + _dateTo);

                        break;
                    case "lv_application": DataTable dt6 = qb.GetValuesfromDB("select * from ViewAttData " + query + " and Status=1 " + " and (AttDate >= " + "'" + _dateFrom + "'" + " and AttDate <= " + "'"
                                                + _dateTo + "'" + " )" + " and (StatusLeave=1 OR StatusHL=1)");
                        List<ViewAttData> _ViewList6 = dt6.ToList<ViewAttData>();
                        List<ViewAttData> _TempViewList6 = new List<ViewAttData>();
                        title = "Leave Attendence Report";
                        if (GlobalVariables.DeploymentType == false)
                            PathString = "/Reports/RDLC/DRAbsent.rdlc";
                        else
                            PathString = "/WMS/Reports/RDLC/DRAbsent.rdlc";

                        //LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewList6, _ViewList6), _dateFrom + " TO " + _dateTo);
                        //To-do Develop Leave Attendance Report
                        break;
                    case "short_lv": DataTable dt7 = qb.GetValuesfromDB("select * from ViewAttData " + query + " and Status=1 " + " and (AttDate >= " + "'" + _dateFrom + "'" + " and AttDate <= " + "'"
                                                     + _dateTo + "'" + " )" + " and StatusSL=1");
                        List<ViewAttData> _ViewList7 = dt7.ToList<ViewAttData>();
                        List<ViewAttData> _TempViewList7 = new List<ViewAttData>();
                        title = "Short Leave Report";
                        if (GlobalVariables.DeploymentType == false)
                            PathString = "/Reports/RDLC/DRShortLeave.rdlc";
                        else
                            PathString = "/WMS/Reports/RDLC/DRShortLeave.rdlc";

                        LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewList7, _ViewList7), _dateFrom + " TO " + _dateTo);

                        break;
                    case "late_in": DataTable dt8 = qb.GetValuesfromDB("select * from ViewAttData " + query + " and Status=1 " + " and (AttDate >= " + "'" + _dateFrom + "'" + " and AttDate <= " + "'"
                                                    + _dateTo + "'" + " )" + " and StatusLI=1 ");
                        List<ViewAttData> _ViewList8 = dt8.ToList<ViewAttData>();
                        List<ViewAttData> _TempViewList8 = new List<ViewAttData>();
                        title = "Late In Report";
                        if (GlobalVariables.DeploymentType == false)
                            PathString = "/Reports/RDLC/DRLateIn.rdlc";
                        else
                            PathString = "/WMS/Reports/RDLC/DRLateIn.rdlc";

                        LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewList8, _ViewList8), _dateFrom + " TO " + _dateTo);

                        break;

                    case "late_out": dt = qb.GetValuesfromDB("select * from ViewAttData " + query + " and Status=1 " + " and (AttDate >= " + "'" + _dateFrom + "'" + " and AttDate <= " + "'"
                                            + _dateTo + "'" + " )" + " and StatusLO=1 ");
                        _ViewList8 = dt.ToList<ViewAttData>();
                        _TempViewList8 = new List<ViewAttData>();
                        title = "Late Out Report";
                        if (GlobalVariables.DeploymentType == false)
                            PathString = "/Reports/RDLC/DRLateOut.rdlc";
                        else
                            PathString = "/WMS/Reports/RDLC/DRLateOut.rdlc";
                        LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewList8, _ViewList8), _dateFrom + " TO " + _dateTo);

                        break;

                    case "early_in": dt = qb.GetValuesfromDB("select * from ViewAttData " + query + " and Status=1 " + " and (AttDate >= " + "'" + _dateFrom + "'" + " and AttDate <= " + "'"
                                           + _dateTo + "'" + " )" + " and StatusEI=1 ");
                        _ViewList8 = dt.ToList<ViewAttData>();
                        _TempViewList8 = new List<ViewAttData>();
                        title = "Early In Report";
                        if (GlobalVariables.DeploymentType == false)
                            PathString = "/Reports/RDLC/DREarlyIn.rdlc";
                        else
                            PathString = "/WMS/Reports/RDLC/DREarlyIn.rdlc";
                        LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewList8, _ViewList8), _dateFrom + " TO " + _dateTo);

                        break;
                    case "early_out": dt = qb.GetValuesfromDB("select * from ViewAttData " + query + " and Status=1 " + " and (AttDate >= " + "'" + _dateFrom + "'" + " and AttDate <= " + "'"
                                             + _dateTo + "'" + " )" + " and StatusEO=1 ");
                        _ViewList8 = dt.ToList<ViewAttData>();
                        _TempViewList8 = new List<ViewAttData>();
                        title = "Early Out Report";
                        if (GlobalVariables.DeploymentType == false)
                            PathString = "/Reports/RDLC/DREarlyOut.rdlc";
                        else
                            PathString = "/WMS/Reports/RDLC/DREarlyOut.rdlc";
                        LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewList8, _ViewList8), _dateFrom + " TO " + _dateTo);

                        break;
                    case "overtime": dt = qb.GetValuesfromDB("select * from ViewAttData " + query + " and Status=1 " + " and (AttDate >= " + "'" + _dateFrom + "'" + " and AttDate <= " + "'"
                                         + _dateTo + "'" + " )" + " and StatusOT=1 ");
                        _ViewList8 = dt.ToList<ViewAttData>();
                        _TempViewList8 = new List<ViewAttData>();
                        title = "OverTime Report";
                        if (GlobalVariables.DeploymentType == false)
                            PathString = "/Reports/RDLC/DROverTime.rdlc";
                        else
                            PathString = "/WMS/Reports/RDLC/DROverTime.rdlc";
                        LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewList8, _ViewList8), _dateFrom + " TO " + _dateTo);

                        break;
                    case "missing_attendance": dt = qb.GetValuesfromDB("select * from ViewAttData " + query + " and Status=1 " + " and (AttDate >= " + "'" + _dateFrom + "'" + " and AttDate <= " + "'"
                                                    + _dateTo + "'" + " )" + " and ((TimeIn is null and TimeOut is not null) or (TimeIn is not null and TimeOut is null)) ");

                        _ViewList8 = dt.ToList<ViewAttData>();
                        _TempViewList8 = new List<ViewAttData>();
                        title = "Missing Attendence Report";
                        if (GlobalVariables.DeploymentType == false)
                            PathString = "/Reports/RDLC/DRMissingAtt.rdlc";
                        else
                            PathString = "/WMS/Reports/RDLC/DRMissingAtt.rdlc";
                        LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewList8, _ViewList8), _dateFrom + " TO " + _dateTo);

                        break;
                    case "multiple_in_out": dt = qb.GetValuesfromDB("select * from ViewMultipleInOut " + query + " and Status=1" + " and (AttDate >= " + "'" + _dateFrom + "'" + " and AttDate <= " + "'"
                                                     + _dateTo + "'" + " )" + " and (Tin1 is not null or TOut1 is not null)");
                        //change query for multiple_in_out
                        List<ViewMultipleInOut> _ViewList9 = dt.ToList<ViewMultipleInOut>();
                        List<ViewMultipleInOut> _TempViewList9 = new List<ViewMultipleInOut>();
                        title = "Multiple In/Out Report";
                        if (GlobalVariables.DeploymentType == false)
                            PathString = "/Reports/RDLC/DRMultipleInOut.rdlc";
                        else
                            PathString = "/WMS/Reports/RDLC/DRMultipleInOut.rdlc";
                        LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewList9, _ViewList9), _dateFrom + " TO " + _dateTo);

                        break;

                    case "monthly_leave_sheet": string _period = Convert.ToDateTime(_dateFrom).Month.ToString() + Convert.ToDateTime(_dateFrom).Year.ToString();
                        dt = qb.GetValuesfromDB("select * from EmpView " + query + " and Status=1 ");
                        title = "Monthly Leave Sheet for Permanent Employees";
                        _ViewList1 = dt.ToList<EmpView>();
                        _TempViewList1 = new List<EmpView>();
                        if (GlobalVariables.DeploymentType == false)
                            PathString = "/Reports/RDLC/MLvConsumed.rdlc";
                        else
                            PathString = "/WMS/Reports/RDLC/MLvConsumed.rdlc";
                        int monthfrom = Convert.ToDateTime(_dateFrom).Month;
                        int monthTo = Convert.ToDateTime(_dateTo).Month;
                        //int totalMonths = monthfrom < monthTo ? monthTo : monthfrom;
                        for (int ul = monthfrom > monthTo ? monthTo : monthfrom; ul <= (monthfrom < monthTo ? monthTo : monthfrom); ul++)
                        {
                            LoadReport(PathString, GetLV(ReportsFilterImplementation(fm, _TempViewList1, _ViewList1), 2), ul);

                        }

                        // LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewList1, _ViewList1), _dateFrom);
                        break;

                    case "monthly_21-20": _period = Convert.ToDateTime(_dateFrom).Month.ToString() + Convert.ToDateTime(_dateFrom).Year.ToString();
                        monthfrom = Convert.ToDateTime(_dateFrom).Month;
                        monthTo = Convert.ToDateTime(_dateTo).Month;
                        for (int i = monthfrom; i <= monthTo; i++)
                        {
                            consolidatedMonth = consolidatedMonth + "  Period =" + i + Convert.ToDateTime(_dateFrom).Year.ToString() + " OR";
                        }
                        if (consolidatedMonth.Length > 4)
                            consolidatedMonth = consolidatedMonth.Substring(0, consolidatedMonth.Length - 3);
                        dt = qb.GetValuesfromDB("select * from ViewMonthlyDataPer " + query + " and Status=1 " + " and" + consolidatedMonth);
                        //dt = qb.GetValuesfromDB("select * from ViewMonthlyDataPer " + query + " and Period = " + _period);
                        title = "Monthly Sheet (21st to 20th)";
                        List<ViewMonthlyDataPer> _ViewListMonthlyDataPer = dt.ToList<ViewMonthlyDataPer>();
                        List<ViewMonthlyDataPer> _TempViewListMonthlyDataPer = new List<ViewMonthlyDataPer>();
                        //Change the Paths
                        if (GlobalVariables.DeploymentType == false)
                            PathString = "/Reports/RDLC/MRSheetP.rdlc";
                        else
                            PathString = "/WMS/Reports/RDLC/MRSheetP.rdlc";
                        LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewListMonthlyDataPer, _ViewListMonthlyDataPer), _dateFrom);
                        break;

                    case "monthly_1-31": _period = Convert.ToDateTime(_dateFrom).Month.ToString() + Convert.ToDateTime(_dateFrom).Year.ToString();
                        monthfrom = Convert.ToDateTime(_dateFrom).Month;
                        monthTo = Convert.ToDateTime(_dateTo).Month;
                        for (int i = monthfrom; i <= monthTo; i++)
                        {
                            consolidatedMonth = consolidatedMonth + "  Period =" + i + Convert.ToDateTime(_dateFrom).Year.ToString() + " OR";
                        }
                        if (consolidatedMonth.Length > 4)
                            consolidatedMonth = consolidatedMonth.Substring(0, consolidatedMonth.Length - 3);
                        dt = qb.GetValuesfromDB("select * from ViewMonthlyData " + query + " and Status=1" + " and" + consolidatedMonth);
                        //dt = qb.GetValuesfromDB("select * from ViewMonthlyData " + query + " and Period = " + _period);
                        title = "Monthly Sheet (1st to 31st)";
                        List<ViewMonthlyData> _ViewListMonthlyData = dt.ToList<ViewMonthlyData>();
                        List<ViewMonthlyData> _TempViewListMonthlyData = new List<ViewMonthlyData>();
                        //Change the Paths
                        if (GlobalVariables.DeploymentType == false)
                            PathString = "/Reports/RDLC/MRSheetC.rdlc";
                        else
                            PathString = "/WMS/Reports/RDLC/MRSheetC.rdlc";
                        LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewListMonthlyData, _ViewListMonthlyData), _dateFrom);
                        break;

                    case "monthlysummary_21-20": _period = Convert.ToDateTime(_dateFrom).Month.ToString() + Convert.ToDateTime(_dateFrom).Year.ToString();
                        monthfrom = Convert.ToDateTime(_dateFrom).Month;
                        monthTo = Convert.ToDateTime(_dateTo).Month;
                        for (int i = monthfrom; i <= monthTo; i++)
                        {
                            consolidatedMonth = consolidatedMonth + "  Period =" + i + Convert.ToDateTime(_dateFrom).Year.ToString() + " OR";
                        }
                        if (consolidatedMonth.Length > 4)
                            consolidatedMonth = consolidatedMonth.Substring(0, consolidatedMonth.Length - 3);
                        dt = qb.GetValuesfromDB("select * from ViewMonthlyDataPer " + query + " and Status=1" + " and" + consolidatedMonth);
                        //dt = qb.GetValuesfromDB("select * from ViewMonthlyDataPer " + query + " and Period = " + _period);
                        title = "Monthly Summary Report (21st to 20th)";
                        _ViewListMonthlyDataPer = dt.ToList<ViewMonthlyDataPer>();
                        _TempViewListMonthlyDataPer = new List<ViewMonthlyDataPer>();
                        //Change the Paths
                        if (GlobalVariables.DeploymentType == false)
                            PathString = "/Reports/RDLC/MRSummary.rdlc";
                        else
                            PathString = "/WMS/Reports/RDLC/MRSummary.rdlc";
                        LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewListMonthlyDataPer, _ViewListMonthlyDataPer), _dateFrom);
                        break;
                    case "monthlysummary_1-31": _period = Convert.ToDateTime(_dateFrom).Month.ToString() + Convert.ToDateTime(_dateFrom).Year.ToString();
                        monthfrom = Convert.ToDateTime(_dateFrom).Month;
                        monthTo = Convert.ToDateTime(_dateTo).Month;
                        for (int i = monthfrom; i <= monthTo; i++)
                        {
                            consolidatedMonth = consolidatedMonth + "  Period =" + i + Convert.ToDateTime(_dateFrom).Year.ToString() + " OR";
                        }
                        if (consolidatedMonth.Length > 4)
                            consolidatedMonth = consolidatedMonth.Substring(0, consolidatedMonth.Length - 3);
                        dt = qb.GetValuesfromDB("select * from ViewMonthlyData " + query + " and Status=1" + " and" + consolidatedMonth);
                        //dt = qb.GetValuesfromDB("select * from ViewMonthlyDataPer " + query + " and Period = " + _period);
                        title = "Monthly Summary (1st to 31st)";
                        _ViewListMonthlyData = dt.ToList<ViewMonthlyData>();
                        _TempViewListMonthlyData = new List<ViewMonthlyData>();
                        //Change the Paths
                        if (GlobalVariables.DeploymentType == false)
                            PathString = "/Reports/RDLC/MRSummaryC.rdlc";
                        else
                            PathString = "/WMS/Reports/RDLC/MRSummaryC.rdlc";
                        LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewListMonthlyData, _ViewListMonthlyData), _dateFrom);
                        break;

                    case "monthly_21-20_excel": _period = Convert.ToDateTime(_dateFrom).Month.ToString() + Convert.ToDateTime(_dateFrom).Year.ToString();
                         monthfrom = Convert.ToDateTime(_dateFrom).Month;
                        monthTo = Convert.ToDateTime(_dateTo).Month;
                        for (int i = monthfrom; i <= monthTo; i++)
                        {
                            consolidatedMonth = consolidatedMonth + "  Period =" + i + Convert.ToDateTime(_dateFrom).Year.ToString() + " OR";
                        }
                        if (consolidatedMonth.Length > 4)
                            consolidatedMonth = consolidatedMonth.Substring(0, consolidatedMonth.Length - 3);
                        dt = qb.GetValuesfromDB("select * from ViewMonthlyDataPer " + query + " and Status=1" + " and" + consolidatedMonth);
                        //dt = qb.GetValuesfromDB("select * from ViewMonthlyDataPer " + query + " and Period = " + _period);
                        title = "Monthly Sheet (21st to 20th)";
                        _ViewListMonthlyDataPer = dt.ToList<ViewMonthlyDataPer>();
                        _TempViewListMonthlyDataPer = new List<ViewMonthlyDataPer>();
                        //Change the Paths
                        if (GlobalVariables.DeploymentType == false)
                            PathString = "/Reports/RDLC/MRDetailExcelP.rdlc";
                        else
                            PathString = "/WMS/Reports/RDLC/MRDetailExcelP.rdlc";
                        LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewListMonthlyDataPer, _ViewListMonthlyDataPer), _dateFrom);
                        break;

                    case "monthly_1-31_consolidated": _period = Convert.ToDateTime(_dateFrom).Month.ToString() + Convert.ToDateTime(_dateFrom).Year.ToString();
                        monthfrom = Convert.ToDateTime(_dateFrom).Month;
                        monthTo = Convert.ToDateTime(_dateTo).Month;

                        for (int i = monthfrom; i <= monthTo; i++)
                        {
                            consolidatedMonth = consolidatedMonth + "  Period =" + i + Convert.ToDateTime(_dateFrom).Year.ToString() + " OR";
                        }
                        if (consolidatedMonth.Length > 4)
                            consolidatedMonth = consolidatedMonth.Substring(0, consolidatedMonth.Length - 3);
                        dt = qb.GetValuesfromDB("select * from ViewMonthlyData " + query + " and Status=1" + " and" + consolidatedMonth);
                        title = "Monthly Consolidated Attendance Sheet (1st to 31th)";
                        _ViewListMonthlyData = dt.ToList<ViewMonthlyData>();
                        _TempViewListMonthlyData = new List<ViewMonthlyData>();
                        //Change the Paths
                        if (GlobalVariables.DeploymentType == false)
                            PathString = "/Reports/RDLC/MRDetailExcelC.rdlc";
                        else
                            PathString = "/WMS/Reports/RDLC/MRDetailExcelC.rdlc";
                        LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewListMonthlyData, _ViewListMonthlyData), _dateFrom + " to " + _dateTo);
                        break;

                    case "monthly_21-20_consolidated": _period = Convert.ToDateTime(_dateFrom).Month.ToString() + Convert.ToDateTime(_dateFrom).Year.ToString();
                        consolidatedMonth = "";
                        monthfrom = Convert.ToDateTime(_dateFrom).Month;
                        monthTo = Convert.ToDateTime(_dateTo).Month;
                        for (int i = monthfrom; i <= monthTo; i++)
                        {
                            consolidatedMonth = consolidatedMonth + "  Period =" + i + Convert.ToDateTime(_dateFrom).Year.ToString() + " OR";
                        }
                        if (consolidatedMonth.Length > 4)
                            consolidatedMonth = consolidatedMonth.Substring(0, consolidatedMonth.Length - 3);
                        dt = qb.GetValuesfromDB("select * from ViewMonthlyDataPer " + query + " and Status=1" + " and" + consolidatedMonth);
                        title = "Monthly Consolidated (21th to 20th)(Excel)";
                        _ViewListMonthlyDataPer = dt.ToList<ViewMonthlyDataPer>();
                        _TempViewListMonthlyDataPer = new List<ViewMonthlyDataPer>();
                        //Change the Paths
                        if (GlobalVariables.DeploymentType == false)
                            PathString = "/Reports/RDLC/MRDetailExcelP.rdlc";
                        else
                            PathString = "/WMS/Reports/RDLC/MRDetailExcelP.rdlc";
                        LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewListMonthlyDataPer, _ViewListMonthlyDataPer), _dateFrom + " to " + _dateTo);
                        break;
                    case "emp_att": dt = qb.GetValuesfromDB("select * from ViewAttData " + query + " and Status=1" + " and (AttDate >= " + "'" + _dateFrom + "'" + " and AttDate <= " + "'" + _dateTo + "'" + " )");
                        title = "Employee Attendance";
                        _ViewList8 = dt.ToList<ViewAttData>();
                        _TempViewList8 = new List<ViewAttData>();
                        //Change the Paths
                        if (GlobalVariables.DeploymentType == false)
                            PathString = "/Reports/RDLC/EmpAttSummary.rdlc";
                        else
                            PathString = "/WMS/Reports/RDLC/EmpAttSummary.rdlc";
                        LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewList8, _ViewList8), _dateFrom + " TO " + _dateTo);
                        break;

                    case "emp_absent":
                        _period = Convert.ToDateTime(_dateFrom).Month.ToString() + Convert.ToDateTime(_dateFrom).Year.ToString();
                        dt = qb.GetValuesfromDB("select * from ViewAttData " + query + " and Status=1" + " and (AttDate >= " + "'" + _dateFrom + "'" + " and AttDate <= " + "'" + _dateTo + "'" + " )" + " and StatusAB = 1 ");
                        title = "Employee Absent";
                        _ViewListMonthlyDataPer = dt.ToList<ViewMonthlyDataPer>();
                        _TempViewListMonthlyDataPer = new List<ViewMonthlyDataPer>();
                        //Change the Paths

                        if (GlobalVariables.DeploymentType == false)
                            PathString = "/Reports/RDLC/MRSummary.rdlc";
                        else
                            PathString = "/WMS/Reports/RDLC/MRSummary.rdlc";
                        LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewListMonthlyDataPer, _ViewListMonthlyDataPer), _dateFrom);
                        break;
                    case "lv_quota": dt = qb.GetValuesfromDB("select * from EmpView " + query + " and Status=1");
                        _ViewList1 = dt.ToList<EmpView>();
                        _TempViewList1 = new List<EmpView>();
                        if (GlobalVariables.DeploymentType == false)
                            PathString = "/Reports/RDLC/MYLeaveSummary.rdlc";
                        else
                            PathString = "/WMS/Reports/RDLC/MYLeaveSummary.rdlc";
                        LoadReport(PathString, GYL(ReportsFilterImplementation(fm, _TempViewList1, _ViewList1)));
                        // LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewListMonthlyDataPer, _ViewListMonthlyDataPer), _dateFrom);
                        break;
                        /////////////////////////////////////////////////////////////
                        /////////////////Summary Reports////////////////////////////
                        ///////////////////////////////////////////////////////////
                    case "company_consolidated":
                        if (GlobalVariables.DeploymentType == false)
                            PathString = "/Reports/RDLC/DSConsolidated.rdlc";
                        else
                            PathString = "/WMS/Reports/RDLC/DSConsolidated.rdlc";
                        LoadReport(PathString, ReportsFilterImplementation(fm,_dateFrom,_dateTo,"C"), _dateFrom + " TO " + _dateTo,"Company Consolidated Summary");
                        break;
                    case "company_strength":
                        if (GlobalVariables.DeploymentType == false)
                            PathString = "/Reports/RDLC/DSEmpStrength.rdlc";
                        else
                            PathString = "/WMS/Reports/RDLC/DSEmpStrength.rdlc";
                        LoadReport(PathString, ReportsFilterImplementation(fm, _dateFrom, _dateTo, "C"), _dateFrom + " TO " + _dateTo, "Company Strength Summary");
                        break;
                    case "company_worktimes":
                        if (GlobalVariables.DeploymentType == false)
                            PathString = "/Reports/RDLC/DSWorkSummary.rdlc";
                        else
                            PathString = "/WMS/Reports/RDLC/DSWorkSummary.rdlc";
                        LoadReport(PathString, ReportsFilterImplementation(fm, _dateFrom, _dateTo, "C"), _dateFrom + " TO " + _dateTo, "Company Work Times Summary");
                        break;
                    case "location_consolidated":
                        if (GlobalVariables.DeploymentType == false)
                            PathString = "/Reports/RDLC/DSConsolidated.rdlc";
                        else
                            PathString = "/WMS/Reports/RDLC/DSConsolidated.rdlc";
                        ReportsFilterImplementation(fm, _dateFrom, _dateTo, "L");
                        LoadReport(PathString, ReportsFilterImplementation(fm, _dateFrom, _dateTo, "L"), _dateFrom + " TO " + _dateTo, "Location Consolidated Summary");
                        break;
                    case "location_strength":
                        if (GlobalVariables.DeploymentType == false)
                            PathString = "/Reports/RDLC/DSEmpStrength.rdlc";
                        else
                            PathString = "/WMS/Reports/RDLC/DSEmpStrength.rdlc";
                        LoadReport(PathString, ReportsFilterImplementation(fm, _dateFrom, _dateTo, "L"), _dateFrom + " TO " + _dateTo, "Location Strength Summary");
                        break;
                    case "location_worktimes":
                        if (GlobalVariables.DeploymentType == false)
                            PathString = "/Reports/RDLC/DSWorkSummary.rdlc";
                        else
                            PathString = "/WMS/Reports/RDLC/DSWorkSummary.rdlc";
                        LoadReport(PathString, ReportsFilterImplementation(fm, _dateFrom, _dateTo, "L"), _dateFrom + " TO " + _dateTo, "Location Work Times Summary");
                        break;
                    case "shift_consolidated":
                        if (GlobalVariables.DeploymentType == false)
                            PathString = "/Reports/RDLC/DSConsolidated.rdlc";
                        else
                            PathString = "/WMS/Reports/RDLC/DSConsolidated.rdlc";
                        LoadReport(PathString, ReportsFilterImplementation(fm, _dateFrom, _dateTo, "S"), _dateFrom + " TO " + _dateTo, "Shift Consolidated Summary");
                        break;
                    case "shift_strength":
                        if (GlobalVariables.DeploymentType == false)
                            PathString = "/Reports/RDLC/DSEmpStrength.rdlc";
                        else
                            PathString = "/WMS/Reports/RDLC/DSEmpStrength.rdlc";
                        LoadReport(PathString, ReportsFilterImplementation(fm, _dateFrom, _dateTo, "S"), _dateFrom + " TO " + _dateTo, "Shift Strength Summary");
                        break;
                    case "shift_worktimes":
                        if (GlobalVariables.DeploymentType == false)
                            PathString = "/Reports/RDLC/DSWorkSummary.rdlc";
                        else
                            PathString = "/WMS/Reports/RDLC/DSWorkSummary.rdlc";
                        LoadReport(PathString, ReportsFilterImplementation(fm, _dateFrom, _dateTo, "S"), _dateFrom + " TO " + _dateTo, "Shift Work Times Summary");
                        break;
                    case "category_consolidated":
                        if (GlobalVariables.DeploymentType == false)
                            PathString = "/Reports/RDLC/DSConsolidated.rdlc";
                        else
                            PathString = "/WMS/Reports/RDLC/DSConsolidated.rdlc";
                        LoadReport(PathString, ReportsFilterImplementation(fm, _dateFrom, _dateTo, "A"), _dateFrom + " TO " + _dateTo, "Category Consolidated Summary");
                        break;
                    case "category_strength":
                        if (GlobalVariables.DeploymentType == false)
                            PathString = "/Reports/RDLC/DSEmpStrength.rdlc";
                        else
                            PathString = "/WMS/Reports/RDLC/DSEmpStrength.rdlc";
                        LoadReport(PathString, ReportsFilterImplementation(fm, _dateFrom, _dateTo, "A"), _dateFrom + " TO " + _dateTo, "Category Strength Summary");
                        break;
                    case "category_worktimes":
                        if (GlobalVariables.DeploymentType == false)
                            PathString = "/Reports/RDLC/DSWorkSummary.rdlc";
                        else
                            PathString = "/WMS/Reports/RDLC/DSWorkSummary.rdlc";
                        LoadReport(PathString, ReportsFilterImplementation(fm, _dateFrom, _dateTo, "A"), _dateFrom + " TO " + _dateTo, "Category Work Times Summary");
                        break;
                    case "type_consolidated":
                        if (GlobalVariables.DeploymentType == false)
                            PathString = "/Reports/RDLC/DSConsolidated.rdlc";
                        else
                            PathString = "/WMS/Reports/RDLC/DSConsolidated.rdlc";
                        LoadReport(PathString, ReportsFilterImplementation(fm, _dateFrom, _dateTo, "T"), _dateFrom + " TO " + _dateTo, "Employee Type Consolidated Summary");
                        break;
                    case "type_strength":
                        if (GlobalVariables.DeploymentType == false)
                            PathString = "/Reports/RDLC/DSEmpStrength.rdlc";
                        else
                            PathString = "/WMS/Reports/RDLC/DSEmpStrength.rdlc";
                        LoadReport(PathString, ReportsFilterImplementation(fm, _dateFrom, _dateTo, "T"), _dateFrom + " TO " + _dateTo, "Employee Type Strength Summary");
                        break;
                    case "type_worktimes":
                        if (GlobalVariables.DeploymentType == false)
                            PathString = "/Reports/RDLC/DSWorkSummary.rdlc";
                        else
                            PathString = "/WMS/Reports/RDLC/DSWorkSummary.rdlc";
                        LoadReport(PathString, ReportsFilterImplementation(fm, _dateFrom, _dateTo, "T"), _dateFrom + " TO " + _dateTo, "Employee Type Work Times Summary");
                        break;
                    case "dept_consolidated":
                        if (GlobalVariables.DeploymentType == false)
                            PathString = "/Reports/RDLC/DSConsolidated.rdlc";
                        else
                            PathString = "/WMS/Reports/RDLC/DSConsolidated.rdlc";
                        LoadReport(PathString, ReportsFilterImplementation(fm, _dateFrom, _dateTo, "D"), _dateFrom + " TO " + _dateTo, "Department Consolidated Summary");
                        break;
                    case "dept_strength":
                        if (GlobalVariables.DeploymentType == false)
                            PathString = "/Reports/RDLC/DSEmpStrength.rdlc";
                        else
                            PathString = "/WMS/Reports/RDLC/DSEmpStrength.rdlc";
                        LoadReport(PathString, ReportsFilterImplementation(fm, _dateFrom, _dateTo, "D"), _dateFrom + " TO " + _dateTo, "Department Strength Summary");
                        break;
                    case "dept_worktimes":
                        if (GlobalVariables.DeploymentType == false)
                            PathString = "/Reports/RDLC/DSWorkSummary.rdlc";
                        else
                            PathString = "/WMS/Reports/RDLC/DSWorkSummary.rdlc";
                        LoadReport(PathString, ReportsFilterImplementation(fm, _dateFrom, _dateTo, "D"), _dateFrom + " TO " + _dateTo, "Department Work Times Summary");
                        break;
                    case "section_consolidated":
                        if (GlobalVariables.DeploymentType == false)
                            PathString = "/Reports/RDLC/DSConsolidated.rdlc";
                        else
                            PathString = "/WMS/Reports/RDLC/DSConsolidated.rdlc";
                        LoadReport(PathString, ReportsFilterImplementation(fm, _dateFrom, _dateTo, "E"), _dateFrom + " TO " + _dateTo, "Section Consolidated Summary");
                        break;
                    case "section_strength":
                        if (GlobalVariables.DeploymentType == false)
                            PathString = "/Reports/RDLC/DSEmpStrength.rdlc";
                        else
                            PathString = "/WMS/Reports/RDLC/DSEmpStrength.rdlc";
                        LoadReport(PathString, ReportsFilterImplementation(fm, _dateFrom, _dateTo, "E"), _dateFrom + " TO " + _dateTo, "Section Strength Summary");
                        break;
                    case "section_worktimes":
                        if (GlobalVariables.DeploymentType == false)
                            PathString = "/Reports/RDLC/DSWorkSummary.rdlc";
                        else
                            PathString = "/WMS/Reports/RDLC/DSWorkSummary.rdlc";
                        LoadReport(PathString, ReportsFilterImplementation(fm, _dateFrom, _dateTo, "E"), _dateFrom + " TO " + _dateTo, "Section Work Times Summary");
                        break;

                }

            }
        }
Beispiel #5
0
        /// <summary>
        ///  This function takes FiltersModel and an empty list of AttDeptSummary as input and 
        ///  gives a populated AttDeptSummary as output. If there is any dept selected in the filter
        ///  it will iterate through all the departments if there is no dept selected it will try to
        ///  find all the depts of the company.
        /// </summary>
        /// <param name="fm"> FiltersModel </param>
        /// <param name="attDeptList">Empty List of AttDeptSummary</param>
        /// <returns>Populated List of AttDeptSummary</returns>
        public List<AttDeptSummary> GetListForAttDepartmentsSummary(FiltersModel fm, string _dateFrom,string _dateTo)
        {
            List<AttDeptSummary> attDeptList = new List<AttDeptSummary>();
            TAS2013Entities db = new TAS2013Entities();
               //To get the query from the db
            QueryBuilder qb = new QueryBuilder();
            //Get the Department filters
            List<FiltersAttributes> departments = new List<FiltersAttributes>();

            departments = fm.DepartmentFilter;
            //if more then 0 it means some departments are selected now we iterate over them and see
            //how many employee does one dept has. The table empView is the most suitable db for this case.
            if (departments.Count > 0)
            {
            //do nothing still cater for it in future there might be a need
            }
            //if there is no department list in the filter then first get the company's department and then do the same as above.
            else
            {
            foreach (var comp in fm.CompanyFilter)
            {
            int compID = Convert.ToInt16(comp.ID);
            List<Department> depts = db.Departments.Where(aa => aa.CompanyID == compID).ToList();
            foreach (var dept in depts)
                departments.Add(new FiltersAttributes() { ID=dept.DeptID + "", FilterName=dept.DeptName });

            }
            }
            //NOw run the departments if they are from the department filter or from the company itself

            foreach (var dept in departments)
            {

            DataTable dt = qb.GetValuesfromDB("select * from EmpView where DeptID=" + dept.ID);
            List<EmpView> EmView = dt.ToList<EmpView>();

            //2015-01-24

            foreach (DateTime day in EachDay(Convert.ToDateTime(_dateFrom), Convert.ToDateTime(_dateTo)))
            {
                AttDeptSummary singleInstance = new AttDeptSummary();
                singleInstance.Department = dept.FilterName;
                singleInstance.TotalStrength = EmView.Count();
                singleInstance.Total = singleInstance.TotalStrength;
                singleInstance.Location = EmView.FirstOrDefault().LocName;
                singleInstance.Section = EmView.FirstOrDefault().SectionName;
                singleInstance.Company = EmView.FirstOrDefault().CompName;
                singleInstance.CardSwapped = 0;
                singleInstance.Absent = 0;
                singleInstance.OnLeave = 0;
                string dynamicQueryForEmps = GetDynamicQueryForEmps(EmView);
                string queryForCardSwapped = "select * from AttData where (TimeIn is not null AND AttDate = '" + day + "') AND ";
                string queryForAbsent = "select * from AttData where (StatusAB = 1 AND AttDate = '" + day + "') AND ";
                string queryOnLeave = "select * from AttData where (StatusHL = 1 OR StatusLeave =1  AND StatusSL=1 AND AttDate = '" + day + "') AND ";

                queryForCardSwapped = queryForCardSwapped + dynamicQueryForEmps;

                singleInstance.CardSwapped = qb.GetValuesfromDB(queryForCardSwapped).ToList<AttData>().Count();
                queryForAbsent = queryForAbsent + dynamicQueryForEmps;
                singleInstance.Absent = qb.GetValuesfromDB(queryForAbsent).ToList<AttData>().Count(); queryOnLeave = queryOnLeave + dynamicQueryForEmps;
                singleInstance.OnLeave = qb.GetValuesfromDB(queryOnLeave).ToList<AttData>().Count();

                //foreach (var emp in EmView)
                //{

                //s= singleInstance.CardSwapped + db.AttDatas.Where(aa => aa.TimeIn != null && aa.AttDate == day && aa.EmpID == emp.EmpID).Count();
                //singleInstance.Absent = singleInstance.Absent+ db.AttDatas.Where(aa => aa.StatusAB == true && aa.AttDate == day && aa.EmpID == emp.EmpID).Count();
                //singleInstance.OnLeave = singleInstance.OnLeave + db.AttDatas.Where(aa => (aa.StatusHL == true || aa.StatusLeave == true || aa.StatusSL == true) && aa.AttDate == day && aa.EmpID == emp.EmpID).Count();

                //}
                singleInstance.date = day;
                attDeptList.Add(singleInstance);
            }

            }
            return attDeptList;
        }
        public ActionResult JobCardList(string sortOrder, string searchString, string currentFilter, int? page)
        {
            ViewBag.CurrentSort = sortOrder;
            ViewBag.NameSortParm = String.IsNullOrEmpty(sortOrder) ? "name_desc" : "";
            ViewBag.DesigSortParm = sortOrder == "designation" ? "designation_desc" : "designation";
            ViewBag.SectionSortParm = sortOrder == "section" ? "section_desc" : "section";
            //List<EmpView> emps = new List<EmpView>();
            if (searchString != null)
            {
                page = 1;
            }
            else
            {
                searchString = currentFilter;
            }
            User LoggedInUser = Session["LoggedUser"] as User;
            QueryBuilder qb = new QueryBuilder();
            string query = qb.MakeCustomizeQuery(LoggedInUser);
            DataTable dt = qb.GetValuesfromDB("select * from ViewJobCardApp " + query);
            List<ViewJobCardApp> jobCardsApps = dt.ToList<ViewJobCardApp>();

            // List<EmpView> emps = db.EmpViews.ToList();
            ViewBag.CurrentFilter = searchString;

            if (!String.IsNullOrEmpty(searchString))
            {
                try
                {

                    jobCardsApps = jobCardsApps.Where(s => s.EmpName.ToUpper().Contains(searchString.ToUpper())
                        || s.EmpNo.ToUpper().Contains(searchString.ToUpper()) || s.DesignationName.ToString().Contains(searchString)
                    ).OrderByDescending(aa=>aa.DateCreated).ToList();
                }
                catch (Exception ex)
                {

                    }
            }

            switch (sortOrder)
            {
                case "name_desc":
                    jobCardsApps = jobCardsApps.OrderByDescending(s => s.EmpName).ToList();
                    break;
                case "designation_desc":
                    jobCardsApps = jobCardsApps.OrderByDescending(s => s.DesignationName).ToList();
                    break;
                case "designation":
                    jobCardsApps = jobCardsApps.OrderBy(s => s.DesignationName).ToList();
                    break;
                case "section_desc":
                    jobCardsApps = jobCardsApps.OrderByDescending(s => s.SectionName).ToList();
                    break;
                case "section":
                    jobCardsApps = jobCardsApps.OrderBy(s => s.SectionName).ToList();
                    break;
                default:
                    jobCardsApps = jobCardsApps.OrderBy(s => s.EmpName).ToList();
                    break;
            }
            int pageSize = 10;
            int pageNumber = (page ?? 1);
            return View(jobCardsApps.ToPagedList(pageNumber, pageSize));
        }
        // GET: /Designation/
        public ActionResult Index(string sortOrder, string searchString, string currentFilter, int? page)
        {
            if (Session["LogedUserFullname"].ToString() != "")
            {
            ViewBag.CurrentSort = sortOrder;
            ViewBag.NameSortParm = String.IsNullOrEmpty(sortOrder) ? "name_desc" : "";
            if (searchString != null)
            {
                page = 1;
            }
            else
            {
                searchString = currentFilter;
            }

            ViewBag.CurrentFilter = searchString;
            QueryBuilder qb = new QueryBuilder();

            var designation = db.Designations.AsQueryable();
            if (!String.IsNullOrEmpty(searchString))
            {
                designation = designation.Where(s => s.DesignationName.ToUpper().Contains(searchString.ToUpper()));
            }

            switch (sortOrder)
            {
                case "name_desc":
                    designation = designation.OrderByDescending(s => s.DesignationName);
                    break;
                default:
                    designation = designation.OrderBy(s => s.DesignationName);
                    break;
            }
            int pageSize = 8;
            int pageNumber = (page ?? 1);
            return View(designation.ToPagedList(pageNumber, pageSize));
            }
             else
                 return Redirect(Request.UrlReferrer.ToString());
        }
 private void BindGridViewLocation(string search)
 {
     User LoggedInUser = HttpContext.Current.Session["LoggedUser"] as User;
     QueryBuilder qb = new QueryBuilder();
     string query = qb.QueryForLocationTableSegerationForLinq(LoggedInUser);
     List<Location> _View = da.Locations.Where(query).ToList();
     GridViewLocation.DataSource = _View.Where(aa => aa.LocName.ToUpper().Contains(search.ToUpper())).ToList();
     GridViewLocation.DataBind();
 }
 public ActionResult EditAttJobCard()
 {
     User LoggedInUser = Session["LoggedUser"] as User;
     string Message = "";
     QueryBuilder qb = new QueryBuilder();
     string query = qb.MakeCustomizeQuery(LoggedInUser);
     DataTable dt = qb.GetValuesfromDB("select * from EmpView " + query);
     List<EmpView> emps = dt.ToList<EmpView>();
     try
     {
         string _EmpNo = "";
         // int CompID = Convert.ToInt16(Request.Form["CompanyID"].ToString());
         List<EmpView> _Emp = new List<EmpView>();
         short _WorkCardID = Convert.ToInt16(Request.Form["JobCardType"].ToString());
         //First Save Job Card Application
         JobCardApp jobCardApp = new JobCardApp();
         jobCardApp.CardType = _WorkCardID;
         jobCardApp.DateCreated = DateTime.Now;
         jobCardApp.DateStarted = Convert.ToDateTime(Request.Form["JobDateFrom"]);
         jobCardApp.DateEnded = Convert.ToDateTime(Request.Form["JobDateTo"]);
         jobCardApp.Status = false;
         jobCardApp.UserID = LoggedInUser.UserID;
         _EmpNo = Request.Form["JobEmpNo"];
         _Emp = emps.Where(aa => aa.EmpNo == _EmpNo).ToList();
         if (_Emp.Count > 0)
         {
             jobCardApp.CriteriaData = _Emp.FirstOrDefault().EmpID;
             jobCardApp.JobCardCriteria = "E";
             if (ValidateJobCard(jobCardApp))
             {
                 db.JobCardApps.Add(jobCardApp);
                 if (db.SaveChanges() > 0)
                 {
                     AddJobCardAppToJobCardData();
                     Message = "Job Card Created Sucessfully.";
                 }
             }
             else
                 Message = "Job Card already created for FPID: " + _EmpNo;
         }
         else
             Message = "No Employee found, Please enter a valid FPID";
         //Add Job Card to JobCardData and Mark Legends in Attendance Data if attendance Created
         Session["EditAttendanceDate"] = DateTime.Today.Date.ToString("yyyy-MM-dd");
         ViewData["datef"] = Session["EditAttendanceDate"].ToString();
         ViewData["JobDateFrom"] = DateTime.Today.AddDays(-1).ToString("yyyy-MM-dd");
         ViewData["JobDateTo"] = DateTime.Today.AddDays(-1).ToString("yyyy-MM-dd");
         ViewBag.JobCardType = new SelectList(db.JobCards, "WorkCardID", "WorkCardName");
     }
     catch (Exception ex)
     {
         Message = "An Error occured while creating Job Card of " + Request.Form["JobCardType"].ToString();
     }
         //List<EmpView> emps = new List<EmpView>();
         ViewData["JobDateFrom"] = DateTime.Today.AddDays(-1).ToString("yyyy-MM-dd");
         ViewData["JobDateTo"] = DateTime.Today.AddDays(-1).ToString("yyyy-MM-dd");
         ViewBag.JobCardType = new SelectList(db.JobCards, "WorkCardID", "WorkCardName");
         ViewBag.CMessage = Message;
         ViewBag.CurrentFilter = "";
         int pageSize = 10;
         int? page = 1;
         int pageNumber = (page ?? 1);
     return View("Index",emps.ToPagedList(pageNumber, pageSize));
 }
        // GET: /Emp/
        public ActionResult Index(string sortOrder, string searchString, string currentFilter, int? page)
        {
            ViewBag.CurrentSort = sortOrder;
            ViewBag.NameSortParm = String.IsNullOrEmpty(sortOrder) ? "name_desc" : "";
            ViewBag.DesigSortParm = sortOrder == "designation" ? "designation_desc" : "designation";
            ViewBag.LocSortParm = sortOrder == "location" ? "location_desc" : "location";
            ViewBag.SectionSortParm = sortOrder == "section" ? "section_desc" : "section";
            ViewBag.DepartmentSortParm = sortOrder == "wing" ? "wing_desc" : "wing";
            ViewBag.ShiftSortParm = sortOrder == "shift" ? "shift_desc" : "shift";
            ViewBag.TypeSortParm = sortOrder == "type" ? "type_desc" : "type";
            //List<EmpView> emps = new List<EmpView>();
            if (searchString != null)
            {
                page = 1;
            }
            else
            {
                searchString = currentFilter;
            }
            User LoggedInUser = Session["LoggedUser"] as User;
            QueryBuilder qb = new QueryBuilder();
            string query = qb.MakeCustomizeQuery(LoggedInUser);
            DataTable dt = qb.GetValuesfromDB("select * from EmpView"+query);
            List<EmpView> emps = dt.ToList<EmpView>();

            ViewBag.CurrentFilter = searchString;

            if (!String.IsNullOrEmpty(searchString))
            {
                if (searchString == "Active" || searchString == "active")
                {
                    emps = emps.Where(aa => aa.Status == true).ToList();
                }
                else if (searchString == "Inactive" || searchString == "inactive")
                {
                    emps = emps.Where(aa => aa.Status == false).ToList();
                }
                else
                {
                    try
                    {
                        emps = emps.Where(s => s.EmpName.ToUpper().Contains(searchString.ToUpper())
                         || s.EmpNo.Contains(searchString.ToUpper())
                         || s.SectionName.ToUpper().Contains(searchString.ToUpper())
                         || s.ShiftName.ToUpper().Contains(searchString.ToUpper())
                         || s.DesignationName.ToUpper().Contains(searchString.ToUpper())).ToList();
                    }
                    catch(Exception ex)
                    {

                    }
                }
            }

            switch (sortOrder)
            {
                case "name_desc":
                    emps = emps.OrderByDescending(s => s.EmpName).ToList();
                    break;
                case "designation_desc":
                    emps = emps.OrderByDescending(s => s.DesignationName).ToList();
                    break;
                case "designation":
                    emps = emps.OrderBy(s => s.DesignationName).ToList();
                    break;
                case "location_desc":
                    emps = emps.OrderByDescending(s => s.LocName).ToList();
                    break;
                case "location":
                    emps = emps.OrderBy(s => s.LocName).ToList();
                    break;
                case "section_desc":
                    emps = emps.OrderByDescending(s => s.SectionName).ToList();
                    break;
                case "section":
                    emps = emps.OrderBy(s => s.SectionName).ToList();
                    break;
                //case "wing_desc":
                //    emps = emps.OrderByDescending(s => s.sec.DeptName).ToList();
                //    break;
                //case "wing":
                //    emps = emps.OrderBy(s => s.DeptName).ToList();
                //    break;
                case "shift_desc":
                    emps = emps.OrderByDescending(s => s.ShiftName).ToList();
                    break;
                case "shift":
                    emps = emps.OrderBy(s => s.ShiftName).ToList();
                    break;
                case "type_desc":
                    emps = emps.OrderByDescending(s => s.TypeName).ToList();
                    break;
                case "type":
                    emps = emps.OrderBy(s => s.TypeName).ToList();
                    break;
                default:
                    emps = emps.OrderBy(s => s.EmpName).ToList();
                    break;
            }
            int pageSize = 10;
            int pageNumber = (page ?? 1);
            return View(emps.ToPagedList(pageNumber, pageSize));
            //var emps = db.Emps.Include(e => e.Company).Include(e => e.Crew).Include(e => e.Designation).Include(e => e.Grade).Include(e => e.JobTitle).Include(e => e.Location).Include(e => e.Section).Include(e => e.Shift).Include(e => e.EmpType).Include(e => e.EmpFace).Include(e => e.EmpFp).Include(e => e.LvQuota);
            //return View(emps.ToList());
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            String reportName = Request.QueryString["reportname"];
            if (!Page.IsPostBack)
            {
                List<string> list = Session["ReportSession"] as List<string>;
                FiltersModel fm = Session["FiltersModel"] as FiltersModel;
                CreateDataTable();
                User LoggedInUser = HttpContext.Current.Session["LoggedUser"] as User;
                QueryBuilder qb = new QueryBuilder();
                string query = qb.MakeCustomizeQuery(LoggedInUser);
                _dateFrom = list[0];
                string _dateTo = list[1];

                string PathString = "";

                switch (reportName)
                {
                    case "emp_record":   DataTable dt = qb.GetValuesfromDB("select * from EmpView " + query);
                                        List<EmpView> _ViewList = dt.ToList<EmpView>();
                                        List<EmpView> _TempViewList = new List<EmpView>();
                                        title = "Employee Report";
                                         if (GlobalVariables.DeploymentType == false)
                                                                    PathString = "/Reports/RDLC/Employee.rdlc";
                                                               else
                                                                    PathString = "/WMS/Reports/RDLC/Employee.rdlc";

                                        LoadReport(PathString, ReportsFilterImplementation(fm,_TempViewList, _ViewList) , _dateFrom+" TO "+_dateTo);

                           break;

                    case "emp_detail_excel": DataTable dt1 = qb.GetValuesfromDB("select * from EmpView " + query);
                                               List<EmpView> _ViewList1 = dt1.ToList<EmpView>();
                                               List<EmpView> _TempViewList1 = new List<EmpView>();
                                               title = "Employee Detail Report";
                                               if (GlobalVariables.DeploymentType == false)
                                                   PathString = "/Reports/RDLC/EmployeeDetail.rdlc";
                                               else
                                                   PathString = "/WMS/Reports/RDLC/EmployeeDetail.rdlc";
                                               LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewList1, _ViewList1), _dateFrom + " TO " + _dateTo);

                                                break;
                    case "leave_application": dt1 = qb.GetValuesfromDB("select * from ViewLvApplication " + query + " and (FromDate >= '" + _dateFrom + "' and ToDate <= '" + _dateTo + "' )");
                                               List<ViewLvApplication> _ViewListLvApp = dt1.ToList<ViewLvApplication>();
                                               List<ViewLvApplication> _TempViewListLvApp = new List<ViewLvApplication>();
                                                title = "Leave Application Report";
                                                if (GlobalVariables.DeploymentType == false)
                                                    PathString = "/Reports/RDLC/DRLeave.rdlc";
                                                else
                                                    PathString = "/WMS/Reports/RDLC/EmployeeDetail.rdlc";
                                                LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewListLvApp, _ViewListLvApp), _dateFrom + " TO " + _dateTo);

                                                break;
                    case "detailed_att": DataTable dt2 = qb.GetValuesfromDB("select * from ViewDetailAttData " + query + " and (AttDate >= " + "'" + _dateFrom + "'" + " and AttDate <= " + "'"
                                                     + _dateTo + "'" + " )");
                                                List<ViewDetailAttData> _ViewList2 = dt2.ToList<ViewDetailAttData>();
                                                List<ViewDetailAttData> _TempViewList2 = new List<ViewDetailAttData>();
                                                title = "Detailed Attendence";
                                                if (GlobalVariables.DeploymentType == false)
                                                    PathString = "/Reports/RDLC/DRdetailed.rdlc";
                                                else
                                                    PathString = "/WMS/Reports/RDLC/DRdetailed.rdlc";

                                                LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewList2, _ViewList2), _dateFrom + " TO " + _dateTo);

                                                break;
                    case "consolidated_att": DataTable dt3 = qb.GetValuesfromDB("select * from ViewAttData " + query + " and (AttDate >= " + "'" + _dateFrom + "'" + " and AttDate <= " + "'"
                                                     + _dateTo + "'" + " )" );
                                                List<ViewAttData> _ViewList3 = dt3.ToList<ViewAttData>();
                                                List<ViewAttData> _TempViewList3 = new List<ViewAttData>();
                                                title = "Consolidated Attendence";
                                                if (GlobalVariables.DeploymentType == false)
                                                    PathString = "/Reports/RDLC/DRAttendance.rdlc";
                                                else
                                                    PathString = "/WMS/Reports/RDLC/DRAttendance.rdlc";

                                                LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewList3, _ViewList3), _dateFrom + " TO " + _dateTo);

                                                break;
                    case "present": DataTable dt4 = qb.GetValuesfromDB("select * from ViewAttData " + query + " and (AttDate >= " + "'" + _dateFrom + "'" + " and AttDate <= " + "'"
                                                     + _dateTo + "'" + " )" + " and StatusP = 1 ");
                                                List<ViewAttData> _ViewList4 = dt4.ToList<ViewAttData>();
                                                List<ViewAttData> _TempViewList4 = new List<ViewAttData>();
                                                title = "Present Employee Report";
                                                if (GlobalVariables.DeploymentType == false)
                                                    PathString = "/Reports/RDLC/DRPresent.rdlc";
                                                else
                                                    PathString = "/WMS/Reports/RDLC/DRPresent.rdlc";

                                                LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewList4, _ViewList4), _dateFrom + " TO " + _dateTo);

                                                break;
                    case "absent": DataTable dt5 = qb.GetValuesfromDB("select * from ViewAttData " + query + " and (AttDate >= " + "'" + _dateFrom + "'" + " and AttDate <= " + "'"
                                                     + _dateTo + "'" + " )" +" and StatusAB = 1 ");
                                                List<ViewAttData> _ViewList5 = dt5.ToList<ViewAttData>();
                                                List<ViewAttData> _TempViewList5 = new List<ViewAttData>();
                                                title = "Absent Employee Report";
                                                if (GlobalVariables.DeploymentType == false)
                                                    PathString = "/Reports/RDLC/DRAbsent.rdlc";
                                                else
                                                    PathString = "/WMS/Reports/RDLC/DRAbsent.rdlc";

                                                LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewList5, _ViewList5), _dateFrom + " TO " + _dateTo);

                                                break;
                    case "lv_application":      DataTable dt6 = qb.GetValuesfromDB("select * from ViewAttData " + query + " and (AttDate >= " + "'" + _dateFrom + "'" + " and AttDate <= " + "'"
                                                     + _dateTo + "'" + " )" + " and (StatusLeave=1 OR StatusHL=1)");
                                                List<ViewAttData> _ViewList6 = dt6.ToList<ViewAttData>();
                                                List<ViewAttData> _TempViewList6 = new List<ViewAttData>();
                                                title = "Leave Attendence Report";
                                                if (GlobalVariables.DeploymentType == false)
                                                    PathString = "/Reports/RDLC/DRAbsent.rdlc";
                                                else
                                                    PathString = "/WMS/Reports/RDLC/DRAbsent.rdlc";

                                                //LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewList6, _ViewList6), _dateFrom + " TO " + _dateTo);
                                              //To-do Develop Leave Attendance Report
                                                break;
                    case "short_lv": DataTable dt7 = qb.GetValuesfromDB("select * from ViewAttData " + query + " and (AttDate >= " + "'" + _dateFrom + "'" + " and AttDate <= " + "'"
                                                     + _dateTo + "'" + " )" + " and StatusSL=1");
                                                List<ViewAttData> _ViewList7 = dt7.ToList<ViewAttData>();
                                                List<ViewAttData> _TempViewList7 = new List<ViewAttData>();
                                                title = "Short Leave Report";
                                                if (GlobalVariables.DeploymentType == false)
                                                    PathString = "/Reports/RDLC/DRShortLeave.rdlc";
                                                else
                                                    PathString = "/WMS/Reports/RDLC/DRShortLeave.rdlc";

                                                LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewList7, _ViewList7), _dateFrom + " TO " + _dateTo);

                                                break;
                    case "late_in": DataTable dt8 = qb.GetValuesfromDB("select * from ViewAttData " + query + " and (AttDate >= " + "'" + _dateFrom + "'" + " and AttDate <= " + "'"
                                                    + _dateTo + "'" + " )" + " and StatusLI=1 ");
                                                List<ViewAttData> _ViewList8 = dt8.ToList<ViewAttData>();
                                                List<ViewAttData> _TempViewList8 = new List<ViewAttData>();
                                                title = "Late In Report";
                                                if (GlobalVariables.DeploymentType == false)
                                                    PathString = "/Reports/RDLC/DRLateIn.rdlc";
                                                else
                                                    PathString = "/WMS/Reports/RDLC/DRLateIn.rdlc";

                                                LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewList8, _ViewList8), _dateFrom + " TO " + _dateTo);

                                                break;

                    case "late_out":        dt = qb.GetValuesfromDB("select * from ViewAttData " + query + " and (AttDate >= " + "'" + _dateFrom + "'" + " and AttDate <= " + "'"
                                                   + _dateTo + "'" + " )" + " and StatusLO=1 ");
                                                _ViewList8 = dt.ToList<ViewAttData>();
                                                _TempViewList8 = new List<ViewAttData>();
                                                title = "Late Out Report";
                                                if (GlobalVariables.DeploymentType == false)
                                                    PathString = "/Reports/RDLC/DRLateOut.rdlc";
                                                else
                                                    PathString = "/WMS/Reports/RDLC/DRLateOut.rdlc";
                                               LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewList8, _ViewList8), _dateFrom + " TO " + _dateTo);

                                                break;

                    case "early_in":          dt = qb.GetValuesfromDB("select * from ViewAttData " + query + " and (AttDate >= " + "'" + _dateFrom + "'" + " and AttDate <= " + "'"
                                                    + _dateTo + "'" + " )" + " and StatusEI=1 ");
                                                _ViewList8 = dt.ToList<ViewAttData>();
                                                _TempViewList8 = new List<ViewAttData>();
                                                title = "Early In Report";
                                                if (GlobalVariables.DeploymentType == false)
                                                    PathString = "/Reports/RDLC/DREarlyIn.rdlc";
                                                else
                                                    PathString = "/WMS/Reports/RDLC/DREarlyIn.rdlc";
                                                LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewList8, _ViewList8), _dateFrom + " TO " + _dateTo);

                                                break;
                    case "early_out":         dt = qb.GetValuesfromDB("select * from ViewAttData " + query + " and (AttDate >= " + "'" + _dateFrom + "'" + " and AttDate <= " + "'"
                                                     + _dateTo + "'" + " )" + " and StatusEO=1 ");
                                                _ViewList8 = dt.ToList<ViewAttData>();
                                                _TempViewList8 = new List<ViewAttData>();
                                                title = "Early Out Report";
                                                if (GlobalVariables.DeploymentType == false)
                                                    PathString = "/Reports/RDLC/DREarlyOut.rdlc";
                                                else
                                                    PathString = "/WMS/Reports/RDLC/DREarlyOut.rdlc";
                                                LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewList8, _ViewList8), _dateFrom + " TO " + _dateTo);

                                                break;
                    case "overtime":           dt = qb.GetValuesfromDB("select * from ViewAttData " + query + " and (AttDate >= " + "'" + _dateFrom + "'" + " and AttDate <= " + "'"
                                                   + _dateTo + "'" + " )" + " and StatusOT=1 ");
                                                _ViewList8 = dt.ToList<ViewAttData>();
                                                _TempViewList8 = new List<ViewAttData>();
                                                title = "OverTime Report";
                                                if (GlobalVariables.DeploymentType == false)
                                                    PathString = "/Reports/RDLC/DROverTime.rdlc";
                                                else
                                                    PathString = "/WMS/Reports/RDLC/DROverTime.rdlc";
                                                LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewList8, _ViewList8), _dateFrom + " TO " + _dateTo);

                                                break;
                    case "missing_attendance": dt = qb.GetValuesfromDB("select * from ViewAttData " + query + " and (AttDate >= " + "'" + _dateFrom + "'" + " and AttDate <= " + "'"
                                                    + _dateTo + "'" + " )" + " and ((TimeIn is null and TimeOut is not null) or (TimeIn is not null and TimeOut is null)) ");

                                                _ViewList8 = dt.ToList<ViewAttData>();
                                                _TempViewList8 = new List<ViewAttData>();
                                                title = "Missing Attendence";
                                                if (GlobalVariables.DeploymentType == false)
                                                    PathString = "/Reports/RDLC/DRMissingAtt.rdlc";
                                                else
                                                    PathString = "/WMS/Reports/RDLC/DRMissingAtt.rdlc";
                                                LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewList8, _ViewList8), _dateFrom + " TO " + _dateTo);

                                                break;
                    case "multiple_in_out": dt = qb.GetValuesfromDB("select * from ViewMultipleInOut " + query + " and (AttDate >= " + "'" + _dateFrom + "'" + " and AttDate <= " + "'"
                                                     + _dateTo + "'" + " )" + " and (Tin1 is not null or TOut1 is not null)");
                                                //change query for multiple_in_out
                                                List<ViewMultipleInOut> _ViewList9 = dt.ToList<ViewMultipleInOut>();
                                                List<ViewMultipleInOut> _TempViewList9 = new List<ViewMultipleInOut>();
                                                title = "Multiple In/Out Report";
                                                if (GlobalVariables.DeploymentType == false)
                                                    PathString = "/Reports/RDLC/DRMultipleInOut.rdlc";
                                                else
                                                    PathString = "/WMS/Reports/RDLC/DRMultipleInOut.rdlc";
                                                LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewList9, _ViewList9), _dateFrom + " TO " + _dateTo);

                                                break;

                    case "monthly_leave_sheet": string _period = Convert.ToDateTime(_dateFrom).Month.ToString() + Convert.ToDateTime(_dateFrom).Year.ToString();
                                                dt = qb.GetValuesfromDB("select * from EmpView " + query);
                                                title = "Monthly Leave Sheet for Permanent Employees";
                                                _ViewList1 = dt.ToList<EmpView>();
                                                _TempViewList1 = new List<EmpView>();
                                                if (GlobalVariables.DeploymentType == false)
                                                    PathString = "/Reports/RDLC/MLvConsumed.rdlc";
                                                else
                                                    PathString = "/WMS/Reports/RDLC/MLvConsumed.rdlc";
                                                int month = Convert.ToDateTime(_dateFrom).Month;
                                                LoadReport(PathString,GetLV(ReportsFilterImplementation(fm, _TempViewList1, _ViewList1) ,2),month);
                                               // LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewList1, _ViewList1), _dateFrom);
                                                break;

                    case "monthly_21-20":       _period = Convert.ToDateTime(_dateFrom).Month.ToString() + Convert.ToDateTime(_dateFrom).Year.ToString();
                                                dt = qb.GetValuesfromDB("select * from ViewMonthlyDataPer " + query + " and Period = " + _period);
                                                title = "Monthly Sheet for Permanent Employees(21st to 20th)";
                                                List<ViewMonthlyDataPer> _ViewListMonthlyDataPer = dt.ToList<ViewMonthlyDataPer>();
                                                List<ViewMonthlyDataPer> _TempViewListMonthlyDataPer = new List<ViewMonthlyDataPer>();
                                                //Change the Paths
                                                if (GlobalVariables.DeploymentType == false)
                                                    PathString = "/Reports/RDLC/MRSheetP.rdlc";
                                                else
                                                    PathString = "/WMS/Reports/RDLC/MRSheetP.rdlc";
                                                LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewListMonthlyDataPer, _ViewListMonthlyDataPer), _dateFrom);
                                                break;

                    case "monthly_1-31":         _period = Convert.ToDateTime(_dateFrom).Month.ToString() + Convert.ToDateTime(_dateFrom).Year.ToString();
                                                dt = qb.GetValuesfromDB("select * from ViewMonthlyData " + query + " and Period = " + _period);
                                                title = "Monthly Sheet for Permanent Employees(1st to 31st)";
                                                List<ViewMonthlyData> _ViewListMonthlyData = dt.ToList<ViewMonthlyData>();
                                                List<ViewMonthlyData> _TempViewListMonthlyData = new List<ViewMonthlyData>();
                                                //Change the Paths
                                                if (GlobalVariables.DeploymentType == false)
                                                    PathString = "/Reports/RDLC/MRSheetC.rdlc";
                                                else
                                                    PathString = "/WMS/Reports/RDLC/MRSheetC.rdlc";
                                                LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewListMonthlyData, _ViewListMonthlyData), _dateFrom);
                                                break;

                    case "monthlysummary_21-20": _period = Convert.ToDateTime(_dateFrom).Month.ToString() + Convert.ToDateTime(_dateFrom).Year.ToString();
                                                dt = qb.GetValuesfromDB("select * from ViewMonthlyDataPer " + query + " and Period = " + _period);
                                                title = "Monthly Summary for Permanent Employees(21st to 20th)";
                                                _ViewListMonthlyDataPer = dt.ToList<ViewMonthlyDataPer>();
                                                _TempViewListMonthlyDataPer = new List<ViewMonthlyDataPer>();
                                                //Change the Paths
                                                if (GlobalVariables.DeploymentType == false)
                                                    PathString = "/Reports/RDLC/MRSummary.rdlc";
                                                else
                                                    PathString = "/WMS/Reports/RDLC/MRSummary.rdlc";
                                                LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewListMonthlyDataPer, _ViewListMonthlyDataPer), _dateFrom);
                                                break;
                    case "monthlysummary_1-31": _period = Convert.ToDateTime(_dateFrom).Month.ToString() + Convert.ToDateTime(_dateFrom).Year.ToString();
                                                dt = qb.GetValuesfromDB("select * from ViewMonthlyDataPer " + query + " and Period = " + _period);
                                                title = "Monthly Summary for Permanent Employees(1st to 31st)";
                                                _ViewListMonthlyData = dt.ToList<ViewMonthlyData>();
                                                _TempViewListMonthlyData = new List<ViewMonthlyData>();
                                                //Change the Paths
                                                if (GlobalVariables.DeploymentType == false)
                                                    PathString = "/Reports/RDLC/MRSummaryC.rdlc";
                                                else
                                                    PathString = "/WMS/Reports/RDLC/MRSummaryC.rdlc";
                                                LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewListMonthlyData, _ViewListMonthlyData), _dateFrom);
                                                break;

                    case "monthly_21-20_excel": _period = Convert.ToDateTime(_dateFrom).Month.ToString() + Convert.ToDateTime(_dateFrom).Year.ToString();
                                                dt = qb.GetValuesfromDB("select * from ViewMonthlyDataPer " + query + " and Period = " + _period);
                                                title = "Monthly Sheet for Permanent Employees(21st to 20th)";
                                                _ViewListMonthlyDataPer = dt.ToList<ViewMonthlyDataPer>();
                                                _TempViewListMonthlyDataPer = new List<ViewMonthlyDataPer>();
                                                //Change the Paths
                                                if (GlobalVariables.DeploymentType == false)
                                                    PathString = "/Reports/RDLC/MRDetailExcelP.rdlc";
                                                else
                                                    PathString = "/WMS/Reports/RDLC/MRDetailExcelP.rdlc";
                                                LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewListMonthlyDataPer, _ViewListMonthlyDataPer), _dateFrom);
                                                break;

                    case "monthly_1-31_consolidated": _period = Convert.ToDateTime(_dateFrom).Month.ToString() + Convert.ToDateTime(_dateFrom).Year.ToString();
                                                      dt = qb.GetValuesfromDB("select * from ViewMonthlyData " + query + " and Period = " + _period);
                                                         title = "Monthly Consolidated (1st to 31th)";
                                                        List<ViewMonthlyData> VMLD =new List<ViewMonthlyData>();
                                                        VMLD = dt.ToList<ViewMonthlyData>();
                                                         _TempViewListMonthlyData = new List<ViewMonthlyData>();
                                                //Change the Paths
                                                if (GlobalVariables.DeploymentType == false)
                                                    PathString = "/Reports/RDLC/MRDetailExcelC.rdlc";
                                                else
                                                    PathString = "/WMS/Reports/RDLC/MRDetailExcelC.rdlc";
                                                LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewListMonthlyData, VMLD), _dateFrom);
                                                break;

                    case "monthly_21-20_consolidated": _period = Convert.ToDateTime(_dateFrom).Month.ToString() + Convert.ToDateTime(_dateFrom).Year.ToString();
                                                                   dt = qb.GetValuesfromDB("select * from ViewMonthlyDataPer " + query + " and Period = " + _period);
                                                         title = "Monthly Consolidated (21th to 20th)(Excel)";
                                                        _ViewListMonthlyDataPer = dt.ToList<ViewMonthlyDataPer>();
                                                        _TempViewListMonthlyDataPer = new List<ViewMonthlyDataPer>();
                                                         //Change the Paths
                                                         if (GlobalVariables.DeploymentType == false)
                                                             PathString = "/Reports/RDLC/MRDetailExcelP.rdlc";
                                                          else
                                                             PathString = "/WMS/Reports/RDLC/MRDetailExcelP.rdlc";
                                                          LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewListMonthlyDataPer, _ViewListMonthlyDataPer), _dateFrom);
                                                         break;
                    case "emp_att":                      dt = qb.GetValuesfromDB("select * from ViewAttData " + query + " and (AttDate >= " + "'" + _dateFrom + "'" + " and AttDate <= " + "'"
                                                        + _dateTo + "'" + " )");
                                                          title = "Employee Attendance";
                                                          _ViewList8 = dt.ToList<ViewAttData>();
                                                          _TempViewList8 = new List<ViewAttData>();
                                                         //Change the Paths
                                                         if (GlobalVariables.DeploymentType == false)
                                                             PathString = "/Reports/RDLC/EmpAttSummary.rdlc";
                                                         else
                                                             PathString = "/WMS/Reports/RDLC/EmpAttSummary.rdlc";
                                                         LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewList8, _ViewList8), _dateFrom + " TO " + _dateTo);
                                                         break;

                    case "emp_absent":
                                                       _period = Convert.ToDateTime(_dateFrom).Month.ToString() + Convert.ToDateTime(_dateFrom).Year.ToString();
                                                         dt = qb.GetValuesfromDB("select * from ViewAttData " + query + " and (AttDate >= " + "'" + _dateFrom + "'" + " and AttDate <= " + "'"
                                                        + _dateTo + "'" + " )" + " and StatusAB = 1 ");
                                                         title = "Employee Absent";
                                                         _ViewListMonthlyDataPer = dt.ToList<ViewMonthlyDataPer>();
                                                         _TempViewListMonthlyDataPer = new List<ViewMonthlyDataPer>();
                                                         //Change the Paths

                                                         if (GlobalVariables.DeploymentType == false)
                                                             PathString = "/Reports/RDLC/MRSummary.rdlc";
                                                         else
                                                             PathString = "/WMS/Reports/RDLC/MRSummary.rdlc";
                                                         LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewListMonthlyDataPer, _ViewListMonthlyDataPer), _dateFrom);
                                                         break;
                    case "lv_quota":                     dt = qb.GetValuesfromDB("select * from EmpView " + query);
                                                           _ViewList1 = dt.ToList<EmpView>();
                                                          _TempViewList1 = new List<EmpView>();
                                                        if (GlobalVariables.DeploymentType == false)
                                                             PathString = "/Reports/RDLC/MYLeaveSummary.rdlc";
                                                         else
                                                            PathString = "/WMS/Reports/RDLC/MYLeaveSummary.rdlc";
                                                         LoadReport(PathString, GYL(ReportsFilterImplementation(fm, _TempViewList1, _ViewList1)));
                                                        // LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewListMonthlyDataPer, _ViewListMonthlyDataPer), _dateFrom);
                                                         break;

                }

            }
        }
        //
        // GET: /Zones/
        public ActionResult Index(string sortOrder, string searchString, string currentFilter, int? page)
        {
            ViewBag.CurrentSort = sortOrder;
            ViewBag.NameSortParm = String.IsNullOrEmpty(sortOrder) ? "name_desc" : "";
            if (searchString != null)
            {
                page = 1;
            }
            else
            {
                searchString = currentFilter;
            }

            ViewBag.CurrentFilter = searchString;
            User LoggedInUser = HttpContext.Session["LoggedUser"] as User;
            QueryBuilder qb = new QueryBuilder();
            string query = qb.QueryForUserAccess(LoggedInUser, "Zone");
            DataTable dt = qb.GetValuesfromDB("Select * FROM Zone where " + query);
            var zone = dt.ToList<Zone>().AsQueryable();

            if (!String.IsNullOrEmpty(searchString))
            {
                zone = zone.Where(s => s.ZoneName.ToUpper().Contains(searchString.ToUpper()));
            }

            switch (sortOrder)
            {
                case "name_desc":
                    zone = zone.OrderByDescending(s => s.ZoneName);
                    break;
                default:
                    zone = zone.OrderBy(s => s.ZoneName);
                    break;
            }
            int pageSize = 8;
            int pageNumber = (page ?? 1);
            return View(zone.ToPagedList(pageNumber, pageSize));
        }
Beispiel #13
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         DivGridSection.Visible = false;
         DivGridCrew.Visible = false;
         DivGridDept.Visible = false;
         DivGridEmp.Visible = false;
         DivShiftGrid.Visible = false;
         DivLocGrid.Visible = false;
         DivTypeGrid.Visible = false;
         ReportViewer1.Visible = true;
         ReportViewer1.Width = 1050;
         ReportViewer1.Height = 700;
         SelectedTypes.Clear();
         SelectedCrews.Clear();
         SelectedDepts.Clear();
         SelectedEmps.Clear();
         SelectedLocs.Clear();
         SelectedSections.Clear();
         SelectedShifts.Clear();
         RefreshLabels();
         LoadGridViews();
         if (GlobalVariables.DeploymentType == false)
         {
             PathString = "/Reports/RDLC/YLvConsumed.rdlc";
         }
         else
             PathString = "/WMS/Reports/RDLC/YLvConsumed.rdlc";
         User LoggedInUser = HttpContext.Current.Session["LoggedUser"] as User;
         QueryBuilder qb = new QueryBuilder();
         string query = qb.MakeCustomizeQuery(LoggedInUser);
         DataTable dt = qb.GetValuesfromDB("select * from ViewLvConsumed " + query);
         List<ViewLvConsumed> _ViewList = dt.ToList<ViewLvConsumed>();
         LoadReport(PathString, _ViewList);
     }
 }
Beispiel #14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {

                DateTime date = DateTime.Today.Date.AddDays(-1);
                if (GlobalVariables.DeploymentType == false)
                {
                    PathString = "/Reports/RDLC/DRDetailed.rdlc";
                }
                else
                    PathString = "/WMS/Reports/RDLC/DRDetailed.rdlc";
                //List<ViewMultipleInOut> _View = new List<ViewMultipleInOut>();
                User LoggedInUser = HttpContext.Current.Session["LoggedUser"] as User;
                QueryBuilder qb = new QueryBuilder();
                string query = qb.MakeCustomizeQuery(LoggedInUser);
                DataTable dt = qb.GetValuesfromDB("select * from ViewMultipleInOut " + query +" and AttDate = '"+ date.Date.Year.ToString()+"-"+date.Date.Month.ToString()+"-"+date.Date.Day.ToString()+"'");
                List<ViewMultipleInOut> _View = dt.ToList<ViewMultipleInOut>();
                LoadReport(PathString, _View);
            }
        }
Beispiel #15
0
        protected void btnGenerateReport_Click(object sender, EventArgs e)
        {
            ReportViewer1.Visible = true;
            //List<ViewMultipleInOut> _ViewList = new List<ViewMultipleInOut>();
            List<ViewMultipleInOut> _TempViewList = new List<ViewMultipleInOut>();
            User LoggedInUser = HttpContext.Current.Session["LoggedUser"] as User;
            QueryBuilder qb = new QueryBuilder();
            string query = qb.MakeCustomizeQuery(LoggedInUser);
            string _dateTo = "'"+DateTo.Date.Year.ToString() + "-" + DateTo.Date.Month.ToString() + "-" + DateTo.Date.Day.ToString()+"'";
            string _dateFrom = "'" + DateFrom.Date.Year.ToString() + "-" + DateFrom.Date.Month.ToString() + "-" + DateFrom.Date.Day.ToString() + "'";
            DataTable dt = qb.GetValuesfromDB("select * from ViewMultipleInOut " + query + " and (AttDate >= "+_dateFrom+" and AttDate <= "+_dateTo+" )" );
            List<ViewMultipleInOut> _ViewList = dt.ToList<ViewMultipleInOut>();

            if (GlobalVariables.DeploymentType == false)
            {
                PathString = "/Reports/RDLC/DRDetailed.rdlc";
            }
            else
                PathString = "/WMS/Reports/RDLC/DRDetailed.rdlc";
            LoadReport(PathString, _ViewList);
        }
 private void BindGridViewType(string search)
 {
     FiltersModel fm = Session["FiltersModel"] as FiltersModel;
     List<ViewEmpType> _View = new List<ViewEmpType>();
     List<ViewEmpType> _TempView = new List<ViewEmpType>();
     User LoggedInUser = HttpContext.Current.Session["LoggedUser"] as User;
     QueryBuilder qb = new QueryBuilder();
     string query = qb.QueryForCompanyViewForLinq(LoggedInUser);
     DataTable dt = qb.GetValuesfromDB("select * from ViewEmpType where " + query);
     _View = dt.ToList<ViewEmpType>();
     if (fm.CompanyFilter.Count > 0)
     {
         foreach (var comp in fm.CompanyFilter)
         {
             short _compID = Convert.ToInt16(comp.ID);
             _TempView.AddRange(_View.Where(aa => aa.CompanyID == _compID).ToList());
         }
         _View = _TempView.ToList();
     }
     GridViewType.DataSource = _View.Where(aa => aa.TypeName.ToUpper().Contains(search.ToUpper())).ToList();
     GridViewType.DataBind();
 }
Beispiel #17
0
        protected void btnGenerateReport_Click(object sender, EventArgs e)
        {
            RefreshLabels();
            DivGridSection.Visible = false;
            DivGridCrew.Visible = false;
            DivGridDept.Visible = false;
            DivGridEmp.Visible = false;
            DivShiftGrid.Visible = false;
            DivLocGrid.Visible = false;
            DivTypeGrid.Visible = false;
            ReportViewer1.Visible = true;
            DivGridComapny.Visible = false;
            DivGridComapny.Visible = false;
            List<ViewAttData> _TempViewList = new List<ViewAttData>();

            User LoggedInUser = HttpContext.Current.Session["LoggedUser"] as User;
            QueryBuilder qb = new QueryBuilder();
            string query = qb.MakeCustomizeQuery(LoggedInUser);
            string _dateTo = "'" + DateTo.Date.Year.ToString() + "-" + DateTo.Date.Month.ToString() + "-" + DateTo.Date.Day.ToString() + "'";
            string _dateFrom = "'" + DateFrom.Date.Year.ToString() + "-" + DateFrom.Date.Month.ToString() + "-" + DateFrom.Date.Day.ToString() + "'";
            DataTable dt = qb.GetValuesfromDB("select * from ViewAttData " + query + " and (AttDate >= " + _dateFrom + " and AttDate <= " + _dateTo + " )" + " and ( StatusOT=1 " + "or StatusGZOT = 1) ");

            List<ViewAttData> _ViewList = dt.ToList<ViewAttData>();
            //_ViewList = context.ViewAttDatas.Where(aa => aa.AttDate >= DateFrom.Date && aa.AttDate <= DateTo.Date && (aa.StatusOT == true || aa.StatusGZOT == true)).ToList();
            if (SelectedEmps.Count > 0)
            {
                foreach (var emp in SelectedEmps)
                {
                    _TempViewList.AddRange(_ViewList.Where(aa => aa.EmpID == emp.EmpID).ToList());
                }
                _ViewList = _TempViewList.ToList();
            }
            else
                _TempViewList = _ViewList.ToList();

            _TempViewList.Clear();
            //for department
            if (SelectedDepts.Count > 0)
            {
                foreach (var dept in SelectedDepts)
                {
                    _TempViewList.AddRange(_ViewList.Where(aa => aa.DeptName == dept.DeptName).ToList());
                }
                _ViewList = _TempViewList.ToList();
            }
            else
                _TempViewList = _ViewList.ToList();
            _TempViewList.Clear();

            //for company
            if (SelectedComps.Count > 0)
            {
                foreach (var comp in SelectedComps)
                {
                    _TempViewList.AddRange(_ViewList.Where(aa => aa.CompName == comp.CompName).ToList());
                }
                _ViewList = _TempViewList.ToList();
            }
            else
                _TempViewList = _ViewList.ToList();
            _TempViewList.Clear();

            //for sections
            if (SelectedSections.Count > 0)
            {
                foreach (var sec in SelectedSections)
                {
                    _TempViewList.AddRange(_ViewList.Where(aa => aa.SectionName == sec.SectionName).ToList());
                }
                _ViewList = _TempViewList.ToList();
            }
            else
                _TempViewList = _ViewList.ToList();

            _TempViewList.Clear();

            //for crews
            if (SelectedCrews.Count > 0)
            {
                foreach (var cre in SelectedCrews)
                {
                    _TempViewList.AddRange(_ViewList.Where(aa => aa.CrewName == cre.CrewName).ToList());
                }
                _ViewList = _TempViewList.ToList();
            }
            else
                _TempViewList = _ViewList.ToList();
            _TempViewList.Clear();

            //for location
            if (SelectedLocs.Count > 0)
            {
                foreach (var loc in SelectedLocs)
                {
                    _TempViewList.AddRange(_ViewList.Where(aa => aa.LocName == loc.LocName).ToList());
                }
                _ViewList = _TempViewList.ToList();
            }
            else
                _TempViewList = _ViewList.ToList();
            _TempViewList.Clear();

            //for shifts
            if (SelectedShifts.Count > 0)
            {
                foreach (var shift in SelectedShifts)
                {
                    _TempViewList.AddRange(_ViewList.Where(aa => aa.ShiftName == shift.ShiftName).ToList());
                }
                _ViewList = _TempViewList.ToList();
            }
            else
                _TempViewList = _ViewList.ToList();

            _TempViewList.Clear();

            //for category
            if (SelectedTypes.Count > 0)
            {
                foreach (var cat in SelectedTypes)
                {
                    _TempViewList.AddRange(_ViewList.Where(aa => aa.TypeName == cat.TypeName).ToList());
                }
                _ViewList = _TempViewList.ToList();
            }
            else
                _TempViewList = _ViewList.ToList();
            _TempViewList.Clear();
            if (GlobalVariables.DeploymentType == false)
            {
                PathString = "/Reports/RDLC/DROverTime.rdlc";
            }
            else
                PathString = "/WMS/Reports/RDLC/DROverTime.rdlc";
            LoadReport(PathString, _ViewList);
        }
Beispiel #18
0
        // GET: /Shift/
        public ActionResult Index(string sortOrder, string searchString, string currentFilter, int? page)
        {
            ViewBag.CurrentSort = sortOrder;
            ViewBag.NameSortParm = String.IsNullOrEmpty(sortOrder) ? "name_desc" : "";
            if (searchString != null)
            {
                page = 1;
            }
            else
            {
                searchString = currentFilter;
            }

            ViewBag.CurrentFilter = searchString;
            User LoggedInUser = Session["LoggedUser"] as User;
            QueryBuilder qb = new QueryBuilder();
            string query = qb.QueryForLocationSegeration(LoggedInUser);
            DataTable dt = qb.GetValuesfromDB("select * from Shift " + query);
            List<Shift> shift1 = dt.ToList<Shift>();
            var shift = shift1.AsQueryable();

            if (!String.IsNullOrEmpty(searchString))
            {
                shift = shift.Where(s => s.ShiftName.ToUpper().Contains(searchString.ToUpper()));
            }

            switch (sortOrder)
            {
                case "name_desc":
                    shift = shift.OrderByDescending(s => s.ShiftName);
                    break;
                default:
                    shift = shift.OrderBy(s => s.ShiftName);
                    break;
            }
            int pageSize = 8;
            int pageNumber = (page ?? 1);
            return View(shift.ToPagedList(pageNumber, pageSize));
        }
Beispiel #19
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         DivGridSection.Visible = false;
         DivGridCrew.Visible = false;
         DivGridDept.Visible = false;
         DivGridEmp.Visible = false;
         DivShiftGrid.Visible = false;
         DivLocGrid.Visible = false;
         DivTypeGrid.Visible = false;
         ReportViewer1.Visible = true;
         ReportViewer1.Width = 1050;
         ReportViewer1.Height = 700;
         DivGridComapny.Visible = false;
         SelectedComps.Clear();
         SelectedTypes.Clear();
         SelectedCrews.Clear();
         SelectedDepts.Clear();
         SelectedEmps.Clear();
         SelectedLocs.Clear();
         SelectedSections.Clear();
         SelectedShifts.Clear();
         LoadGridViews();
         RefreshLabels();
         DateTime date = DateTime.Today.Date;
         if (GlobalVariables.DeploymentType == false)
         {
             PathString = "/Reports/RDLC/DROverTime.rdlc";
         }
         else
             PathString = "/WMS/Reports/RDLC/DROverTime.rdlc";
         User LoggedInUser = HttpContext.Current.Session["LoggedUser"] as User;
         QueryBuilder qb = new QueryBuilder();
         string query = qb.MakeCustomizeQuery(LoggedInUser);
         DataTable dt = qb.GetValuesfromDB("select * from ViewAttData " + query + " and AttDate = '" + date.Date.Year.ToString() + "-" + date.Date.Month.ToString() + "-" + date.Date.Day.ToString() + "'" + " and ( StatusOT=1 or StatusGZOT = 1 ) ");
         List<ViewAttData> _View = dt.ToList<ViewAttData>();
         LoadReport(PathString, _View);
     }
 }
Beispiel #20
0
        public ActionResult ShiftList()
        {
            QueryBuilder qb = new QueryBuilder();
            User LoggedInUser = Session["LoggedUser"] as User;
            qb.QueryForShiftForLinq(LoggedInUser);
            //var type;
            //if (HttpContext.Request.IsAjaxRequest())
            //    return Json(new SelectList(
            //                    types.ToArray(),
            //                    "ShiftID",
            //                    "ShiftName")
            //               , JsonRequestBehavior.AllowGet);

            return RedirectToAction("Index");
        }
Beispiel #21
0
 private void BindGridView(string search)
 {
     User LoggedInUser = HttpContext.Current.Session["LoggedUser"] as User;
     QueryBuilder qb = new QueryBuilder();
     string query = qb.QueryForCompanyViewLinq(LoggedInUser);
     List<Company> _View = da.Companies.Where(query).ToList();
     GridViewCompany.DataSource = _View.Where(aa => aa.CompName.ToUpper().Contains(search.ToUpper())).ToList();
     GridViewCompany.DataBind();
 }
Beispiel #22
0
 private void LoadSectionGrid(User _loggedUser)
 {
     QueryBuilder qb = new QueryBuilder();
     string query = qb.QueryForCompanySegeration(_loggedUser);
     DataTable dt = qb.GetValuesfromDB("select * from ViewSection " + query);
     List<ViewSection> _View = dt.ToList<ViewSection>();
     grid_Section.DataSource = _View;
     grid_Section.DataBind();
 }
 private void BindGridViewEmployee(string search)
 {
     FiltersModel fm = Session["FiltersModel"] as FiltersModel;
     List<EmpView> _View = new List<EmpView>();
     List<EmpView> _TempView = new List<EmpView>();
     User LoggedInUser = HttpContext.Current.Session["LoggedUser"] as User;
     QueryBuilder qb = new QueryBuilder();
     string query = qb.QueryForCompanyFilters(LoggedInUser);
     DataTable dt = qb.GetValuesfromDB("select * from EmpView " + query);
     _View = dt.ToList<EmpView>().AsQueryable().SortBy("EmpNo").ToList();
     if (fm.CompanyFilter.Count > 0)
     {
         foreach (var comp in fm.CompanyFilter)
         {
             short _compID = Convert.ToInt16(comp.ID);
             _TempView.AddRange(_View.Where(aa => aa.CompanyID == _compID).ToList());
         }
         _View = _TempView.ToList();
     }
     if (fm.DivisionFilter.Count > 0)
     {
         _TempView.Clear();
         foreach (var comp in fm.DivisionFilter)
         {
             short _compID = Convert.ToInt16(comp.ID);
             _TempView.AddRange(_View.Where(aa => aa.DivID == _compID).ToList());
         }
         _View = _TempView.ToList();
     }
     if (fm.DepartmentFilter.Count > 0)
     {
         _TempView.Clear();
         foreach (var comp in fm.DepartmentFilter)
         {
             short _compID = Convert.ToInt16(comp.ID);
             _TempView.AddRange(_View.Where(aa => aa.DeptID == _compID).ToList());
         }
         _View = _TempView.ToList();
     }
     if (fm.SectionFilter.Count > 0)
     {
         _TempView.Clear();
         foreach (var comp in fm.SectionFilter)
         {
             short _compID = Convert.ToInt16(comp.ID);
             _TempView.AddRange(_View.Where(aa => aa.SecID == _compID).ToList());
         }
         _View = _TempView.ToList();
     }
     if (fm.TypeFilter.Count > 0)
     {
         _TempView.Clear();
         foreach (var comp in fm.TypeFilter)
         {
             short _compID = Convert.ToInt16(comp.ID);
             _TempView.AddRange(_View.Where(aa => aa.TypeID == _compID).ToList());
         }
         _View = _TempView.ToList();
     }
     if (fm.LocationFilter.Count > 0)
     {
         _TempView.Clear();
         foreach (var comp in fm.LocationFilter)
         {
             short _compID = Convert.ToInt16(comp.ID);
             _TempView.AddRange(_View.Where(aa => aa.LocID == _compID).ToList());
         }
         _View = _TempView.ToList();
     }
     if (fm.ShiftFilter.Count > 0)
     {
         _TempView.Clear();
         foreach (var comp in fm.ShiftFilter)
         {
             short _compID = Convert.ToInt16(comp.ID);
             _TempView.AddRange(_View.Where(aa => aa.ShiftID == _compID).ToList());
         }
         _View = _TempView.ToList();
     }
     if (fm.CrewFilter.Count > 0)
     {
         _TempView.Clear();
         foreach (var comp in fm.CrewFilter)
         {
             short _compID = Convert.ToInt16(comp.ID);
             _TempView.AddRange(_View.Where(aa => aa.CrewID == _compID).ToList());
         }
         _View = _TempView.ToList();
     }
     GridViewEmployee.DataSource = _View.Where(aa => aa.EmpName.ToUpper().Contains(search.ToUpper()) ||aa.EmpNo.ToUpper().Contains(search.ToUpper())).ToList();
     GridViewEmployee.DataBind();
 }
 private void BindGridViewDepartment(string search)
 {
     FiltersModel fm = Session["FiltersModel"] as FiltersModel;
     List<ViewDepartment> _View = new List<ViewDepartment>();
     List<ViewDepartment> _TempView = new List<ViewDepartment>();
     User LoggedInUser = HttpContext.Current.Session["LoggedUser"] as User;
     QueryBuilder qb = new QueryBuilder();
     //string query = qb.QueryForCompanyFilters(LoggedInUser);
     DataTable dt = qb.GetValuesfromDB("select * from ViewDepartment order by DeptName asc");
     _View = dt.ToList<ViewDepartment>();
     //if (fm.CompanyFilter.Count > 0)
     //{
     //    foreach (var comp in fm.CompanyFilter)
     //    {
     //        short _compID = Convert.ToInt16(comp.ID);
     //        _TempView.AddRange(_View.Where(aa => aa.CompID == _compID).ToList());
     //    }
     //    _View = _TempView.ToList();
     //}
     if (fm.DivisionFilter.Count > 0)
     {
         _TempView.Clear();
         foreach (var div in fm.DivisionFilter)
         {
             short _divID = Convert.ToInt16(div.ID);
             _TempView.AddRange(_View.Where(aa => aa.DivID == _divID).ToList());
         }
         _View = _TempView.ToList();
     }
     GridViewWing.DataSource = _View.Where(aa => aa.DeptName.ToUpper().Contains(search.ToUpper())).ToList();
     GridViewWing.DataBind();
 }
Beispiel #25
0
 private void LoadEmpGrid(User _loggedUser)
 {
     QueryBuilder qb = new QueryBuilder();
     string query = qb.MakeCustomizeQuery(_loggedUser);
     DataTable dt = qb.GetValuesfromDB("select * from EmpView " + query + " and (Status=1)");
     List<EmpView> _View = dt.ToList<EmpView>();
     grid_Employee.DataSource = _View;
     grid_Employee.DataBind();
 }
        // GET: /JobCard/
        public ActionResult Index(string sortOrder, string searchString, string currentFilter, int? page)
        {
            ViewBag.CurrentSort = sortOrder;
            ViewBag.NameSortParm = String.IsNullOrEmpty(sortOrder) ? "name_desc" : "";
            ViewBag.DesigSortParm = sortOrder == "designation" ? "designation_desc" : "designation";
            ViewBag.LocSortParm = sortOrder == "location" ? "location_desc" : "location";
            ViewBag.SectionSortParm = sortOrder == "section" ? "section_desc" : "section";
            ViewBag.DepartmentSortParm = sortOrder == "wing" ? "wing_desc" : "wing";
            ViewBag.ShiftSortParm = sortOrder == "shift" ? "shift_desc" : "shift";
            ViewBag.TypeSortParm = sortOrder == "type" ? "type_desc" : "type";
            //List<EmpView> emps = new List<EmpView>();
            if (searchString != null)
            {
                page = 1;
            }
            else
            {
                searchString = currentFilter;
            }
            User LoggedInUser = Session["LoggedUser"] as User;
            QueryBuilder qb = new QueryBuilder();
            string query = qb.MakeCustomizeQuery(LoggedInUser);
            DataTable dt = qb.GetValuesfromDB("select * from EmpView " + query);
            List<EmpView> emps = dt.ToList<EmpView>();

            // List<EmpView> emps = db.EmpViews.ToList();
            ViewBag.CurrentFilter = searchString;

            if (!String.IsNullOrEmpty(searchString))
            {
                if (searchString == "Active" || searchString == "active")
                {
                    emps = emps.Where(aa => aa.Status == true).ToList();
                }
                else if (searchString == "Inactive" || searchString == "inactive")
                {
                    emps = emps.Where(aa => aa.Status == false).ToList();
                }
                else
                {
                    try
                    {

                        emps = emps.Where(s => s.EmpName.ToUpper().Contains(searchString.ToUpper())
                         || s.EmpNo.ToUpper().Contains(searchString.ToUpper()) || s.DesignationName.ToString().Contains(searchString)
                        ).ToList();
                    }
                    catch (Exception ex)
                    {

                    }
                }
            }

            switch (sortOrder)
            {
                case "name_desc":
                    emps = emps.OrderByDescending(s => s.EmpName).ToList();
                    break;
                case "designation_desc":
                    emps = emps.OrderByDescending(s => s.DesignationName).ToList();
                    break;
                case "designation":
                    emps = emps.OrderBy(s => s.DesignationName).ToList();
                    break;
                case "location_desc":
                    emps = emps.OrderByDescending(s => s.LocName).ToList();
                    break;
                case "location":
                    emps = emps.OrderBy(s => s.LocName).ToList();
                    break;
                case "section_desc":
                    emps = emps.OrderByDescending(s => s.SectionName).ToList();
                    break;
                case "section":
                    emps = emps.OrderBy(s => s.SectionName).ToList();
                    break;
                case "wing_desc":
                    emps = emps.OrderByDescending(s => s.DeptName).ToList();
                    break;
                case "wing":
                    emps = emps.OrderBy(s => s.DeptName).ToList();
                    break;
                case "shift_desc":
                    emps = emps.OrderByDescending(s => s.ShiftName).ToList();
                    break;
                case "shift":
                    emps = emps.OrderBy(s => s.ShiftName).ToList();
                    break;
                case "type_desc":
                    emps = emps.OrderByDescending(s => s.TypeName).ToList();
                    break;
                case "type":
                    emps = emps.OrderBy(s => s.TypeName).ToList();
                    break;
                default:
                    emps = emps.OrderBy(s => s.EmpName).ToList();
                    break;
            }
            int pageSize = 10;
            int pageNumber = (page ?? 1);
            ViewData["JobDateFrom"] = DateTime.Today.AddDays(-1).ToString("yyyy-MM-dd");
            ViewData["JobDateTo"] = DateTime.Today.AddDays(-1).ToString("yyyy-MM-dd");
            ViewBag.JobCardType = new SelectList(db.JobCards, "WorkCardID", "WorkCardName");
            return View(emps.ToPagedList(pageNumber, pageSize));
        }
        // GET: /Crew/
        public ActionResult Index(string sortOrder, string searchString, string currentFilter, int? page)
        {
            ViewBag.CurrentSort = sortOrder;
            ViewBag.NameSortParm = String.IsNullOrEmpty(sortOrder) ? "name_desc" : "";
            if (searchString != null)
            {
                page = 1;
            }
            else
            {
                searchString = currentFilter;
            }

            ViewBag.CurrentFilter = searchString;
            User LoggedInUser = Session["LoggedUser"] as User;
            QueryBuilder qb = new QueryBuilder();
            string query = qb.QueryForCompanyViewForLinq(LoggedInUser);
            var crew = db.Crews.AsQueryable();
            if (!String.IsNullOrEmpty(searchString))
            {
                crew = crew.Where(s => s.CrewName.ToUpper().Contains(searchString.ToUpper()));
            }

            switch (sortOrder)
            {
                case "name_desc":
                    crew = crew.OrderByDescending(s => s.CrewName);
                    break;
                default:
                    crew = crew.OrderBy(s => s.CrewName);
                    break;
            }
            int pageSize = 8;
            int pageNumber = (page ?? 1);
            return View(crew.ToPagedList(pageNumber, pageSize));
        }
        // GET: /LvShort/
        public ActionResult Index(string sortOrder, string searchString, string currentFilter, int? page)
        {
            User LoggedInUser = Session["LoggedUser"] as User;
            ViewBag.CurrentSort = sortOrder;
            ViewBag.NameSortParm = String.IsNullOrEmpty(sortOrder) ? "name_desc" : "";
            ViewBag.TypeSortParm = sortOrder == "LvType" ? "LvType_desc" : "LvType";
            ViewBag.DateSortParm = sortOrder == "Date" ? "Date_desc" : "Date";
            if (searchString != null)
            {
                page = 1;
            }
            else
            {
                searchString = currentFilter;
            }
            QueryBuilder qb = new QueryBuilder();
            string query = qb.QueryForUserAccess(LoggedInUser, qb.CheckForUserRole(LoggedInUser));

            DateTime dt1 = DateTime.Today;
            DateTime dt2 = new DateTime(dt1.Year, 1, 1);
            string date = dt2.Year.ToString() + "-" + dt2.Month.ToString() + "-" + dt2.Day.ToString() + " ";
            DataTable dt = qb.GetValuesfromDB("select * from ViewSLData where " + query);
            List<ViewSLData> lvapplications = dt.ToList<ViewSLData>();

            ViewBag.CurrentFilter = searchString;
            //var lvapplications = db.LvApplications.Where(aa=>aa.ToDate>=dt2).Include(l => l.Emp).Include(l => l.LvType1);
            if (!String.IsNullOrEmpty(searchString))
            {
                lvapplications = lvapplications.Where(s => s.EmpName.ToUpper().Contains(searchString.ToUpper())
                     || s.EmpNo.ToUpper().Contains(searchString.ToUpper())).ToList();
            }

            switch (sortOrder)
            {
                case "name_desc":
                    lvapplications = lvapplications.OrderByDescending(s => s.EmpName).ToList();
                    break;
                case "Date_desc":
                    lvapplications = lvapplications.OrderByDescending(s => s.DutyDate).ToList();
                    break;
                case "Date":
                    lvapplications = lvapplications.OrderBy(s => s.DutyDate).ToList();
                    break;
                default:
                    lvapplications = lvapplications.OrderBy(s => s.EmpName).ToList();
                    break;
            }
            int pageSize = 10;
            int pageNumber = (page ?? 1);
            return View(lvapplications.OrderByDescending(aa => aa.DutyDate).ToPagedList(pageNumber, pageSize));
        }
 private void BindGridViewLocation(string search)
 {
     FiltersModel fm = Session["FiltersModel"] as FiltersModel;
     List<Location> _View = new List<Location>();
     List<Location> _TempView = new List<Location>();
     TAS2013Entities db = new TAS2013Entities();
     User LoggedInUser = HttpContext.Current.Session["LoggedUser"] as User;
     QueryBuilder qb = new QueryBuilder();
     string query = qb.QueryForLocReport(LoggedInUser);
     List<City> city = db.Cities.ToList();
     DataTable dt = qb.GetValuesfromDB("select * from Location " + query+" order by LocName asc");
     _View = dt.ToList<Location>();
     if (fm.RegionFilter.Count > 0)
     {
         _TempView.Clear();
         foreach (var region in fm.RegionFilter)
         {
             short regionID = Convert.ToInt16(region.ID);
             foreach (var c in city.Where(aa => aa.RegionID == regionID))
             {
                 _TempView.AddRange(_View.Where(aa => aa.CityID == c.CityID).ToList());
             }
         }
         _View = _TempView.ToList();
     }
     if (fm.CityFilter.Count > 0)
     {
         _TempView.Clear();
         foreach (var citi in fm.CityFilter)
         {
             short _compID = Convert.ToInt16(citi.ID);
             _TempView.AddRange(_View.Where(aa => aa.CityID == _compID).ToList());
         }
         _View = _TempView.ToList();
     }
     GridViewLocation.DataSource = _View.Where(aa => aa.LocName.ToUpper().Contains(search.ToUpper())).ToList();
     GridViewLocation.DataBind();
 }
        private List<DailySummary> ReportsFilterImplementation(FiltersModel fm,string dateFrom,string dateTo, string Criteria)
        {
            List<DailySummary> ViewDS = new List<DailySummary>();
            List<DailySummary> TempDS = new List<DailySummary>();
            QueryBuilder qb = new QueryBuilder();
            DataTable dt = new DataTable();
            switch (Criteria)
            {
                case "C":
                    //for company
                    dt = qb.GetValuesfromDB("select * from DailySummary " + " where Criteria = '"+Criteria + "' and (Date >= " + "'" + dateFrom + "'" + " and Date <= " + "'"
                                                     + dateTo + "'" + " )");
                    ViewDS = dt.ToList<DailySummary>();
                    if (fm.CompanyFilter.Count > 0)
                    {
                        foreach (var comp in fm.CompanyFilter)
                        {
                            short _compID = Convert.ToInt16(comp.ID);
                            TempDS.AddRange(ViewDS.Where(aa => aa.CriteriaValue == _compID && aa.Criteria == Criteria).ToList());
                        }
                        ViewDS = TempDS.ToList();
                    }
                    else
                        TempDS = ViewDS.ToList();
                    TempDS.Clear();
                    break;
                case "L":
                    dt = qb.GetValuesfromDB("select * from DailySummary " + " where Criteria = '"+Criteria + "' and (Date >= " + "'" + dateFrom + "'" + " and Date <= " + "'"
                                                     + dateTo + "'" + " )");
                    ViewDS = dt.ToList<DailySummary>();
                    if (fm.LocationFilter.Count > 0)
                    {
                        foreach (var loc in fm.LocationFilter)
                        {
                            short _locID = Convert.ToInt16(loc.ID);
                            TempDS.AddRange(ViewDS.Where(aa => aa.CriteriaValue == _locID && aa.Criteria == Criteria).ToList());
                        }
                        ViewDS = TempDS.ToList();
                    }
                    else
                        TempDS = ViewDS.ToList();
                    TempDS.Clear();
                    break;
                case "D":
                    dt = qb.GetValuesfromDB("select * from DailySummary " + " where Criteria = '"+Criteria + "' and (Date >= " + "'" + dateFrom + "'" + " and Date <= " + "'"
                                                     + dateTo + "'" + " )");
                    ViewDS = dt.ToList<DailySummary>();
                    if (fm.DepartmentFilter.Count > 0)
                    {
                        foreach (var dept in fm.DepartmentFilter)
                        {
                            short _deptID = Convert.ToInt16(dept.ID);
                            TempDS.AddRange(ViewDS.Where(aa => aa.CriteriaValue == _deptID && aa.Criteria == Criteria).ToList());
                        }
                        ViewDS = TempDS.ToList();
                    }
                    else
                        TempDS = ViewDS.ToList();
                    TempDS.Clear();
                    break;
                case "E":
                    dt = qb.GetValuesfromDB("select * from DailySummary " + " where Criteria = '"+Criteria + "' and (Date >= " + "'" + dateFrom + "'" + " and Date <= " + "'"
                                                     + dateTo + "'" + " )");
                    ViewDS = dt.ToList<DailySummary>();
                    if (fm.SectionFilter.Count > 0)
                    {
                        foreach (var sec in fm.SectionFilter)
                        {
                            short _secID = Convert.ToInt16(sec.ID);
                            TempDS.AddRange(ViewDS.Where(aa => aa.CriteriaValue == _secID && aa.Criteria == Criteria).ToList());
                        }
                        ViewDS = TempDS.ToList();
                    }
                    else
                        TempDS = ViewDS.ToList();
                    TempDS.Clear();
                    break;

                case "S":
                    dt = qb.GetValuesfromDB("select * from DailySummary " + " where Criteria = '"+Criteria + "' and (Date >= " + "'" + dateFrom + "'" + " and Date <= " + "'"
                                                     + dateTo + "'" + " )");
                    ViewDS = dt.ToList<DailySummary>();
                    if (fm.ShiftFilter.Count > 0)
                    {
                        foreach (var shift in fm.ShiftFilter)
                        {
                            short _shiftID = Convert.ToInt16(shift.ID);
                            TempDS.AddRange(ViewDS.Where(aa => aa.CriteriaValue == _shiftID && aa.Criteria == Criteria).ToList());
                        }
                        ViewDS = TempDS.ToList();
                    }
                    else
                        TempDS = ViewDS.ToList();
                    TempDS.Clear();
                    break;
                case "T":
                    dt = qb.GetValuesfromDB("select * from DailySummary " + " where Criteria = '"+Criteria + "' and (Date >= " + "'" + dateFrom + "'" + " and Date <= " + "'"
                                                     + dateTo + "'" + " )");
                    ViewDS = dt.ToList<DailySummary>();
                    if (fm.TypeFilter.Count > 0)
                    {
                        foreach (var type in fm.TypeFilter)
                        {
                            short _typeID = Convert.ToInt16(type.ID);
                            TempDS.AddRange(ViewDS.Where(aa => aa.CriteriaValue == _typeID && aa.Criteria == Criteria).ToList());
                        }
                        ViewDS = TempDS.ToList();
                    }
                    else
                        TempDS = ViewDS.ToList();
                    TempDS.Clear();
                    break;
                //case "A":
                //    if (fm.CompanyFilter.Count > 0)
                //    {
                //        foreach (var comp in fm.CompanyFilter)
                //        {
                //            short _compID = Convert.ToInt16(comp.ID);
                //            TempDS.AddRange(ViewDS.Where(aa => aa.CriteriaValue == _compID && aa.Criteria == Criteria).ToList());
                //        }
                //        ViewDS = TempDS.ToList();
                //    }
                //    else
                //        TempDS = ViewDS.ToList();
                //    TempDS.Clear();
                //    break;
            }
            return ViewDS;
        }