Ejemplo n.º 1
0
 private void AssignGroupID()
 {
     try
     {
         if (Request["SGroupID"] != null)
         {
             GroupID = int.Parse(Request["SGroupID"]);
         }
         else
         {
             GroupID = int.Parse(pc["SecureGroup_CurrentGroup"]);
             using (IDataReader rdr = SecureGroup.GetGroup(GroupID))
             {
                 if (!rdr.Read())
                 {
                     GroupID = 1;
                     pc["SecureGroup_CurrentGroup"] = "1";
                 }
             }
         }
     }
     catch
     {
         pc["SecureGroup_CurrentGroup"] = "1";
         GroupID = 1;
     }
 }
Ejemplo n.º 2
0
        public bool IsEnable(object Sender, object Element)
        {
            bool retval = true;

            if (Mediachase.IBN.Business.Security.IsUserInGroup(InternalSecureGroups.Partner))
            {
                retval = false;

                // get the partner groupId
                int groupId = User.GetGroupForPartnerUser(Mediachase.IBN.Business.Security.CurrentUser.UserID);

                // Check that partner group has OrgUid
                using (IDataReader reader = SecureGroup.GetGroup(groupId))
                {
                    if (reader.Read())
                    {
                        if (reader["OrgUid"] != DBNull.Value)
                        {
                            retval = true;
                        }
                    }
                }
            }

            return(retval);
        }
Ejemplo n.º 3
0
		private void GetGroups()
		{
			using (IDataReader reader = User.GetListSecureGroup(Security.CurrentUser.UserID))
			{
				if (reader.Read())
				{
					iCurGroupId = (int)reader["GroupId"];
				}
			}

			try
			{
				if (Request["SGroupID"] != null)
				{
					GroupID = int.Parse(Request["SGroupID"]);
					if (GroupID != 1 && GroupID != 6 && !SecureGroup.CanRead(GroupID))
						GroupID = iCurGroupId;
					pc["SecureGroup_CurrentGroup"] = GroupID.ToString();
				}
				else
				{
					try
					{
						GroupID = int.Parse(pc["SecureGroup_CurrentGroup"]);
						using (IDataReader r = SecureGroup.GetGroup(GroupID))
						{
							if (!r.Read())
							{
								GroupID = iCurGroupId;
								pc["SecureGroup_CurrentGroup"] = iCurGroupId.ToString();
							}
							else
							{
								if (GroupID != 1 && GroupID != 6 && !SecureGroup.CanRead(GroupID))
								{
									GroupID = iCurGroupId;
									pc["SecureGroup_CurrentGroup"] = iCurGroupId.ToString();
								}
							}
						}
					}
					catch (Exception)
					{
						pc["SecureGroup_CurrentGroup"] = iCurGroupId.ToString();
						GroupID = iCurGroupId;
					}
				}
			}
			catch
			{
				pc["SecureGroup_CurrentGroup"] = iCurGroupId.ToString();
				GroupID = iCurGroupId;
			}
		}
Ejemplo n.º 4
0
 private string GetGroupTitleById(int GrId)
 {
     ///		GroupId, GroupName, IMGroupId
     using (IDataReader reader = SecureGroup.GetGroup(GrId))
     {
         if (reader.Read())
         {
             return(CommonHelper.GetResFileString(reader["GroupName"].ToString()));
         }
     }
     return(String.Empty);
 }
Ejemplo n.º 5
0
 private void BindToolbar()
 {
     using (IDataReader reader = SecureGroup.GetGroup(GroupID))
     {
         while (reader.Read())
         {
             secHeader.Title = LocRM.GetString("tbTitle") + " '" + CommonHelper.GetResFileString((string)reader["GroupName"]) + "'";
         }
     }
     //secHeader.AddSeparator();
     btnMove.Text   = LocRM.GetString("Save");
     btnCancel.Text = LocRM.GetString("Cancel");
 }
Ejemplo n.º 6
0
		private void BindToolbar()
		{
			using (IDataReader reader = SecureGroup.GetGroup(GroupID))
			{
				if (reader.Read())
				{
					secHeader.Title = CommonHelper.GetResFileString((string)reader["GroupName"]);
				}
			}

			if (User.CanCreatePending())
			{
				secHeader.AddSeparator();
				secHeader.AddLink("<img alt='' src='../Layouts/Images/icons/pending_create.gif' title='" + LocRM.GetString("AddPendingUser") + "'/>", "../Directory/PendingEdit.aspx");
			}
		}
