/// <summary>
        /// 设置 配送方式 数据源
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmbShipTypeEnum_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ComboBox cmbShipTypeEnum = (sender) as ComboBox;

            if (!string.IsNullOrEmpty(cmbShipTypeEnum.SelectedValue.ToString()) && cmbShipTypeEnum.SelectedIndex != 0)
            {
                string[] selectedEnum = new string[] { cmbShipTypeEnum.SelectedValue.ToString() };
                if (selectedEnum[0].Contains(","))
                {
                    selectedEnum    = new string[2];
                    selectedEnum[0] = "1";
                    selectedEnum[1] = "2";
                }
                m_QueryFacde.GetShipTypeList((obj, args) =>
                {
                    if (!args.FaultsHandle())
                    {
                        List <SOInterceptInfoVM> infoVMList = new List <SOInterceptInfoVM>();
                        if (args.Result != null && args.Result.Count > 0)
                        {
                            foreach (var item in args.Result)
                            {
                                if (string.IsNullOrEmpty(item.ShipTypeID))
                                {
                                    item.ShipTypeID = item.SysNo.ToString();
                                }
                                if (selectedEnum.Contains(item.ShipTypeEnum.ToString()) && item.IsOnlineShow != HYNStatus.Hide)
                                {
                                    SOInterceptInfoVM infoVM = new SOInterceptInfoVM();
                                    infoVM.ShipTypeSysNo     = item.SysNo;
                                    infoVM.ShippingTypeID    = item.ShipTypeID;
                                    infoVM.ShippingTypeName  = item.ShippingTypeName;
                                    infoVMList.Add(infoVM);
                                }
                            }
                            infoVMList.Insert(0, new SOInterceptInfoVM {
                                ShippingTypeID   = "",
                                ShippingTypeName = ResCommonEnum.Enum_All
                            });

                            cmbShipTypeSysNo.ItemsSource   = infoVMList;
                            cmbShipTypeSysNo.SelectedIndex = 0;
                        }
                    }
                });
            }
            else
            {
                cmbShipTypeSysNo.ItemsSource = null;
            }
        }
