Beispiel #1
0
        private void LoginUserLoaded(LoadOperation<User> result)
        {
            if (result.Error == null)
            {
                Login.LoginUser = null;
                foreach (User user in result.Entities)
                    Login.LoginUser = user;

                if (Login.LoginUser != null)
                {
                    SmartMap_DomainContext context = new SmartMap_DomainContext();
                    LoadOperation loadOp = context.Load(context.GetRolePermissionsQuery(Login.LoginUser.RoleID), PermissionsLoaded, null);
                }
                else
                {
                    if (_loadingAnm != null)
                        _loadingAnm.Visibility = Visibility.Collapsed;
                    MessageBox.Show("Incorrect Username or password.");
                }
            }
            else
            {
                if (_loadingAnm != null)
                    _loadingAnm.Visibility = Visibility.Collapsed;
                string msg = result.Error.Message;
                if (result.Error.InnerException != null)
                    msg += ("Inner: \n" + result.Error.InnerException.Message);
                MessageBox.Show("Custom Error Handler:\n"+ msg);
            }
        }
Beispiel #2
0
        private void LoginButton_Click(object sender, RoutedEventArgs e)
        {
            if(_loadingAnm != null)
                _loadingAnm.Visibility = Visibility.Visible;

            SmartMap_DomainContext context = new SmartMap_DomainContext();
            LoadOperation loadOp = context.Load<User>(context.GetUserQuery(userNameBox.Text.Trim().ToLower(),passBox.Password),LoginUserLoaded,null);
        }
Beispiel #3
0
        private void UserLaoded(LoadOperation<User> result)
        {
            Login.LoginUser = null;
            foreach (User user in result.Entities)
                Login.LoginUser = user;

            if (Login.LoginUser != null)
            {
                SmartMap_DomainContext context = new SmartMap_DomainContext();
                LoadOperation loadOp = context.Load(context.GetRolePermissionsQuery(Login.LoginUser.RoleID), PermissionsLoaded, null);
            }
        }
Beispiel #4
0
        public App()
        {
            timer.Interval = new TimeSpan(0, 0, 1);
            timer.Tick += new EventHandler(Timer_Tick);
            timer.Start();
            string uri = this.Host.Source.ToString();

            uri = uri.Substring(0, uri.LastIndexOf("/") + 1) + "Configuration.xml";
            HttpWebRequest webRequest = WebRequest.Create(new Uri(uri)) as HttpWebRequest;

            if (webRequest != null)
                webRequest.BeginGetResponse(getResponse, webRequest);
            else
                MessageBox.Show("Error! Configuration Not Set.");

            if (Cookie.Read(Login.USER_COOKIE_KEY) != null)
            {
                cookieuserexist = true;
                SmartMap_DomainContext context = new SmartMap_DomainContext();
                context.Load<User>(context.GetUserWithoutPasswordQuery(Cookie.Read(Login.USER_COOKIE_KEY)), UserLaoded, null);
            }
        }
        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 void LoadAllProductProvinceGroupings()
 {
     SmartMap_DomainContext context = new SmartMap_DomainContext();
     context.Load<ProductProvinceGrouping>(context.GetAllProductProvinceGroupingQuery(), AllProductProvinceGroupings_Loaded, null);
 }
 private void ChangedNameGrouping_Saved(SubmitOperation result)
 {
     SmartMap_DomainContext context = new SmartMap_DomainContext();
     context.PakKonAllProductProvinceGrouping(_grouping.ID, ProductProvinceGroup_Deleted, null);
 }
 private void GroupingSave_Submited(SubmitOperation result)
 {
     if (Utils.LoadOperation_Error_Handled(result.Error, "SmartMap"))
     {
         SmartMap_DomainContext context = new SmartMap_DomainContext();
         groupcounter += 1;
         ProvinceGrouping grouping = (ProvinceGrouping)result.UserState;
         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
         {
             DoneClickedEventArgs args = new DoneClickedEventArgs(grouping);
             this.OnClosed(args);
             this.DialogResult = true;
         }
     }
 }
 private void DoneBtn_Click(object sender, RoutedEventArgs e)
 {
     if (SavingLoading != null)
         SavingLoading.Visibility = System.Windows.Visibility.Visible;
     if (DoneBtn != null)
         DoneBtn.IsEnabled = false;
     SmartMap_DomainContext context = new SmartMap_DomainContext();
     if (_grouping == null)
     {
         List<int> list = new List<int>();
         foreach (int productMapId in GetSelectedProductsIds())
             list.Add(productMapId);
         context.PakKonAllProductProvinceGroups(list, ProductProvinceGroup_Deleted, null);
     }
     else
     {
         if (_grouping.Name != GroupingNameTbx.Text)
         {
             _grouping.Name = GroupingNameTbx.Text;
             context.Load<ProvinceGrouping>(context.GetProvinceGroupingByIdQuery(_grouping.ID), ChangedNameGrouping_Loaded, context);
         }
         else
         {
             context.PakKonAllProductProvinceGrouping(_grouping.ID, ProductProvinceGroup_Deleted, null);
         }
     }
 }
 private void DoneBtn_Click(object sender, RoutedEventArgs e)
 {
     if (SavingLoading != null)
         SavingLoading.Visibility = System.Windows.Visibility.Visible;
     if (DoneBtn != null)
         DoneBtn.IsEnabled = false;
     SmartMap_DomainContext context = new SmartMap_DomainContext();
     context.PakKonAllProvinceGroups(_grouping.ID,AllGroupsDeleted,null);
 }
 private void GroupsSaved(SubmitOperation result)
 {
     if (Utils.LoadOperation_Error_Handled(result.Error, "SmartMap"))
     {
         if (groupCounter < GroupsList.Items.Count)
         {
             SmartMap_DomainContext context = new SmartMap_DomainContext();
             GroupsListItem item = (GroupsListItem)GroupsList.Items[groupCounter];
             ProvinceGroup group = new ProvinceGroup { Name = item.GroupName, ProvinceGroupingID = _grouping.ID, ParentRegionMapID = item.Provinces[0].RegionMapID };
             context.ProvinceGroups.Add(group);
             groupCounter += 1;
             foreach (RegionMap rm in item.Provinces)
             {
                 ProvinceGroupRegionMap link = new ProvinceGroupRegionMap();
                 link.ProvinceGroupID = group.ID;
                 link.RegionMapID = rm.RegionMapID;
                 context.ProvinceGroupRegionMaps.Add(link);
             }
             context.SubmitChanges(GroupsSaved, null);
         }
         else
         {
             this.DialogResult = true;
         }
     }
 }
