public BusinessEntity.Result DeleteRelationshipType(BusinessEntity.Lookup.RelationshipTypeEntity RelationshipType)
        {
            BusinessEntity.Result result = new BusinessEntity.Result();
            try
            {
                SchoolInformationManagementSystemDBEntities e = new SchoolInformationManagementSystemDBEntities();
                var original = e.tblRelationshipTypes.Find(RelationshipType.ID);
                if (original != null)
                {
                    e.tblRelationshipTypes.Remove(e.tblRelationshipTypes.Where(x => x.ID == RelationshipType.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);
            }
        }
        public BusinessEntity.Result UpdateRelationshipType(BusinessEntity.Lookup.RelationshipTypeEntity RelationshipType)
        {
            BusinessEntity.Result result = new BusinessEntity.Result();
            try
            {
                SchoolInformationManagementSystemDBEntities e = new SchoolInformationManagementSystemDBEntities();
                var original = e.tblRelationshipTypes.Find(RelationshipType.ID);
                if (original != null)
                {
                    e.Entry(original).CurrentValues.SetValues(RelationshipType);
                    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);
            }
        }
        public Models.Lookup.RelationshipTypeModel GetRelationshipTypeByID(int RelationshipTypeID)
        {
            BusinessLogic.Lookup.RelationshipTypeManager RelationshipTypeManager = new BusinessLogic.Lookup.RelationshipTypeManager();
            BusinessEntity.Lookup.RelationshipTypeEntity RelationshipType        = RelationshipTypeManager.GetRelationshipTypeByID(RelationshipTypeID);

            return(new Models.Lookup.RelationshipTypeModel(RelationshipType));
        }
Beispiel #4
0
 public RelationshipTypeModel(BusinessEntity.Lookup.RelationshipTypeEntity relationshipType)
 {
     this.ID          = relationshipType.ID;
     this.Name        = relationshipType.Name;
     this.Description = relationshipType.Description;
     this.CreatedBy   = relationshipType.CreatedBy;
     this.CreatedDate = relationshipType.CreatedDate;
 }
Beispiel #5
0
        public T MapToEntity <T>() where T : class
        {
            BusinessEntity.Lookup.RelationshipTypeEntity relationshipType = new BusinessEntity.Lookup.RelationshipTypeEntity();
            relationshipType.ID          = this.ID;
            relationshipType.Name        = this.Name;
            relationshipType.Description = this.Description;
            relationshipType.CreatedBy   = this.CreatedBy;
            relationshipType.CreatedDate = this.CreatedDate;

            return(relationshipType as T);
        }
        public BusinessEntity.Result SaveRelationshipType(BusinessEntity.Lookup.RelationshipTypeEntity RelationshipType)
        {
            BusinessEntity.Result result = new BusinessEntity.Result();
            try
            {
                SchoolInformationManagementSystemDBEntities e = new SchoolInformationManagementSystemDBEntities();
                e.tblRelationshipTypes.Add(RelationshipType.MapToModel <DataAccessLogic.tblRelationshipType>());
                e.SaveChanges();

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