コード例 #1
0
        // ReSharper disable once UnusedParameter.Local
        private static void Main(string[] args)
        {
            using (var cmdService = new CommandServiceClient())
            {
                cmdService.InnerChannel.OperationTimeout = TimeSpan.FromMinutes(10);

                var req = new CommandRequest
                {
                    serviceName    = DrivesInfoCommand.CommandServiceName,
                    serviceCommand = DrivesInfoCommand.CommandName,
                    numParam       = 2,
                    valueParam     = new string[2]
                };
                req.valueParam[0] = "PARAM81726354";
                req.valueParam[1] = "01928374645--";

                var resp = cmdService.ExecuteCommand(req);
                if (resp.Length > 0)
                {
                    Console.WriteLine("RESPUESTA CODIGO: {0}, DATA: {1}", resp[0].code, resp[0].data);
                    var respObject = JsonConvert.DeserializeObject <List <JDriveInfo> >(resp[0].data);
                    Console.WriteLine("respObject[0].DEVICEID " + respObject.ToArray()[0].DEVICEID);
                }
                else
                {
                    Console.WriteLine("ERROR");
                }
            }
            Console.ReadLine();
        }
コード例 #2
0
        public override MembershipUser CreateUser(string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, out System.Web.Security.MembershipCreateStatus status)
        {
            ValidatePasswordEventArgs args = new ValidatePasswordEventArgs(username, password, true);

            OnValidatingPassword(args);
            if (args.Cancel)
            {
                status = MembershipCreateStatus.InvalidPassword;
                return(null);
            }
            if (RequiresUniqueEmail && !string.IsNullOrEmpty(GetUserNameByEmail(email)))
            {
                status = MembershipCreateStatus.DuplicateEmail;
                return(null);
            }
            MembershipUser user = GetUser(username, true);

            if (user == null)
            {
                CommandServiceClient commandService = new CommandServiceClient();
                commandService.RegisterUserAccount(username, password, username, email, "", new AddressDataObject {
                    City = "", Country = "", State = "", Street = "", Zip = ""
                });
                commandService.Close();
                //Thread.Sleep(6000); // Wait for the synchronization service to sync the event message to query database.
                status = MembershipCreateStatus.Success;
                return(GetUser(username, true));
            }
            else
            {
                status = MembershipCreateStatus.DuplicateUserName;
                return(null);
            }
        }
コード例 #3
0
        public ActionResult ShowTickets(string orderId, decimal comission)
        {
            var orderInfo = GetOrderInfo(orderId, comission);

            // Printing tickets
            try
            {
                using (var client = new CommandServiceClient())
                {
                    UrlHelper urlHelper  = new UrlHelper(Request.RequestContext);
                    var       urlBuilder =
                        new System.UriBuilder(Request.Url.AbsoluteUri)
                    {
                        Path = urlHelper.Action("TicketsToPrint", new { orderId, comission })
                    };

                    Uri    uri = urlBuilder.Uri;
                    string url = HttpUtility.UrlDecode(uri.ToString());

                    client.PrintUrl(url);
                }

                return(Success(orderInfo));
            }
            catch (EndpointNotFoundException ex)
            {
#if DEBUG
                return(Success(orderInfo));
#endif
                throw;
            }
        }
コード例 #4
0
        public ActionResult Edit(BookDataObject book)
        {
            CommandServiceClient commandService = new CommandServiceClient();

            commandService.UpdateBook(book.AggregateRootId, book.Title, book.Author, book.Description, book.ISBN, book.Pages, book.Inventory);
            commandService.Close();
            return(RedirectToAction("Index", "Books"));
        }
コード例 #5
0
        public ActionResult Create(BookDataObject book)
        {
            CommandServiceClient commandService = new CommandServiceClient();

            commandService.AddBook(book.Title, book.Author, book.Description, book.ISBN, book.Pages, book.Inventory);
            commandService.Close();
            return(RedirectToAction("Index"));
        }
コード例 #6
0
        public ActionResult BuyTickets(string passengers, string r, string f,
                                       string v, string email, string phoneCode, string phoneNumber, decimal amount, decimal comission)
        {
            string orderId = string.Empty;

            try
            {
                List <OrderPerson> passngrs =
                    JsonConvert.DeserializeObject <List <OrderPerson> >(passengers).ToList();
                passngrs = passngrs.Where(c => !string.IsNullOrWhiteSpace(c.LastName)).ToList();

                // setup doc exp date
                var setDocExpDate = bool.Parse(ConfigurationManager.AppSettings["SetDocExpDate"]);
                if (setDocExpDate)
                {
                    foreach (var p in passngrs)
                    {
                        p.DocExpDate = "01.01.2030";
                    }
                }

                var orderInfo = new OrderInfo();
                orderInfo.F             = f;
                orderInfo.PersonalEmail = email;
                orderInfo.Persons       = passngrs;
                orderInfo.PhoneCountry  = phoneCode;
                orderInfo.PhoneNumber   = phoneNumber.Replace("(", "").Replace(")", "").Replace("-", "").Replace(" ", "");
                orderInfo.R             = r;
                orderInfo.UserName      = "";
                orderInfo.V             = v;
                orderId = _api.CreateOrder(orderInfo);

                // Printing check
                using (var client = new CommandServiceClient())
                {
                    client.PrintCheck(amount, comission);
                }

                return(Success(orderId));
            }
            catch (EndpointNotFoundException ex)
            {
#if DEBUG
                return(Success(orderId));
#endif
                return(Error(ex.Message));
            }
            catch (Exception e)
            {
                return(Error(e.Message));
            }
        }
