예제 #1
0
        protected void btnGoFindOrder_Click(object sender, EventArgs e)
        {
            lblFindOrderMessage.Text = string.Empty;

            var c = new OrderSearchCriteria();

            c.OrderNumber  = FindOrderNumberField.Text.Trim();
            c.IsPlaced     = true;
            c.StartDateUtc = DateTime.UtcNow.AddYears(-5);
            c.EndDateUtc   = DateTime.UtcNow.AddYears(1);

            var found = false;

            var totalCount = 0;
            var results    = HccApp.OrderServices.Orders.FindByCriteriaPaged(c, 1, 10, ref totalCount);

            if (results != null)
            {
                if (results.Count > 0)
                {
                    found = true;
                    var args = new UserSelectedEventArgs();
                    args.UserAccount = HccApp.MembershipServices.Customers.Find(results[0].UserID);
                    UserSelected(args);
                }
            }

            if (!found)
            {
                lblFindOrderMessage.Text = "<span class=\"errormessage\">That order was not found</span>";
            }
        }
        private void ValidateUser()
        {
            var users = HccApp.MembershipServices.Customers.FindByEmail(UserNameField.Text.Trim());
            var u     = users != null?users.FirstOrDefault() : null;

            if (u != null)
            {
                if (u.Bvin != string.Empty)
                {
                    var args = new UserSelectedEventArgs();
                    args.UserAccount = u;
                    if (UserSelected != null)
                    {
                        UserSelected(this, args);
                    }
                }
                else
                {
                    if (MessageBox != null)
                    {
                        MessageBox.ShowWarning("User account " + UserNameField.Text.Trim() +
                                               " wasn't found. Please try again or create a new account.");
                    }
                }
            }
        }
        private void ValidateUser()
        {
            var users = HccApp.MembershipServices.Customers.FindByEmail(UserNameField.Text.Trim());
            var u     = users != null?users.FirstOrDefault() : null;

            if (u != null)
            {
                if (u.Bvin != string.Empty)
                {
                    var args = new UserSelectedEventArgs();
                    args.UserAccount = u;
                    if (UserSelected != null)
                    {
                        UserSelected(this, args);
                    }
                }
                else
                {
                    if (MessageBox != null)
                    {
                        MessageBox.ShowWarning(string.Format(Localization.GetString("UserNotFound"), UserNameField.Text.Trim()));
                    }
                }
            }
        }
        protected void btnGoFindOrder_Click(object sender, EventArgs e)
        {
            lblFindOrderMessage.Text = string.Empty;

            var c = new OrderSearchCriteria();

            c.OrderNumber  = FindOrderNumberField.Text.Trim();
            c.IsPlaced     = true;
            c.StartDateUtc = DateTime.UtcNow.AddYears(-5);
            c.EndDateUtc   = DateTime.UtcNow.AddYears(1);

            var found = false;

            var totalCount = 0;
            var results    = HccApp.OrderServices.Orders.FindByCriteriaPaged(c, 1, 10, ref totalCount);

            if (results != null)
            {
                if (results.Count > 0)
                {
                    found = true;
                    var args = new UserSelectedEventArgs();
                    args.UserAccount = HccApp.MembershipServices.Customers.Find(results[0].UserID);
                    UserSelected(args);
                }
            }

            if (!found)
            {
                lblFindOrderMessage.Text = string.Format(ERRORFORMAT, Localization.GetString("NoOrder"));
            }
        }
예제 #5
0
        private void UserPicker1_UserSelected(object sender, UserSelectedEventArgs e)
        {
            var q = TypedQualification;

            q.AddUserId(e.UserAccount.Bvin);
            UpdatePromotion();
            LoadQualification();
        }
        protected void gridSelectUser_RowEditing(object sender, GridViewEditEventArgs e)
        {
            var bvin = gridSelectUser.DataKeys[e.NewEditIndex]["Bvin"].ToString();
            var u    = HccApp.MembershipServices.Customers.Find(bvin);
            var args = new UserSelectedEventArgs();

            args.UserAccount = u;
            UserSelected(args);
        }
