Exemplo n.º 1
0
        public string GetJsonDataSource(string nodeId)
        {
            List <JsonTreeNode> nodes = new List <JsonTreeNode>();

            int          userIMGroupId = 0;
            DataTable    dt            = null;
            JsonTreeNode node;

            if (!IMGroup.CanCreate())
            {
                using (IDataReader rdr = Mediachase.IBN.Business.User.GetUserInfo(Mediachase.IBN.Business.Security.CurrentUser.UserID))
                {
                    rdr.Read();
                    userIMGroupId = (int)rdr["IMGroupId"];
                }

                dt = IMGroup.GetListIMGroupsYouCanSee(userIMGroupId);

                string imGroupName = IMGroup.GetIMGroupName(userIMGroupId, null);
                if (imGroupName != null)
                {
                    DataRow dr = dt.NewRow();

                    dr["IMGroupId"]   = userIMGroupId;
                    dr["IMGroupName"] = imGroupName;

                    dt.Rows.InsertAt(dr, 0);
                }
            }
            else
            {
                dt = IMGroup.GetListIMGroup();
            }

            foreach (DataRow dr in dt.Rows)
            {
                int imGroupId = (int)dr["IMGroupId"];
                node            = new JsonTreeNode();
                node.icon       = "../../../Layouts/Images/icons/ibngroup.gif";
                node.iconCls    = "iconStdCls";
                node.text       = dr["IMGroupName"].ToString();
                node.cls        = "nodeCls";
                node.href       = "../../../Directory/Directory.aspx?Tab=1&IMGroupID=" + imGroupId.ToString();
                node.hrefTarget = "right";
                node.leaf       = true;
                nodes.Add(node);
            }

            if (nodes.Count > 0)
            {
                return(UtilHelper.JsonSerialize(nodes));
            }
            else
            {
                return(String.Empty);
            }
        }
Exemplo n.º 2
0
        private void BindDefaultValues()
        {
            int groupId      = GroupID;
            int cloneGroupID = CloneGroupID;

            tbGroupTitle.Text = "";
            tbColor.Text      = "2B6087";

            int id = 0;

            if (groupId > 0)
            {
                id = groupId;
            }
            else if (cloneGroupID > 0)
            {
                id = cloneGroupID;
            }
            imgLogo.Src = "../../Common/GroupLogo.aspx?GroupID=" + id;


            using (DataTable table = IMGroup.GetListIMGroup())
            {
                foreach (DataRow row in table.Rows)
                {
                    int    imGroupId   = (int)row["IMGroupId"];
                    string imGroupName = row["IMGroupName"].ToString();

                    if (groupId == 0 || groupId != imGroupId)
                    {
                        string imGroupIdString = imGroupId.ToString(CultureInfo.InvariantCulture);

                        lbVisible.Items.Add(new ListItem(imGroupName, imGroupIdString));
                        lbCU.Items.Add(new ListItem(imGroupName, imGroupIdString));
                    }
                }
            }
        }
Exemplo n.º 3
0
        private void BindStatusLog()
        {
            bool logUserStatus = PortalConfig.PortalLogUserStatus;

            tdStatusLog.Visible = logUserStatus;
            if (logUserStatus)
            {
                btnGenerate.Text = LocRM.GetString("Generate");

                ddlGroup.Items.Add(new ListItem(LocRM.GetString("AnyGroup"), "0"));
                using (DataTable table = IMGroup.GetListIMGroup())
                {
                    foreach (DataRow row in table.Rows)
                    {
                        ddlGroup.Items.Add(new ListItem(row["IMGroupName"].ToString(), ((int)row["IMGroupId"]).ToString(CultureInfo.InvariantCulture)));
                    }
                }

                ddlUser.Items.Add(new ListItem(LocRM.GetString("AnyUser"), "0"));

                fromDate.SelectedDate = DateTime.Now.Date.AddDays(-DateTime.Now.Day + 1);
            }
        }