コード例 #7
0
        public ActionResult Return(Guid id)
        {
            QueryServiceClient queryService = new QueryServiceClient();
            var book = queryService.GetBookByGuid(id);
            var user = queryService.GetUserByUserName(User.Identity.Name);

            queryService.Close();

            CommandServiceClient commandService = new CommandServiceClient();

            commandService.ReturnBookFromUser(book.AggregateRootId, user.AggregateRootId);
            commandService.Close();

            return(RedirectToAction("MyAccount", "Account"));
        }
コード例 #8
0
        public ActionResult Edit(UserAccountDataObject obj)
        {
            CommandServiceClient commandService = new CommandServiceClient();

            commandService.UpdateUserAccount(obj.AggregateRootId, obj.DisplayName, obj.Email, obj.ContactPhone,
                                             new AddressDataObject
            {
                Country = obj.AddressCountry,
                State   = obj.AddressState,
                City    = obj.AddressCity,
                Street  = obj.AddressStreet,
                Zip     = obj.AddressZip
            });
            commandService.Close();
            return(RedirectToAction("MyAccount"));
        }
コード例 #9
0
        public ActionResult ReturnPushedMoney()
        {
            try
            {
                using (var client = new CommandServiceClient())
                {
#if DEBUG
                    return(OK());
#endif
                    client.ReturnSessionMoney();
                    return(OK());
                }
            }
            catch (Exception ex)
            {
                _log.FatalException("Error: {0}", ex);
                return(Error(ex.Message));
            }
        }
コード例 #10
0
        public ActionResult GetMoneyReceived()
        {
            try
            {
                using (var client = new CommandServiceClient())
                {
#if DEBUG
                    return(OK("0"));
#endif
                    var count = client.GetSessionMoneyReceived();
                    return(OK(count.ToString()));
                }
            }
            catch (Exception ex)
            {
                _log.FatalException("Error: {0}", ex);
                return(Error(ex.Message));
            }
        }
コード例 #11
0
        public ActionResult DisableMoneyReceiving()
        {
            try
            {
                using (var client = new CommandServiceClient())
                {
#if DEBUG
                    return(OK());
#endif
                    client.DisableMoneyReceiving();
                    return(OK());
                }
            }
            catch (Exception ex)
            {
                _log.FatalException("Error: {0}", ex);
                return(Error(ex.Message));
            }
        }
コード例 #12
0
        public ActionResult Change(int count)
        {
            try
            {
                using (var client = new CommandServiceClient())
                {
#if DEBUG
                    return(OK());
#endif
                    client.Change(count);
                    return(OK());
                }
            }
            catch (Exception ex)
            {
                _log.FatalException("Error: {0}", ex);
                return(Error(ex.Message));
            }
        }
コード例 #13
0
        public ActionResult DropNotesCount()
        {
            try
            {
                using (var client = new CommandServiceClient())
                {
#if DEBUG
                    return(OK());
#endif
                    client.FlushPaymentSession();
                    return(OK());
                }
            }
            catch (Exception ex)
            {
                _log.FatalException("Error: {0}", ex);
                return(Error(ex.Message));
            }
        }
コード例 #14
0
        public ActionResult PrintCheck(decimal amount, decimal comission)
        {
            try
            {
                using (var client = new CommandServiceClient())
                {
#if DEBUG
                    return(OK());
#endif
                    client.PrintCheck(amount, comission);
                    _log.Info("Check printed. Amount: {0}, Comission: {1}", amount, comission);
                    return(OK());
                }
            }
            catch (Exception ex)
            {
                _log.FatalException("Error: {0}", ex);
                return(Error(ex.Message));
            }
        }
コード例 #15
0
        public ActionResult PrintUrl(string url)
        {
            try
            {
                using (var client = new CommandServiceClient())
                {
#if DEBUG
                    return(OK());
#endif
                    client.PrintUrl(url);
                    _log.Info("Url printed: {0}", url);
                    return(OK());
                }
            }
            catch (Exception ex)
            {
                _log.FatalException("Error: {0}", ex);
                return(Error(ex.Message));
            }
        }