예제 #1
0
        private void BindValues()
        {
            BindVisibility();

            btnAddOneGr.Attributes.Add("onclick", "MoveOne(" + lbAvailableGroups.ClientID + "," + lbSelectedGroups.ClientID + "); return false;");
            btnAddAllGr.Attributes.Add("onclick", "MoveAll(" + lbAvailableGroups.ClientID + "," + lbSelectedGroups.ClientID + "); return false;");
            btnRemoveOneGr.Attributes.Add("onclick", "MoveOne(" + lbSelectedGroups.ClientID + "," + lbAvailableGroups.ClientID + "); return false;");
            btnRemoveAllGr.Attributes.Add("onclick", "MoveAll(" + lbSelectedGroups.ClientID + "," + lbAvailableGroups.ClientID + ");return false;");

            lbAvailableGroups.Attributes.Add("ondblclick", "MoveOne(" + lbAvailableGroups.ClientID + "," + lbSelectedGroups.ClientID + "); return false;");
            lbSelectedGroups.Attributes.Add("ondblclick", "MoveOne(" + lbSelectedGroups.ClientID + "," + lbAvailableGroups.ClientID + "); return false;");

            ddlIMGroup.DataTextField  = "IMGroupName";
            ddlIMGroup.DataValueField = "IMGroupId";
            ddlIMGroup.DataSource     = IMGroup.GetListIMGroupsWithoutPartners();
            ddlIMGroup.DataBind();

            using (IDataReader reader = SecureGroup.GetListGroupsWithParameters(false, false, false, false, false, false, false, false, false, false, false))
            {
                while (reader.Read())
                {
                    lbAvailableGroups.Items.Add(new ListItem(CommonHelper.GetResFileString(reader["GroupName"].ToString()), reader["GroupId"].ToString()));
                }
            }

            lbSecurityRoles.Items.Clear();
            int      iRoleId   = (int)InternalSecureGroups.Administrator;
            ListItem liSecRole = new ListItem(GetGroupTitleById(iRoleId), iRoleId.ToString());

            lbSecurityRoles.Items.Add(liSecRole);

            iRoleId   = (int)InternalSecureGroups.HelpDeskManager;
            liSecRole = new ListItem(GetGroupTitleById(iRoleId), iRoleId.ToString());
            lbSecurityRoles.Items.Add(liSecRole);

            iRoleId   = (int)InternalSecureGroups.PowerProjectManager;
            liSecRole = new ListItem(GetGroupTitleById(iRoleId), iRoleId.ToString());
            lbSecurityRoles.Items.Add(liSecRole);

            iRoleId   = (int)InternalSecureGroups.ProjectManager;
            liSecRole = new ListItem(GetGroupTitleById(iRoleId), iRoleId.ToString());

            if (Configuration.ProjectManagementEnabled)
            {
                liSecRole.Selected = true;
            }

            lbSecurityRoles.Items.Add(liSecRole);

            iRoleId   = (int)InternalSecureGroups.ExecutiveManager;
            liSecRole = new ListItem(GetGroupTitleById(iRoleId), iRoleId.ToString());
            lbSecurityRoles.Items.Add(liSecRole);

            iRoleId   = (int)InternalSecureGroups.TimeManager;
            liSecRole = new ListItem(GetGroupTitleById(iRoleId), iRoleId.ToString());
            lbSecurityRoles.Items.Add(liSecRole);

            lstLang.DataSource     = Common.GetListLanguages();
            lstLang.DataTextField  = "FriendlyName";
            lstLang.DataValueField = "LanguageId";
            lstLang.DataBind();
            int LanguageId = Security.CurrentUser.LanguageId;

            Util.CommonHelper.SafeSelect(lstLang, LanguageId.ToString());

            lstTimeZone.DataSource     = User.GetListTimeZone();
            lstTimeZone.DataTextField  = "DisplayName";
            lstTimeZone.DataValueField = "TimeZoneId";
            lstTimeZone.DataBind();

            int TimeZoneId = Security.CurrentUser.TimeZoneId;

            lstTimeZone.ClearSelection();
            ListItem li = lstTimeZone.Items.FindByValue(TimeZoneId.ToString());

            if (li != null)
            {
                li.Selected = true;
            }

            using (IDataReader reader = SecureGroup.GetListChildGroups((int)InternalSecureGroups.Partner))
            {
                while (reader.Read())
                {
                    ddPartnerGroups.Items.Add(new ListItem(CommonHelper.GetResFileString(reader["GroupName"].ToString()), reader["GroupId"].ToString()));
                }
            }

            if (ddPartnerGroups.Items.Count == 0)
            {
                ListItem liUserType = ddUserType.Items.FindByValue("1");
                if (liUserType != null)
                {
                    ddUserType.Items.Remove(liUserType);
                    if (ddUserType.SelectedIndex < 0)
                    {
                        ddUserType.SelectedIndex = 0;
                    }
                    BindVisibility();
                }
            }

            EntityObject[] profiles = BusinessManager.List(CustomizationProfileEntity.ClassName, (new FilterElementCollection()).ToArray(), (new SortingElementCollection(new SortingElement("Name", SortingElementType.Asc))).ToArray());
            foreach (CustomizationProfileEntity profile in profiles)
            {
                ProfileList.Items.Add(new ListItem(CommonHelper.GetResFileString(profile.Name), profile.PrimaryKeyId.ToString()));
            }
            ListItem liProfile = ProfileList.Items.FindByValue("-1");

            if (liProfile != null)
            {
                liProfile.Selected = true;
            }

            SelectGroup();
        }
