Exemplo n.º 1
0
        //[BindProperty(SupportsGet = true)]
        //public string startdate { get; set; } = "test";


        //[BindProperty]
        //public DateTime enddate { get; set; }


        public async Task OnGetAsync()
        {
            ListOfDepartment = new List <SelectListItem>();
            List <Department> departments = new List <Department>();

            departments = await Mediator.Send(new GetDepartmentsQuery()
            {
                ID = null
            });

            foreach (Department department in departments)
            {
                ListOfDepartment.Add(new SelectListItem()
                {
                    Text = department.Name, Value = department.Id.ToString()
                });
            }


            ListOfYears = new List <SelectListItem>();
            List <int> years = Enumerable.Range(PersianDate.Now.Year, 3).ToList();

            // List<object> yearslist = new List<object>();

            foreach (int i in years)
            {
                ListOfYears.Add(new SelectListItem()
                {
                    Value = i.ToString(), Text = i.ToString()
                });
            }

            List <object> mlist = PersianDate.GetPersianMonths();

            ListOfMonths = new List <SelectListItem>();
            //ListOfMonths = mlist.Select(x => new SelectListItem() { Value = x.ToString(), Text = x.ToString()}).ToList();

            foreach (var item in mlist)
            {
                int    value = (int)item?.GetType().GetProperty("Value")?.GetValue(item, null);
                string text  = (string)item?.GetType().GetProperty("Text")?.GetValue(item, null);

                ListOfMonths.Add(new SelectListItem()
                {
                    Value = value.ToString(), Text = text.ToString()
                });
            }
        }
    void LoadData()
    {
        uxTable.ClientIDMode = ClientIDMode.Static;
        List <DEPARTMENT> list = AttendanceBLL.GetDepartments();

        uxOrg.DataSource = list;
        uxOrg.DataBind();

        List <int>    years     = Enumerable.Range(PersianDate.Now.Year, 3).ToList();
        List <object> yearslist = new List <object>();

        foreach (int i in years)
        {
            yearslist.Add(new { Value = i, Text = i });
        }

        uxYear.DataSource = yearslist;
        uxYear.DataBind();


        List <object> mlist = PersianDate.GetPersianMonths();

        uxMonth.DataSource = mlist;
        uxMonth.DataBind();

        List <Zone> zlist = AttendanceBLL.GetZones();

        uxZoneName.DataSource = zlist;
        uxZoneName.DataBind();
        //List<vAttendanceReport> EmployeeReport = AttendanceBLL.GetReportForAMonth();

        //ListsBLL.GenerateGeneralReportXL(EmployeeReport);

        //String output = "";
        //int counter = 1;
        //foreach (vAttendanceReport m in EmployeeReport)
        //{
        //    output = output + Temp.Replace("$Counter", counter.ToString()).Replace("$NameLocal", m.NAMELOCAL).Replace("$FatherNameLocal", m.FATHERNAMELOCAL).Replace("$Bast", m.Bast).Replace("$Qadam", m.Qadam).Replace("$UserID", m.USERID.ToString()).Replace("$Title", m.TITLE).Replace("$Department", m.Departments).Replace("$Present", m.Present.ToString()).Replace("$Absent", m.Absent.ToString()).Replace("$Leave", m.Leave.ToString());
        //    counter++;
        //}
        //uxTable.InnerHtml = output;
    }