Exemplo n.º 1
0
        // shows the form with default values for comboboxes and pickers
        // links:
        //  docLink: http://sql2x.org/documentationLink/f5685d96-a0bb-4f7b-beaa-b3d578c7cf28
        public void ShowAsAdd(System.Guid productId, decimal amount, System.Guid financialCurrencyId, string stateRcd, System.Guid userId)
        {
            try {
                _contract                             = new CrudeCartProductContract();
                _isNew                                = true;
                _contract.ProductId                   = productId;
                _contract.Amount                      = amount;
                maskedTextBoxAmount.Text              = _contract.Amount.ToString();
                _contract.FinancialCurrencyId         = financialCurrencyId;
                financialCurrencyPicker.SelectedValue = _contract.FinancialCurrencyId;
                _contract.StateRcd                    = stateRcd;
                textBoxState.Text                     = _contract.StateRcd;
                _contract.UserId                      = userId;
                userPicker.SelectedValue              = userId;
                _contract.DateTime                    = DateTime.UtcNow;
                dateTimePickerDateTime.Text           = _contract.DateTime.ToString();

                Show();
            } catch (Exception ex) {
                if (ex == null)
                {
                }
                else
                {
                    System.Diagnostics.Debugger.Break();
                }
            }
        }
Exemplo n.º 2
0
        // shows the form in edit modus
        // links:
        //  docLink: http://sql2x.org/documentationLink/49afd26c-4f21-4992-967b-be190eacef77
        public void ShowAsEdit(System.Guid cartProductId)
        {
            var service = new CrudeCartProductServiceClient();

            _isNew = false;
            try {
                _contract = service.FetchByCartProductId(cartProductId);
                maskedTextBoxAmount.Text = _contract.Amount.ToString();
                financialCurrencyPicker.SelectedValue = _contract.FinancialCurrencyId;
                textBoxState.Text           = _contract.StateRcd;
                userPicker.SelectedValue    = _contract.UserId;
                _contract.DateTime          = DateTime.UtcNow;
                dateTimePickerDateTime.Text = _contract.DateTime.ToString();

                Show();
            } catch (Exception ex) {
                if (ex == null)
                {
                }
                else
                {
                    System.Diagnostics.Debugger.Break();
                }
            } finally {
                service.Close();
            }
        }
        public ActionResult CrudeCartProductCreate([Bind()] CrudeCartProductContract contract)
        {
            if (ModelState.IsValid)
            {
                new CrudeCartProductServiceClient().Insert(contract);

                return(RedirectToAction("CrudeCartProductIndex"));
            }

            return(View(
                       "~/Views/Crude/Cart/CrudeCartProduct/CrudeCartProductCreate.cshtml",
                       contract
                       ));
        }
        public ActionResult CrudeCartProductEdit([Bind()] CrudeCartProductContract contract)
        {
            if (ModelState.IsValid)
            {
                contract.DateTime = DateTime.UtcNow;

                new CrudeCartProductServiceClient().Update(contract);

                return(RedirectToAction("CrudeCartProductIndex"));
            }

            return(View(
                       "~/Views/Crude/Cart/CrudeCartProduct/CrudeCartProductEdit.cshtml",
                       contract
                       ));
        }
Exemplo n.º 5
0
        public ActionResult CrudeCartProductCreate(System.Guid?productId, System.Guid?financialCurrencyId, System.Guid?userId)
        {
            var contract = new CrudeCartProductContract();

            if (productId != null)
            {
                contract.ProductId = (System.Guid)productId;
            }
            if (financialCurrencyId != null)
            {
                contract.FinancialCurrencyId = (System.Guid)financialCurrencyId;
            }
            if (userId != null)
            {
                contract.UserId = (System.Guid)userId;
            }

            ViewBag.ProductId =
                new SelectList(new CrudeProductServiceClient().FetchAll(),
                               "ProductId",
                               "ProductName",
                               contract.ProductId
                               );

            ViewBag.FinancialCurrencyId =
                new SelectList(new CrudeFinancialCurrencyServiceClient().FetchAll(),
                               "FinancialCurrencyId",
                               "FinancialCurrencyTypeName",
                               contract.FinancialCurrencyId
                               );

            if (userId == null)
            {
                contract.UserId = new System.Guid("{FFFFFFFF-5555-5555-5555-FFFFFFFFFFFF}");
            }

            ViewBag.DefaultUserName =
                new CrudeDefaultUserServiceClient().FetchByDefaultUserId(contract.UserId).DefaultUserName;

            contract.DateTime = DateTime.UtcNow;


            return(View(
                       "~/Views/Crude/Cart/CrudeCartProduct/CrudeCartProductCreate.cshtml",
                       contract
                       ));
        }