Exemple #2
0
 /// <summary>
 /// 添加订单拦截设置
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnSave_Click(object sender, RoutedEventArgs e)
 {
     m_SOInterceptInfoVM = gdAddSOIntercept.DataContext as SOInterceptInfoVM;
     if (string.IsNullOrEmpty(m_SOInterceptInfoVM.ShippingTypeID) ||
         string.IsNullOrEmpty(m_SOInterceptInfoVM.StockSysNo) ||
         string.IsNullOrEmpty(m_SOInterceptInfoVM.HasTrackingNumber) ||
         string.IsNullOrEmpty(m_SOInterceptInfoVM.ShipTimeType) ||
         string.IsNullOrEmpty(m_SOInterceptInfoVM.EmailAddress) ||
         string.IsNullOrEmpty(m_SOInterceptInfoVM.CCEmailAddress) ||
         string.IsNullOrEmpty(m_SOInterceptInfoVM.FinanceEmailAddress) ||
         string.IsNullOrEmpty(m_SOInterceptInfoVM.FinanceCCEmailAddress)
         )
     {
         CPApplication.Current.CurrentPage.Context.Window.Alert(ResSOIntercept.Info_SaveSOIntercept_Input_Error, MessageType.Error);
     }
     else
     {
         ValidationManager.Validate(this.gdAddSOIntercept);
         if (m_SOInterceptInfoVM.HasValidationErrors && m_SOInterceptInfoVM.ValidationErrors.Count > 0)
         {
             return;
         }
         m_SOInterceptInfoVM.ShipTypeSysNo = Convert.ToInt32(m_SOInterceptInfoVM.ShippingTypeID);
         SOInterceptInfo req = m_SOInterceptInfoVM.ConvertVM <SOInterceptInfoVM, SOInterceptInfo>();
         new SOInterceptFacade(CPApplication.Current.CurrentPage).AddSOInterceptInfo(req, (obj, args) =>
         {
             if (!args.FaultsHandle())
             {
                 CPApplication.Current.CurrentPage.Context.Window.Alert(ResSOIntercept.Info_AddSOIntercept_Success, MessageType.Information);
                 CloseDialog(new ResultEventArgs
                 {
                     DialogResult = DialogResultType.OK
                 });
             }
         });
     }
 }
 /// <summary>
 /// 批量修改订单拦截设置
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnBatchUpdate_Click(object sender, RoutedEventArgs e)
 {
     m_SOInterceptInfoVM = gdUpdateSOIntercept.DataContext as SOInterceptInfoVM;
     CurrentSOInterceptInfoVM.Sysnolist = SysNoList;
     if (string.IsNullOrEmpty(m_SOInterceptInfoVM.EmailAddress) ||
         string.IsNullOrEmpty(m_SOInterceptInfoVM.CCEmailAddress) ||
         string.IsNullOrEmpty(m_SOInterceptInfoVM.FinanceEmailAddress) ||
         string.IsNullOrEmpty(m_SOInterceptInfoVM.FinanceCCEmailAddress)
         )
     {
         CPApplication.Current.CurrentPage.Context.Window.Alert(ResSOIntercept.Info_SaveSOIntercept_Input_Error, MessageType.Error);
     }
     else
     {
         ValidationManager.Validate(this.gdUpdateSOIntercept);
         if (m_SOInterceptInfoVM.HasValidationErrors && m_SOInterceptInfoVM.ValidationErrors.Count > 0)
         {
             return;
         }
         if (string.IsNullOrEmpty(CurrentSOInterceptInfoVM.Sysnolist))
         {
             CPApplication.Current.CurrentPage.Context.Window.Alert(ResSOIntercept.Info_SOIntercept_UpdateError_NoData, MessageType.Error);
         }
         SOInterceptInfo req = m_SOInterceptInfoVM.ConvertVM <SOInterceptInfoVM, SOInterceptInfo>();
         new SOInterceptFacade().BatchUpdateSOInterceptInfo(req, (obj, args) =>
         {
             if (!args.FaultsHandle())
             {
                 CPApplication.Current.CurrentPage.Context.Window.Alert(ResSOIntercept.Info_BatchUpdateSOIntercept_Success, MessageType.Information);
                 CloseDialog(new ResultEventArgs
                 {
                     DialogResult = DialogResultType.OK
                 });
             }
         });
     }
 }
