Beispiel #1
0
        // List<TempCallHistory> objTempCallHistory = new List<TempCallHistory>();
        public frmCallHistory(CallerIdType_Configuration obj)
        {
            InitializeComponent();

            this.objCLISettings = obj;
            this.Load          += new EventHandler(frmCallHistory_Load);
            FormatGrid();



            ddlCustomer.Enter += new EventHandler(ddlCustomer_Enter);


            //  ComboFunctions.FillCustomerCombo(ddlCustomer);

            grdCalls.CommandCellClick += new CommandCellClickEventHandler(grdCalls_CommandCellClick);
            this.chkSubCompanyWise.ToggleStateChanged += ChkSubCompanyWise_ToggleStateChanged;
            grdCalls.ViewCellFormatting += grdLister_ViewCellFormatting;
        }
        private void GenerateReport()
        {
            try
            {
                bool isMissed = optMissedCalls.Checked;



                if (dtpFromDate.Value != null && dtpFromDate.Value.Value.Year == 1753)
                {
                    dtpFromDate.Value = null;
                }

                if (dtpTillDate.Value != null && dtpTillDate.Value.Value.Year == 1753)
                {
                    dtpTillDate.Value = null;
                }

                DateTime?fromDate = dtpFromDate.Value.ToDateorNull();
                DateTime?tillDate = dtpTillDate.Value.ToDateorNull();

                string phone = txtPhone.Text.Trim();
                string name  = txtName.Text.Trim().ToLower();
                string Line  = txtLine.Text.ToStr();
                string Stn   = txtStn.Text.ToStr();


                var list = (from a in GeneralBLL.GetQueryable <CallHistory>(null)
                            where (fromDate == null || a.CallDateTime.Value.Date >= fromDate) &&
                            (tillDate == null || a.CallDateTime.Value.Date <= tillDate) &&
                            (name == string.Empty || a.Name.Trim().ToLower().StartsWith(name)) &&
                            (phone == string.Empty || a.PhoneNumber.Trim() == phone) &&
                            (Line == string.Empty || a.Line == Line) &&
                            (Stn == string.Empty || a.STN == Stn) &&
                            (isMissed == false || (a.IsAccepted != null && a.IsAccepted == true))
                            orderby a.CallDateTime descending
                            select new
                {
                    Name = a.Name,
                    PhoneNumber = a.PhoneNumber,
                    CallDateTime = a.CallDateTime,
                    Line = a.Line,
                    STN = a.STN
                }).ToList();



                CallHistoryBindingSource.DataSource = list;



                Microsoft.Reporting.WinForms.ReportParameter[] param = new Microsoft.Reporting.WinForms.ReportParameter[6];

                string address = AppVars.objSubCompany.Address;
                string telNo   = "Tel No. " + AppVars.objSubCompany.TelephoneNo;

                param[0] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Header", AppVars.objSubCompany.CompanyName.ToStr());
                param[1] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Address", address);
                param[2] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Telephone", telNo);

                string heading = string.Empty;
                if (fromDate != null && tillDate != null)
                {
                    heading = string.Format("{0:dd/MM/yyyy}", fromDate) + " to " + string.Format("{0:dd/MM/yyyy}", tillDate);
                }
                param[3] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Criteria", heading);
                param[4] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_TotalCalls", list.Count.ToStr());


                CallerIdType_Configuration obj = General.GetObject <CallerIdType_Configuration>(c => c.Id != null);
                string DigitalCLIType          = obj.DigitalCLIType.ToStr();

                param[5] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_DigitalCLIType", DigitalCLIType == "" ? "0" : DigitalCLIType);

                reportViewer1.LocalReport.SetParameters(param);

                this.reportViewer1.ZoomPercent = 100;
                this.reportViewer1.ZoomMode    = Microsoft.Reporting.WinForms.ZoomMode.Percent;
                this.reportViewer1.RefreshReport();
            }
            catch (Exception ex)
            {
                ENUtils.ShowMessage(ex.Message);
            }
        }
        private void GenerateReport()
        {
            try
            {
                if (dtpFromDate.Value != null && dtpFromDate.Value.Value.Year == 1753)
                {
                    dtpFromDate.Value = null;
                }

                if (dtpTillDate.Value != null && dtpTillDate.Value.Value.Year == 1753)
                {
                    dtpTillDate.Value = null;
                }

                DateTime?fromDate = dtpFromDate.Value.ToDateorNull();
                DateTime?tillDate = dtpTillDate.Value.ToDateorNull();

                string phone     = txtPhone.Text.Trim();
                string name      = txtName.Text.Trim().ToLower();
                bool?  isArrived = chkArrivalRing.Checked;
                string Stn       = txtStn.Text.ToStr();



                if (chkAll.Checked)
                {
                    isArrived = null;
                }

                var list = (new TaxiDataContext()).stp_GetRingBackLog(fromDate, tillDate, name, Stn, phone, isArrived).ToList();



                this.stp_GetRingBackLogResultBindingSource.DataSource = list;



                Microsoft.Reporting.WinForms.ReportParameter[] param = new Microsoft.Reporting.WinForms.ReportParameter[6];

                string address = AppVars.objSubCompany.Address;
                string telNo   = "Tel No. " + AppVars.objSubCompany.TelephoneNo;

                param[0] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Header", AppVars.objSubCompany.CompanyName.ToStr());
                param[1] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Address", address);
                param[2] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Telephone", telNo);

                string heading = string.Empty;
                if (fromDate != null && tillDate != null)
                {
                    heading = string.Format("{0:dd/MM/yyyy}", fromDate) + " to " + string.Format("{0:dd/MM/yyyy}", tillDate);
                }
                param[3] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Criteria", heading);
                param[4] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_TotalCalls", list.Count.ToStr());


                CallerIdType_Configuration obj = General.GetObject <CallerIdType_Configuration>(c => c.Id != null);
                string DigitalCLIType          = obj.DigitalCLIType.ToStr();

                param[5] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_DigitalCLIType", DigitalCLIType == "" ? "0" : DigitalCLIType);

                reportViewer1.LocalReport.SetParameters(param);

                this.reportViewer1.ZoomPercent = 150;
                this.reportViewer1.ZoomMode    = Microsoft.Reporting.WinForms.ZoomMode.Percent;
                this.reportViewer1.RefreshReport();
            }
            catch (Exception ex)
            {
                ENUtils.ShowMessage(ex.Message);
            }
        }