Exemplo n.º 4
0
        private void BinddgGroupsUsers()
        {
            dgUsers.Columns[1].HeaderText = LocRM.GetString("GroupUser");
            dgUsers.Columns[2].HeaderText = LocRM.GetString("Email");

            if (GroupID == 0)
            {
                dgUsers.Columns[2].Visible = false;
            }

            DataTable dt = new DataTable();

            dt.Columns.Add(new DataColumn("ID", typeof(int)));
            dt.Columns.Add(new DataColumn("Type", typeof(int)));             //0-IMGroup, 1- User
            dt.Columns.Add(new DataColumn("GroupName", typeof(string)));
            dt.Columns.Add(new DataColumn("Email", typeof(string)));
            dt.Columns.Add(new DataColumn("ActionEdit", typeof(string)));
            dt.Columns.Add(new DataColumn("ActionDelete", typeof(string)));

            DataView dv;
            DataRow  dr;

            if (GroupID > 0)             // Bind Users
            {
                // [..]
                dr              = dt.NewRow();
                dr["ID"]        = 0;
                dr["Type"]      = 0;
                dr["GroupName"] = "<span style='padding-left:30px'>&nbsp;</span><a href='../Directory/directory.aspx?Tab=1&amp;IMGroupID=0'>[..]</a>";
                dt.Rows.Add(dr);

                using (IDataReader rdr = IMGroup.GetListUsers(GroupID))
                {
                    while (rdr.Read())
                    {
                        dr = dt.NewRow();
                        int iUserId = (int)rdr["UserId"];
                        dr["ID"]    = iUserId;
                        dr["Type"]  = 1;
                        dr["Email"] = rdr["Email"].ToString();
                        if (User.CanUpdateUserInfo(iUserId))
                        {
                            dr["ActionEdit"] = String.Format("<a href='../Directory/UserEdit.aspx?UserID={0}'><img alt='{1}' src='../Layouts/Images/edit.gif' title='{1}'/></a>", iUserId.ToString(), LocRM.GetString("Edit"));
                        }
                        if (User.CanDelete(iUserId))
                        {
                            dr["ActionDelete"] = String.Format("<a href='javascript:DeleteUser({0})'><img alt='{1}' src='../Layouts/Images/delete.gif' title='{1}'/></a>", iUserId.ToString(), LocRM.GetString("Delete"));
                        }
                        dt.Rows.Add(dr);
                    }
                }
                dv = dt.DefaultView;
            }
            else              // Bind IMGroups
            {
                int userIMGroupId = 0;

                if (!IMGroup.CanCreate())
                {
                    using (IDataReader rdr = User.GetUserInfo(Security.CurrentUser.UserID))
                    {
                        rdr.Read();
                        if (rdr["IMGroupId"] != DBNull.Value)
                        {
                            userIMGroupId = (int)rdr["IMGroupId"];
                        }
                    }

                    if (userIMGroupId > 0)
                    {
                        using (DataTable table = IMGroup.GetListIMGroupsYouCanSee(userIMGroupId))
                        {
                            foreach (DataRow row in table.Rows)
                            {
                                dr = dt.NewRow();

                                int groupId = (int)row["IMGroupId"];
                                dr["ID"]        = groupId;
                                dr["Type"]      = 0;
                                dr["GroupName"] = row["IMGroupName"].ToString();
                                if (IMGroup.CanUpdate())
                                {
                                    dr["ActionEdit"] = String.Format("<a href='../Directory/AddIMGroup.aspx?GroupID={0}'><img alt='{1}' src='../Layouts/Images/edit.gif' title='{1}'/></a>", groupId, LocRM.GetString("Edit"));
                                }
                                if (IMGroup.CanDelete(groupId))
                                {
                                    dr["ActionDelete"] = String.Format("<a href='javascript:DeleteGroup({0})'><img alt='{1}' src='../Layouts/Images/delete.gif' title='{1}'/></a>", groupId, LocRM.GetString("Delete"));
                                }

                                dt.Rows.Add(dr);
                            }
                        }

                        string imGroupName = IMGroup.GetIMGroupName(userIMGroupId, null);
                        if (imGroupName != null)
                        {
                            dr = dt.NewRow();

                            dr["ID"]        = userIMGroupId;
                            dr["Type"]      = 0;
                            dr["GroupName"] = imGroupName;
                            if (IMGroup.CanUpdate())
                            {
                                dr["ActionEdit"] = String.Format("<a href='../Directory/AddIMGroup.aspx?GroupID={0}'><img alt='{1}' src='../Layouts/Images/edit.gif' title='{1}'/></a>", userIMGroupId, LocRM.GetString("Edit"));
                            }

                            dt.Rows.Add(dr);
                        }
                    }
                }
                else
                {
                    using (DataTable table = IMGroup.GetListIMGroup())
                    {
                        foreach (DataRow row in table.Rows)
                        {
                            dr = dt.NewRow();

                            int groupId = (int)row["IMGroupId"];
                            dr["ID"]        = groupId;
                            dr["Type"]      = 0;
                            dr["GroupName"] = row["IMGroupName"].ToString();
                            if (IMGroup.CanUpdate())
                            {
                                dr["ActionEdit"] = string.Format("<a href='../Directory/AddIMGroup.aspx?GroupID={0}'><img alt='{1}' src='../Layouts/Images/edit.gif' title='{1}'/></a>", groupId, LocRM.GetString("Edit"));
                            }
                            if (IMGroup.CanDelete(groupId))
                            {
                                dr["ActionDelete"] = string.Format("<a href='javascript:DeleteGroup({0})'><img alt='{1}' src='../Layouts/Images/delete.gif' title='{1}'/></a>", groupId, LocRM.GetString("Delete"));
                            }

                            dt.Rows.Add(dr);
                        }
                    }
                }
                dv      = dt.DefaultView;
                dv.Sort = "GroupName";
            }

            dgUsers.DataSource = dv;
            dgUsers.DataBind();
        }