예제 #2
0
        private void BindStep1()
        {
            lgdContactInf.InnerText          = LocRM.GetString("tContactInformation");
            lgdCompanyinf.InnerText          = LocRM.GetString("tCompanyInformation");
            lgdSelGroup.InnerText            = LocRM.GetString("tSelectIBNGroups");
            lgdTextPartner.InnerText         = LocRM.GetString("tSelectPartnerGroup");
            lblGroupsTitle.Text              = LocRM.GetString("tPartnerGroups");
            lgdLang.InnerText                = LocRM.GetString("tDefLanguage");
            lgdRole.InnerText                = LocRM.GetString("tRole");
            lgdTextExt.InnerText             = LocRM.GetString("tExternalAdding");
            lgdWelcome.InnerText             = LocRM.GetString("tWelcomeComments");
            txtRELoginValidator.ErrorMessage = LocRM.GetString("LoginReg");
            lblSelected.Text  = LocRM.GetString("tSelected");
            lblAvailable.Text = LocRM.GetString("tAvailable");

            btnAddOneGr.Attributes.Add("onclick", "MoveOne(" + lbAvailableGroups.ClientID + "," + lbSelectedGroups.ClientID + "); SaveGroups(); return false;");
            btnAddAllGr.Attributes.Add("onclick", "MoveAll(" + lbAvailableGroups.ClientID + "," + lbSelectedGroups.ClientID + "); SaveGroups(); return false;");
            btnRemoveOneGr.Attributes.Add("onclick", "MoveOne(" + lbSelectedGroups.ClientID + "," + lbAvailableGroups.ClientID + "); SaveGroups(); return false;");
            btnRemoveAllGr.Attributes.Add("onclick", "MoveAll(" + lbSelectedGroups.ClientID + "," + lbAvailableGroups.ClientID + "); SaveGroups();return false;");

            lbAvailableGroups.Attributes.Add("ondblclick", "MoveOne(" + lbAvailableGroups.ClientID + "," + lbSelectedGroups.ClientID + "); SaveGroups(); return false;");
            lbSelectedGroups.Attributes.Add("ondblclick", "MoveOne(" + lbSelectedGroups.ClientID + "," + lbAvailableGroups.ClientID + "); SaveGroups(); return false;");

            if (user_type == 1 || user_type == 2)
            {
                rbAccount.Items.Add(new ListItem(" " + LocRM.GetString("tIBNAccount"), "0"));
                if (User.CanCreateExternal())
                {
                    rbAccount.Items.Add(new ListItem(" " + LocRM.GetString("tExternalAccount"), "1"));
                }
                if (user_type != 2 && User.CanCreatePartner())
                {
                    rbAccount.Items.Add(new ListItem(" " + LocRM.GetString("tPartnerAccount"), "2"));
                }
                rbAccount.SelectedIndex = 0;
            }
            if (user_type == 3)
            {
                lblUserType.Text = LocRM.GetString("tOnlyPending");
            }

            cbRole.Items.Add(new ListItem(" " + LocRM.GetString("tPPM"), "0"));
            cbRole.Items.Add(new ListItem(" " + LocRM.GetString("tPM"), "1"));
            cbRole.Items.Add(new ListItem(" " + LocRM.GetString("tHDM"), "2"));
            cbRole.RepeatColumns = 3;

            using (IDataReader reader = SecureGroup.GetListGroupsWithParameters(false, false, false, false, false, false, false, false, false, false, false))
            {
                while (reader.Read())
                {
                    lbAvailableGroups.Items.Add(new ListItem(CommonHelper.GetResFileString(reader["GroupName"].ToString()), reader["GroupId"].ToString()));
                }
            }

            ddLang.DataSource     = Common.GetListLanguages();
            ddLang.DataTextField  = "FriendlyName";
            ddLang.DataValueField = "LanguageId";
            ddLang.DataBind();

            ddIMGroup.DataTextField  = "IMGroupName";
            ddIMGroup.DataValueField = "IMGroupId";
            ddIMGroup.DataSource     = IMGroup.GetListIMGroupsWithoutPartners();
            ddIMGroup.DataBind();
        }
