Ejemplo n.º 1
0
        private void btnSendEmail_Click(object sender, EventArgs e)
        {
            int      driverId = ddl_Driver.SelectedValue.ToInt();
            int      userId   = ddlController.SelectedValue.ToInt();
            string   userName = ddlController.Text.Trim();
            DateTime?fromDate = dtpFromDate.Value.ToDate();
            DateTime?tillDate = dtpTillDate.Value.ToDate();



            string error = string.Empty;


            if (fromDate == null)
            {
                if (string.IsNullOrEmpty(error))
                {
                    error += Environment.NewLine;
                }

                error += "Required : From Date";
            }

            if (tillDate == null)
            {
                if (string.IsNullOrEmpty(error))
                {
                    error += Environment.NewLine;
                }

                error += "Required : To Date";
            }

            if (!string.IsNullOrEmpty(error))
            {
                ENUtils.ShowMessage(error);
                return;
            }



            int reportType = eReportType.ALL;

            if (optReject.ToggleState == Telerik.WinControls.Enumerations.ToggleState.On)
            {
                reportType = eReportType.REJECTED;
            }
            else if (optNotAcceped.ToggleState == Telerik.WinControls.Enumerations.ToggleState.On)
            {
                reportType = eReportType.NOTACCEPTED;
            }
            else if (optRecover.ToggleState == Telerik.WinControls.Enumerations.ToggleState.On)
            {
                reportType = eReportType.RECOVER;
            }



            rptfrmSinBinReport frm = new rptfrmSinBinReport();


            frm.DataSource = GetDataSource(driverId, reportType, fromDate, tillDate, userName);
            frm.Criteria   = "For the Period : " + Environment.NewLine + string.Format("{0:dd/MM/yyyy}", fromDate) + " to " + string.Format("{0:dd/MM/yyyy}", tillDate);
            frm.GenerateReport();
            frm.SendEmail();
        }
Ejemplo n.º 2
0
        public override void Print()
        {
            int      driverId = ddl_Driver.SelectedValue.ToInt();
            int      userId   = ddlController.SelectedValue.ToInt();
            string   userName = ddlController.Text.Trim();
            DateTime?fromDate = dtpFromDate.Value.ToDate();
            DateTime?tillDate = dtpTillDate.Value.ToDate();



            string error = string.Empty;


            if (fromDate == null)
            {
                if (string.IsNullOrEmpty(error))
                {
                    error += Environment.NewLine;
                }

                error += "Required : From Date";
            }

            if (tillDate == null)
            {
                if (string.IsNullOrEmpty(error))
                {
                    error += Environment.NewLine;
                }

                error += "Required : To Date";
            }

            if (!string.IsNullOrEmpty(error))
            {
                ENUtils.ShowMessage(error);
                return;
            }



            int reportType = eReportType.ALL;

            if (optReject.ToggleState == Telerik.WinControls.Enumerations.ToggleState.On)
            {
                reportType = eReportType.REJECTED;
            }
            else if (optNotAcceped.ToggleState == Telerik.WinControls.Enumerations.ToggleState.On)
            {
                reportType = eReportType.NOTACCEPTED;
            }
            else if (optRecover.ToggleState == Telerik.WinControls.Enumerations.ToggleState.On)
            {
                reportType = eReportType.RECOVER;
            }



            rptfrmSinBinReport frm = new rptfrmSinBinReport();


            frm.DataSource = GetDataSource(driverId, reportType, fromDate, tillDate, userName);



            frm.Criteria = "For the Period : " + Environment.NewLine + string.Format("{0:dd/MM/yyyy}", fromDate) + " to " + string.Format("{0:dd/MM/yyyy}", tillDate);
            //    frm.StatementType = statementType;
            frm.GenerateReport();

            DockWindow doc = UI.MainMenuForm.MainMenuFrm.GetDockByName("rptfrmSinBinReport1");

            if (doc != null)
            {
                doc.Close();
            }
            UI.MainMenuForm.MainMenuFrm.ShowForm(frm);
        }