Beispiel #1
0
 public static NdcViewModel Create(NdcItem ndc, IBookService bookService)
 {
     return new NdcViewModel(ndc, bookService);
 }
Beispiel #2
0
 /// <summary>
 /// Initializes a new instance of the NdcViewModel class.
 /// </summary>
 private NdcViewModel(NdcItem ndc, IBookService bookService)
 {
     _ndc = ndc;
     _bookService = bookService;
 }
Beispiel #3
0
 public void UpdBookNdc(NdcItem before, NdcItem after, Action<Exception> callback)
 {
     try
     {
         ServiceLocator.Current.GetInstance<IUserService>().GetLoginUser((lu, ex) =>
         {
             if (ex != null)
             {
                 callback(ex);
                 return;
             }
             var config = ServiceLocator.Current.GetInstance<IConfigService>();
             config.GetValue("ndc", (jobj, ex2) =>
             {
                 if (ex2 != null)
                 {
                     callback(ex2);
                     return;
                 }
                 var ndcs = (JObject)jobj;
                 if (before == null && after != null)
                 {
                     ndcs.Add(after.code, after.name);
                 }
                 else if (after == null)
                 {
                     ndcs.Remove(before.code);
                 }
                 else
                 {
                     ndcs.Remove(before.code);
                     ndcs.Add(after.code, after.name);
                 }
                 config.SetValue("ndc", ndcs, ex3 =>
                 {
                     if (ex != null)
                     {
                         callback(ex3);
                         return;
                     }
                 });
             });
             callback(null);
         });
     }
     catch (Exception ex)
     {
         logger.Warn(ex);
         callback(ex);
     }
 }