Exemplo n.º 5
0
        private int MakeUser(string sfirst, string slast, string semail, bool badmin)
        {
            ArrayList alGroups = new ArrayList();

            alGroups.Add((int)InternalSecureGroups.ProjectManager);
            using (IDataReader reader = SecureGroup.GetListGroups())
            {
                while (reader.Read())
                {
                    int iGroupId = (int)reader["GroupId"];
                    if (iGroupId > 8)
                    {
                        alGroups.Add(iGroupId);
                        break;
                    }
                }
            }
            int iIMGroup = 0;

            using (DataTable table = IMGroup.GetListIMGroup())
            {
                foreach (DataRow row in table.Rows)
                {
                    if (!(bool)row["is_partner"])
                    {
                        iIMGroup = (int)row["IMGroupId"];
                        break;
                    }
                }
            }

            int userId = -1;

            #region makeuser
            if (semail != "")
            {
                int id = User.GetUserByEmail(semail);
                if (id <= 0)
                {
                    string strLogin = semail.Substring(0, semail.IndexOf("@"));
                    int    i        = 0;
                    bool   fl       = false;
                    do
                    {
                        string tmpLogin = strLogin;
                        if (i > 0)
                        {
                            tmpLogin = tmpLogin + i.ToString();
                        }
                        using (IDataReader reader = User.GetUserInfoByLogin(tmpLogin))
                        {
                            if (reader.Read())
                            {
                                fl = true;
                            }
                            else
                            {
                                fl = false;
                            }
                        }
                        i++;
                    }while (fl);

                    string sFirst = (sfirst == "") ? strLogin : sfirst;
                    string sLast  = (slast == "") ? strLogin : slast;
                    if (i > 1)
                    {
                        strLogin = strLogin + (i - 1).ToString();
                    }

                    ArrayList newList = new ArrayList(alGroups);
                    if (badmin)
                    {
                        newList.Add((int)InternalSecureGroups.Administrator);
                    }

                    userId = User.Create(strLogin, "ibn", sFirst, sLast, semail, true,
                                         newList, iIMGroup, "", "", "", "", "", "", "", Security.CurrentUser.TimeZoneId,
                                         Security.CurrentUser.LanguageId, null, null, -1);
                }
            }
            #endregion

            return(userId);
        }
