Ejemplo n.º 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;
        }
Ejemplo n.º 2
0
        public Boolean AddScholarshipDiscounts(List <ScholarshipDiscountBDO> discounts, int scholarshipCode, ref string message)
        {
            message = "Scholarship Discounts Added Successfully";
            Boolean ret = true;

            try {
                foreach (ScholarshipDiscountBDO d in discounts)
                {
                    ScholarshipDiscount sd = new ScholarshipDiscount();
                    ConvertScholarshipDiscountBDOToScholarshipDiscount(d, sd);
                    using (var DCEnt = new DCFIEntities())
                    {
                        DCEnt.ScholarshipDiscounts.Attach(sd);
                        int num = DCEnt.SaveChanges();
                        if (num != 1)
                        {
                            ret = false;
                        }
                    }
                }
            }
            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);
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
0
 public Boolean AddScholarshipDiscounts(List<ScholarshipDiscountBDO> discounts, int scholarshipCode, ref string message)
 {
     message = "Scholarship Discounts Added Successfully";
     Boolean ret = true;
     try {
     foreach (ScholarshipDiscountBDO d in discounts)
     {
         ScholarshipDiscount sd = new ScholarshipDiscount();
         ConvertScholarshipDiscountBDOToScholarshipDiscount(d, sd);
         using (var DCEnt = new DCFIEntities())
         {
             DCEnt.ScholarshipDiscounts.Attach(sd);
             int num = DCEnt.SaveChanges();
             if (num != 1)
                 ret = false;
         }
     }
     }
     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;
 }
Ejemplo n.º 5
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;
        }
Ejemplo n.º 6
0
        public Boolean DeleteScholarshipDiscount(string sdCode, string scholarshipCode)
        {
            //message = "User Deleted successfully.";
            Boolean ret = true;

            using (var DCEnt = new DCFIEntities())
            {
                ScholarshipDiscount sdInDB = (from sd in DCEnt.ScholarshipDiscounts
                                              where sd.ScholarshipCode == scholarshipCode && sd.ScholarshipFeeCode == sdCode
                                              select sd).FirstOrDefault();

                if (sdInDB == null)
                {
                    throw new Exception("No Scholarship Discount with ID " + sdCode);
                }

                DCEnt.ScholarshipDiscounts.Remove(sdInDB);
                DCEnt.Entry(sdInDB).State = System.Data.Entity.EntityState.Deleted;
                int num = DCEnt.SaveChanges();
                if (num != 1)
                {
                    ret = false;
                    //message = "Deletion of User Failed.";
                }
            }
            return(ret);
        }
Ejemplo n.º 7
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);
        }
Ejemplo n.º 8
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;
 }
Ejemplo n.º 9
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);
 }
Ejemplo n.º 10
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;
        }
Ejemplo n.º 11
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);
        }
Ejemplo n.º 12
0
        public List <ScholarshipDiscount> ToScholarshipDiscountList(List <ScholarshipDiscountBDO> scholarhsipDiscounts)
        {
            List <ScholarshipDiscount> sdList = new List <ScholarshipDiscount>();

            foreach (ScholarshipDiscountBDO sdbdo in scholarhsipDiscounts)
            {
                ScholarshipDiscount s = new ScholarshipDiscount();
                s.Deactivated = sdbdo.Deactivated;
                s.Discount    = sdbdo.Discount;
                //ss.Fee = sdbdo.Fee;
                //   s.FeeID = sdbdo.FeeID;
                // s.ScholarshipCode = sdbdo.ScholarshipCode;
                s.ScholarshipDiscountId = sdbdo.ScholarshipDiscountId;
                sdList.Add(s);
            }
            return(sdList);
        }
Ejemplo n.º 13
0
        public Boolean AddScholarshipDiscounts(List<ScholarshipDiscountBDO> discounts, string scholarshipCode, ref string message)
        {
            message = "Scholarship Discounts Added Successfully";
            Boolean ret = true;

            foreach (ScholarshipDiscountBDO d in discounts)
            {
                ScholarshipDiscount sd = new ScholarshipDiscount();
                ConvertScholarshipDiscountBDOToScholarshipDiscount(d, sd, scholarshipCode);
                using (var DCEnt = new DCFIEntities())
                {
                    DCEnt.ScholarshipDiscounts.Attach(sd);
                    int num = DCEnt.SaveChanges();
                    if (num != 1)
                        ret = false;
                }
            }
            return ret;
        }
Ejemplo n.º 14
0
        public Boolean DeleteScholarshipDiscount(int sdCode)
        {
            //message = "User Deleted successfully.";
            Boolean ret = true;

            try {
                using (var DCEnt = new DCFIEntities())
                {
                    ScholarshipDiscount sdInDB = (from sd in DCEnt.ScholarshipDiscounts
                                                  where  sd.ScholarshipDiscountId == sdCode
                                                  select sd).FirstOrDefault();

                    if (sdInDB == null)
                    {
                        throw new Exception("No Scholarship Discount with ID " + sdCode);
                    }

                    DCEnt.ScholarshipDiscounts.Remove(sdInDB);
                    DCEnt.Entry(sdInDB).State = System.Data.Entity.EntityState.Deleted;
                    int num = DCEnt.SaveChanges();
                    if (num != 1)
                    {
                        ret = false;
                        //message = "Deletion of User 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);
        }
Ejemplo n.º 15
0
        public Boolean AddScholarshipDiscounts(List <ScholarshipDiscountBDO> discounts, string scholarshipCode, ref string message)
        {
            message = "Scholarship Discounts Added Successfully";
            Boolean ret = true;

            foreach (ScholarshipDiscountBDO d in discounts)
            {
                ScholarshipDiscount sd = new ScholarshipDiscount();
                ConvertScholarshipDiscountBDOToScholarshipDiscount(d, sd, scholarshipCode);
                using (var DCEnt = new DCFIEntities())
                {
                    DCEnt.ScholarshipDiscounts.Attach(sd);
                    int num = DCEnt.SaveChanges();
                    if (num != 1)
                    {
                        ret = false;
                    }
                }
            }
            return(ret);
        }
Ejemplo n.º 16
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;
            }
        }
Ejemplo n.º 17
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);
            }
        }
Ejemplo n.º 18
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);
        }
Ejemplo n.º 19
0
 public List<ScholarshipDiscount> ToScholarshipDiscountList(List<ScholarshipDiscountBDO> scholarhsipDiscounts)
 {
     List<ScholarshipDiscount> sdList = new List<ScholarshipDiscount>();
     foreach (ScholarshipDiscountBDO sdbdo in scholarhsipDiscounts)
     {
         ScholarshipDiscount s = new ScholarshipDiscount();
         s.Deactivated = sdbdo.Deactivated;
         s.Discount = sdbdo.Discount;
         //ss.Fee = sdbdo.Fee;
      //   s.FeeID = sdbdo.FeeID;
        // s.ScholarshipCode = sdbdo.ScholarshipCode;
         s.ScholarshipDiscountId = sdbdo.ScholarshipDiscountId;
         sdList.Add(s);
     }
     return sdList;
 }
Ejemplo n.º 20
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;
 }
Ejemplo n.º 21
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;
 }
Ejemplo n.º 22
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;
 }
Ejemplo n.º 23
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;
 }
Ejemplo n.º 24
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);
 }