public SelectProductWindow(List<GroupsListItem> groups,ProvinceGrouping grouping, List<int> selectedProductMapIds)
 {
     _groups = groups;
     _grouping = grouping;
     _selectedProductMapIds = selectedProductMapIds;
     InitializeComponent();
 }
 public CreateGroups(ProvinceGrouping grouping,List<ProvinceGroup> groups, List<ProvinceGroupRegionMap> regionMapIds)
 {
     _grouping = grouping;
     _groups = groups;
     _groupRegionMapIds = regionMapIds;
     InitializeComponent();
 }
 public DoneClickedEventArgs(ProvinceGrouping createdProvinceGrouping)
 {
     _createdProvinceGrouping = createdProvinceGrouping;
 }
        private void SaveAll(string groupingName, List<GroupsListItem> groups, List<int> productMapIds)
        {
            SmartMap_DomainContext context = new SmartMap_DomainContext();
            if (_grouping == null)
            {
                ProvinceGrouping grouping = new ProvinceGrouping();
                grouping.Name = groupingName;
                context.ProvinceGroupings.Add(grouping);

                foreach (int productMapid in productMapIds)
                    context.ProductProvinceGroupings.Add(new ProductProvinceGrouping { ProductMapID = productMapid, ProvinceGroupingID = grouping.ID });

                groupcounter = 0;
                if (groupcounter < groups.Count)
                {
                    ProvinceGroup group = new ProvinceGroup { Name = groups[groupcounter].GroupName, ProvinceGroupingID = grouping.ID };
                    if (groups[groupcounter].Provinces.Count > 0)
                        group.ParentRegionMapID = groups[groupcounter].Provinces[0].RegionMapID;
                    context.ProvinceGroups.Add(group);
                    foreach (RegionMap rm in groups[groupcounter].Provinces)
                    {
                        ProvinceGroupRegionMap link = new ProvinceGroupRegionMap();
                        link.ProvinceGroupID = group.ID;
                        link.RegionMapID = rm.RegionMapID;
                        context.ProvinceGroupRegionMaps.Add(link);
                    }
                }
                context.SubmitChanges(GroupingSave_Submited, grouping);
            }
            else
            {
                foreach (int productMapid in productMapIds)
                    context.ProductProvinceGroupings.Add(new ProductProvinceGrouping { ProductMapID = productMapid, ProvinceGroupingID = _grouping.ID });
                context.SubmitChanges(ProductProvinceGroupings_Submitted,null);   
            }
        }
 private bool FilterProvinceGrouping(ProvinceGrouping entity)
 {
     return (entity.ID == this.ProvinceGroupingID);
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the ProvinceGroupings EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToProvinceGroupings(ProvinceGrouping provinceGrouping)
 {
     base.AddObject("ProvinceGroupings", provinceGrouping);
 }
 /// <summary>
 /// Create a new ProvinceGrouping object.
 /// </summary>
 /// <param name="id">Initial value of the ID property.</param>
 /// <param name="name">Initial value of the Name property.</param>
 public static ProvinceGrouping CreateProvinceGrouping(global::System.Int32 id, global::System.String name)
 {
     ProvinceGrouping provinceGrouping = new ProvinceGrouping();
     provinceGrouping.ID = id;
     provinceGrouping.Name = name;
     return provinceGrouping;
 }