Exemple #4
0
 public AddSOIntercept()
 {
     InitializeComponent();
     CurrentSOInterceptInfoVM = new SOInterceptInfoVM();
     IniPageData();
 }
 public UpdatSOIntercept(string sysNoList)
 {
     InitializeComponent();
     CurrentSOInterceptInfoVM = new SOInterceptInfoVM();
     SysNoList = sysNoList;
 }
        /// <summary>
        /// 发送订单拦截邮件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSendSOInterceptEmail_Click(object sender, RoutedEventArgs e)
        {
            SOInterceptInfoVM orderEmailInfoVM   = new SOInterceptInfoVM();
            SOInterceptInfoVM financeEmailInfoVM = new SOInterceptInfoVM();

            orderEmailInfoVM.EmailAddress            = this.txtEmailAddresse.Text;
            orderEmailInfoVM.CCEmailAddress          = this.txtCCEmailAddress.Text;
            financeEmailInfoVM.FinanceEmailAddress   = this.txtFinanceEmailAddress.Text;
            financeEmailInfoVM.FinanceCCEmailAddress = this.txtFinanceCCEmailAddress.Text;
            if (CurrentSOVM.InvoiceInfoVM.IsVAT == true)
            {
                if (string.IsNullOrEmpty(orderEmailInfoVM.EmailAddress) ||
                    string.IsNullOrEmpty(orderEmailInfoVM.CCEmailAddress) ||
                    string.IsNullOrEmpty(financeEmailInfoVM.FinanceEmailAddress) ||
                    string.IsNullOrEmpty(financeEmailInfoVM.FinanceCCEmailAddress)
                    )
                {
                    CPApplication.Current.CurrentPage.Context.Window.Alert(ResSOIntercept.Info_SaveSOIntercept_Input_Error, MessageType.Error);
                }
                else
                {
                    ValidationManager.Validate(this.gdOrderEmailInfo);
                    if (orderEmailInfoVM.HasValidationErrors && orderEmailInfoVM.ValidationErrors.Count > 0)
                    {
                        return;
                    }
                    ValidationManager.Validate(this.gdFinanceEmailInfo);
                    if (financeEmailInfoVM.HasValidationErrors && financeEmailInfoVM.ValidationErrors.Count > 0)
                    {
                        return;
                    }
                    SOInterceptInfoVM soInterceptInfoVM = new SOInterceptInfoVM();
                    soInterceptInfoVM.EmailAddress          = orderEmailInfoVM.EmailAddress;
                    soInterceptInfoVM.CCEmailAddress        = orderEmailInfoVM.CCEmailAddress;
                    soInterceptInfoVM.FinanceEmailAddress   = financeEmailInfoVM.FinanceEmailAddress;
                    soInterceptInfoVM.FinanceCCEmailAddress = financeEmailInfoVM.FinanceCCEmailAddress;

                    CurrentSOVM.SOInterceptInfoVMList.Add(soInterceptInfoVM);

                    #region 发送订单拦截邮件
                    SendEmailReq reqSOOrderIntercep = new SendEmailReq();
                    reqSOOrderIntercep.soInfo   = SOFacade.ConvertTOSOInfoFromSOVM(CurrentSOVM);
                    reqSOOrderIntercep.Language = CPApplication.Current.LanguageCode;
                    new SOInterceptFacade().SendSOOrderInterceptEmail(reqSOOrderIntercep, (obj, args) =>
                    {
                        if (!args.FaultsHandle())
                        {
                            CloseDialog(new ResultEventArgs
                            {
                                DialogResult = DialogResultType.OK,
                            });
                        }
                    });
                    #endregion
                    #region 发送增票拦截邮件
                    SendEmailReq reqSOFinanceIntercep = new SendEmailReq();
                    reqSOFinanceIntercep.soInfo   = SOFacade.ConvertTOSOInfoFromSOVM(CurrentSOVM);
                    reqSOFinanceIntercep.Language = CPApplication.Current.LanguageCode;
                    new SOInterceptFacade().SendSOFinanceInterceptEmail(reqSOFinanceIntercep, (obj, args) =>
                    {
                        if (!args.FaultsHandle())
                        {
                            CPApplication.Current.CurrentPage.Context.Window.Alert(ResSOIntercept.Info_SendEmail_Sucessful, MessageType.Information);
                            CloseDialog(new ResultEventArgs
                            {
                                DialogResult = DialogResultType.OK,
                            });
                        }
                    });
                    #endregion
                }
            }
            else
            {
                if (string.IsNullOrEmpty(orderEmailInfoVM.EmailAddress) || string.IsNullOrEmpty(orderEmailInfoVM.CCEmailAddress))
                {
                    CPApplication.Current.CurrentPage.Context.Window.Alert(ResSOIntercept.Info_SaveSOIntercept_Input_Error, MessageType.Error);
                }
                else
                {
                    ValidationManager.Validate(this.gdOrderEmailInfo);
                    if (orderEmailInfoVM.HasValidationErrors && orderEmailInfoVM.ValidationErrors.Count > 0)
                    {
                        return;
                    }
                    SOInterceptInfoVM soInterceptInfoVM = new SOInterceptInfoVM();
                    soInterceptInfoVM.EmailAddress   = orderEmailInfoVM.EmailAddress;
                    soInterceptInfoVM.CCEmailAddress = orderEmailInfoVM.CCEmailAddress;
                    CurrentSOVM.SOInterceptInfoVMList.Add(soInterceptInfoVM);
                    #region 发送订单拦截邮件
                    SendEmailReq reqSOOrderIntercep = new SendEmailReq();
                    reqSOOrderIntercep.soInfo   = SOFacade.ConvertTOSOInfoFromSOVM(CurrentSOVM);
                    reqSOOrderIntercep.Language = CPApplication.Current.LanguageCode;
                    new SOInterceptFacade().SendSOOrderInterceptEmail(reqSOOrderIntercep, (obj, args) =>
                    {
                        if (!args.FaultsHandle())
                        {
                            CPApplication.Current.CurrentPage.Context.Window.Alert(ResSOIntercept.Info_SendEmail_Sucessful, MessageType.Information);
                            CloseDialog(new ResultEventArgs
                            {
                                DialogResult = DialogResultType.OK,
                            });
                        }
                    });
                    #endregion
                }
            }
        }