예제 #7
0
        protected void gridSelectUser_OnEditCommand(object sender, GridCommandEventArgs e)
        {
            var bvin = gridSelectUser.Items[e.Item.ItemIndex].GetDataKeyValue("Bvin").ToString();
            var u    = HccApp.MembershipServices.Customers.Find(bvin);
            var args = new UserSelectedEventArgs();

            args.UserAccount = u;
            UserSelected(args);
            e.Canceled = true;
        }
예제 #8
0
            // View -> Controller
            public override void RowSelected(UITableView tableView, Foundation.NSIndexPath indexPath)
            {
                tableView.DeselectRow(indexPath, true);
                Restaurant item = Items[indexPath.Row];
                EventHandler <UserSelectedEventArgs> handle = UserSelected;

                if (null != handle)
                {
                    var args = new UserSelectedEventArgs {
                        SelectedItem = item
                    };
                    handle(this, args);
                }
            }
        private void OnSourceUserSelected(object evtSender, UserSelectedEventArgs evt)
        {
            if (_artefactManagerFactory.IsKnownType(SelectedArtefactTypeName) == false || SelectedSourceUser == null)
            {
                lvCrmArtefacts.Items.Clear();
                lvCrmArtefacts.Enabled = true;
                return;
            }

            lvCrmArtefacts.Enabled = false;

            // Load data from CRM
            ExecuteMethod(LoadCrmArtefacts);
        }
예제 #10
0
            public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
            {
                tableView.DeselectRow(indexPath, true);

                User user = Users[indexPath.Row];

                EventHandler <UserSelectedEventArgs> handle = UserSelected;

                if (handle != null)
                {
                    var args = new UserSelectedEventArgs {
                        SelectedUser = user
                    };

                    handle(this, args);
                }
            }
        protected void UserSelected(UserSelectedEventArgs args)
        {
            if (args.UserAccount == null)
            {
                return;
            }

            UserIdField.Value = args.UserAccount.Bvin;

            CurrentOrder.UserID = args.UserAccount.Bvin;

            HccApp.OrderServices.Orders.Update(CurrentOrder);

            BillToAddress.LoadFromAddress(args.UserAccount.BillingAddress);
            ShipToAddress.LoadFromAddress(args.UserAccount.ShippingAddress);
            if (BillToAddress.FirstName == string.Empty)
            {
                BillToAddress.FirstName = args.UserAccount.FirstName;
            }
            if (BillToAddress.LastName == string.Empty)
            {
                BillToAddress.LastName = args.UserAccount.LastName;
            }
            if (ShipToAddress.FirstName == string.Empty)
            {
                ShipToAddress.FirstName = args.UserAccount.FirstName;
            }
            if (ShipToAddress.LastName == string.Empty)
            {
                ShipToAddress.LastName = args.UserAccount.LastName;
            }

            EmailAddressTextBox.Text = args.UserAccount.Email;


            LoadShippingMethods();

            CurrentOrder.UserEmail       = EmailAddressTextBox.Text;
            CurrentOrder.BillingAddress  = BillToAddress.GetAsAddress();
            CurrentOrder.ShippingAddress = ShipToAddress.GetAsAddress();
            HccApp.OrderServices.Orders.Update(CurrentOrder);
        }
        protected void btnNewUserSave_Click(object sender, EventArgs e)
        {
            lblNewUserMessage.Text = string.Empty;
            var u = new CustomerAccount();

            u.Email     = NewUserEmailField.Text.Trim();
            u.FirstName = NewUserFirstNameField.Text.Trim();
            u.LastName  = NewUserLastNameField.Text.Trim();
            var clearPassword = PasswordGenerator.GeneratePassword(12);

            if (HccApp.MembershipServices.CreateCustomer(u, clearPassword))
            {
                var args = new UserSelectedEventArgs();
                args.UserAccount = HccApp.MembershipServices.Customers.Find(u.Bvin);
                UserSelected(args);
            }
            else
            {
                lblNewUserMessage.Text = string.Format(ERRORFORMAT, Localization.GetString("CreateUserError"));
            }
        }