Ejemplo n.º 7
0
        private void BindToolBar()
        {
            if (edit == "1")
            {
                secHeader.Title = LocRM.GetString("EditGroup");
            }
            else
            {
                using (IDataReader reader = SecureGroup.GetGroup(groupId))
                {
                    if (reader.Read())
                    {
                        secHeader.Title = LocRM.GetString("CreateGroup") + " '" + CommonHelper.GetResFileString((string)reader["GroupName"]) + "'";
                    }
                }
            }

            btnSave.Text   = LocRM.GetString("Save");
            btnCancel.Text = LocRM.GetString("Cancel");
        }
Ejemplo n.º 8
0
        private void BindTopBlock()
        {
            using (IDataReader reader = Project.GetProject(ProjectID))
            {
                if (reader.Read())
                {
                    Printheader1.Filter   = "&nbsp;&nbsp;&nbsp;&nbsp;" + LocRM.GetString("tProject") + " : " + reader["Title"].ToString();
                    lblStartDate.Text     = ((DateTime)reader["TargetStartDate"]).ToShortDateString();
                    lblTargetEndDate.Text = ((DateTime)reader["TargetFinishDate"]).ToShortDateString();
                    if (reader["ActualFinishDate"] != DBNull.Value)
                    {
                        lblActualEndDate.Text = ((DateTime)reader["ActualFinishDate"]).ToShortDateString();
                    }
                    else
                    {
                        lblActualEndDate.Text = LocRM.GetString("tNA");
                    }
                    lblProjectStatus.Text = reader["StatusName"].ToString();
                    lblProjectType.Text   = reader["TypeName"].ToString();
                    lblCustomer.Text      = reader["ClientName"].ToString();
                }
            }

            StringBuilder sbSponsors = new StringBuilder();

            using (IDataReader reader = Project.GetListSponsors(ProjectID))
            {
                while (reader.Read())
                {
                    bool IsGroup    = (bool)reader["IsGroup"];
                    int  iSponsorId = (int)reader["PrincipalId"];
                    if (IsGroup)
                    {
                        using (IDataReader principal = SecureGroup.GetGroup(iSponsorId))
                        {
                            if (principal.Read())
                            {
                                sbSponsors.Append(CommonHelper.GetResFileString(principal["GroupName"].ToString()) + "<br>");
                            }
                        }
                    }
                    else
                    {
                        using (IDataReader principal = User.GetUserInfo(iSponsorId, false))
                        {
                            if (principal.Read())
                            {
                                sbSponsors.Append(principal["LastName"] + " " + principal["FirstName"] + "<br>");
                            }
                        }
                    }
                }
            }
            if (sbSponsors.Length == 0)
            {
                sbSponsors.Append(LocRM.GetString("tEmpty"));
            }

            StringBuilder sbStake = new StringBuilder();

            using (IDataReader reader = Project.GetListStakeholders(ProjectID))
            {
                while (reader.Read())
                {
                    bool IsGroup  = (bool)reader["IsGroup"];
                    int  iStakeId = (int)reader["PrincipalId"];
                    if (IsGroup)
                    {
                        using (IDataReader principal = SecureGroup.GetGroup(iStakeId))
                        {
                            if (principal.Read())
                            {
                                sbStake.Append(CommonHelper.GetResFileString(principal["GroupName"].ToString()) + "<br>");
                            }
                        }
                    }
                    else
                    {
                        using (IDataReader principal = User.GetUserInfo(iStakeId, false))
                        {
                            if (principal.Read())
                            {
                                sbStake.Append(principal["LastName"] + " " + principal["FirstName"] + "<br>");
                            }
                        }
                    }
                }
            }
            if (sbStake.Length == 0)
            {
                sbStake.Append(LocRM.GetString("tEmpty"));
            }

            lblSponsors.Text     = sbSponsors.ToString();
            lblStakeholders.Text = sbStake.ToString();

            Printheader1.BtnPrintVisible = false;
            Printheader1.Title           = LocRM.GetString("oProjectSnapshotTitle");
        }
