Esempio n. 1
0
 private void btnEmail_Click(object sender, EventArgs e)
 {
     try
     {
         string FromPostCode = null;
         string ToPostCode   = null;
         int    FromLocId    = 0;
         int    ToLocId      = 0;
         int    FromZoneId   = 0;
         int    ToZoneId     = 0;
         if (rbtnPostCode.IsChecked == true)
         {
             string PostCode = txtPostCode.Text.Trim();
             if (string.IsNullOrEmpty(PostCode))
             {
                 ENUtils.ShowMessage("Requierd : Post Code");
                 return;
             }
             if (rbtnPickup.IsChecked == true)
             {
                 FromPostCode = PostCode;
             }
             else if (rbtnDestination.IsChecked == true)
             {
                 ToPostCode = PostCode;
             }
             else
             {
                 FromPostCode = PostCode;
                 ToPostCode   = PostCode;
             }
         }
         else if (rbtnLocation.IsChecked == true)
         {
             int LocationId = ddlLocation.SelectedValue.ToInt();
             if (LocationId == 0)
             {
                 ENUtils.ShowMessage("Requierd : Loaction Code");
                 return;
             }
             if (rbtnPickup.IsChecked == true)
             {
                 FromLocId = LocationId;
             }
             else if (rbtnDestination.IsChecked == true)
             {
                 ToLocId = LocationId;
             }
             else
             {
                 ToLocId   = LocationId;
                 FromLocId = LocationId;
             }
         }
         else
         {
             int ZoneId = ddlArea.SelectedValue.ToInt();
             if (ZoneId == 0)
             {
                 ENUtils.ShowMessage("Requierd : Area Code");
                 return;
             }
             if (rbtnPickup.IsChecked == true)
             {
                 FromZoneId = ZoneId;
             }
             else if (rbtnDestination.IsChecked == true)
             {
                 ToZoneId = ZoneId;
             }
             else
             {
                 FromZoneId = ZoneId;
                 ToZoneId   = ZoneId;
             }
         }
         rptfrmJobStatisticsReport frm = new rptfrmJobStatisticsReport(FromPostCode, ToPostCode, FromLocId, ToLocId, FromZoneId, ToZoneId, fromDate.Value.ToDate(), tillDate.Value.ToDate());
         frm.EmailSending();
     }
     catch (Exception ex)
     {
         ENUtils.ShowMessage(ex.Message);
     }
 }
Esempio n. 2
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            try
            {
                string FromPostCode = null;
                string ToPostCode   = null;
                int    FromLocId    = 0;
                int    ToLocId      = 0;
                int    FromZoneId   = 0;
                int    ToZoneId     = 0;
                if (rbtnPostCode.IsChecked == true)
                {
                    string PostCode = txtPostCode.Text.Trim();
                    if (string.IsNullOrEmpty(PostCode))
                    {
                        ENUtils.ShowMessage("Requierd : Post Code");
                        return;
                    }
                    if (rbtnPickup.IsChecked == true)
                    {
                        FromPostCode = PostCode;
                    }
                    else if (rbtnDestination.IsChecked == true)
                    {
                        ToPostCode = PostCode;
                    }
                    else
                    {
                        FromPostCode = PostCode;
                        ToPostCode   = PostCode;
                    }
                }
                else if (rbtnLocation.IsChecked == true)
                {
                    int LocationId = ddlLocation.SelectedValue.ToInt();
                    if (LocationId == 0)
                    {
                        ENUtils.ShowMessage("Requierd : Loaction Code");
                        return;
                    }
                    if (rbtnPickup.IsChecked == true)
                    {
                        FromLocId = LocationId;
                    }
                    else if (rbtnDestination.IsChecked == true)
                    {
                        ToLocId = LocationId;
                    }
                    else
                    {
                        ToLocId   = LocationId;
                        FromLocId = LocationId;
                    }
                }
                else
                {
                    int ZoneId = ddlArea.SelectedValue.ToInt();
                    if (ZoneId == 0)
                    {
                        ENUtils.ShowMessage("Requierd : Area Code");
                        return;
                    }
                    if (rbtnPickup.IsChecked == true)
                    {
                        FromZoneId = ZoneId;
                    }
                    else if (rbtnDestination.IsChecked == true)
                    {
                        ToZoneId = ZoneId;
                    }
                    else
                    {
                        FromZoneId = ZoneId;
                        ToZoneId   = ZoneId;
                    }
                }
                rptfrmJobStatisticsReport frm = new rptfrmJobStatisticsReport(FromPostCode, ToPostCode, FromLocId, ToLocId, FromZoneId, ToZoneId, fromDate.Value.ToDate(), tillDate.Value.ToDate());
                // frm.ReportHeading = "Date Range : " + string.Format("{0:dd/MM/yyyy}", fromDate) + " to " + string.Format("{0:dd/MM/yyyy}", toDate);
                //  frm.DataSource = GetDataSource(GetReportType(), ddlCompany.SelectedValue.ToInt(), fromDate, toDate, ddlAllDriver.SelectedValue.ToInt());

                //frm.GenerateReport();

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

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