Exemplo n.º 1
0
 public ActionResult _NotificationEmailItems(EmailNotificationFormModel model)
 {
     if (string.IsNullOrEmpty(model.BillNumber))
     {
         return PartialView(model);
     }
     ViewBag.Message = string.Empty;
     if (model.ShouldSend)
     {
         if (model.EmailType == EmailType.AirExport_Agent_PreAlert)
         {
             SendAgentPreAlertEmails(model);
         }
         if (model.EmailType == EmailType.AirExport_Shipping_Notice)
         {
             SendShippingNoticeEmails(model);
         }
     }
     if (Session["mailerSelectedBillType"] != null)
     {
         int billType = Convert.ToInt32(Session["mailerSelectedBillType"]);
        
         if (model.EmailType == ELT.CDT.EmailType.AirExport_Agent_PreAlert)
         {
             AirExportBL BL = new AirExportBL();
             model.Items = BL.GetAirExportAgentPreAlertEmailItems(int.Parse(GetCurrentELTUser().elt_account_number), model.BillNumber, (BillType)billType);
         }
         if (model.EmailType == ELT.CDT.EmailType.AirExport_Shipping_Notice)
         {
             AirExportBL BL = new AirExportBL();
             model.Items = BL.GetAirExportShippingNoticeEmailItems(int.Parse(GetCurrentELTUser().elt_account_number), model.BillNumber, (BillType)billType);
         }
         if (model.EmailType == ELT.CDT.EmailType.OceanExport_Agent_PreAlert)
         {
             OceanExportBL BL = new OceanExportBL();
             model.Items = BL.GetOceanExportAgentPreAlertEmailItems(int.Parse(GetCurrentELTUser().elt_account_number), model.BillNumber, (BillType)billType);
         }
         if (model.EmailType == ELT.CDT.EmailType.OceanExport_Shipping_Notice)
         {
             OceanExportBL BL = new OceanExportBL();
             model.Items = BL.GetOceanExportShippingNoticeEmailItems(int.Parse(GetCurrentELTUser().elt_account_number), model.BillNumber, (BillType)billType);
         }
         if (model.EmailType == ELT.CDT.EmailType.AirImport_E_Arrival_Notice)
         {
             AirImportBL BL = new AirImportBL();
             model.Items.AddRange(BL.GetAirImportEArrivalNoticeEmailItems(int.Parse(GetCurrentELTUser().elt_account_number), model.BillNumber, (BillType)billType).ToArray());
         }
         if (model.EmailType == ELT.CDT.EmailType.AirImport_Proof_Of_Delivery)
         {
             AirImportBL BL = new AirImportBL();
             model.Items.AddRange(BL.GetAirImportProofOfDeliveryEmailItems(int.Parse(GetCurrentELTUser().elt_account_number), model.BillNumber, (BillType)billType).ToArray());
         }
         if (model.EmailType == ELT.CDT.EmailType.OceanImport_E_Arrival_Notice)
         {
             OceanImportBL BL = new OceanImportBL();
             model.Items.AddRange(BL.GetOceanImportEArrivalNoticeEmailItems(int.Parse(GetCurrentELTUser().elt_account_number), model.BillNumber, (BillType)billType).ToArray());
         }
         if (model.EmailType == ELT.CDT.EmailType.OceanImport_Proof_Of_Delivery)
         {
             OceanImportBL BL = new OceanImportBL();
             model.Items.AddRange(BL.GetOceanImportProofOfDeliveryEmailItems(int.Parse(GetCurrentELTUser().elt_account_number), model.BillNumber, (BillType)billType).ToArray());
         }
         if (model.EmailType == ELT.CDT.EmailType.DomesticFreight_Agent_PreAlert)
         {
             DomesticFreightBL BL = new DomesticFreightBL();
             model.Items = BL.GetDomesticFreightAgentPreAlertEmailItems(int.Parse(GetCurrentELTUser().elt_account_number), model.BillNumber, (BillType)billType);
         }
         if (model.EmailType == ELT.CDT.EmailType.DomesticFreight_Shipping_Notice)
         {
             DomesticFreightBL BL = new DomesticFreightBL();
             model.Items = BL.GetDomesticFreightShippingNoticeEmailItems(int.Parse(GetCurrentELTUser().elt_account_number), model.BillNumber, (BillType)billType);
         }
     }
     return PartialView(model);
 }