Exemplo n.º 6
0
 // shows the form with default values for comboboxes and pickers
 // links:
 //  docLink: http://sql2x.org/documentationLink/e04d0806-55ef-41cc-8669-acf0ddd850c7
 public void ShowAsAdd()
 {
     try {
         _contract  = new CrudeCartProductContract();
         _isNew     = true;
         this.Text += " - Not Savable (Product Missing)";
         Show();
     } catch (Exception ex) {
         if (ex == null)
         {
         }
         else
         {
             System.Diagnostics.Debugger.Break();
         }
     }
 }
Exemplo n.º 7
0
        // shows by foreign keys
        // links:
        //  docLink: http://sql2x.org/documentationLink/f21e72c1-2d57-44c1-a9c1-1b80bad6a391
        public void ShowAsAddByProduct(System.Guid productId)
        {
            try {
                _contract                   = new CrudeCartProductContract();
                _isNew                      = true;
                _contract.DateTime          = DateTime.UtcNow;
                dateTimePickerDateTime.Text = _contract.DateTime.ToString();
                _contract.ProductId         = productId;

                Show();
            } catch (Exception ex) {
                if (ex == null)
                {
                }
                else
                {
                    System.Diagnostics.Debugger.Break();
                }
            }
        }
Exemplo n.º 8
0
        public ActionResult Order(
            Guid productId
            )
        {
            Guid userId = Logging.UserId(User.Identity, ViewBag);

            // get currency
            List <CrudeFinancialCurrencyContract> financialCurrencyContracts = new
                                                                               CrudeFinancialCurrencyServiceClient( ).FetchAllWithLimit(1);

            var cartProductContract = new CrudeCartProductContract( );

            cartProductContract.ProductId = productId;

            // our internal default_user_id becomes the client id... hmm
            cartProductContract.ClientId = userId;

            // save it if we got it
            if (!string.IsNullOrEmpty(Session.SessionID))
            {
                cartProductContract.SessionIdentificator = Session.SessionID;
            }

            // oauth id
            if (!string.IsNullOrEmpty(User.Identity.GetUserId()))
            {
                cartProductContract.AspId = Guid.Parse(User.Identity.GetUserId());
            }

            cartProductContract.Amount = 66;
            cartProductContract.FinancialCurrencyId = financialCurrencyContracts[0].FinancialCurrencyId;
            cartProductContract.StateRcd            = DefaultStateRef.Created;
            cartProductContract.UserId   = userId;
            cartProductContract.DateTime = DateTime.UtcNow;

            new CrudeCartProductServiceClient( ).Insert(cartProductContract);

            Response.Redirect("../CartProduct/CartProductIndexLive", true);

            return(null);
        }
Exemplo n.º 9
0
        // shows the form with default values for comboboxes and pickers
        // links:
        //  docLink: http://sql2x.org/documentationLink/599dcb45-f71b-4672-bb18-46975a4fe9b3
        public void ShowAsAddByRules(System.Guid userId)
        {
            try {
                _contract                   = new CrudeCartProductContract();
                _isNew                      = true;
                _contract.UserId            = userId;
                userPicker.SelectedValue    = _contract.UserId;
                _contract.DateTime          = DateTime.UtcNow;
                dateTimePickerDateTime.Text = _contract.DateTime.ToString();

                Show();
            } catch (Exception ex) {
                if (ex == null)
                {
                }
                else
                {
                    System.Diagnostics.Debugger.Break();
                }
            }
        }
Exemplo n.º 10
0
        // shows by foreign keys
        // links:
        //  docLink: http://sql2x.org/documentationLink/f21e72c1-2d57-44c1-a9c1-1b80bad6a391
        public void ShowAsAddByFinancialCurrency(System.Guid financialCurrencyId)
        {
            try {
                _contract                             = new CrudeCartProductContract();
                _isNew                                = true;
                _contract.DateTime                    = DateTime.UtcNow;
                dateTimePickerDateTime.Text           = _contract.DateTime.ToString();
                _contract.FinancialCurrencyId         = financialCurrencyId;
                financialCurrencyPicker.SelectedValue = _contract.FinancialCurrencyId;

                Show();
            } catch (Exception ex) {
                if (ex == null)
                {
                }
                else
                {
                    System.Diagnostics.Debugger.Break();
                }
            }
        }