예제 #1
0
        public static Boolean IsDeletedSitePermission(SitePermission permission)
        {
            using (TransactionScope scope = new TransactionScope())
            {
                Boolean bol = false;
                using (var context = new SycousCon())
                {
                    try
                    {
                        var Update = context.SitePermissions.Where(p => p.UserID == permission.UserID && p.ClientID == permission.ClientID && p.IsDeleted == 0);
                        if (Update.Count() > 0)
                        {
                            foreach (SitePermission p in Update)
                            {

                                p.IsDeleted = 2;
                                if (permission.CreateBy != null)
                                {
                                    p.ModifyBy = permission.CreateBy;
                                    p.ModifyDate = DateTime.Now;
                                }
                                else
                                {
                                    p.ModifyBy = permission.ModifyBy;
                                    p.ModifyDate = DateTime.Now;
                                }
                                context.SaveChanges();
                                context.AcceptAllChanges();
                                bol = true;
                            }//
                        }
                        else
                        {
                            bol = true;
                        }

                        scope.Complete();
                        context.Dispose();

                    }
                    catch (Exception ex)
                    {
                        context.Dispose();
                        throw;
                    }

                }// using
                return bol;
            } //trans
        }
예제 #2
0
 public static Boolean IsExistsSitePermission(SitePermission permission)
 {
     using (var context = new SycousCon())
     {
         try
         {
             SitePermission perm = context.SitePermissions.SingleOrDefault(p => p.UserID == permission.UserID && p.SiteID == permission.SiteID && p.ClientID == permission.ClientID && p.IsDeleted==0);
             if (perm != null)
             { return false; }
             else
             {
                 return true;
             }
         }
         catch (Exception ex)
         {
             context.Dispose();
             throw;
         }
     }
 }
예제 #3
0
 public static Boolean CreateSitePermission(SitePermission permission)
 {
     Boolean flag = false;
     //if (IsDeletedSitePermission(permission))
     // {
     using (TransactionScope scope = new TransactionScope())
     {
         using (var context = new SycousCon())
         {
             try
             {
                 context.SitePermissions.AddObject(permission);
                 context.SaveChanges();
                 scope.Complete();
                 context.AcceptAllChanges();
                 flag = true;
             }
             catch (Exception ex)
             {
                 context.Dispose();
                 throw;
             }
         }
         // }
     }
     return flag;
 }
예제 #4
0
        // create sitePermission
        public static Boolean CreateSitePermission(SitePermissionclass permissionobj)
        {
            Boolean flag = false;
            SitePermissionclass permission = (SitePermissionclass)permissionobj;
            try
            {
                SitePermission _permission = new SitePermission();

                if (permission.ClientID != null)
                {
                    _permission.ClientID = Convert.ToInt64(permission.ClientID);
                }
                if (permission.SiteID != null)
                {
                    _permission.SiteID = Convert.ToInt64(permission.SiteID);
                }
                if (permission.UserID != null)
                {
                    _permission.UserID = Convert.ToInt64(permission.UserID);
                }
                _permission.CreateDate = DateTime.Now;
                _permission.CreateBy = permission.CreateBy;
                if ((_permission.UserID != null)&&(_permission.SiteID != null)&&(_permission.ClientID != null))
                {
                    flag = DAL.DALUserReg.CreateSitePermission(_permission);
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return flag;
        }
예제 #5
0
 public Boolean DeletedSite()
 {
     Boolean flag = false;
        try
        {
        SitePermission permission  = new SitePermission();
        permission.ClientID = Convert.ToInt64(_SelectedClientID);
        permission.UserID = Convert.ToInt64(_UserID);
        permission.ModifyBy = _ModifyBY;
        permission.ModifyDate = DateTime.Now;
        flag = DALUserReg.IsDeletedSitePermission(permission);
        }
        catch (Exception ex)
        {
        throw;
        }
        return flag;
 }
예제 #6
0
 /// <summary>
 /// Create a new SitePermission object.
 /// </summary>
 /// <param name="mapID">Initial value of the MapID property.</param>
 /// <param name="isDeleted">Initial value of the IsDeleted property.</param>
 public static SitePermission CreateSitePermission(global::System.Int64 mapID, global::System.Int32 isDeleted)
 {
     SitePermission sitePermission = new SitePermission();
     sitePermission.MapID = mapID;
     sitePermission.IsDeleted = isDeleted;
     return sitePermission;
 }
예제 #7
0
 /// <summary>
 /// Deprecated Method for adding a new object to the SitePermissions EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToSitePermissions(SitePermission sitePermission)
 {
     base.AddObject("SitePermissions", sitePermission);
 }