Ejemplo n.º 9
0
        private void BindToolbar()
        {
            using (IDataReader reader = SecureGroup.GetGroup(GroupID))
            {
                if (reader.Read())
                {
                    secHeader.Title = CommonHelper.GetResFileString((string)reader["GroupName"]);
                }
            }

            ComponentArt.Web.UI.MenuItem topMenuItem = new ComponentArt.Web.UI.MenuItem();
            topMenuItem.Text                = /*"<img border='0' src='../Layouts/Images/downbtn.gif' width='9px' height='5px' align='absmiddle'/>&nbsp;" + */ LocRM2.GetString("Actions");
            topMenuItem.Look.LeftIconUrl    = ResolveUrl("~/Layouts/Images/downbtn1.gif");
            topMenuItem.Look.LeftIconHeight = Unit.Pixel(5);
            topMenuItem.Look.LeftIconWidth  = Unit.Pixel(16);
            topMenuItem.LookId              = "TopItemLook";
            ComponentArt.Web.UI.MenuItem subItem;

            #region new group
            if (SecureGroup.CanCreate(GroupID))
            {
                subItem = new ComponentArt.Web.UI.MenuItem();
                subItem.Look.LeftIconUrl    = "~/Layouts/Images/icons/newgroup.gif";
                subItem.Look.LeftIconWidth  = Unit.Pixel(16);
                subItem.Look.LeftIconHeight = Unit.Pixel(16);
                subItem.NavigateUrl         = "~/Directory/AddGroup.aspx?Type=0&GroupID=" + GroupID.ToString();
                subItem.Text = LocRM.GetString("AddGroup");
                topMenuItem.Items.Add(subItem);
            }
            #endregion

            #region edit group
            if (SecureGroup.CanUpdate() && GroupID > 9)
            {
                subItem = new ComponentArt.Web.UI.MenuItem();
                subItem.Look.LeftIconUrl    = "~/Layouts/Images/icons/editgroup.gif";
                subItem.Look.LeftIconWidth  = Unit.Pixel(16);
                subItem.Look.LeftIconHeight = Unit.Pixel(16);
                subItem.NavigateUrl         = "~/Directory/AddGroup.aspx?Type=0&Edit=1&GroupID=" + GroupID.ToString();
                subItem.Text = LocRM.GetString("EditGroup");
                topMenuItem.Items.Add(subItem);
            }
            #endregion

            #region move
            if (SecureGroup.CanMove(GroupID))
            {
                subItem = new ComponentArt.Web.UI.MenuItem();
                subItem.Look.LeftIconUrl    = "~/Layouts/Images/icons/movegroup.gif";
                subItem.Look.LeftIconWidth  = Unit.Pixel(16);
                subItem.Look.LeftIconHeight = Unit.Pixel(16);
                subItem.NavigateUrl         = "~/Directory/MoveGroup.aspx?GroupID=" + GroupID.ToString();
                subItem.Text = LocRM.GetString("MoveGroup");
                topMenuItem.Items.Add(subItem);
            }
            #endregion

            #region delete
            if (SecureGroup.CanDelete(GroupID))
            {
                subItem = new ComponentArt.Web.UI.MenuItem();
                subItem.Look.LeftIconUrl    = "~/Layouts/Images/icons/deletegroup.gif";
                subItem.Look.LeftIconWidth  = Unit.Pixel(16);
                subItem.Look.LeftIconHeight = Unit.Pixel(16);
                subItem.ClientSideCommand   = "javascript:DeleteGroup()";
                subItem.Text = LocRM.GetString("DeleteGroup");
                topMenuItem.Items.Add(subItem);
            }
            #endregion

            #region new user
            if (User.CanCreateExternal() || User.CanCreatePending() || User.CanCreate())
            {
                subItem = new ComponentArt.Web.UI.MenuItem();
                subItem.Look.LeftIconUrl    = "~/Layouts/Images/icons/newuser.gif";
                subItem.Look.LeftIconWidth  = Unit.Pixel(16);
                subItem.Look.LeftIconHeight = Unit.Pixel(16);
                subItem.NavigateUrl         = "~/Directory/MultipleUserEdit.aspx?GroupID=" + GroupID;
                subItem.Text = LocRM.GetString("AddUser");
                topMenuItem.Items.Add(subItem);
            }
            #endregion

            if (topMenuItem.Items.Count > 0)
            {
                secHeader.ActionsMenu.Items.Add(topMenuItem);
            }
        }
