Esempio n. 1
0
 public void ConvertGradeLevelBDOToGradeLevel(GradeLevelBDO gbdo, GradeLevel g)
 {
     g.Description = gbdo.Description;
     g.GradeLevel1 = gbdo.GradeLev;
     g.Category    = gbdo.Category;
     g.level       = gbdo.level;
 }
Esempio n. 2
0
        public Boolean CreateGradeLevel(ref GradeLevelBDO gBDO, ref string message)
        {
            message = "Grade Level Added Successfully";
            bool ret = true;

            GradeLevel g = new GradeLevel();
            try {
            ConvertGradeLevelBDOToGradeLevel(gBDO, g);
            using (var DCEnt = new DCFIEntities())
            {
                DCEnt.GradeLevels.Attach(g);
                DCEnt.Entry(g).State = System.Data.Entity.EntityState.Added;
                int num = DCEnt.SaveChanges();

                if (num != 1)
                {
                    ret = false;
                    message = "Adding of Grade Level failed";
                }
            }
            }
            catch (DbEntityValidationException dbEx)
            {
                foreach (var validationErrors in dbEx.EntityValidationErrors)
                {
                    foreach (var validationError in validationErrors.ValidationErrors)
                    {
                        Trace.TraceInformation("Property: {0} Error: {1}",
                                                validationError.PropertyName,
                                                validationError.ErrorMessage);
                    }
                }
            }
            return ret;
        }
Esempio n. 3
0
 public void ConvertGradeLevelToGradeLevelBDO(GradeLevel g, GradeLevelBDO gbdo)
 {
     gbdo.Description = g.Description;
     gbdo.GradeLev    = g.GradeLevel1;
     gbdo.Category    = g.Category;
     gbdo.level       = g.level;
 }
Esempio n. 4
0
        public Boolean UpdateGradeLevel(ref GradeLevelBDO gBDO, ref string message)
        {
            message = "Grade Level updated successfully.";
            Boolean ret = true;

            using (var DCEnt = new DCFIEntities())
            {
                var        gCode = gBDO.GradeLev;
                GradeLevel gInDB = (from g in DCEnt.GradeLevels
                                    where g.GradeLevel1 == gCode
                                    select g).FirstOrDefault();
                if (gInDB == null)
                {
                    throw new Exception("No Grade Level " + gBDO.GradeLev);
                }
                DCEnt.GradeLevels.Remove(gInDB);
                gInDB.GradeLevel1 = gBDO.GradeLev;
                gInDB.Description = gBDO.Description;

                DCEnt.GradeLevels.Attach(gInDB);
                DCEnt.Entry(gInDB).State = System.Data.Entity.EntityState.Modified;
                int num = DCEnt.SaveChanges();

                if (num != 1)
                {
                    ret     = false;
                    message = "No grade level is updated.";
                }
            }
            return(ret);
        }
Esempio n. 5
0
        public Boolean UpdateGradeLevel(ref GradeLevelBDO gBDO, ref string message)
        {
            message = "Grade Level updated successfully.";
            Boolean ret = true;

            try {
                using (var DCEnt = new DCFIEntities())
                {
                    var        gCode = gBDO.GradeLev;
                    GradeLevel gInDB = (from g in DCEnt.GradeLevels
                                        where g.GradeLevel1 == gCode
                                        select g).FirstOrDefault();
                    if (gInDB == null)
                    {
                        throw new Exception("No Grade Level " + gBDO.GradeLev);
                    }
                    DCEnt.GradeLevels.Remove(gInDB);
                    gInDB.GradeLevel1 = gBDO.GradeLev;
                    gInDB.Description = gBDO.Description;

                    DCEnt.GradeLevels.Attach(gInDB);
                    DCEnt.Entry(gInDB).State = System.Data.Entity.EntityState.Modified;
                    int num = DCEnt.SaveChanges();

                    if (num != 1)
                    {
                        ret     = false;
                        message = "No grade level is updated.";
                    }
                }
            }
            catch (DbEntityValidationException dbEx)
            {
                foreach (var validationErrors in dbEx.EntityValidationErrors)
                {
                    foreach (var validationError in validationErrors.ValidationErrors)
                    {
                        Trace.TraceInformation("Property: {0} Error: {1}",
                                               validationError.PropertyName,
                                               validationError.ErrorMessage);
                    }
                }
            }
            return(ret);
        }
