Esempio n. 1
0
 public void Checkin(CheckoutItem checkout, Action<Exception> callback)
 {
     try
     {
         ServiceLocator.Current.GetInstance<IUserService>().GetLoginUser((lu, ex) =>
         {
             if (ex != null)
             {
                 callback(ex);
                 return;
             }
             checkout.checkin_date = DateTime.Now.Date;
             checkout.upddate = DateTime.Now;
             WebUtil.Put<CheckoutItem>(string.Format("api/checkouts/{0}", lu.Domain), checkout);
             callback(null);
         });
     }
     catch (Exception ex)
     {
         logger.Warn(ex);
         callback(ex);
     }
 }
Esempio n. 2
0
 public void Checkout(CheckoutItem checkout, Action<Exception> callback)
 {
     try
     {
         ServiceLocator.Current.GetInstance<IUserService>().GetLoginUser((lu, ex) =>
         {
             if (ex != null)
             {
                 callback(ex);
                 return;
             }
             //var checkout = new CheckoutItem
             //{
             //    account = user.Account,
             //    name = user.Name,
             //    grade =  user.Grade,
             //    Class = user.Class,
             //    regno = book.regno,
             //    Author = book.Author,
             //    Title = book.Title,
             //    comment = comment,
             //    from_date = DateTime.Now.Date,
             //    due_date = DateTime.Now.Date.AddDays(14),
             //    regdate = DateTime.Now,
             //    upddate = DateTime.Now,
             //    void_p = false
             //};
             WebUtil.Post<CheckoutItem>(string.Format("api/checkouts/{0}", lu.Domain), checkout);
             callback(null);
         });
     }
     catch (Exception ex)
     {
         logger.Warn(ex);
         callback(ex);
     }
 }
Esempio n. 3
0
 public CheckoutViewModel()
 {
     _checkout = new CheckoutItem();
 }
Esempio n. 4
0
 /// <summary>
 /// Initializes a new instance of the CheckoutViewModel class.
 /// </summary>
 public CheckoutViewModel(CheckoutItem checkout)
 {
     _checkout = checkout;
 }
Esempio n. 5
0
 public void DelCheckout(CheckoutItem checkout, Action<Exception> callback)
 {
     try
     {
         ServiceLocator.Current.GetInstance<IUserService>().GetLoginUser((lu, ex) =>
         {
             if (ex != null)
             {
                 callback(ex);
                 return;
             }
             var checkouts = WebUtil.Delete<CheckoutItem>(string.Format("api/checkouts/{0}", lu.Domain), checkout);
             callback(null);
         });
     }
     catch (Exception ex)
     {
         logger.Warn(ex);
         callback(ex);
     }
 }