Beispiel #12
0
        public static void Load_ProductMap_Table()
        {
            try
            {
                SmartMap_DomainContext context = new SmartMap_DomainContext();
                LoadOperation<ProductMap> loadOp = context.Load<ProductMap>(context.GetProductMapsQuery(), ProductMapTable_Loaded, null);
            }
            catch (Exception ex)
            {


                string msg = ex.Message;
                if (ex.InnerException != null)
                    msg += ("Inner: \n" + ex.InnerException.Message);
                System.IO.File.WriteAllText(@"C:\inetpub\wwwroot\snfgis\load_productmaptable1_error.txt", msg);
            }
        }
Beispiel #13
0
 public static void LoadProvinceGroupView()
 {
     SmartMap_DomainContext context = new SmartMap_DomainContext();
     LoadOperation<ProvinceGroupingView> loadOp = context.Load<ProvinceGroupingView>(context.GetProvinceGroupingViewQuery(), ProvinceGroupingView_Loaded ,null);
 }
Beispiel #14
0
 public static void Load_SpecialObjectiveYears()
 {
     SmartMap_DomainContext context = new SmartMap_DomainContext();
     LoadOperation<ObjectiveSpecialYear> loadOp = context.Load<ObjectiveSpecialYear>(context.GetSpecialObjectiveYearsQuery(), SpecialObjectiveYears_Loaded, null);
 }
Beispiel #15
0
 public static void Load_ObjectiveNotations()
 {
     SmartMap_DomainContext context = new SmartMap_DomainContext();
     LoadOperation<ObjectiveNotation> loadOp = context.Load<ObjectiveNotation>(context.GetObjectiveTypeNotationsQuery(), ObjectiveTypeNotations_Loaded, null);
 }
Beispiel #16
0
 private bool Start_Loading_UnloadedTehranPolygons()
 {
     _isLoadingTehranRegions = true;
     int polygonId = Get_Next_UnloadedTehranPolygonId();
     if (polygonId >= 0)
     {
         SmartMap_DomainContext context = new SmartMap_DomainContext();
         LoadOperation loadOp = context.Load(context.GetPointsQuery(polygonId), TehranCustomPoints_Loaded, Create_UserState(Polygons.TehranRegions, polygonId));
         return true;
     }
     else return false;
 }