Esempio n. 6
0
        public Boolean CreateGradeLevel(ref GradeLevelBDO gBDO, ref string message)
        {
            message = "Grade Level Added Successfully";
            bool ret = true;

            GradeLevel g = new GradeLevel();
            ConvertGradeLevelBDOToGradeLevel(gBDO, g);
            using (var DCEnt = new DCFIEntities())
            {
                DCEnt.GradeLevels.Attach(g);
                DCEnt.Entry(g).State = System.Data.Entity.EntityState.Added;
                int num = DCEnt.SaveChanges();

                if (num != 1)
                {
                    ret = false;
                    message = "Adding of Grade Level failed";
                }
            }
            return ret;
        }
Esempio n. 7
0
        public Boolean CreateGradeLevel(ref GradeLevelBDO gBDO, ref string message)
        {
            message = "Grade Level Added Successfully";
            bool ret = true;

            GradeLevel g = new GradeLevel();

            ConvertGradeLevelBDOToGradeLevel(gBDO, g);
            using (var DCEnt = new DCFIEntities())
            {
                DCEnt.GradeLevels.Attach(g);
                DCEnt.Entry(g).State = System.Data.Entity.EntityState.Added;
                int num = DCEnt.SaveChanges();

                if (num != 1)
                {
                    ret     = false;
                    message = "Adding of Grade Level failed";
                }
            }
            return(ret);
        }
Esempio n. 8
0
        public Boolean CreateGradeLevel(ref GradeLevelBDO gBDO, ref string message)
        {
            message = "Grade Level Added Successfully";
            bool ret = true;

            GradeLevel g = new GradeLevel();

            try {
                ConvertGradeLevelBDOToGradeLevel(gBDO, g);
                using (var DCEnt = new DCFIEntities())
                {
                    DCEnt.GradeLevels.Attach(g);
                    DCEnt.Entry(g).State = System.Data.Entity.EntityState.Added;
                    int num = DCEnt.SaveChanges();

                    if (num != 1)
                    {
                        ret     = false;
                        message = "Adding of Grade Level failed";
                    }
                }
            }
            catch (DbEntityValidationException dbEx)
            {
                foreach (var validationErrors in dbEx.EntityValidationErrors)
                {
                    foreach (var validationError in validationErrors.ValidationErrors)
                    {
                        Trace.TraceInformation("Property: {0} Error: {1}",
                                               validationError.PropertyName,
                                               validationError.ErrorMessage);
                    }
                }
            }
            return(ret);
        }
Esempio n. 9
0
 private void ConvertGradeLevelToGradeLevelBDO(GradeLevel g, GradeLevelBDO gbdo)
 {
     gbdo.Description = g.Description;
     gbdo.GradeLev = g.GradeLevel1;
 }
Esempio n. 10
0
 private void ConvertGradeLevelBDOToGradeLevel(GradeLevelBDO gbdo, GradeLevel g)
 {
     g.Description = gbdo.Description;
     g.GradeLevel1 = gbdo.GradeLev;
 }
Esempio n. 11
0
 private void ConvertGradeLevelBDOToGradeLevel(GradeLevelBDO gbdo, GradeLevel g)
 {
     g.Description = gbdo.Description;
     g.GradeLevel1 = gbdo.GradeLev;
 }
Esempio n. 12
0
 private void ConvertGradeLevelToGradeLevelBDO(GradeLevel g, GradeLevelBDO gbdo)
 {
     gbdo.Description = g.Description;
     gbdo.GradeLev    = g.GradeLevel1;
 }
Esempio n. 13
0
 public void ConvertGradeLevelToGradeLevelBDO(GradeLevel g, GradeLevelBDO gbdo)
 {
     gbdo.Description = g.Description;
     gbdo.GradeLev = g.GradeLevel1;
     gbdo.Category = g.Category;
 }
Esempio n. 14
0
 public void ConvertGradeLevelBDOToGradeLevel(GradeLevelBDO gbdo, GradeLevel g)
 {
     g.Description = gbdo.Description;
     g.GradeLevel1 = gbdo.GradeLev;
     g.Category = gbdo.Category;
 }