public CheckoutProfileEditViewModel() { EditBillingAddress = new DelegateCommand(parameter => { Address address = BillingAddress != null ? new Address(BillingAddress) : new Address(); AddressEditor editor = new AddressEditor() { DataContext = new AddressEditViewModel() { Model = address } }; if (editor.ShowDialog() ?? false) { BillingAddress = address; } }); EditShippingAddress = new DelegateCommand(parameter => { Address address = ShippingAddress != null ? new Address(ShippingAddress) : new Address(); AddressEditor editor = new AddressEditor() { DataContext = new AddressEditViewModel() { Model = address } }; if (editor.ShowDialog() ?? false) { ShippingAddress = address; } }); EditPayCard = new DelegateCommand(parameter => { PayCard card = PayCard != null ? new PayCard(PayCard) : new PayCard() { Type = PayCardTypeCollection.Types.ElementAt(0) }; PayCardEditor editor = new PayCardEditor() { DataContext = new PayCardEditViewModel() { Model = card } }; if (editor.ShowDialog() ?? false) { PayCard = card; } }); }
private AppConfig() { ServerName = ConfigurationManager.AppSettings.Get("ServerName"); DatabaseFile = ConfigurationManager.AppSettings.Get("DatabaseFile"); UserName = ConfigurationManager.AppSettings.Get("UserName"); Password = ConfigurationManager.AppSettings.Get("Password"); CallUserCode = ConfigurationManager.AppSettings.Get("CallUserCode"); CallPassword = ConfigurationManager.AppSettings.Get("CallPassword"); StoreCode = ConfigurationManager.AppSettings.Get("StoreCode"); TenderCode = ConfigurationManager.AppSettings.Get("TenderCode"); SKU = ConfigurationManager.AppSettings.Get("SKU"); PayCashNum = ConfigurationManager.AppSettings.Get("PayCashNum"); PayCash = ConfigurationManager.AppSettings.Get("PayCash"); PayCardNum = ConfigurationManager.AppSettings.Get("PayCardNum"); PayCard = ConfigurationManager.AppSettings.Get("PayCard"); DefaultPayNum = ConfigurationManager.AppSettings.Get("DefaultPayNum"); bool convertToBool; Boolean.TryParse(ConfigurationManager.AppSettings.Get("IsTimingUpload"), out convertToBool); IsTimingUpload = convertToBool; TimingUploadTime = ConfigurationManager.AppSettings.Get("TimingUploadTime"); DateTime tempTimingUploadTime; if (!DateTime.TryParse(TimingUploadTime, out tempTimingUploadTime)) { TimingUploadTime = "23:59"; } var payCashDic = PayCash.Split(',').ToDictionaryEx(key => key, value => PayCashNum); var payCardDic = PayCard.Split(',').ToDictionaryEx(key => key, value => PayCardNum); PayDictionary = new Dictionary <string, string>(); payCashDic.ToList().ForEach(x => { if (!PayDictionary.ContainsKey(x.Key)) { PayDictionary.Add(x.Key, x.Value); } }); payCardDic.ToList().ForEach(x => { if (!PayDictionary.ContainsKey(x.Key)) { PayDictionary.Add(x.Key, x.Value); } }); }