Beispiel #1
0
        private void AddOrganization_click(object sender, RoutedEventArgs e)
        {


            Page_AddOrganization Page_AddOrganization = new Page_AddOrganization();
            this.NavigationService.Navigate(Page_AddOrganization);
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Epi.Web.Common.Message.UserRequest            Request = new Epi.Web.Common.Message.UserRequest();
            SurveyManagerServiceV4.ManagerServiceV4Client Client  = ServiceClient.GetClientV4();
            Request.User.FirstName    = FName.Text.ToString();
            Request.User.LastName     = LName.Text.ToString();
            Request.User.EmailAddress = Email.Text.ToString();
            Request.User.PhoneNumber  = this.PhoneNum.Text.ToString();
            Request.User.UserName     = Email.Text.ToString().Split('@')[0];

            Request.User.UGuid         = Guid.NewGuid();
            Request.User.PasswordHash  = "NA";
            Request.User.ResetPassword = false;
            if (IsActive.IsChecked != null)
            {
                Request.User.IsActive = IsActive.IsChecked.Value;
            }
            else
            {
                Request.User.IsActive = false;
            }
            Request.Organization.OrganizationKey = _OrganizationKey.ToString();

            bool Result = false;

            if (string.IsNullOrEmpty(_UserName))
            {
                Result = Client.SetUserInfo(Request);
            }
            else
            {
                var UserId = _UserName.Substring(_UserName.IndexOf("___") + 3);
                var OrgId  = _OrganizationName.Substring(_OrganizationName.IndexOf("___") + 3);
                Request.User.Operation = Common.Constants.Constant.OperationMode.UpdateUserInfo;
                Request.User.UserId    = int.Parse(UserId);
                Request.Organization.OrganizationId = int.Parse(OrgId);
                Result = Client.UpdateUserInfo(Request);
            }
            Message.Text = "";

            if (Result)
            {
                //Message.Foreground = Brushes.Green;
                //Message.Text = "Successfully added a user";

                Page_AddOrganization Page_AddUser = new Page_AddOrganization(_AdminKey.ToString(), _OrganizationName.ToString());
                this.NavigationService.Navigate(Page_AddUser);
            }
            else
            {
                Message.Foreground = Brushes.Red;
                Message.Text       = "Error occurred while trying to add a user";
            }
            // Message.Text= (Result.Message.ToString());
        }
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            Page_AddOrganization Page_AddUser = new Page_AddOrganization(_AdminKey.ToString(), _OrganizationName.ToString());

            this.NavigationService.Navigate(Page_AddUser);
        }