private void mnuCustomMap_Click(object sender, EventArgs e)
        {
            UIMapper manualMapping = null;

            MapedObject aMapObject = null;

            MapManager.FindOrCreateMap(projectView, lstVwAssemblies.SelectedItems[0].SubItems[2].Text, ref aMapObject);
            if ((rbFields.Checked || rbProperties.Checked) && lstVwObjectView.SelectedItems.Count > 0)
            {
                //MapManager.FindOrCreateMap(projectView, lstVwAssemblies.SelectedItems[0].SubItems[2].Text, ref aMapObject);

                manualMapping = new UIMapper(aMapObject, lstVwObjectView.SelectedItems, dgTableView.SelectedRows, currentMode);
            }
            else if (lstVwObjectView.SelectedItems.Count > 0)
            {
                //MapManager.FindOrCreateMap(projectView, lstVwAssemblies.SelectedItems[0].SubItems[2].Text, ref aMapObject);
                //string theparams = String.Empty;
                //if (rbConstructors.Checked)
                //    theparams = lstVwObjectView.SelectedItems[0].SubItems[1].Text;
                //else
                //    theparams = lstVwObjectView.SelectedItems[0].SubItems[2].Text;
                //string[] parameters = theparams.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                //manualMapping = new UIMapper(aMapObject, lstVwObjectView.SelectedItems[0].SubItems[0].Text, Parameters.ParseString(parameters), dgTableView.SelectedRows, currentMode);
                manualMapping = CreateParamsMapper(aMapObject);
            }

            ApplyField(manualMapping);
            if (dgTableView.Tag != null)
            {
                StoreDataTable(this, (exportControlEventArgs)dgTableView.Tag);
            }
        }
        private void mnuMapWindow_Click(object sender, EventArgs e)
        {
            try
            {
                if (projectView.SelectedNode.Parent.Text.Trim().Equals("Mapped Objects"))
                {
                    ToolStripMenuItem   sentIt = (ToolStripMenuItem)sender;
                    MapReferences       aRef   = (MapReferences)projectView.SelectedNode.Tag;
                    Tuple <String, int> parsed = ParseTextLabel(sentIt.Text);
                    BaseStore           store  = null;
                    Guid mapGuid = Guid.Empty;
                    aRef.LastMap = ConvertMenuToMapType(parsed.Item1);
                    currentMode  = aRef.LastMap;
                    if (aRef.LastMap == DataMapType.MethodParameterMap)
                    {
                        aRef.LastMethodMap = (MethodParameterMap)sentIt.Tag;
                        mapGuid            = aRef.LastMethodMap.ID;
                        store = MapManager.FindStore(aRef.LastMethodMap.MethodName, mapGuid, aRef.ReferenceInfo);
                    }
                    else
                    {
                        store = MapManager.FindStore(aRef.LastMap.ToString(), mapGuid, aRef.ReferenceInfo);
                    }
                    UIMapper autoMapIt = null;


                    if (store != null && store.GetType().Equals(typeof(RuleStore)))
                    {
                        autoMapIt = new UIMapper(aRef.ViableInfo.TheMap, ((RuleStore)store).Rules, aRef.LastMethodMap, currentMode);
                    }
                    else
                    {
                        autoMapIt = new UIMapper(aRef.ViableInfo.TheMap, aRef.LastMethodMap, currentMode);
                    }

                    //autoMapIt.AutoMap = true;
                    if (autoMapIt.ShowDialog() == DialogResult.OK)
                    {
                        aRef.ViableInfo.TheMap = UIMapper.Result;
                        if (store.GetType().Equals(typeof(RuleStore)))
                        {
                            ((RuleStore)store).Rules = UIMapper.RuleSets;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
 private void ApplyField(UIMapper aMapper)
 {
     if (aMapper != null && aMapper.ShowDialog() == DialogResult.OK)
     {
         MapReferences mapRef = Mapped.LoadMapToTree(projectView, UIMapper.Result, ctxTreeMenu);
         mapRef.LastMap       = currentMode;
         mapRef.LastMethodMap = aMapper.MethodMap;
         if (UIMapper.RuleSets.Count > 0)
         {
             string storeName = currentMode.ToString();
             Guid   anId      = Guid.Empty;
             if (currentMode == DataMapType.MethodParameterMap)
             {
                 anId      = aMapper.MethodMap.ID;
                 storeName = mapRef.LastMethodMap.MethodName;
             }
             MapManager.FindRuleAndUpdate(storeName, mapRef.ReferenceInfo, UIMapper.RuleSets, currentMode, anId);
         }
     }
 }
 private void mnuAutoMap_Click(object sender, EventArgs e)
 {
     if (currentMode != DataMapType.None && lstVwObjectView.SelectedItems.Count > 0 && dgTableView.SelectedRows.Count > 0)
     {
         UIMapper    autoMapIt  = null;
         MapedObject aMapObject = null;
         MapManager.FindOrCreateMap(projectView, lstVwAssemblies.SelectedItems[0].SubItems[2].Text, ref aMapObject);
         if ((rbFields.Checked || rbProperties.Checked))
         {
             autoMapIt = new UIMapper(aMapObject, lstVwObjectView.SelectedItems, dgTableView.SelectedRows, currentMode);
         }
         else
         {
             autoMapIt = CreateParamsMapper(aMapObject);
         }
         autoMapIt.AutoMap = true;
         ApplyField(autoMapIt);
         if (dgTableView.Tag != null)
         {
             StoreDataTable(this, (exportControlEventArgs)dgTableView.Tag);
         }
     }
 }