예제 #13
0
        protected void gridSelectUser_OnNeedDataSource(object sender, GridNeedDataSourceEventArgs e)
        {
            lblNewUserMessage.Text = string.Empty;
            gridSelectUser.Visible = false;

            var totalCount = 0;
            var found      = false;
            var users      = HccApp.MembershipServices.Customers.FindByFilter(FilterUserField.Text.Trim(),
                                                                              gridSelectUser.CurrentPageIndex, gridSelectUser.PageSize, ref totalCount);

            if (users != null)
            {
                if (totalCount > 0)
                {
                    found = true;

                    if (totalCount == 1)
                    {
                        lblFindUserMessage.Text = "<span class=\"successmessage\">User " + users[0].Email +
                                                  " Found and Selected</span>";
                        var args = new UserSelectedEventArgs();
                        args.UserAccount = users[0];
                        UserSelected(args);
                    }
                    else
                    {
                        lblFindUserMessage.Text = "<span class=\"successmessage\">Found " + totalCount +
                                                  " matching users.</span>";
                        gridSelectUser.Visible          = true;
                        gridSelectUser.VirtualItemCount = totalCount;
                        gridSelectUser.DataSource       = users;
                    }
                }
            }

            if (!found)
            {
                lblFindUserMessage.Text = "<span class=\"errormessage\">No matching users were found.</span>";
            }
        }
        protected void BindUserGrid()
        {
            lblNewUserMessage.Text = string.Empty;
            gridSelectUser.Visible = false;

            var totalCount = 0;
            var found      = false;
            var users      = HccApp.MembershipServices.Customers.FindByFilter(FilterUserField.Text.Trim(),
                                                                              gridSelectUser.PageIndex, gridSelectUser.PageSize, ref totalCount);

            if (users != null)
            {
                if (totalCount > 0)
                {
                    found = true;

                    if (totalCount == 1)
                    {
                        var message = string.Format(Localization.GetString("UserFound"), users[0].Email);
                        lblFindUserMessage.Text = string.Format(SUCCESSFORMAT, message);
                        var args = new UserSelectedEventArgs();
                        args.UserAccount = users[0];
                        UserSelected(args);
                    }
                    else
                    {
                        var message = string.Format(Localization.GetString("UsersFound"), totalCount);
                        lblFindUserMessage.Text         = string.Format(SUCCESSFORMAT, message);
                        gridSelectUser.Visible          = true;
                        gridSelectUser.VirtualItemCount = totalCount;
                        gridSelectUser.DataSource       = users;
                    }
                }
            }

            if (!found)
            {
                lblFindUserMessage.Text = string.Format(ERRORFORMAT, Localization.GetString("NoUsers"));
            }
        }
예제 #15
0
        protected void btnNewUserSave_Click(object sender, EventArgs e)
        {
            lblNewUserMessage.Text = string.Empty;
            var u = new CustomerAccount();

            u.Email     = NewUserEmailField.Text.Trim();
            u.FirstName = NewUserFirstNameField.Text.Trim();
            u.LastName  = NewUserLastNameField.Text.Trim();
            var clearPassword = PasswordGenerator.GeneratePassword(12);

            if (HccApp.MembershipServices.CreateCustomer(u, clearPassword))
            {
                var args = new UserSelectedEventArgs();
                args.UserAccount = HccApp.MembershipServices.Customers.Find(u.Bvin);
                UserSelected(args);
            }
            else
            {
                lblNewUserMessage.Text =
                    "<span class=\"errormessage\">Unable to create this account at this time. Unknown Error.</span>";
            }
        }
예제 #16
0
 void clientesForm_OnUserSelected(object sender, UserSelectedEventArgs e)
 {
     _user           = e.User;
     txtCliente.Text = _user.UserName;
     _clientesForm.Hide();
 }
예제 #17
0
 private void ucUserPicker_UserSelected(object sender, UserSelectedEventArgs e)
 {
     UserIdField.Value = e.UserAccount.Bvin;
 }
 void _proveedoresForm_OnUserSelected(object sender, UserSelectedEventArgs e)
 {
     _proveedor = e.User as Proveedor;
     _proveedoresForm.Hide();
     txtProveedor.Text = _proveedor.UserName;
 }
예제 #19
0
 protected void userSelector_UserSelectedChanged(object sender, UserSelectedEventArgs e)
 {
     btnAssignUser_Click(sender, e);
 }