Ejemplo n.º 10
0
        protected void btnSave_ServerClick(object sender, System.EventArgs e)
        {
            Page.Validate();
            if (!Page.IsValid)
            {
                return;
            }
            string    sGroups  = iGroups.Value;
            ArrayList alGroups = new ArrayList();

            if (ddUserType.SelectedItem.Value != "1")             //non partner
            {
                while (sGroups.Length > 0)
                {
                    alGroups.Add(Int32.Parse(sGroups.Substring(0, sGroups.IndexOf(","))));
                    sGroups = sGroups.Remove(0, sGroups.IndexOf(",") + 1);
                }

                if (ddUserType.SelectedItem.Value == "0")                 //regular
                {
                    foreach (ListItem liRole in lbSecurityRoles.Items)
                    {
                        if (liRole.Selected)
                        {
                            alGroups.Add(Int32.Parse(liRole.Value));
                        }
                    }
                }

                if (alGroups.Count <= 0)
                {
                    GroupValidator.IsValid = false;
                    return;
                }
            }

            string filename = "";

            System.IO.Stream strres = new System.IO.MemoryStream();

            if (fPhoto.PostedFile != null && fPhoto.PostedFile.ContentLength > 0)
            {
                System.Drawing.Image img;
                string extension = "";
                img = Mediachase.Ibn.Web.UI.Images.ProcessImage(fPhoto.PostedFile, out extension);
                string photoid = Guid.NewGuid().ToString().Substring(0, 6);
                filename = photoid + extension;
                img.Save(strres, img.RawFormat);
                strres.Position = 0;
            }

            try
            {
                int imgroup = int.Parse(ddlIMGroup.SelectedItem.Value);

                switch (ddUserType.SelectedItem.Value)
                {
                case "0":
                    UID = User.Create(txtLogin.Text, txtPassword.Text, txtFirstName.Text, txtLastName.Text,
                                      txtEmail.Text, chbIsActive.Checked, alGroups, imgroup, txtPhone.Text,
                                      txtFax.Text, txtMobile.Text, txtJobTitle.Text, txtDepartment.Text, txtCompany.Text,
                                      txtLocation.Text, int.Parse(lstTimeZone.SelectedItem.Value),
                                      int.Parse(lstLang.SelectedItem.Value), "", filename, strres, txtWinLogin.Text,
                                      int.Parse(ProfileList.SelectedValue));
                    break;

                case "1":
                    UID = User.CreatePartnerUser(txtLogin.Text, txtPassword.Text, txtFirstName.Text,
                                                 txtLastName.Text, txtEmail.Text, chbIsActive.Checked,
                                                 int.Parse(ddPartnerGroups.SelectedItem.Value), txtPhone.Text, txtFax.Text,
                                                 txtMobile.Text, txtJobTitle.Text, txtDepartment.Text, txtCompany.Text,
                                                 txtLocation.Text, int.Parse(lstTimeZone.SelectedItem.Value),
                                                 int.Parse(lstLang.SelectedItem.Value), filename, strres,
                                                 int.Parse(ProfileList.SelectedValue));
                    break;

                case "2":
                    UID = User.CreateExternal(txtFirstName.Text, txtLastName.Text, txtEmail.Text, alGroups,
                                              chbIsActive.Checked, txtPhone.Text, txtFax.Text, txtMobile.Text, txtJobTitle.Text,
                                              txtDepartment.Text, txtCompany.Text, txtLocation.Text,
                                              int.Parse(lstTimeZone.SelectedItem.Value),
                                              int.Parse(lstLang.SelectedItem.Value), "", filename, strres);
                    break;

                case "3":
                    UID = User.CreatePending(txtLogin.Text, txtPassword.Text, txtFirstName.Text, txtLastName.Text, txtEmail.Text, alGroups, txtPhone.Text, txtFax.Text, txtMobile.Text, txtJobTitle.Text, txtDepartment.Text, txtCompany.Text, txtLocation.Text, int.Parse(lstTimeZone.SelectedItem.Value), int.Parse(lstLang.SelectedItem.Value), "", filename, strres);
                    break;
                }
                if (!cbOneMore.Checked)
                {
                    Response.Redirect("~/Directory/UserView.aspx?UserID=" + UID);
                }
                else
                {
                    Response.Redirect("~/Directory/MultipleUserEdit.aspx");
                }
            }
            catch (MaxUsersCountException)
            {
                lblError.Text    = LocRM.GetString("MaxUsersCount");
                lblError.Visible = true;
            }

            catch (LoginDuplicationException)
            {
                if (ddUserType.SelectedItem.Value == "2")
                {
                    int    iUserId   = User.GetUserByEmail(txtEmail.Text);
                    string sUserName = String.Empty;
                    if (iUserId > 0)
                    {
                        sUserName = CommonHelper.GetUserStatusPureName(iUserId);
                    }
                    lblError.Text = LocRM.GetString("EmailDuplicate") + " (" + sUserName + ")";
                }
                else
                {
                    lblError.Text = LocRM.GetString("DuplicatedLogin");
                }
                lblError.Visible = true;
            }
            catch (EmailDuplicationException)
            {
                int    iUserId   = User.GetUserByEmail(txtEmail.Text);
                string sUserName = String.Empty;
                if (iUserId > 0)
                {
                    sUserName = CommonHelper.GetUserStatusPureName(iUserId);
                }
                lblError.Text    = LocRM.GetString("EmailDuplicate") + " (" + sUserName + ")";
                lblError.Visible = true;
            }
            catch (PasswordRequiredException)
            {
                for (int i = 0; i < alGroups.Count; i++)
                {
                    using (IDataReader reader = SecureGroup.GetGroup((int)alGroups[i]))
                    {
                        if (reader.Read())
                        {
                            lbSelectedGroups.Items.Add(new ListItem(CommonHelper.GetResFileString(reader["GroupName"].ToString()), ((int)alGroups[i]).ToString()));
                            ListItem li = lbAvailableGroups.Items.FindByValue(((int)alGroups[i]).ToString());
                            if (li != null)
                            {
                                lbAvailableGroups.Items.Remove(li);
                            }
                        }
                    }
                }
                PasswordValidator1.Validate();
                PasswordValidator1.Enabled = true;
                lblError.Text    = LocRM.GetString("PasswordRequest");
                lblError.Visible = true;
            }
        }
