Пример #1
0
        public Boolean AddScholarshipDiscount(ScholarshipDiscountBDO discount,int scholarshipCode, ref string message)
        {
            message = "Scholarship Discount Added Successfully";
            Boolean ret = true;

            ScholarshipDiscount sd = new ScholarshipDiscount();
            try {
            ConvertScholarshipDiscountBDOToScholarshipDiscount(discount, sd);
            using (var DCEnt = new DCFIEntities())
            {
                DCEnt.ScholarshipDiscounts.Add(sd);
                DCEnt.Entry(sd).State = System.Data.Entity.EntityState.Added;
                int num = DCEnt.SaveChanges();

                if (num != 1)
                {
                    ret = false;
                    message = "Adding of Scholarship Discount 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;
        }
Пример #2
0
        public ScholarshipDiscountBDO GetScholarship(int discountId)
        {
            ScholarshipDiscount sd = new ScholarshipDiscount();
            ScholarshipDiscountBDO sBDO = new ScholarshipDiscountBDO();
            try { 
            using (var DCEnt = new DCFIEntities())
            {
                 sd = (from s in DCEnt.ScholarshipDiscounts
                          where s.ScholarshipDiscountId==discountId
                          select s).FirstOrDefault();
               
            }
           
                ConvertScholarshipDiscountToScholarshipDiscountBDO(sd, sBDO);
        }
            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 sBDO;
        }
Пример #3
0
            public List<ScholarshipDiscountBDO> GetAllScholarships()
        {
            List<ScholarshipDiscount> sList = new List<ScholarshipDiscount>();
            List<ScholarshipDiscountBDO> sBDOList = new List<ScholarshipDiscountBDO>();
            try { 
            using (var DCEnt = new DCFIEntities())
            {
                var allScholarships = (DCEnt.ScholarshipDiscounts);
                sList = allScholarships.ToList();
            }

         
            foreach (ScholarshipDiscount s in sList)
            {
                ScholarshipDiscountBDO sBDO = new ScholarshipDiscountBDO();
                ConvertScholarshipDiscountToScholarshipDiscountBDO(s, sBDO);
                sBDOList.Add(sBDO);
            }
            }
            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 sBDOList;
        }
Пример #4
0
        public void ConvertAssessToAssessBDO(StudentAssessment a, StudentAssessmentBDO ab)
        {
            FeeDAO fd = new FeeDAO();
            FeeBDO fb = new FeeBDO();
            ScholarshipDAO sd = new ScholarshipDAO();
            ScholarshipDiscountBDO sb = new ScholarshipDiscountBDO();

            if (a.DiscountId.HasValue)
            {
                int d = (int)a.DiscountId;
                sb = sd.GetScholarship(d);
                ab.DiscountId = (int)a.DiscountId;
            }

            ab.StudentAssessmentId = a.StudentAssessmentId;
            ab.StudentSY = a.StudentSY;
            ab.FeeID = a.FeeID;
            ab.Fee = fd.GetFee((int)ab.FeeID);

            ab.ScholarshipDiscount = sb;
        }
Пример #5
0
        public Boolean CreateScholarship(ref ScholarshipDiscountBDO sBDO, ref string message)
        {
            message = "Scholarship Added Successfully";
            bool ret = true;

            //    Scholarship s = new Scholarship();
            //    ConvertScholarshipBDOToScholarship(sBDO, s);
            //    using (var DCEnt = new DCFIEntities())
            //    {
            //        DCEnt.Scholarships.Add(s);
            //        DCEnt.Entry(s).State = System.Data.Entity.EntityState.Added;
            //        int num = DCEnt.SaveChanges();
            //        sBDO.ScholarshipCode = s.ScholarshipCode;

            //        if (num != 1)
            //        {
            //            ret = false;
            //            message = "Adding of Scholarship failed";
            //        }
            //    }
            return ret;
        }
Пример #6
0
        public Boolean AddScholarshipDiscount(ScholarshipDiscountBDO discount, string scholarshipCode, ref string message)
        {
            message = "Scholarship Discount Added Successfully";
            Boolean ret = true;

            ScholarshipDiscount sd = new ScholarshipDiscount();
            ConvertScholarshipDiscountBDOToScholarshipDiscount(discount, sd, scholarshipCode);
            using (var DCEnt = new DCFIEntities())
            {
                DCEnt.ScholarshipDiscounts.Attach(sd);
                DCEnt.Entry(sd).State = System.Data.Entity.EntityState.Added;
                int num = DCEnt.SaveChanges();

                if (num != 1)
                {
                    ret = false;
                    message = "Adding of Scholarship Discount failed";
                }

                return ret;
            }
        }
Пример #7
0
        private void TranslateScholarshipDiscountToScholarshipDiscountBDO(ScholarshipDiscount sc, ScholarshipDiscountBDO sbdo)
        {

            //FeeService fs = new FeeService();
            //Fee f = new Fee();
            //f = fs.GetFee(sc.FeeID);
            sbdo.Deactivated = sc.Deactivated;
            sbdo.Discount = (float)sc.Discount;
            sbdo.ScholarshipDiscountId = sc.ScholarshipDiscountId;
            //sbdo.Fee = f;
        }
Пример #8
0
 private void ConvertScholarshipDiscountToScholarshipDiscountBDO(ScholarshipDiscount d, ScholarshipDiscountBDO sd, string scholarshipCode)
 {
     FeeBDO f = new FeeBDO();
     ConvertFeeToFeeBDO(d.Fee, f);
     sd.Deactivated = d.Deactivated;
     sd.Discount = d.Discount;
     sd.FeeCode = d.FeeCode;
     sd.ScholarshipFeeCode = d.ScholarshipFeeCode;
     sd.Fee = f;
 }
Пример #9
0
 public void ConvertScholarshipDiscountBDOToScholarshipDiscount(ScholarshipDiscountBDO d, ScholarshipDiscount sd)
 {
     sd.Deactivated = d.Deactivated;
     sd.Discount = d.Discount;
     sd.Scholarship = d.Scholarship;
     sd.Description = d.Description;
     sd.ScholarshipDiscountId = d.ScholarshipDiscountId;
 }
Пример #10
0
 public void TranslateScholarshipToScholarshipBDO(ScholarshipDiscount s, ScholarshipDiscountBDO sBDO)
 {
     //sBDO.ScholarshipCode = s.ScholarshipCode;
     //sBDO.Condition = s.Condition;
     sBDO.Deactivated = s.Deactivated;
     sBDO.Description = s.Description;
       //  sBDO.Privilege = s.Privilege;
 }
Пример #11
0
 // Done
 public bool UpdateScholarshipDiscount(ref ScholarshipDiscount scholarshipDiscount, ref string message)
 {
     ScholarshipDiscountBDO sdBDO = new ScholarshipDiscountBDO();
     TranslateScholarshipDiscountToScholarshipDiscountBDO(scholarshipDiscount, sdBDO);
     return sLogic.UpdateScholarshipDiscount(ref sdBDO, ref message);
 }
Пример #12
0
        public List<ScholarshipDiscountBDO> ToScholarhsipDiscountBDOList(List<ScholarshipDiscount> sdbdo)
        {
            List<ScholarshipDiscountBDO> scholarshipDiscounts = new List<ScholarshipDiscountBDO>();
            foreach (ScholarshipDiscount SD in sdbdo)
            {
                ScholarshipDiscountBDO s = new ScholarshipDiscountBDO();
                TranslateScholarshipDiscountToScholarshipDiscountBDO(SD, s);
                scholarshipDiscounts.Add(s);
            }

            return scholarshipDiscounts;
        }
Пример #13
0
 public Boolean UpdateScholarshipDiscount(ref ScholarshipDiscountBDO sdBDO, ref string message)
 {
     return sDAO.UpdateScholarshipDiscount(ref sdBDO, ref message);
 }
Пример #14
0
 public Boolean CreateScholarship(ref ScholarshipDiscountBDO sbdo, ref string message)
 {
     return sDAO.CreateScholarship(ref sbdo, ref message);
 }
Пример #15
0
 public Boolean AddScholarshipDiscount(ScholarshipDiscountBDO sdBDO, int scholarshipCode, ref string message)
 {
     return sDAO.AddScholarshipDiscount(sdBDO, scholarshipCode, ref message);
 }
Пример #16
0
 public void ConvertScholarshipBDOToScholarship(ScholarshipDiscountBDO sbdo, ScholarshipDiscount s)
 {
     // s.Condition = sbdo.Condition;
     s.Deactivated = sbdo.Deactivated;
     s.Description = sbdo.Description;
     //s.Privilege = sbdo.Privilege;
     //s.ScholarshipCode = sbdo.ScholarshipCode;
        // s.ScholarshipDiscounts = ToScholarshipDiscountList(sbdo.ScholarshipDiscounts);
 }
Пример #17
0
        //    DCEnt.Scholarships.Remove(sInDB);
        //    sInDB.Condition = sBDO.Condition;
        //    sInDB.Deactivated = sBDO.Deactivated;
        //    sInDB.Description = sBDO.Description;
        //    sInDB.Privilege = sBDO.Privilege;
        //    sInDB.ScholarshipCode = sBDO.ScholarshipCode;
        //    DCEnt.Scholarships.Attach(sInDB);
        //    DCEnt.Entry(sInDB).State = System.Data.Entity.EntityState.Modified;
        //    int num = DCEnt.SaveChanges();
        //    if (num != 1)
        //    {
        //        ret = false;
        //        message = "No scholarship is updated.";
        //    }
        //}
        //return ret;
        public Boolean UpdateScholarshipDiscount(ref ScholarshipDiscountBDO sBDO, ref string message)
        {
            message = "Scholarship discount updated successfully.";
            Boolean ret = true;
            try {
            using (var DCEnt = new DCFIEntities())
            {
                var scholarshipCode = sBDO.ScholarshipDiscountId;
                ScholarshipDiscount sInDB = (from s in DCEnt.ScholarshipDiscounts
                                             where s.ScholarshipDiscountId== scholarshipCode
                                             select s).FirstOrDefault();
                if (sInDB == null)
                {
                    throw new Exception("No Scholarship discount with ScholarshipCode " + sBDO.ScholarshipDiscountId);
                }
                DCEnt.ScholarshipDiscounts.Remove(sInDB);

               // sInDB.FeeID= sBDO.FeeID;
                sInDB.Deactivated = sBDO.Deactivated;
                sInDB.Discount = sBDO.Discount;
                sInDB.ScholarshipDiscountId = sBDO.ScholarshipDiscountId;

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

                if (num != 1)
                {
                    ret = false;
                    message = "No scholarship discount 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;
        }
Пример #18
0
        public Boolean UpdateScholarship(ref ScholarshipDiscountBDO sBDO, ref string message)
        {
            message = "Scholarship updated successfully.";
            Boolean ret = true;
            //Scholarship sc = new Scholarship();

            //ConvertScholarshipBDOToScholarship(sBDO, sc);
            //Scholarship scholarshipInDB = new Scholarship();
            //using (var DCEnt = new DCFIEntities())
            //{
            //    var scholarshipCode = sBDO.ScholarshipCode;
            //    Scholarship sInDB = (from s in DCEnt.Scholarships
            //                         where s.ScholarshipCode == scholarshipCode
            //                         select s).FirstOrDefault();
            //    if (sInDB == null)
            //    {
            //        throw new Exception("No Scholarship with ScholarshipCode " + sBDO.ScholarshipCode);
            //    }

            //    // 1st Part
            //    if (scholarshipInDB.ScholarshipDiscounts.Count == 0)
            //    {
            //        foreach (ScholarshipDiscount sd in sc.ScholarshipDiscounts)
            //        {
            //            scholarshipInDB.ScholarshipDiscounts.Add(sd);
            //        }
            //    }
            //    else if (scholarshipInDB.ScholarshipDiscounts.Count < sc.ScholarshipDiscounts.Count)
            //    {
            //        //compare 2 lists check the non existing to the other
            //        IEnumerable<ScholarshipDiscount> sdToAdd = sc.ScholarshipDiscounts.Except(scholarshipInDB.ScholarshipDiscounts);
            //        if (sdToAdd != null)
            //        {
            //            foreach (ScholarshipDiscount child in sdToAdd)
            //            {
            //                scholarshipInDB.ScholarshipDiscounts.Add(child);
            //            }
            //        }

            //        IEnumerable<ScholarshipDiscount> sdToRemove = scholarshipInDB.ScholarshipDiscounts.Except(sc.ScholarshipDiscounts);
            //        if (sdToRemove != null)
            //        {
            //            foreach (ScholarshipDiscount child in sdToRemove)
            //            {
            //                scholarshipInDB.ScholarshipDiscounts.Add(child);
            //            }
            //        }
            //    }
            //    else if (scholarshipInDB.ScholarshipDiscounts.Count > sc.ScholarshipDiscounts.Count)
            //    {
            //        //compare 2 lists check the non existing to the other
            //        IEnumerable<ScholarshipDiscount> sdToAdd = sc.ScholarshipDiscounts.Except(scholarshipInDB.ScholarshipDiscounts);
            //        if (sdToAdd != null)
            //        {
            //            foreach (ScholarshipDiscount child in sdToAdd)
            //            {
            //                scholarshipInDB.ScholarshipDiscounts.Add(child);
            //            }
            //        }

            //        // TBC
            //        IEnumerable<ScholarshipDiscount> sdToRemove = scholarshipInDB.ScholarshipDiscounts.Except(sc.ScholarshipDiscounts);
            //        if (sdToRemove != null)
            //        {
            //            foreach (ScholarshipDiscount child in sdToRemove)
            //            {
            //                scholarshipInDB.ScholarshipDiscounts.Add(child);
            //            }
            //        }
            //    }
            //    else if (scholarshipInDB.ScholarshipDiscounts.Count == sc.ScholarshipDiscounts.Count)
            //    {
            //        //compare 2 lists check the non existing to the other
            //        IEnumerable<ScholarshipDiscount> sdToAdd = sc.ScholarshipDiscounts.Except(scholarshipInDB.ScholarshipDiscounts);
            //        if (sdToAdd != null)
            //        {
            //            foreach (ScholarshipDiscount child in sdToAdd)
            //            {
            //                scholarshipInDB.ScholarshipDiscounts.Add(child);
            //            }
            //        }

            //        IEnumerable<ScholarshipDiscount> sdToRemove = scholarshipInDB.ScholarshipDiscounts.Except(sc.ScholarshipDiscounts);
            //        if (sdToRemove != null)
            //        {
            //            foreach (ScholarshipDiscount child in sdToRemove)
            //            {
            //                scholarshipInDB.ScholarshipDiscounts.Add(child);
            //            }
            //        }
            //    }
            //}
            //using (var DC = new DCFIEntities())
            //{
            //    scholarshipInDB = sc;

            //    DC.Entry(scholarshipInDB).State = System.Data.Entity.EntityState.Modified;
            //    foreach (ScholarshipDiscount sd in scholarshipInDB.ScholarshipDiscounts)
            //        DC.Entry(sd).State = sd.ScholarshipDiscountId == 0 ? System.Data.Entity.EntityState.Added : System.Data.Entity.EntityState.Modified;
            //    int number = DC.SaveChanges();

            //    if (number > 0)
            //    {
            //        // ret = false;
            //        message = "No Scholarship is updated.";
            //    }
            //}

            return ret;
        }
Пример #19
0
 public List<ScholarshipDiscountBDO> GetAllScholarshipDiscountsFromScholarship(int scholarshipCode)
 {
     List<ScholarshipDiscount> scholarshipDiscounts = null;
     List<ScholarshipDiscountBDO> sbdoList = new List<ScholarshipDiscountBDO>();
     try {
     using (var DCEnt = new DCFIEntities())
     {
         scholarshipDiscounts = (from sd in DCEnt.ScholarshipDiscounts
                                 where sd.ScholarshipDiscountId == scholarshipCode
                                 select sd).ToList<ScholarshipDiscount>();
     }
     foreach (ScholarshipDiscount sd in scholarshipDiscounts)
     {
         ScholarshipDiscountBDO scholDisBDO = new ScholarshipDiscountBDO();
         ConvertScholarshipDiscountToScholarshipDiscountBDO(sd, scholDisBDO);
         sbdoList.Add(scholDisBDO);
     }
     }
     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 sbdoList;
 }
Пример #20
0
        private void TranslateScholarshipDiscountBDOToScholarshipDiscount(ScholarshipDiscountBDO sc, ScholarshipDiscount sbdo)
        {

            sbdo.Deactivated = sc.Deactivated;
            sbdo.Discount = sc.Discount;

            sbdo.ScholarshipDiscountId = sc.ScholarshipDiscountId;

        }
Пример #21
0
 public bool AddScholarshipDiscount(ref ScholarshipDiscount scholarshipDiscount, int scholarshipCode, ref string message)
 {
     ScholarshipDiscountBDO sdbdo = new ScholarshipDiscountBDO();
     TranslateScholarshipDiscountToScholarshipDiscountBDO(scholarshipDiscount, sdbdo);
     return sLogic.AddScholarshipDiscount(sdbdo, scholarshipCode, ref message);
 }
Пример #22
0
 private void TranslateScholarshipDiscountToScholarshipDiscountBDO(ScholarshipDiscount sc, ScholarshipDiscountBDO sbdo)
 {
     sbdo.Deactivated = sc.Deactivated;
     sbdo.Discount = sc.Discount;
     sbdo.FeeCode = sc.FeeCode;
     sbdo.ScholarshipCode = sc.ScholarshipCode;
     sbdo.ScholarshipFeeCode = sc.ScholarshipFeeCode;
 }
Пример #23
0
 public bool CreateScholarship(ref ScholarshipDiscount scholarship, ref string message)
 {
     ScholarshipDiscountBDO sbdo = new ScholarshipDiscountBDO();
     TranslateScholarshipToScholarshipBDO(scholarship, sbdo);
     return sLogic.CreateScholarship(ref sbdo, ref message);
 }
Пример #24
0
 public List<ScholarshipDiscountBDO> GetAllScholarshipDiscountsFromScholarship(string scholarshipCode)
 {
     List<ScholarshipDiscount> scholarshipDiscounts = null;
     List<ScholarshipDiscountBDO> sbdoList = new List<ScholarshipDiscountBDO>();
     using (var DCEnt = new DCFIEntities())
     {
         scholarshipDiscounts = (from sd in DCEnt.ScholarshipDiscounts
                                 where sd.ScholarshipCode == scholarshipCode
                                 select sd).ToList<ScholarshipDiscount>();
     }
     foreach (ScholarshipDiscount sd in scholarshipDiscounts)
     {
         ScholarshipDiscountBDO scholDisBDO = new ScholarshipDiscountBDO();
         ConvertScholarshipDiscountToScholarshipDiscountBDO(sd, scholDisBDO, scholarshipCode);
         sbdoList.Add(scholDisBDO);
     }
     return sbdoList;
 }
Пример #25
0
        private void TranslateScholarshipBDOToScholarship(ScholarshipDiscountBDO sc, ScholarshipDiscount sbdo)
        {
            sbdo.ScholarshipDiscountId = sc.ScholarshipDiscountId;
            sbdo.Scholarship = sc.Scholarship;
            sbdo.Discount = sc.Discount;
            sbdo.Deactivated = sc.Deactivated;
            sbdo.Description = sc.Description;

        }
Пример #26
0
        public List<ScholarshipDiscountBDO> GetAllDiscounts(string scholarshipCode)
        {
            List<ScholarshipDiscountBDO> sdList = new List<ScholarshipDiscountBDO>();
            List<ScholarshipDiscount> discounts = new List<ScholarshipDiscount>();
            using (var DCEnt = new DCFIEntities())
            {
                discounts = (from s in DCEnt.ScholarshipDiscounts
                             where s.ScholarshipCode == scholarshipCode
                             select s).ToList<ScholarshipDiscount>();
            }
            foreach (ScholarshipDiscount sd in discounts)
            {
                ScholarshipDiscountBDO sdBDO = new ScholarshipDiscountBDO();
                ConvertScholarshipDiscountToScholarshipDiscountBDO(sd, sdBDO, scholarshipCode);
                sdList.Add(sdBDO);

            }
            return sdList;
        }
Пример #27
0
        //    DCEnt.Scholarships.Remove(sInDB);

        //    sInDB.Condition = sBDO.Condition;
        //    sInDB.Deactivated = sBDO.Deactivated;
        //    sInDB.Description = sBDO.Description;
        //    sInDB.Privilege = sBDO.Privilege;
        //    sInDB.ScholarshipCode = sBDO.ScholarshipCode;

        //    DCEnt.Scholarships.Attach(sInDB);
        //    DCEnt.Entry(sInDB).State = System.Data.Entity.EntityState.Modified;
        //    int num = DCEnt.SaveChanges();

        //    if (num != 1)
        //    {
        //        ret = false;
        //        message = "No scholarship is updated.";
        //    }
        //}
        //return ret;


        public Boolean UpdateScholarshipDiscount(ref ScholarshipDiscountBDO sBDO, ref string message)
        {
            message = "Scholarship discount updated successfully.";
            Boolean ret = true;
            using (var DCEnt = new DCFIEntities())
            {
                var scholarshipCode = sBDO.ScholarshipCode;
                ScholarshipDiscount sInDB = (from s in DCEnt.ScholarshipDiscounts
                                             where s.ScholarshipCode == scholarshipCode
                                             select s).FirstOrDefault();
                if (sInDB == null)
                {
                    throw new Exception("No Scholarship discount with ScholarshipCode " + sBDO.ScholarshipCode);
                }
                DCEnt.ScholarshipDiscounts.Remove(sInDB);

                sInDB.FeeCode = sBDO.FeeCode;
                sInDB.Deactivated = sBDO.Deactivated;
                sInDB.Discount = sBDO.Discount;
                sInDB.ScholarshipCode = sBDO.ScholarshipCode;

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

                if (num != 1)
                {
                    ret = false;
                    message = "No scholarship discount is updated.";
                }
            }
            return ret;

        }
Пример #28
0
 public void ConvertScholarshipDiscountToScholarshipDiscountBDO(ScholarshipDiscount d, ScholarshipDiscountBDO sd)
 {
     sd.Deactivated = d.Deactivated;
     sd.Discount = (float)d.Discount;
     sd.Description = d.Description;
     sd.Scholarship = d.Scholarship;
     sd.ScholarshipDiscountId = d.ScholarshipDiscountId;
 }