Exemplo n.º 6
0
        private void ShowStep(int step)
        {
            for (int i = 0; i <= _stepCount; i++)
            {
                ((Panel)steps[i]).Visible = false;
            }

            ((Panel)steps[step - 1]).Visible = true;

            if (step == _stepCount + 1)
            {
                ArrayList alGroups = new ArrayList();
                using (IDataReader reader = SecureGroup.GetListGroups())
                {
                    while (reader.Read())
                    {
                        int iGroupId = (int)reader["GroupId"];
                        if (iGroupId > 8)
                        {
                            alGroups.Add(iGroupId);
                            break;
                        }
                    }
                }
                int iIMGroup = 0;
                using (DataTable table = IMGroup.GetListIMGroup())
                {
                    if (table.Rows.Count > 0)
                    {
                        iIMGroup = (int)table.Rows[0]["IMGroupId"];
                    }
                }

                #region txtEMail1
                if (txtEMail1.Text != "")
                {
                    int id = User.GetUserByEmail(txtEMail1.Text);
                    if (id <= 0)
                    {
                        string strLogin = txtEMail1.Text.Substring(0, txtEMail1.Text.IndexOf("@"));
                        int    i        = 0;
                        bool   fl       = false;
                        do
                        {
                            string tmpLogin = strLogin;
                            if (i > 0)
                            {
                                tmpLogin = tmpLogin + i.ToString();
                            }
                            using (IDataReader reader = User.GetUserInfoByLogin(tmpLogin))
                            {
                                if (reader.Read())
                                {
                                    fl = true;
                                }
                                else
                                {
                                    fl = false;
                                }
                            }
                            i++;
                        }while (fl);

                        string sFirst = (txtFirstName1.Text == "") ? strLogin : txtFirstName1.Text;
                        string sLast  = (txtLastName1.Text == "") ? strLogin : txtLastName1.Text;
                        if (i > 1)
                        {
                            strLogin = strLogin + (i - 1).ToString();
                        }

                        User.Create(strLogin, "ibn", sFirst, sLast, txtEMail1.Text,
                                    alGroups, iIMGroup, "", "", "", "", "", "", Security.CurrentUser.LanguageId, "");
                    }
                }
                #endregion

                #region txtEMail2
                if (txtEMail2.Text != "")
                {
                    int id = User.GetUserByEmail(txtEMail2.Text);
                    if (id <= 0)
                    {
                        string strLogin = txtEMail2.Text.Substring(0, txtEMail2.Text.IndexOf("@"));
                        int    i        = 0;
                        bool   fl       = false;
                        do
                        {
                            string tmpLogin = strLogin;
                            if (i > 0)
                            {
                                tmpLogin = tmpLogin + i.ToString();
                            }
                            using (IDataReader reader = User.GetUserInfoByLogin(tmpLogin))
                            {
                                if (reader.Read())
                                {
                                    fl = true;
                                }
                                else
                                {
                                    fl = false;
                                }
                            }
                            i++;
                        }while (fl);
                        string sFirst = (txtFirstName2.Text == "") ? strLogin : txtFirstName2.Text;
                        string sLast  = (txtLastName2.Text == "") ? strLogin : txtLastName2.Text;
                        if (i > 1)
                        {
                            strLogin = strLogin + (i - 1).ToString();
                        }

                        User.Create(strLogin, "ibn", sFirst, sLast, txtEMail2.Text,
                                    alGroups, iIMGroup, "", "", "", "", "", "", Security.CurrentUser.LanguageId, "");
                    }
                }
                #endregion

                #region txtEMail3
                if (txtEMail3.Text != "")
                {
                    int id = User.GetUserByEmail(txtEMail3.Text);
                    if (id <= 0)
                    {
                        string strLogin = txtEMail3.Text.Substring(0, txtEMail3.Text.IndexOf("@"));
                        int    i        = 0;
                        bool   fl       = false;
                        do
                        {
                            string tmpLogin = strLogin;
                            if (i > 0)
                            {
                                tmpLogin = tmpLogin + i.ToString();
                            }
                            using (IDataReader reader = User.GetUserInfoByLogin(tmpLogin))
                            {
                                if (reader.Read())
                                {
                                    fl = true;
                                }
                                else
                                {
                                    fl = false;
                                }
                            }
                            i++;
                        }while (fl);
                        string sFirst = (txtFirstName3.Text == "") ? strLogin : txtFirstName3.Text;
                        string sLast  = (txtLastName3.Text == "") ? strLogin : txtLastName3.Text;
                        if (i > 1)
                        {
                            strLogin = strLogin + (i - 1).ToString();
                        }
                        User.Create(strLogin, "ibn", sFirst, sLast, txtEMail3.Text,
                                    alGroups, iIMGroup, "", "", "", "", "", "", Security.CurrentUser.LanguageId, "");
                    }
                }
                #endregion

                #region txtEMail4
                if (txtEMail4.Text != "")
                {
                    int id = User.GetUserByEmail(txtEMail4.Text);
                    if (id <= 0)
                    {
                        string strLogin = txtEMail4.Text.Substring(0, txtEMail4.Text.IndexOf("@"));
                        int    i        = 0;
                        bool   fl       = false;
                        do
                        {
                            string tmpLogin = strLogin;
                            if (i > 0)
                            {
                                tmpLogin = tmpLogin + i.ToString();
                            }
                            using (IDataReader reader = User.GetUserInfoByLogin(tmpLogin))
                            {
                                if (reader.Read())
                                {
                                    fl = true;
                                }
                                else
                                {
                                    fl = false;
                                }
                            }
                            i++;
                        }while (fl);
                        string sFirst = (txtFirstName4.Text == "") ? strLogin : txtFirstName4.Text;
                        string sLast  = (txtLastName4.Text == "") ? strLogin : txtLastName4.Text;
                        if (i > 1)
                        {
                            strLogin = strLogin + (i - 1).ToString();
                        }
                        User.Create(strLogin, "ibn", sFirst, sLast, txtEMail4.Text,
                                    alGroups, iIMGroup, "", "", "", "", "", "", Security.CurrentUser.LanguageId, "");
                    }
                }
                #endregion

                UserLightPropertyCollection pc = Security.CurrentUser.Properties;
                PortalConfig.PortalShowAdminWizard = cbShowNextTime.Checked;
                if (pc["USetup_ShowStartupWizard"] == null || pc["USetup_ShowStartupWizard"] == "True")
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(),
                                                            "try{window.opener.top.right.location.href='" + ResolveClientUrl("~/Workspace/default.aspx") + "?BTab=Workspace&wizard=1';} catch (e) {} window.close();",
                                                            true);
                }
                else
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(),
                                                            "try{window.opener.top.location.href='" + ResolveClientUrl("~/Apps/Shell/Pages/default.aspx") + "';} catch (e) {} window.close();",
                                                            true);
                }
            }
        }