Ejemplo n.º 11
0
        private void BindData()
        {
            lblGroupTitle.Text = LocRM.GetString("GroupTitle");
            if (edit == "1")
            {
                string       gTitle     = "";
                PrimaryKeyId orgUid     = PrimaryKeyId.Empty;
                PrimaryKeyId contactUid = PrimaryKeyId.Empty;
                using (IDataReader rdr = SecureGroup.GetGroup(groupId))
                {
                    if (rdr.Read())
                    {
                        gTitle = (string)rdr["GroupName"];
                        if (rdr["OrgUid"] != DBNull.Value)
                        {
                            orgUid = PrimaryKeyId.Parse(rdr["OrgUid"].ToString());
                        }
                        if (rdr["ContactUid"] != DBNull.Value)
                        {
                            contactUid = PrimaryKeyId.Parse(rdr["ContactUid"].ToString());
                        }
                    }
                }
                tbGroupTitle.Text = HttpUtility.HtmlDecode(gTitle);

                if (groupId == (int)InternalSecureGroups.Partner || SecureGroup.IsPartner(groupId))
                {
                    using (IDataReader reader = SecureGroup.GetListGroupsByPartner(groupId))
                    {
                        while (reader.Read())
                        {
                            lbSelectedGroups.Items.Add(new ListItem(CommonHelper.GetResFileString(reader["GroupName"].ToString()), reader["GroupId"].ToString()));
                        }
                    }

                    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 (orgUid != PrimaryKeyId.Empty)
                    {
                        ClientControl.ObjectType = OrganizationEntity.GetAssignedMetaClassName();
                        ClientControl.ObjectId   = orgUid;
                    }
                    else if (contactUid != PrimaryKeyId.Empty)
                    {
                        ClientControl.ObjectType = ContactEntity.GetAssignedMetaClassName();
                        ClientControl.ObjectId   = contactUid;
                    }
                    else
                    {
                        ClientControl.ObjectType = String.Empty;
                        ClientControl.ObjectId   = PrimaryKeyId.Empty;
                    }
                }
            }
        }
