Example #1
0
        private void btnExportExcel_Click(object sender, EventArgs e)
        {
            try
            {
                rptfrmCustomerAppUsersReport frm = new rptfrmCustomerAppUsersReport();

                DateTime?fromDate = dtpFromDate.Value.ToDateorNull();
                DateTime?toDate   = dtpToDate.Value.ToDateorNull();

                if (fromDate != null && dtpFromTime.Value != null && dtpFromTime.Value.Value != null)
                {
                    fromDate = (fromDate.Value.ToDate() + dtpFromTime.Value.Value.TimeOfDay).ToDateTime();
                }

                if (toDate != null && dtptilltime.Value != null && dtptilltime.Value.Value != null)
                {
                    toDate = (toDate.Value.ToDate() + dtptilltime.Value.Value.TimeOfDay).ToDateTime();
                }

                frm.ReportHeading = "Date Range : " + string.Format("{0:dd/MM/yyyy}", fromDate) + " to " + string.Format("{0:dd/MM/yyyy}", toDate);

                frm.DataSource = GetDataSource(fromDate, toDate);

                frm.GenerateReport();

                frm.ExportReportToExcel();
            }
            catch (Exception ex)
            {
                ENUtils.ShowMessage(ex.Message);
            }
        }
Example #2
0
        private void btnEmail_Click(object sender, EventArgs e)
        {
            try
            {
                DateTime?fromDate = dtpFromDate.Value.ToDate();
                DateTime?tillDate = dtpToDate.Value.ToDate();


                if (fromDate != null && dtpFromTime.Value != null && dtpFromTime.Value.Value != null)
                {
                    fromDate = (fromDate.Value.ToDate() + dtpFromTime.Value.Value.TimeOfDay).ToDateTime();
                }

                if (tillDate != null && dtptilltime.Value != null && dtptilltime.Value.Value != null)
                {
                    tillDate = (tillDate.Value.ToDate() + dtptilltime.Value.Value.TimeOfDay).ToDateTime();
                }

                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;
                }

                rptfrmCustomerAppUsersReport frm = new rptfrmCustomerAppUsersReport();
                frm.DataSource = GetDataSource(fromDate, tillDate);
                frm.GenerateReport();
                frm.SendEmail();
            }
            catch (Exception ex)
            {
                ENUtils.ShowMessage(ex.Message);
            }
        }
Example #3
0
        public override void Print()
        {
            try
            {
                DateTime?fromDate = dtpFromDate.Value.ToDateorNull();
                DateTime?toDate   = dtpToDate.Value.ToDateorNull();

                if (fromDate != null && dtpFromTime.Value != null && dtpFromTime.Value.Value != null)
                {
                    fromDate = (fromDate.Value.ToDate() + dtpFromTime.Value.Value.TimeOfDay).ToDateTime();
                }

                if (toDate != null && dtptilltime.Value != null && dtptilltime.Value.Value != null)
                {
                    toDate = (toDate.Value.ToDate() + dtptilltime.Value.Value.TimeOfDay).ToDateTime();
                }

                rptfrmCustomerAppUsersReport frm = new rptfrmCustomerAppUsersReport();

                frm.ReportHeading = "Date Range : " + string.Format("{0:dd/MM/yyyy}", fromDate) + " to " + string.Format("{0:dd/MM/yyyy}", toDate);

                frm.DataSource = GetDataSource(fromDate, toDate);

                frm.GenerateReport();

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

                if (doc != null)
                {
                    doc.Close();
                }
                UI.MainMenuForm.MainMenuFrm.ShowForm(frm);
            }
            catch (Exception ex)
            {
                ENUtils.ShowMessage(ex.Message);
            }
        }