예제 #3
0
        private void BindValues()
        {
            btnAddOneGr.Attributes.Add("onclick", "MoveOne(" + lbAvailableGroups.ClientID + "," + lbSelectedGroups.ClientID + "); return false;");
            btnAddAllGr.Attributes.Add("onclick", "MoveAll(" + lbAvailableGroups.ClientID + "," + lbSelectedGroups.ClientID + "); return false;");
            btnRemoveOneGr.Attributes.Add("onclick", "MoveOne(" + lbSelectedGroups.ClientID + "," + lbAvailableGroups.ClientID + "); return false;");
            btnRemoveAllGr.Attributes.Add("onclick", "MoveAll(" + lbSelectedGroups.ClientID + "," + lbAvailableGroups.ClientID + ");return false;");

            lbAvailableGroups.Attributes.Add("ondblclick", "MoveOne(" + lbAvailableGroups.ClientID + "," + lbSelectedGroups.ClientID + "); return false;");
            lbSelectedGroups.Attributes.Add("ondblclick", "MoveOne(" + lbSelectedGroups.ClientID + "," + lbAvailableGroups.ClientID + "); return false;");

            ddlIMGroup.DataTextField  = "IMGroupName";
            ddlIMGroup.DataValueField = "IMGroupId";
            ddlIMGroup.DataSource     = IMGroup.GetListIMGroupsWithoutPartners();
            ddlIMGroup.DataBind();

            using (IDataReader reader = SecureGroup.GetListGroupsWithParameters(false, false, false, false, false, false, false, false, false, false, false))
            {
                while (reader.Read())
                {
                    lbAvailableGroups.Items.Add(new ListItem(CommonHelper.GetResFileString(reader["GroupName"].ToString()), reader["GroupId"].ToString()));
                }
            }

            lbSecurityRoles.Items.Clear();
            int      iRoleId   = (int)InternalSecureGroups.Administrator;
            ListItem liSecRole = new ListItem(GetGroupTitleById(iRoleId), iRoleId.ToString());

            lbSecurityRoles.Items.Add(liSecRole);

            iRoleId   = (int)InternalSecureGroups.HelpDeskManager;
            liSecRole = new ListItem(GetGroupTitleById(iRoleId), iRoleId.ToString());
            lbSecurityRoles.Items.Add(liSecRole);

            iRoleId   = (int)InternalSecureGroups.PowerProjectManager;
            liSecRole = new ListItem(GetGroupTitleById(iRoleId), iRoleId.ToString());
            lbSecurityRoles.Items.Add(liSecRole);

            iRoleId   = (int)InternalSecureGroups.ProjectManager;
            liSecRole = new ListItem(GetGroupTitleById(iRoleId), iRoleId.ToString());
            lbSecurityRoles.Items.Add(liSecRole);

            iRoleId   = (int)InternalSecureGroups.ExecutiveManager;
            liSecRole = new ListItem(GetGroupTitleById(iRoleId), iRoleId.ToString());
            lbSecurityRoles.Items.Add(liSecRole);

            iRoleId   = (int)InternalSecureGroups.TimeManager;
            liSecRole = new ListItem(GetGroupTitleById(iRoleId), iRoleId.ToString());
            lbSecurityRoles.Items.Add(liSecRole);

            lstLang.DataSource     = Common.GetListLanguages();
            lstLang.DataTextField  = "FriendlyName";
            lstLang.DataValueField = "LanguageId";
            lstLang.DataBind();

            lstTimeZone.DataSource     = User.GetListTimeZone();
            lstTimeZone.DataTextField  = "DisplayName";
            lstTimeZone.DataValueField = "TimeZoneId";
            lstTimeZone.DataBind();

            int TimeZoneId = Security.CurrentUser.TimeZoneId;

            lstTimeZone.ClearSelection();
            ListItem li = lstTimeZone.Items.FindByValue(TimeZoneId.ToString());

            if (li != null)
            {
                li.Selected = true;
            }

            EntityObject[] profiles = BusinessManager.List(CustomizationProfileEntity.ClassName, (new FilterElementCollection()).ToArray(), (new SortingElementCollection(new SortingElement("Name", SortingElementType.Asc))).ToArray());
            foreach (CustomizationProfileEntity profile in profiles)
            {
                ProfileList.Items.Add(new ListItem(CommonHelper.GetResFileString(profile.Name), profile.PrimaryKeyId.ToString()));
            }
            EntityObject[] list = BusinessManager.List(CustomizationProfileUserEntity.ClassName, new FilterElement[] { FilterElement.EqualElement(CustomizationProfileUserEntity.FieldPrincipalId, UID) });
            if (list.Length > 0)
            {
                li = ProfileList.Items.FindByValue(((CustomizationProfileUserEntity)list[0]).ProfileId.ToString());
                if (li != null)
                {
                    li.Selected = true;
                }
            }
            else
            {
                li = ProfileList.Items.FindByValue("-1");
                if (li != null)
                {
                    li.Selected = true;
                }
            }

            if (UID != 0)
            {
                if (Security.IsUserInGroup(InternalSecureGroups.Administrator))
                {
                    tdWindowsLoginLabel.Visible   = false;
                    tdWindowsLoginTextBox.Visible = true;
                }
                else
                {
                    tdWindowsLoginLabel.Visible   = true;
                    tdWindowsLoginTextBox.Visible = false;
                }
                using (IDataReader reader = User.GetUserInfo(UID))
                {
                    if (reader.Read())
                    {
                        if ((bool)reader["IsExternal"])
                        {
                            ViewState[UID + "IsExternal"] = true;
                        }
                        else
                        {
                            ViewState[UID + "IsExternal"] = false;
                        }

                        if ((bool)reader["IsPending"])
                        {
                            ViewState[UID + "IsPending"] = true;
                            btnSave.Text     = LocRM.GetString("btnapprove");
                            chbIsActive.Text = LocRM.GetString("active") + ",&nbsp;<font color='red'>" + LocRM.GetString("PendingUser") + "</font>";
                        }
                        else
                        {
                            ViewState[UID + "IsPending"] = false;
                        }

                        string sLogin = reader["Login"].ToString();
                        if (sLogin.ToLower() == "alert")                                // AlertService user
                        {
                            groupInfoRow.Visible   = false;
                            chbIsActive.Enabled    = false;
                            tbWindowsLogin.Enabled = false;
                            txtPassword.Enabled    = false;
                            txtConfirm.Enabled     = false;
                        }

                        if (!(bool)ViewState[UID + "IsExternal"])
                        {
                            trTimeZone.Visible         = false;
                            trLang.Visible             = false;
                            PasswordValidator1.Enabled = false;
                            if (sLogin.IndexOf("___PENDING_USER___") < 0)
                            {
                                txtLogin.Visible            = false;
                                txtLoginRFValidator.Enabled = false;
                                txtRELoginValidator.Enabled = false;
                                txtLogin.Text    = "";
                                lblLogin.Text    = sLogin;
                                lblLogin.Visible = true;
                            }
                        }
                        txtFirstName.Text = HttpUtility.HtmlDecode(reader["FirstName"].ToString());
                        txtLastName.Text  = HttpUtility.HtmlDecode(reader["LastName"].ToString());
                        txtEmail.Text     = HttpUtility.HtmlDecode(reader["Email"].ToString());
                        if (reader["IMGroupId"] != null)
                        {
                            CommonHelper.SafeSelect(ddlIMGroup, reader["IMGroupId"].ToString());
                        }
                        if (!(bool)reader["IsActive"])
                        {
                            chbIsActive.Checked = false;
                        }

                        lbWindowsLogin.Text = tbWindowsLogin.Text = reader["WindowsLogin"].ToString();

                        if (reader["Password"].ToString() != string.Empty)
                        {
                            userHasEmptyPassword = false;
                        }
                    }
                }

                //if(!(bool)ViewState[UID + "IsExternal"] && !(bool)ViewState[UID + "IsPending"])
                //{
                using (IDataReader reader = User.GetListSecureGroup(UID))
                {
                    while (reader.Read())
                    {
                        lbSelectedGroups.Items.Add(new ListItem(CommonHelper.GetResFileString(reader["GroupName"].ToString()), reader["GroupId"].ToString()));
                    }
                }
                foreach (ListItem liSelectedGroup in lbSelectedGroups.Items)
                {
                    CommonHelper.SafeMultipleSelect(lbSecurityRoles, liSelectedGroup.Value);
                }
                lbSelectedGroups.Items.Remove(lbSelectedGroups.Items.FindByValue(((int)InternalSecureGroups.Everyone).ToString()));
                lbSelectedGroups.Items.Remove(lbSelectedGroups.Items.FindByValue(((int)InternalSecureGroups.Administrator).ToString()));
                lbSelectedGroups.Items.Remove(lbSelectedGroups.Items.FindByValue(((int)InternalSecureGroups.HelpDeskManager).ToString()));
                lbSelectedGroups.Items.Remove(lbSelectedGroups.Items.FindByValue(((int)InternalSecureGroups.PowerProjectManager).ToString()));
                lbSelectedGroups.Items.Remove(lbSelectedGroups.Items.FindByValue(((int)InternalSecureGroups.ProjectManager).ToString()));
                lbSelectedGroups.Items.Remove(lbSelectedGroups.Items.FindByValue(((int)InternalSecureGroups.ExecutiveManager).ToString()));
                lbSelectedGroups.Items.Remove(lbSelectedGroups.Items.FindByValue(((int)InternalSecureGroups.TimeManager).ToString()));
                lbSelectedGroups.DataBind();
                //}

                for (int i = 0; i < lbSelectedGroups.Items.Count; i++)
                {
                    if (lbAvailableGroups.Items.FindByValue(lbSelectedGroups.Items[i].Value) != null)
                    {
                        lbAvailableGroups.Items.Remove(lbAvailableGroups.Items.FindByValue(lbSelectedGroups.Items[i].Value));
                    }
                    iGroups.Value += lbSelectedGroups.Items[i].Value + ",";
                }

                if (!User.CanUpdateSecureFields(UID))
                {
                    trGroups.Visible         = false;
                    ddlIMGroup.Enabled       = false;
                    chbIsActive.Enabled      = false;
                    tblSecurityRoles.Visible = false;
                    ProfileRow.Visible       = false;
                }

                using (IDataReader reader = User.GetUserProfile(UID))
                {
                    if (reader.Read())
                    {
                        txtPhone.Text      = HttpUtility.HtmlDecode(reader["phone"].ToString());
                        txtFax.Text        = HttpUtility.HtmlDecode(reader["fax"].ToString());
                        txtMobile.Text     = HttpUtility.HtmlDecode(reader["mobile"].ToString());
                        txtJobTitle.Text   = HttpUtility.HtmlDecode(reader["position"].ToString());
                        txtDepartment.Text = HttpUtility.HtmlDecode(reader["department"].ToString());
                        txtLocation.Text   = HttpUtility.HtmlDecode(reader["location"].ToString());
                        txtCompany.Text    = HttpUtility.HtmlDecode(reader["company"].ToString());
                        if (reader["PictureUrl"] == DBNull.Value || (string)reader["PictureUrl"] == "")
                        {
                            Picture.Visible  = false;
                            cbDelete.Visible = false;
                        }
                        else
                        {
                            imgPhoto.Src     = "~/Common/GetUserPhoto.aspx?UserID=" + UID.ToString() + "&t=" + DateTime.Now.Millisecond.ToString();
                            Picture.Visible  = true;
                            cbDelete.Text    = "&nbsp;" + LocRM.GetString("tDeletePhoto");
                            cbDelete.Visible = true;
                        }
                    }
                }
            }
        }