Enhanced: rename a method name for clarification
Enhanced: convert 16-32 bit link data at procedure level Enhanced: convert 16-32 bit link data at procedure level.
This commit is contained in:
parent
1934a6b5e9
commit
15f3b2ce09
@ -1626,7 +1626,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
return newEnh;
|
||||
}
|
||||
public void DoCreateLinksEnhancedSteps(ItemInfo enhii, int enhtype)
|
||||
public void DoCreateLinksEnhancedSingleItem(ItemInfo enhii, int enhtype)
|
||||
{
|
||||
// Link the 2 items, srcII & enhii:
|
||||
if (IsStep)
|
||||
|
@ -1399,11 +1399,27 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
}
|
||||
}
|
||||
public void CreateLinksEnhancedSteps(ItemInfo srcII, ItemInfo enhII, int enhtype)
|
||||
public void CreateLinksEnhancedSingleItem(ItemInfo srcII, ItemInfo enhII, int enhtype)
|
||||
{
|
||||
srcII.DoCreateLinksEnhancedSteps(enhII, enhtype);
|
||||
srcII.DoCreateLinksEnhancedSingleItem(enhII, enhtype);
|
||||
SetFocus();
|
||||
}
|
||||
public void CreateLinksEnhancedAllInProcedure(ItemInfo srcII, ItemInfo enhII, int enhtype)
|
||||
{
|
||||
using (ContentInfoList cil = ContentInfoList.Convert16To32EnhancedContents(srcII.ItemID, enhII.ItemID, enhtype))
|
||||
{
|
||||
foreach (ContentInfo ci in cil)
|
||||
{
|
||||
using (Content c = ci.Get())
|
||||
{
|
||||
// first refresh configs because the ContentInfo.Refresh causes events to occur that refresh screen
|
||||
// and if configs aren't done first, the screen refresh, if based on config data, will not be correct.
|
||||
foreach (ItemInfo ii in ci.ContentItems) ii.RefreshConfig();
|
||||
ContentInfo.Refresh(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public void UnlinkEnhanced(ItemInfo enhII)
|
||||
{
|
||||
enhII.DoUnlinkEnhanced(enhII);
|
||||
|
@ -263,6 +263,7 @@ namespace Volian.Controls.Library
|
||||
#endregion
|
||||
}
|
||||
public ItemInfo enhUseExist = null;
|
||||
public bool enhDoConv = false;
|
||||
void btnEnhancedGoTo_Click(object sender, EventArgs e)
|
||||
{
|
||||
DevComponents.DotNetBar.BaseItem btn = sender as DevComponents.DotNetBar.BaseItem;
|
||||
@ -286,15 +287,17 @@ namespace Volian.Controls.Library
|
||||
int enhtype = System.Convert.ToInt32(btn.Name.Replace("btnEnhancedTo", ""));
|
||||
dlgEnhMissingItem enhMissDlg = new dlgEnhMissingItem(this, ii, enhtype);
|
||||
DialogResult dr = enhMissDlg.ShowDialog(this.Parent);
|
||||
if (dr == DialogResult.OK)
|
||||
if (enhMissDlg.OKSelected || dr == DialogResult.OK)
|
||||
{
|
||||
if (enhUseExist == null)
|
||||
{
|
||||
ItemInfo newEnh = MyEditItem.AddMissingEnhancedStep(ii, enhtype);
|
||||
if (ii.IsProcedure && newEnh != null) OnAddProcToDVInTree(new StepTabRibbonEventArgs(newEnh));
|
||||
}
|
||||
else if (!enhDoConv)
|
||||
MyEditItem.CreateLinksEnhancedSingleItem(ii, enhUseExist, enhtype);
|
||||
else
|
||||
MyEditItem.CreateLinksEnhancedSteps(ii, enhUseExist, enhtype);
|
||||
MyEditItem.CreateLinksEnhancedAllInProcedure(ii, enhUseExist, enhtype);
|
||||
MyEditItem.SetFocus();
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@
|
||||
{
|
||||
this.rbCreateNew = new System.Windows.Forms.RadioButton();
|
||||
this.rbLinkToExisting = new System.Windows.Forms.RadioButton();
|
||||
this.cbUnlinkEnhancedItems = new System.Windows.Forms.ComboBox();
|
||||
this.cbUnlinkedEnhancedItems = new System.Windows.Forms.ComboBox();
|
||||
this.btnOK = new System.Windows.Forms.Button();
|
||||
this.btnCancel = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
@ -59,14 +59,14 @@
|
||||
this.rbLinkToExisting.UseVisualStyleBackColor = true;
|
||||
this.rbLinkToExisting.CheckedChanged += new System.EventHandler(this.rbLinkToExisting_CheckedChanged);
|
||||
//
|
||||
// cbUnlinkEnhancedItems
|
||||
// cbUnlinkedEnhancedItems
|
||||
//
|
||||
this.cbUnlinkEnhancedItems.FormattingEnabled = true;
|
||||
this.cbUnlinkEnhancedItems.Location = new System.Drawing.Point(57, 102);
|
||||
this.cbUnlinkEnhancedItems.Name = "cbUnlinkEnhancedItems";
|
||||
this.cbUnlinkEnhancedItems.Size = new System.Drawing.Size(506, 24);
|
||||
this.cbUnlinkEnhancedItems.TabIndex = 2;
|
||||
this.cbUnlinkEnhancedItems.SelectedIndexChanged += new System.EventHandler(this.cbUnlinkEnhancedItems_SelectedIndexChanged);
|
||||
this.cbUnlinkedEnhancedItems.FormattingEnabled = true;
|
||||
this.cbUnlinkedEnhancedItems.Location = new System.Drawing.Point(57, 102);
|
||||
this.cbUnlinkedEnhancedItems.Name = "cbUnlinkedEnhancedItems";
|
||||
this.cbUnlinkedEnhancedItems.Size = new System.Drawing.Size(506, 24);
|
||||
this.cbUnlinkedEnhancedItems.TabIndex = 2;
|
||||
this.cbUnlinkedEnhancedItems.SelectedIndexChanged += new System.EventHandler(this.cbUnlinkedEnhancedItems_SelectedIndexChanged);
|
||||
//
|
||||
// btnOK
|
||||
//
|
||||
@ -96,7 +96,7 @@
|
||||
this.ClientSize = new System.Drawing.Size(612, 242);
|
||||
this.Controls.Add(this.btnCancel);
|
||||
this.Controls.Add(this.btnOK);
|
||||
this.Controls.Add(this.cbUnlinkEnhancedItems);
|
||||
this.Controls.Add(this.cbUnlinkedEnhancedItems);
|
||||
this.Controls.Add(this.rbLinkToExisting);
|
||||
this.Controls.Add(this.rbCreateNew);
|
||||
this.Name = "dlgEnhMissingItem";
|
||||
@ -110,7 +110,7 @@
|
||||
|
||||
private System.Windows.Forms.RadioButton rbCreateNew;
|
||||
private System.Windows.Forms.RadioButton rbLinkToExisting;
|
||||
private System.Windows.Forms.ComboBox cbUnlinkEnhancedItems;
|
||||
private System.Windows.Forms.ComboBox cbUnlinkedEnhancedItems;
|
||||
private System.Windows.Forms.Button btnOK;
|
||||
private System.Windows.Forms.Button btnCancel;
|
||||
}
|
||||
|
@ -13,8 +13,15 @@ namespace Volian.Controls.Library
|
||||
public partial class dlgEnhMissingItem : Form
|
||||
{
|
||||
StepTabRibbon STRibbon = null;
|
||||
private ItemInfo _SourceItem = null;
|
||||
private int _EnhType = -1;
|
||||
private bool _Initializing = false;
|
||||
public bool OKSelected = false;
|
||||
public dlgEnhMissingItem(StepTabRibbon strbn, ItemInfo srcItem, int enhType)
|
||||
{
|
||||
_Initializing = true;
|
||||
_SourceItem = srcItem;
|
||||
_EnhType = enhType;
|
||||
InitializeComponent();
|
||||
STRibbon = strbn;
|
||||
btnOK.Enabled = true;
|
||||
@ -23,48 +30,87 @@ namespace Volian.Controls.Library
|
||||
if (iil == null || iil.Count == 0)
|
||||
{
|
||||
rbLinkToExisting.Enabled = false;
|
||||
cbUnlinkEnhancedItems.Enabled = false;
|
||||
cbUnlinkedEnhancedItems.Enabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
rbLinkToExisting.Enabled = true;
|
||||
cbUnlinkEnhancedItems.DataSource = iil;
|
||||
cbUnlinkEnhancedItems.SelectedIndex = -1;
|
||||
cbUnlinkEnhancedItems.Enabled = false;
|
||||
cbUnlinkedEnhancedItems.DataSource = iil;
|
||||
cbUnlinkedEnhancedItems.SelectedIndex = -1;
|
||||
cbUnlinkedEnhancedItems.Enabled = false;
|
||||
}
|
||||
if (srcItem.IsProcedure) this.Text = "Create Missing Enhanced Item for " + srcItem.DisplayNumber;
|
||||
else this.Text = "Create Missing Enhanced Item";
|
||||
_Initializing = false;
|
||||
}
|
||||
|
||||
private void btnOK_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (rbCreateNew.Checked)
|
||||
{
|
||||
STRibbon.enhUseExist = null;
|
||||
STRibbon.enhDoConv = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
ItemInfo ii = cbUnlinkEnhancedItems.SelectedItem as ItemInfo;
|
||||
ItemInfo ii = cbUnlinkedEnhancedItems.SelectedItem as ItemInfo;
|
||||
STRibbon.enhUseExist = ii;
|
||||
}
|
||||
OKSelected = true;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void rbLinkToExisting_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (rbLinkToExisting.Checked)
|
||||
{
|
||||
cbUnlinkEnhancedItems.Enabled = true;
|
||||
cbUnlinkEnhancedItems.SelectedIndex = -1;
|
||||
cbUnlinkedEnhancedItems.Enabled = true;
|
||||
cbUnlinkedEnhancedItems.SelectedIndex = -1;
|
||||
btnOK.Enabled = false; // disable until user selects an item from combobox
|
||||
}
|
||||
else
|
||||
cbUnlinkEnhancedItems.Enabled = false;
|
||||
cbUnlinkedEnhancedItems.Enabled = false;
|
||||
}
|
||||
|
||||
private void rbCreateNew_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (rbCreateNew.Checked) btnOK.Enabled = true;
|
||||
}
|
||||
|
||||
private void cbUnlinkEnhancedItems_SelectedIndexChanged(object sender, EventArgs e)
|
||||
private void cbUnlinkedEnhancedItems_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (_Initializing) return;
|
||||
// cbUnlinkedEnhancedItems combo box has a list of all items in the enhanced document
|
||||
// that can be linked to from this item.
|
||||
btnOK.Enabled = true;
|
||||
STRibbon.enhDoConv = false;
|
||||
// if on a procedure, take the selected enhanced procedure & see if there are non-procedure items
|
||||
// within it that can be linked based on old 16 bit data. If no sections/steps are returned, only the
|
||||
// procedure can be linked so it really isn't a match. Otherwise, prompt user to see if they want to
|
||||
// convert the data. If so, convert all items within it that can be linked. If not, just link as before.
|
||||
if (_SourceItem.IsProcedure)
|
||||
{
|
||||
ItemInfo ii = cbUnlinkedEnhancedItems.SelectedItem as ItemInfo;
|
||||
ContentInfoList cil = ContentInfoList.Get16BitEnhancedContents(_SourceItem.ItemID, ii.ItemID, _EnhType);
|
||||
bool foundSubItem = false; // in returned list, see if there are any sections/steps. If none, don't prompt
|
||||
foreach (ContentInfo ci in cil)
|
||||
{
|
||||
if (ci.Type >= 10000)
|
||||
{
|
||||
foundSubItem = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (foundSubItem)
|
||||
{
|
||||
DialogResult dr = MessageBox.Show("The procedure that is selected has enhanced data. Do you want to convert it (this will link any section/steps that can be linked)?", "Enhanced Links", MessageBoxButtons.YesNo);
|
||||
if (dr == DialogResult.Yes)
|
||||
{
|
||||
STRibbon.enhUseExist = ii;
|
||||
STRibbon.enhDoConv = true;
|
||||
btnOK_Click(sender, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user