Ejemplo n.º 12
0
        protected void btnSave_ServerClick(object sender, System.EventArgs e)
        {
            Page.Validate();
            if (!Page.IsValid)
            {
                return;
            }
            string    sGroups  = iGroups.Value;
            ArrayList alGroups = new ArrayList();

            while (sGroups.Length > 0)
            {
                alGroups.Add(Int32.Parse(sGroups.Substring(0, sGroups.IndexOf(","))));
                sGroups = sGroups.Remove(0, sGroups.IndexOf(",") + 1);
            }

            foreach (ListItem liRole in lbSecurityRoles.Items)
            {
                if (liRole.Selected)
                {
                    alGroups.Add(Int32.Parse(liRole.Value));
                }
            }

            string filename = "";

            System.IO.Stream strres = new System.IO.MemoryStream();

            if (fPhoto.PostedFile != null && fPhoto.PostedFile.ContentLength > 0)
            {
                System.Drawing.Image img;
                string extension = "";
                img = Mediachase.Ibn.Web.UI.Images.ProcessImage(fPhoto.PostedFile, out extension);
                string photoid = Guid.NewGuid().ToString().Substring(0, 6);
                filename = photoid + extension;
                img.Save(strres, img.RawFormat);
                strres.Position = 0;
            }

            try
            {
                int imgroup = int.Parse(ddlIMGroup.SelectedItem.Value);

                bool bApprovePending = false;
                if (UID > 0)
                {
                    if (User.CheckUserGroup(Security.CurrentUser.UserID, (int)InternalSecureGroups.Administrator))
                    {
                        if (tdWindowsLoginTextBox.Visible)
                        {
                            User.UpdateWindowsLogin(UID, tbWindowsLogin.Text.Trim());
                        }
                    }
                    if ((bool)ViewState[UID + "IsPending"])
                    {
                        User.ApprovePending(UID, (lblLogin.Text != "") ? lblLogin.Text : txtLogin.Text, txtPassword.Text, txtFirstName.Text, txtLastName.Text, txtEmail.Text,
                                            chbIsActive.Checked, alGroups, imgroup, txtPhone.Text, txtFax.Text, txtMobile.Text,
                                            txtJobTitle.Text, txtDepartment.Text, txtCompany.Text, txtLocation.Text, filename, strres,
                                            int.Parse(ProfileList.SelectedValue));
                        ViewState[UID + "IsPending"] = false;
                        bApprovePending = true;
                    }
                    else if ((bool)ViewState[UID + "IsExternal"])
                    {
                        User.CreateFromExternal(UID, txtLogin.Text, txtPassword.Text, txtFirstName.Text, txtLastName.Text, txtEmail.Text,
                                                chbIsActive.Checked, alGroups, imgroup, txtPhone.Text, txtFax.Text, txtMobile.Text,
                                                txtJobTitle.Text, txtDepartment.Text, txtCompany.Text, txtLocation.Text, int.Parse(lstTimeZone.SelectedItem.Value),
                                                int.Parse(lstLang.SelectedItem.Value), filename, strres);
                        ViewState[UID + "IsExternal"] = false;
                    }
                    else
                    {
                        User.UpdateUserInfo(UID, txtPassword.Text, txtFirstName.Text, txtLastName.Text, txtEmail.Text, chbIsActive.Checked,
                                            alGroups, imgroup, txtPhone.Text, txtFax.Text, txtMobile.Text,
                                            txtJobTitle.Text, txtDepartment.Text, txtCompany.Text, txtLocation.Text, filename, strres, cbDelete.Checked,
                                            int.Parse(ProfileList.SelectedValue));
                    }
                }
                else
                {
                    UID = User.Create(txtLogin.Text, txtPassword.Text, txtFirstName.Text, txtLastName.Text, txtEmail.Text, chbIsActive.Checked,
                                      alGroups, imgroup, txtPhone.Text, txtFax.Text, txtMobile.Text,
                                      txtJobTitle.Text, txtDepartment.Text, txtCompany.Text, txtLocation.Text, int.Parse(lstTimeZone.SelectedItem.Value),
                                      int.Parse(lstLang.SelectedItem.Value), filename, strres, int.Parse(ProfileList.SelectedValue));
                }
                if (UID != Security.CurrentUser.UserID)
                {
                    if (!bApprovePending)
                    {
                        Response.Redirect("../Directory/UserView.aspx?UserID=" + UID);
                    }
                    else
                    {
                        Util.CommonHelper.ReloadTopFrame("ActiveWork.ascx", "../Directory/UserView.aspx?UserID=" + UID, Response);
                    }
                }
                else
                {
                    Picture.Visible = false;
                    Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(),
                                                            "window.top.location.href='../Directory/UserView.aspx?UserID=" + UID.ToString() + "';", true);
                }
            }
            catch (MaxUsersCountException)
            {
                lblError.Text    = LocRM.GetString("MaxUsersCount");
                lblError.Visible = true;
            }
            catch (EmailDuplicationException)
            {
                int    iUserId   = User.GetUserByEmail(txtEmail.Text);
                string sUserName = String.Empty;
                if (iUserId > 0)
                {
                    sUserName = CommonHelper.GetUserStatusPureName(iUserId);
                }
                lblError.Text    = LocRM.GetString("EmailDuplicate") + " (" + sUserName + ")";
                lblError.Visible = true;
            }
            catch (LoginDuplicationException)
            {
                lblError.Text    = LocRM.GetString("DuplicatedLogin");
                lblError.Visible = true;
            }
            catch (PasswordRequiredException)
            {
                for (int i = 0; i < alGroups.Count; i++)
                {
                    using (IDataReader reader = SecureGroup.GetGroup((int)alGroups[i]))
                    {
                        if (reader.Read())
                        {
                            lbSelectedGroups.Items.Add(new ListItem(CommonHelper.GetResFileString(reader["GroupName"].ToString()), ((int)alGroups[i]).ToString()));
                            ListItem li = lbAvailableGroups.Items.FindByValue(((int)alGroups[i]).ToString());
                            if (li != null)
                            {
                                lbAvailableGroups.Items.Remove(li);
                            }
                        }
                    }
                }
                PasswordValidator1.Validate();
                PasswordValidator1.Enabled = true;
                lblError.Text    = LocRM.GetString("PasswordRequest");
                lblError.Visible = true;
            }
        }
