Compare commits

...

5 Commits

3 changed files with 45 additions and 32 deletions

View File

@@ -145,6 +145,9 @@ namespace VEPROMS
} }
LoadRefreshGroupUsers(); LoadRefreshGroupUsers();
// C2026-004 - messagebox when create group
MessageBox.Show($"{txt} group successfully created.", "Create group", MessageBoxButtons.OK, MessageBoxIcon.Information);
} }
private void tvFolders_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) private void tvFolders_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
{ {
@@ -187,18 +190,22 @@ namespace VEPROMS
//Add a Member to a Group //Add a Member to a Group
private void addMember_Click(object sender, EventArgs e) private void addMember_Click(object sender, EventArgs e)
{ {
int groupIndex = cbGroupSelection.SelectedIndex; // B2026-007 PROMS Security - don't error when add a user to a group but no group selected
string selectedUserID = lstNonMembers.SelectedValue.ToString(); if (lstNonMembers.SelectedValue != null)
int selectedUID = UserInfo.GetByUserID(selectedUserID).UID; {
GroupInfo gi = myGroupInfoList[groupIndex]; int groupIndex = cbGroupSelection.SelectedIndex;
User selectedUser = User.Get(selectedUID); string selectedUserID = lstNonMembers.SelectedValue.ToString();
int selectedUID = UserInfo.GetByUserID(selectedUserID).UID;
GroupInfo gi = myGroupInfoList[groupIndex];
User selectedUser = User.Get(selectedUID);
Membership.MakeMembership(selectedUser, Group.Get(gi.GID), null, ""); Membership.MakeMembership(selectedUser, Group.Get(gi.GID), null, "");
updateMembershipLists(); updateMembershipLists();
lstNonMembers.SelectedIndex = -1; lstNonMembers.SelectedIndex = -1;
int index = lstMembers.FindString(selectedUserID); int index = lstMembers.FindString(selectedUserID);
lstMembers.SetSelected(index, true); lstMembers.SetSelected(index, true);
}
} }
//Remove a Member From a Group //Remove a Member From a Group

View File

@@ -537,6 +537,10 @@ namespace Volian.Controls.Library
// if it is a modify and there will be no usages if it is new (the usage gets created on the save) // if it is a modify and there will be no usages if it is new (the usage gets created on the save)
if (!MyFlexGrid.IsRoTable) if (!MyFlexGrid.IsRoTable)
{ {
// B2026-003 we where using a string.format on this inside the while loop - allocating memory each time
// so I move it outside the while loop and did a simple assigment of text
string lookForLinks = @"<START\](\\[^v \\]+)*\\v0(\\[^v '?{{}}~\\]+)*( |\\u[0-9]{{1,4}}?|\\'[0-9a-fA-F]{{2}}|\\[{{}}~])(.*?)(\\[^v '?{{}}~\\]+)*\\v(\\[^v \\]+)* #Link:(ReferencedObject|Transition[^:]*?):.*?\[END>";
while (r < h) while (r < h)
{ {
CellRange cr = MyFlexGrid.GetMergedRange(r, c); CellRange cr = MyFlexGrid.GetMergedRange(r, c);
@@ -546,8 +550,7 @@ namespace Volian.Controls.Library
{ {
// see if there are any links and save these so that any deleted ROs or transitions in the // see if there are any links and save these so that any deleted ROs or transitions in the
// steprtb can have associated usages/transitions records removed from the database. // steprtb can have associated usages/transitions records removed from the database.
string lookFor = string.Format(@"<START\](\\[^v \\]+)*\\v0(\\[^v '?{{}}~\\]+)*( |\\u[0-9]{{1,4}}?|\\'[0-9a-fA-F]{{2}}|\\[{{}}~])(.*?)(\\[^v '?{{}}~\\]+)*\\v(\\[^v \\]+)* #Link:(ReferencedObject|Transition[^:]*?):.*?\[END>"); MatchCollection matches = Regex.Matches((string)MyFlexGrid[r, c], lookForLinks);
MatchCollection matches = Regex.Matches((string)MyFlexGrid[r, c], lookFor);
for (int i = matches.Count - 1; i >= 0; i--) for (int i = matches.Count - 1; i >= 0; i--)
{ {
Match m = matches[i]; Match m = matches[i];
@@ -569,15 +572,15 @@ namespace Volian.Controls.Library
{ {
int tid = int.Parse(myMatch.Groups[2].Value); int tid = int.Parse(myMatch.Groups[2].Value);
RtfTransList.Add(tid); RtfTransList.Add(tid);
int myIndex = m.Groups[4].Index; int myIndex = m.Groups[4].Index;
int myLength = m.Groups[4].Length; int myLength = m.Groups[4].Length;
if (m.Groups[3].Value != " ") if (m.Groups[3].Value != " ")
{ {
myIndex = m.Groups[3].Index; myIndex = m.Groups[3].Index;
myLength += m.Groups[3].Length; myLength += m.Groups[3].Length;
} }
string gg = ((string)MyFlexGrid[r, c]).Substring(myIndex, myLength); string gg = ((string)MyFlexGrid[r, c]).Substring(myIndex, myLength);
if (gg.ToUpper().Contains("(PAGE ~)")) RtfTransPageNumList.Add(tid); // B2020-089, check for upper case Page ~ in case step was upper cased if (gg.ToUpper().Contains("(PAGE ~)")) RtfTransPageNumList.Add(tid); // B2020-089, check for upper case Page ~ in case step was upper cased
} }
} }
} }

View File

@@ -272,21 +272,24 @@ namespace Volian.Controls.Library
for (int i = 0; i < rows * cols; i++) for (int i = 0; i < rows * cols; i++)
datum.Add("|"); datum.Add("|");
XmlNodeList nl = xd.SelectNodes("C1FlexGrid/Cells/Cell/Data"); XmlNodeList nl = xd.SelectNodes("C1FlexGrid/Cells/Cell/Data");
string data = string.Empty; // B2026-003 use StringBuilder a "using" statement around the RichTextBox for better mememory management
StringBuilder data = new StringBuilder();
foreach (XmlNode xn in nl) foreach (XmlNode xn in nl)
{ {
RichTextBox rtb = new RichTextBox(); using (RichTextBox rtb = new RichTextBox())
rtb.Rtf = xn.InnerText; {
XmlAttribute xa = xn.ParentNode.Attributes.GetNamedItem("index") as XmlAttribute; rtb.Rtf = xn.InnerText;
string[] rc = xa.InnerText.Split(','); XmlAttribute xa = xn.ParentNode.Attributes.GetNamedItem("index") as XmlAttribute;
int r = int.Parse(rc[0]); string[] rc = xa.InnerText.Split(',');
int c = int.Parse(rc[1]); int r = int.Parse(rc[0]);
int index = r * cols + c; int c = int.Parse(rc[1]);
datum[index] = "|" + (rtb.Text == "" ? "" : rtb.Text); int index = r * cols + c;
datum[index] = "|" + (rtb.Text == "" ? "" : rtb.Text);
}
} }
foreach (string s in datum) foreach (string s in datum)
data += s; data.Append(s);
return data; return data.ToString();
} }
private string GetCellFormatString(XmlDocument xd) private string GetCellFormatString(XmlDocument xd)
{ {