Exemplo n.º 1
0
        private void BindGridData()
        {
            var filter = new VisitorFilter()
            {
                DATE_FROM = (dtFrom.Value == null || dtFrom.Value == DateTime.MinValue) ? DateTime.Now : dtFrom.Value,
                DATE_TO   = (dtTo.Value == null || dtTo.Value == DateTime.MinValue) ? DateTime.Now : dtTo.Value
            };

            if (radAll.Checked)
            {
                filter.TYPE = nameof(VisitorMode.All);
            }
            if (radIn.Checked)
            {
                filter.TYPE = nameof(VisitorMode.In);
            }
            if (radOut.Checked)
            {
                filter.TYPE = nameof(VisitorMode.Out);
            }
            filter.DEPT_ID = Convert.ToInt32(ddlDept.SelectedValue);

            _container.Filter = filter;
            _container        = _service.GetVisitorForReport(_container);

            SetDataSourceHeader(gridReportList, ListHeader(), _container.ResultObj);
        }
Exemplo n.º 2
0
        private void BindGridData()
        {
            var filter = new VisitorFilter()
            {
                ID_CARD       = txtIDCard.Text,
                LICENSE_PLATE = txtLicense.Text,
                NO            = txtNo.Text == "" ? 0 : Convert.ToInt32(txtNo.Text),
                FIRST_NAME    = txtName.Text,
                LAST_NAME     = txtLastName.Text
            };

            if (comboType.SelectedIndex == 0)
            {
            }
            else if (comboType.SelectedIndex == 1)
            {
                filter.TYPE = "In";
            }
            else if (comboType.SelectedIndex == 2)
            {
                filter.TYPE = "Out";
            }
            else if (comboType.SelectedIndex == 3)
            {
                filter.TYPE = "Appointment";
            }
            else if (comboType.SelectedIndex == 4)
            {
                filter.TYPE = "AppointmentOut";
            }
            _container.Filter = filter;
            _container        = _service.Retrieve(_container);
            SetDataSourceHeader(gridVisitorList, ListHeader(), _container.ResultObj);
            SetPageControl(_container);
        }
Exemplo n.º 3
0
        private void BindGridData()
        {
            var filter = new VisitorFilter()
            {
                //TYPE = "IN",
                DATE_FROM = (dtFrom.Value == null || dtFrom.Value == DateTime.MinValue) ? DateTime.Now : dtFrom.Value,
                DATE_TO   = (dtTo.Value == null || dtTo.Value == DateTime.MinValue) ? DateTime.Now : dtTo.Value
            };

            _container.Filter = filter;
            _container        = _service.GetVisitorForReport(_container);

            SetDataSourceHeader(gridListVisitor, ListHeader(), _container.ResultObj);
        }
Exemplo n.º 4
0
        private void BindGridData()
        {
            var filter = new VisitorFilter()
            {
                ID_CARD       = txtIDCard.Text,
                FIRST_NAME    = txtName.Text,
                LAST_NAME     = txtLastName.Text,
                LICENSE_PLATE = txtLicense.Text,
            };

            if (chkDate.Checked)
            {
                filter.DATE_FROM = dtContactDate.Value;
            }

            _container.Filter = filter;
            _container        = _service.GetListVisitorNotOut(_container);
            lblTotalItem.Text = _container.PageInfo.TOTAL_ITEM.ToString();
            SetDataSourceHeader(gridVisitorOut, ListHeader(), _container.ResultObj);
            SetPageControl(_container);
        }
Exemplo n.º 5
0
        private void btnPrintMonth_Click(object sender, EventArgs e)
        {
            var timeNow         = DateTime.Now;
            var firstDayOfMonth = new DateTime(timeNow.Year, timeNow.Month, 1);
            var lastDayOfMonth  = firstDayOfMonth.AddMonths(1).AddDays(-1);
            var filter          = new VisitorFilter()
            {
                DATE_FROM = ChangeTime(firstDayOfMonth, 0, 0, 0, 1),
                DATE_TO   = ChangeTime(lastDayOfMonth, 23, 59, 59, 59),
            };

            _container.Filter = filter;
            _container        = _service.GetVisitorForReport(_container);

            if (_container.ResultObj.Count > 0)
            {
                List <CustomVisitor> listData    = (List <CustomVisitor>)_container.ResultObj;
                DataTable            dt          = ConvertToDataTable(listData);
                DataTable            headerTable = new DataTable("Customers");
                DataColumn           dtColumn;
                DataRow myDataRow;

                dtColumn            = new DataColumn();
                dtColumn.DataType   = typeof(String);
                dtColumn.ColumnName = "COMPANY_NAME";
                headerTable.Columns.Add(dtColumn);

                dtColumn            = new DataColumn();
                dtColumn.DataType   = typeof(String);
                dtColumn.ColumnName = "USER_PRINT";
                headerTable.Columns.Add(dtColumn);

                myDataRow = headerTable.NewRow();
                myDataRow["COMPANY_NAME"] = "BIG Visitor Management";
                myDataRow["USER_PRINT"]   = LOGIN;
                headerTable.Rows.Add(myDataRow);

                ReportDocument rpt     = new ReportDocument();
                string         path    = System.Reflection.Assembly.GetExecutingAssembly().Location;
                var            appPath = Application.StartupPath + "\\" + "VisitorListReport.rpt";
                rpt.Load(appPath);
                rpt.Database.Tables[0].SetDataSource(dt);
                rpt.Database.Tables[1].SetDataSource(headerTable);

                using (Form form = new Form())
                {
                    CrystalReportViewer tempViewer = new CrystalReportViewer();
                    tempViewer.ActiveViewIndex          = -1;
                    tempViewer.BorderStyle              = System.Windows.Forms.BorderStyle.FixedSingle;
                    tempViewer.Dock                     = System.Windows.Forms.DockStyle.Fill;
                    tempViewer.Name                     = "tempViewer";
                    tempViewer.SelectionFormula         = "";
                    tempViewer.TabIndex                 = 0;
                    tempViewer.ViewTimeSelectionFormula = "";
                    tempViewer.ReportSource             = rpt;
                    tempViewer.AutoSize                 = true;
                    tempViewer.Refresh();
                    form.Controls.Add(tempViewer);
                    form.Size          = this.Size;
                    form.StartPosition = FormStartPosition.CenterParent;
                    form.ShowDialog();
                }
            }

            SetDataSourceHeader(gridReportList, ListHeader(), _container.ResultObj);
        }