コード例 #1
0
        public void TestUpdate()
        {
            RoleDetailPanel page = new RoleDetailPanel();

            DetailPanelPageProxy proxy = new DetailPanelPageProxy(page);

            IRoleApi roleApi = SpringContext.Current.GetObject<IRoleApi>();

            IOrganizationApi organizationApi = SpringContext.Current.GetObject<IOrganizationApi>();

            IMembershipApi membershipApi = SpringContext.Current.GetObject<IMembershipApi>();

            IPermissionApi permissionApi = SpringContext.Current.GetObject<IPermissionApi>();

            using (var httpEnv = new HttpEnvironment())
            {
                httpEnv.SetRequestUrl(@"/RoleDetailPanel/DynamicPage.svc?Domain=Department");
                UserObject current = membershipApi.Get("admin");
                httpEnv.SetSessionParaemeter("CurrentUser", current);

                #region Create Data
                Guid guid = Guid.NewGuid();
                string surfix = guid.ToString().Substring(0, 5);

                OrganizationTypeObject obj = new OrganizationTypeObject()
                {
                    Name = "OrganizationTypeTest" + surfix,
                    Description = "OrganizationTypeTest" + surfix,
                    Predefined = false,
                    Domain = "Department",
                    DeleteStatus = DeleteStatus.NotDeleted
                };

                organizationApi.Save(obj);
                OrganizationTypeObjectIds.Add(obj.OrganizationTypeId);

                RoleObject roleObj = new RoleObject()
                {
                    Domain = "Department",
                    RoleName = "superRole" + surfix,
                    Predefined = false
                };

                roleApi.Save(roleObj);

                RoleIds.Add(roleObj.RoleId);
                #endregion

                #region Bind Web Control
                TextBox TextBoxName = new TextBox();
                TextBoxName.Text = "SuperRole" + surfix;
                proxy.Set("TextBoxName", TextBoxName);

                TextBox TextBoxDescription = new TextBox();
                TextBoxDescription.Text = "SuperRoleUpdate" + surfix;
                proxy.Set("TextBoxDescription", TextBoxDescription);

                PermissionTreeView permissionTreeView = new PermissionTreeView();
                proxy.Set("PermissionTreeView", permissionTreeView);
                Type _type = typeof(PermissionTreeView);
                _type.GetMethod("OnInit", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(permissionTreeView, new object[] { new EventArgs() });
                IList<string> values = new List<string>();

                IList<PermissionConfig> permissions = permissionApi.FindPermissionConfig(current.UserId).ToList<PermissionConfig>();
                for (int i = 0; i < permissions.Count; i++)
                {
                    if ((permissions[i].Value == null) || (permissions[i].Value.Equals(String.Empty)))
                        values.Add("P" + i);
                    else
                        values.Add(permissions[i].Value);
                }
                permissionTreeView.CheckedValues = values;
                #endregion

                proxy.Update(roleObj.RoleId.ToString());

                Assert.AreEqual(roleApi.Get(roleObj.RoleId).Description, "SuperRoleUpdate" + surfix);

            }
        }
        public void TestUpdate()
        {
            HierarchyDataDetailPanel page = new HierarchyDataDetailPanel();

            DetailPanelPageProxy proxy = new DetailPanelPageProxy(page);

            IHierarchyApi hierarchyApi = SpringContext.Current.GetObject<IHierarchyApi>();

            using (var httpEnv = new HttpEnvironment())
            {
                #region Create Data
                httpEnv.SetRequestUrl(@"/HierarchyDataDetailPanel/DynamicPage.svc?HierarchyType=Department");
                Guid guid = Guid.NewGuid();

                string surfix = guid.ToString().Substring(0, 5);

                HierarchyDataObject obj = new HierarchyDataObject()
                {
                    HierarchyType = "Department",
                    Name = "HierarchyType" + surfix,
                    Description = "HierarchyType" + surfix

                };

                hierarchyApi.Save(obj);
                #endregion

                #region Bind Web Control
                W.TextBox TextBoxName = new W.TextBox();
                TextBoxName.Text = "HierarchyType" + surfix;
                proxy.Set("TextBoxName", TextBoxName);

                W.TextBox TextBoxDescription = new W.TextBox();
                TextBoxDescription.Text = "HierarchyTypeUpdate" + surfix;
                proxy.Set("TextBoxDescription", TextBoxDescription);

                proxy.Set("ComboBoxParentHierarchyData", null);

                proxy.Set("ExtensionDataForm", null);
                #endregion

                proxy.Update(obj.HierarchyDataId.ToString());

                Assert.AreEqual(obj.Description, "HierarchyType" + surfix);

                obj = hierarchyApi.GetHierarchyData(obj.HierarchyDataId);

                Assert.AreEqual(obj.Description, "HierarchyTypeUpdate" + surfix);

            }
        }
        public void TestUpdate()
        {
            ConcreteDataDetailPanel page = new ConcreteDataDetailPanel();

            DetailPanelPageProxy proxy = new DetailPanelPageProxy(page);

            IConcreteDataApi concreteDataApi = SpringContext.Current.GetObject<IConcreteDataApi>();
            using (var httpEnv = new HttpEnvironment())
            {
                Guid guid = Guid.NewGuid();

                string surfix = guid.ToString().Substring(0, 5);

                httpEnv.SetRequestUrl(@"/ConcreteDataDetailPanel/DynamicPage.svc?ConcreteDataType=Department");

                ConcreteDataObject obj = new ConcreteDataObject()
                {
                    Name = "concrete" + surfix,
                    Value = "concrete" + surfix,
                    Type = "Department",
                    DeleteStatus = DeleteStatus.NotDeleted
                };

                concreteDataApi.Save(obj);

                #region Bind Control
                TextBox TextBoxName = new TextBox();
                TextBoxName.Text = "concrete" + surfix;
                proxy.Set("TextBoxName", TextBoxName);

                TextBox TextBoxValue = new TextBox();
                TextBoxValue.Text = "concreteUpdate" + surfix;
                proxy.Set("TextBoxValue", TextBoxValue);

                Array statusData = new string[] { "NotDeleted", "Deleted" };
                RadioButtonList RadioButtonListStatus = new RadioButtonList();
                RadioButtonListStatus.DataSource = statusData;
                RadioButtonListStatus.DataBind();
                RadioButtonListStatus.SelectedIndex = 0;
                proxy.Set("RadioButtonListStatus", RadioButtonListStatus);

                proxy.Set("ExtensionDataForm", null);
                #endregion

                proxy.Update(obj.ConcreteDataId.ToString());

                Assert.AreEqual(obj.Value, "concrete" + surfix);

                obj = concreteDataApi.GetById(obj.ConcreteDataId);

                Assert.AreEqual(obj.Value, "concreteUpdate" + surfix);

            }
        }
コード例 #4
0
        public void TestUpdate()
        {
            UserDetailPanel page = new UserDetailPanel();

            DetailPanelPageProxy proxy = new DetailPanelPageProxy(page);

            IOrganizationApi organizationApi = SpringContext.Current.GetObject<IOrganizationApi>();

            IMembershipApi membershipApi = SpringContext.Current.GetObject<IMembershipApi>();

            IPlatformConfiguration platformConfiguration = SpringContext.Current.GetObject<IPlatformConfiguration>();

            using (var httpEnv = new HttpEnvironment())
            {
                httpEnv.SetRequestUrl(@"/UserDetailPanel/DynamicPage.svc?Domain=Department");
                Guid guid = Guid.NewGuid();
                string surfix = guid.ToString().Substring(0, 5);

                UserObject obj = new UserObject()
                {
                    OrganizationId = platformConfiguration.Organization.OrganizationId,
                    Comment = "IT specialist",
                    DisplayName = "Eunge Liu" + surfix,
                    Email = "*****@*****.**",
                    IsApproved = true,
                    MobilePin = "137641855XX",
                    UserName = "******" + surfix
                };

                membershipApi.Save(obj, "password1", null);
                createdObjectIds.Add(obj.UserId);

                OrganizationSelector OrganizationSelector = new OrganizationSelector();
                //IList<OrganizationObject> ds = new List<OrganizationObject>();
                OrganizationObject organization = new OrganizationObject()
                {
                    OrganizationCode = "123456" + surfix,
                    OrganizationName = "org" + surfix,
                    Status = OrganizationStatus.Enabled,
                    OrganizationTypeId = organizationApi.FindOrganizationTypes(new List<string>() { "Department" }).Select(x => x.OrganizationTypeId).FirstOrDefault(),
                    Description = "organ"
                };

                organizationApi.Save(organization);
                //ds.Add(organization);
                createdOrganizationIds.Add(organization.OrganizationId);

                OrganizationSelector.SelectedOrganization = organization;

                proxy.Set("OrganizationSelector", OrganizationSelector);

                TextBox TextBoxUserName = new TextBox();
                TextBoxUserName.Text = "Eunge" + surfix;
                proxy.Set("TextBoxUserName", TextBoxUserName);

                TextBox TextBoxPassword = new TextBox();
                TextBoxPassword.Text = "Password" + surfix;
                proxy.Set("TextBoxPassword", TextBoxPassword);

                TextBox TextBoxConfirmPassword = new TextBox();
                TextBoxConfirmPassword.Text = "Password" + surfix;
                proxy.Set("TextBoxConfirmPassword", TextBoxConfirmPassword);

                TextBox TextBoxDisplayName = new TextBox();
                TextBoxDisplayName.Text = "Eunge" + surfix;
                proxy.Set("TextBoxDisplayName", TextBoxConfirmPassword);

                TextBox TextBoxEmail = new TextBox();
                TextBoxEmail.Text = "*****@*****.**";
                proxy.Set("TextBoxEmail", TextBoxEmail);

                TextBox TextBoxMobile = new TextBox();
                TextBoxMobile.Text = "13456789009";
                proxy.Set("TextBoxMobile", TextBoxMobile);

                ExtensionDataForm UserExtensionDataForm = null;
                proxy.Set("UserExtensionDataForm", UserExtensionDataForm);

                TextBox TextBoxComment = new TextBox();
                TextBoxComment.Text = "13456789009" + surfix;
                proxy.Set("TextBoxComment", TextBoxComment);

                Array statusData = new string[] { "true", "false" };
                RadioButtonList RadioButtonListStatus = new RadioButtonList();
                RadioButtonListStatus.DataSource = statusData;
                RadioButtonListStatus.DataBind();
                RadioButtonListStatus.SelectedIndex = 0;
                proxy.Set("RadioButtonListStatus", RadioButtonListStatus);

                TextBox TextBoxCreationDate = new TextBox();
                TextBoxCreationDate.Text = System.DateTime.UtcNow.ToShortTimeString();
                proxy.Set("TextBoxCreationDate", TextBoxCreationDate);

                TextBox TextBoxLastLoginDate = new TextBox();
                TextBoxLastLoginDate.Text = System.DateTime.UtcNow.ToShortTimeString();
                proxy.Set("TextBoxLastLoginDate", TextBoxLastLoginDate);

                TextBox TextBoxLastActivityDate = new TextBox();
                TextBoxLastActivityDate.Text = System.DateTime.UtcNow.ToShortTimeString();
                proxy.Set("TextBoxLastActivityDate", TextBoxLastActivityDate);

                TextBox TextBoxLockedOutDate = new TextBox();
                TextBoxLockedOutDate.Text = System.DateTime.UtcNow.ToShortTimeString();
                proxy.Set("TextBoxLockedOutDate", TextBoxLockedOutDate);

                TextBox TextBoxLastPasswordChangedDate = new TextBox();
                TextBoxLastPasswordChangedDate.Text = System.DateTime.UtcNow.ToShortTimeString();
                proxy.Set("TextBoxLastPasswordChangedDate", TextBoxLastPasswordChangedDate);

                TextBox TextBoxLastUpdatedDate = new TextBox();
                TextBoxLastUpdatedDate.Text = System.DateTime.UtcNow.ToShortTimeString();
                proxy.Set("TextBoxLastUpdatedDate", TextBoxLastUpdatedDate);

                PermissionTreeView @PermissionTreeView = null;
                proxy.Set("PermissionTreeView", @PermissionTreeView);

                proxy.Update(obj.UserId.ToString());
            }
        }
        public void TestUpdate()
        {
            IOrganizationApi organizationApi = SpringContext.Current.GetObject<IOrganizationApi>();

            OrganizationTypeDetailPanel page = new OrganizationTypeDetailPanel();

            DetailPanelPageProxy proxy = new DetailPanelPageProxy(page);

            using (var httpEnv = new HttpEnvironment())
            {
                httpEnv.SetRequestUrl(@"/OrganizationTypeDetailPanel/DynamicPage.svc?Domain=Department");

                #region Create Data
                 Guid guid = Guid.NewGuid();
                string surfix = guid.ToString().Substring(0, 5);
                OrganizationTypeObject obj = new OrganizationTypeObject()
                {
                    Name = "OrganizationTypeTestUpdate" + surfix,
                    Description = "OrganizationTypeTest" + surfix,
                    Predefined = false,
                    Domain = "Department",
                    DeleteStatus = DeleteStatus.NotDeleted
                };

                organizationApi.Save(obj);

                ids.Add(obj.OrganizationTypeId);
                #endregion
                #region Bind Web Control

                RapidWebDev.UI.Controls.TextBox TextBoxName = new RapidWebDev.UI.Controls.TextBox();
                TextBoxName.Text = "OrganizationTypeTestUpdate" + surfix;
                proxy.Set("TextBoxName", TextBoxName);

                RapidWebDev.UI.Controls.TextBox TextBoxDescription = new RapidWebDev.UI.Controls.TextBox();
                TextBoxDescription.Text = "OrganizationTypeTestUpdate" + surfix;
                proxy.Set("TextBoxDescription", TextBoxDescription);

                DropDownList DropDownListDomain = new DropDownList();
                var typeData = new string[] { "Department" };
                DropDownListDomain.DataSource = typeData;
                DropDownListDomain.DataBind();
                DropDownListDomain.SelectedIndex = 0;
                proxy.Set("DropDownListDomain", DropDownListDomain);

                #endregion

                proxy.Update(obj.OrganizationTypeId.ToString());

                Assert.AreEqual(obj.Description, "OrganizationTypeTest" + surfix);

                obj = organizationApi.GetOrganizationType(obj.OrganizationTypeId);

                Assert.AreEqual(obj.Description, "OrganizationTypeTestUpdate" + surfix);

            }
        }
        public void TestUpdate()
        {
            OrganizationDetailPanel testpage = new OrganizationDetailPanel();

            DetailPanelPageProxy proxy = new DetailPanelPageProxy(testpage);

            IOrganizationApi organizationApi = SpringContext.Current.GetObject<IOrganizationApi>();

            Guid guid = Guid.NewGuid();

            string surfix = guid.ToString().Substring(0, 5);

            using (var httpEnv = new HttpEnvironment())
            {
                #region Setup the pre-required data
                //Setup the right URL
                httpEnv.SetRequestUrl("/OrganizationDetailPanel/DynamicPage.svc?Domain=Department");

                OrganizationObject testOrganization = new OrganizationObject()
                {
                    OrganizationCode = "78903"+surfix,
                    OrganizationName = "testOrganizationUpdate" + surfix,
                    OrganizationTypeId = organizationApi.FindOrganizationTypes(new List<string>() { "Department" }).Select(x => x.OrganizationTypeId).FirstOrDefault(),
                    Status = OrganizationStatus.Enabled
                };

                organizationApi.Save(testOrganization);
                createdOrganizationIds.Add(testOrganization.OrganizationId);

                #endregion

                OrganizationObject organization = organizationApi.GetOrganizationByName("testOrganizationUpdate"+surfix);

                #region Setup the Updated Code
                //Binding the required web controls
                TextBox organizationCode = new TextBox();
                organizationCode.Text = "78903" + surfix;
                proxy.Set("TextBoxOrganizationCode", organizationCode);

                TextBox organizationName = new TextBox();
                organizationName.Text = "OrganziationTest" + surfix;
                proxy.Set("TextBoxOrganizationName", organizationName);

                DropDownList DropDownListOrganizationType = new DropDownList();
                var typeData = organizationApi.FindOrganizationTypes(new List<string>() { "Department" }).Select(x => x.OrganizationTypeId);

                DropDownListOrganizationType.Items.Clear();
                DropDownListOrganizationType.DataSource = typeData;
                DropDownListOrganizationType.DataBind();
                DropDownListOrganizationType.SelectedIndex = 1;

                proxy.Set("DropDownListOrganizationType", DropDownListOrganizationType);

                Array statusData = new string[] { "Enabled", "Disabled", "Pending" };
                RadioButtonList RadioButtonListOrganizationStatus = new RadioButtonList();
                RadioButtonListOrganizationStatus.DataSource = statusData;
                RadioButtonListOrganizationStatus.DataBind();
                RadioButtonListOrganizationStatus.SelectedIndex = 0;
                proxy.Set("RadioButtonListOrganizationStatus", RadioButtonListOrganizationStatus);
                #endregion
                proxy.Update(organization.OrganizationId.ToString());

                OrganizationObject organizationUpdated = organizationApi.GetOrganization(organization.OrganizationId);

                Assert.AreNotEqual(organizationUpdated.OrganizationName, "testOrganization" + surfix);
                Assert.AreEqual(organizationUpdated.OrganizationName, "OrganziationTest" + surfix);
            }
        }