Ejemplo n.º 13
0
        public string GetJsonDataSource(string nodeId)
        {
            List <JsonTreeNode> nodes = new List <JsonTreeNode>();

            int parentId;

            if (!int.TryParse(nodeId, out parentId) || parentId < 1)
            {
                parentId = 1;
            }

            if (Mediachase.IBN.Business.Security.IsUserInGroup(InternalSecureGroups.Partner) && (parentId == 1 || parentId == 6))
            {
                int       iCurGroupId            = -1;
                ArrayList VisiblePartnerGroups   = new ArrayList();
                ArrayList VisibleUnpartnerGroups = new ArrayList();
                using (IDataReader reader = Mediachase.IBN.Business.User.GetListSecureGroup(Mediachase.IBN.Business.Security.CurrentUser.UserID))
                {
                    if (reader.Read())
                    {
                        iCurGroupId = (int)reader["GroupId"];
                    }
                }
                VisiblePartnerGroups.Clear();
                VisibleUnpartnerGroups.Clear();
                VisiblePartnerGroups.Add(iCurGroupId);
                using (IDataReader reader = SecureGroup.GetListGroupsByPartner(iCurGroupId))
                {
                    while (reader.Read())
                    {
                        int iGroupId = (int)reader["GroupId"];
                        if (SecureGroup.IsPartner(iGroupId))
                        {
                            VisiblePartnerGroups.Add(iGroupId);
                        }
                        else
                        {
                            VisibleUnpartnerGroups.Add(iGroupId);
                        }
                    }
                }
                ClearUnpartnerGroups(VisibleUnpartnerGroups);
                if (VisibleUnpartnerGroups.Contains(1))
                {
                    return(BindOrdinaryTree(parentId));
                }

                ArrayList children = new ArrayList();
                if (parentId == 1)
                {
                    children.AddRange(VisibleUnpartnerGroups);
                    children.Add(6);
                }
                else if (parentId == 6)
                {
                    children.AddRange(VisiblePartnerGroups);
                }
                children.Sort();
                foreach (int iGroupId in children)
                {
                    JsonTreeNode node = new JsonTreeNode();
                    node.icon = "../../../Layouts/Images/icons/regular.gif";
                    if (iGroupId < 9 && iGroupId != 6)
                    {
                        node.icon = "../../../Layouts/Images/icons/Admins.gif";
                    }
                    if (SecureGroup.IsPartner(iGroupId) || iGroupId == 6)
                    {
                        node.icon = "../../../Layouts/Images/icons/Partners.gif";
                    }
                    node.iconCls = "iconStdCls";

                    using (IDataReader rdr = SecureGroup.GetGroup(iGroupId))
                    {
                        if (rdr.Read())
                        {
                            node.text = CHelper.GetResFileString(rdr["GroupName"].ToString());
                        }
                    }
                    node.cls = "nodeCls";

                    node.href       = "../../../Directory/Directory.aspx?Tab=0&SGroupID=" + iGroupId.ToString();
                    node.hrefTarget = "right";

                    node.id             = Guid.NewGuid().ToString("N");
                    node.itemid         = iGroupId.ToString();
                    node.staticParentId = _rootId;

                    node.leaf = true;
                    if (iGroupId == 6)
                    {
                        node.leaf = false;
                    }
                    else
                    {
                        using (IDataReader rdr = SecureGroup.GetListChildGroups(iGroupId))
                        {
                            if (rdr.Read())
                            {
                                node.leaf = false;
                            }
                        }
                    }

                    nodes.Add(node);
                }
            }
            else
            {
                return(BindOrdinaryTree(parentId));
            }

            if (nodes.Count > 0)
            {
                return(UtilHelper.JsonSerialize(nodes));
            }
            else
            {
                return(String.Empty);
            }
        }
