Example #1
0
        public BusinessEntity.Result DeletePermissionType(BusinessEntity.Lookup.PermissionTypeEntity PermissionType)
        {
            BusinessEntity.Result result = new BusinessEntity.Result();
            try
            {
                SchoolInformationManagementSystemDBEntities e = new SchoolInformationManagementSystemDBEntities();
                var original = e.tblPermissionTypes.Find(PermissionType.ID);
                if (original != null)
                {
                    e.tblPermissionTypes.Remove(e.tblPermissionTypes.Where(x => x.ID == PermissionType.ID).First());
                    e.SaveChanges();

                    result.Message = "Deleted Successfully.";
                    result.Status  = true;
                    return(result);
                }
                else
                {
                    result.Message = "Failed to delete";
                    result.Status  = false;
                    return(result);
                }
            }
            catch (Exception)
            {
                result.Message = "Failed to delete";
                result.Status  = false;
                return(result);
            }
        }
Example #2
0
        public BusinessEntity.Result UpdatePermissionType(BusinessEntity.Lookup.PermissionTypeEntity PermissionType)
        {
            BusinessEntity.Result result = new BusinessEntity.Result();
            try
            {
                SchoolInformationManagementSystemDBEntities e = new SchoolInformationManagementSystemDBEntities();
                var original = e.tblPermissionTypes.Find(PermissionType.ID);
                if (original != null)
                {
                    e.Entry(original).CurrentValues.SetValues(PermissionType);
                    e.SaveChanges();

                    result.Message = "Updated Successfully.";
                    result.Status  = true;
                    return(result);
                }
                else
                {
                    result.Message = "Failed to update";
                    result.Status  = false;
                    return(result);
                }
            }
            catch (Exception)
            {
                result.Message = "Failed to update";
                result.Status  = false;
                return(result);
            }
        }
Example #3
0
        public Models.Lookup.PermissionTypeModel GetPermissionTypeByID(int PermissionTypeID)
        {
            BusinessLogic.Lookup.PermissionTypeManager PermissionTypeManager = new BusinessLogic.Lookup.PermissionTypeManager();
            BusinessEntity.Lookup.PermissionTypeEntity PermissionType        = PermissionTypeManager.GetPermissionTypeByID(PermissionTypeID);

            return(new Models.Lookup.PermissionTypeModel(PermissionType));
        }
 public PermissionTypeModel(BusinessEntity.Lookup.PermissionTypeEntity permissionType)
 {
     this.ID          = permissionType.ID;
     this.Name        = permissionType.Name;
     this.Description = permissionType.Description;
     this.CreatedBy   = permissionType.CreatedBy;
     this.CreatedDate = permissionType.CreatedDate;
 }
        public T MapToEntity <T>() where T : class
        {
            BusinessEntity.Lookup.PermissionTypeEntity permissionType = new BusinessEntity.Lookup.PermissionTypeEntity();
            permissionType.ID          = this.ID;
            permissionType.Name        = this.Name;
            permissionType.Description = this.Description;
            permissionType.CreatedBy   = this.CreatedBy;
            permissionType.CreatedDate = this.CreatedDate;

            return(permissionType as T);
        }
Example #6
0
        public BusinessEntity.Result SavePermissionType(BusinessEntity.Lookup.PermissionTypeEntity PermissionType)
        {
            BusinessEntity.Result result = new BusinessEntity.Result();
            try
            {
                SchoolInformationManagementSystemDBEntities e = new SchoolInformationManagementSystemDBEntities();
                e.tblPermissionTypes.Add(PermissionType.MapToModel <DataAccessLogic.tblPermissionType>());
                e.SaveChanges();

                result.Message = "Saved Successfully.";
                result.Status  = true;
                return(result);
            }
            catch (Exception)
            {
                result.Message = "Failed to save";
                result.Status  = false;
                return(result);
            }
        }