예제 #1
0
        public void Update(CurrencyInfoVM _viewMode, EventHandler <RestClientEventArgs <CurrencyInfoVM> > callback)
        {
            string relativeUrl = "/CommonService/Currency/UpdateCurrency";
            var    msg         = _viewMode.ConvertVM <CurrencyInfoVM, CurrencyInfo>((s, t) =>
            {
                if (string.IsNullOrEmpty(s.CurrencyName))
                {
                    t.CurrencyName = s.CurrencyName;
                }
                if (string.IsNullOrEmpty(s.CurrencySymbol))
                {
                    t.CurrencySymbol = s.CurrencySymbol;
                }
                if (s.ExchangeRate.HasValue)
                {
                    t.ExchangeRate = s.ExchangeRate;
                }
                if (s.IsLocal.HasValue)
                {
                    t.IsLocal = s.IsLocal;
                }
                if (s.Status.HasValue)
                {
                    t.Status = s.Status == CurrencyStatus.Active ? 0 : -1;
                }
                if (s.ListOrder.HasValue)
                {
                    t.ListOrder = s.ListOrder;
                }
            });

            restClient.Update(relativeUrl, msg, callback);
        }
예제 #2
0
        public void Create(CurrencyInfoVM infoVM, EventHandler <RestClientEventArgs <CurrencyInfoVM> > callback)
        {
            string relativeUrl = "/CommonService/Currency/CreateCurrency";
            var    msg         = infoVM.ConvertVM <CurrencyInfoVM, CurrencyInfo>((s, t) =>
            {
                t.CurrencyName   = s.CurrencyName;
                t.CurrencySymbol = s.CurrencySymbol;
                t.ExchangeRate   = s.exchangeRate;
                t.ListOrder      = s.ListOrder;
                t.IsLocal        = s.IsLocal;
                t.Status         = s.Status == CurrencyStatus.Active ? 0 : -1;
            });

            restClient.Create <CurrencyInfoVM>(relativeUrl, msg, (s, args) =>
            {
                if (args.FaultsHandle())
                {
                    return;
                }
                infoVM = args.Result;
                callback(s, new RestClientEventArgs <CurrencyInfoVM>(infoVM, restClient.Page));
            });
        }