Ejemplo n.º 14
0
        private void BindData()
        {
            using (IDataReader reader = Report.GetProjectStatisticReport(ProjectID))
            {
                if (reader.Read())
                {
                    lblTotalTasks.Text       = reader["Tasks"].ToString();
                    lblTotalCalEntries.Text  = reader["Events"].ToString();
                    lblTotalIssues.Text      = reader["Incidents"].ToString();
                    lblTotalDiscussions.Text = reader["Discussions"].ToString();
                    lblTotalToDos.Text       = reader["ToDo"].ToString();
//					lblTotalFiles.Text = reader["Files"].ToString();
                    lblTotalResources.Text = reader["Resources"].ToString();
                }
            }

            using (IDataReader reader = Project.GetProject(ProjectID))
            {
                if (reader.Read())
                {
                    Printheader1.Filter   = LocRM.GetString("tPrjTitle") + " : " + reader["Title"].ToString();
                    lblStartDate.Text     = ((DateTime)reader["StartDate"]).ToShortDateString();
                    lblTargetEndDate.Text = ((DateTime)reader["TargetFinishDate"]).ToShortDateString();
                    if (reader["ActualFinishDate"] != DBNull.Value)
                    {
                        lblActualEndDate.Text = ((DateTime)reader["ActualFinishDate"]).ToShortDateString();
                    }
                    else
                    {
                        lblActualEndDate.Text = LocRM.GetString("tNA");
                    }
                    lblProjectStatus.Text = reader["StatusName"].ToString();
                    lblProjectType.Text   = reader["TypeName"].ToString();
                    lblCustomer.Text      = reader["ClientName"].ToString();
                }
            }

            StringBuilder sbSponsors = new StringBuilder();

            using (IDataReader reader = Project.GetListSponsors(ProjectID))
            {
                while (reader.Read())
                {
                    bool IsGroup    = (bool)reader["IsGroup"];
                    int  iSponsorId = (int)reader["PrincipalId"];
                    if (IsGroup)
                    {
                        using (IDataReader principal = SecureGroup.GetGroup(iSponsorId))
                        {
                            if (principal.Read())
                            {
                                sbSponsors.Append(CommonHelper.GetResFileString(principal["GroupName"].ToString()) + "<br>");
                            }
                        }
                    }
                    else
                    {
                        using (IDataReader principal = User.GetUserInfo(iSponsorId, false))
                        {
                            if (principal.Read())
                            {
                                sbSponsors.Append(principal["LastName"] + " " + principal["FirstName"] + "<br>");
                            }
                        }
                    }
                }
            }

            if (sbSponsors.Length == 0)
            {
                sbSponsors.Append(LocRM.GetString("tEmpty"));
            }

            StringBuilder sbStake = new StringBuilder();

            using (IDataReader reader = Project.GetListStakeholders(ProjectID))
            {
                while (reader.Read())
                {
                    bool IsGroup  = (bool)reader["IsGroup"];
                    int  iStakeId = (int)reader["PrincipalId"];
                    if (IsGroup)
                    {
                        using (IDataReader principal = SecureGroup.GetGroup(iStakeId))
                        {
                            if (principal.Read())
                            {
                                sbStake.Append(CommonHelper.GetResFileString(principal["GroupName"].ToString()) + "<br>");
                            }
                        }
                    }
                    else
                    {
                        using (IDataReader principal = User.GetUserInfo(iStakeId, false))
                        {
                            if (principal.Read())
                            {
                                sbStake.Append(principal["LastName"] + " " + principal["FirstName"] + "<br>");
                            }
                        }
                    }
                }
            }
            if (sbStake.Length == 0)
            {
                sbStake.Append(LocRM.GetString("tEmpty"));
            }

            lblSponsors.Text     = sbSponsors.ToString();
            lblStakeholders.Text = sbStake.ToString();

            DataTable dt = new DataTable();

            dt.Columns.Add("ResourceID", typeof(int));
            dt.Columns.Add("ResourceInf", typeof(string));
            dt.Columns.Add("IssuesCreated", typeof(int));
            dt.Columns.Add("IssuesModified", typeof(int));
            dt.Columns.Add("IssuesClosed", typeof(int));
//			dt.Columns.Add("FilesPublished", typeof(int));
            dt.Columns.Add("CalendarEntries", typeof(int));
            dt.Columns.Add("DiscussionsAdded", typeof(int));

            DataRow row;

            using (IDataReader reader = Project.GetListTeamMembers(ProjectID))
            {
                while (reader.Read())
                {
                    row = dt.NewRow();
                    int     iResId = (int)reader["UserId"];
                    decimal iRate  = (decimal)reader["Rate"];
                    row["ResourceID"] = iResId;
                    using (IDataReader Member = Report.GetProjectStatisticByUserReport(ProjectID, iResId))
                    {
                        if (Member.Read())
                        {
                            row["ResourceInf"] = "<b>" + CommonHelper.GetUserStatusPureName(iResId) + "</b>,&nbsp;" +
                                                 LocRM.GetString("tRate") + ":&nbsp;<b>" + iRate.ToString("f") + "</b>";
                            row["IssuesCreated"]  = (int)Member["IncidentsCreated"];
                            row["IssuesModified"] = (int)Member["IncidentsModified"];
                            row["IssuesClosed"]   = (int)Member["IncidentsClosed"];
//							row["FilesPublished"] = (int)Member["Files"];
                            row["CalendarEntries"]  = (int)Member["Events"];
                            row["DiscussionsAdded"] = (int)Member["Discussions"];
                        }
                    }
                    dt.Rows.Add(row);
                }
            }

            DataView dv = dt.DefaultView;

            ResourcesRep.DataSource = dv;
            ResourcesRep.DataBind();
        }