Ejemplo n.º 1
0
        public BusinessEntity.Result DeletePaymentPeriod(BusinessEntity.Lookup.PaymentPeriodEntity PaymentPeriod)
        {
            BusinessEntity.Result result = new BusinessEntity.Result();
            try
            {
                SchoolInformationManagementSystemDBEntities e = new SchoolInformationManagementSystemDBEntities();
                var original = e.tblPaymentPeriods.Find(PaymentPeriod.ID);
                if (original != null)
                {
                    e.tblPaymentPeriods.Remove(e.tblPaymentPeriods.Where(x => x.ID == PaymentPeriod.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);
            }
        }
Ejemplo n.º 2
0
        public BusinessEntity.Result UpdatePaymentPeriod(BusinessEntity.Lookup.PaymentPeriodEntity PaymentPeriod)
        {
            BusinessEntity.Result result = new BusinessEntity.Result();
            try
            {
                SchoolInformationManagementSystemDBEntities e = new SchoolInformationManagementSystemDBEntities();
                var original = e.tblPaymentPeriods.Find(PaymentPeriod.ID);
                if (original != null)
                {
                    e.Entry(original).CurrentValues.SetValues(PaymentPeriod);
                    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);
            }
        }
Ejemplo n.º 3
0
        public Models.Lookup.PaymentPeriodModel GetPaymentPeriodByID(int PaymentPeriodID)
        {
            BusinessLogic.Lookup.PaymentPeriodManager PaymentPeriodManager = new BusinessLogic.Lookup.PaymentPeriodManager();
            BusinessEntity.Lookup.PaymentPeriodEntity PaymentPeriod        = PaymentPeriodManager.GetPaymentPeriodByID(PaymentPeriodID);

            return(new Models.Lookup.PaymentPeriodModel(PaymentPeriod));
        }
 public PaymentPeriodModel(BusinessEntity.Lookup.PaymentPeriodEntity paymentPeriod)
 {
     this.ID          = paymentPeriod.ID;
     this.Name        = paymentPeriod.Name;
     this.Description = paymentPeriod.Description;
     this.CreatedBy   = paymentPeriod.CreatedBy;
     this.CreatedDate = paymentPeriod.CreatedDate;
 }
        public T MapToEntity <T>() where T : class
        {
            BusinessEntity.Lookup.PaymentPeriodEntity paymentPeriod = new BusinessEntity.Lookup.PaymentPeriodEntity();
            paymentPeriod.ID          = this.ID;
            paymentPeriod.Name        = this.Name;
            paymentPeriod.Description = this.Description;
            paymentPeriod.CreatedBy   = this.CreatedBy;
            paymentPeriod.CreatedDate = this.CreatedDate;

            return(paymentPeriod as T);
        }
Ejemplo n.º 6
0
        public BusinessEntity.Result SavePaymentPeriod(BusinessEntity.Lookup.PaymentPeriodEntity PaymentPeriod)
        {
            BusinessEntity.Result result = new BusinessEntity.Result();
            try
            {
                SchoolInformationManagementSystemDBEntities e = new SchoolInformationManagementSystemDBEntities();
                e.tblPaymentPeriods.Add(PaymentPeriod.MapToModel <DataAccessLogic.tblPaymentPeriod>());
                e.SaveChanges();

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