public Models.Lookup.PaymentReasonModel GetPaymentReasonByID(int PaymentReasonID)
        {
            BusinessLogic.Lookup.PaymentReasonManager PaymentReasonManager = new BusinessLogic.Lookup.PaymentReasonManager();
            BusinessEntity.Lookup.PaymentReasonEntity PaymentReason        = PaymentReasonManager.GetPaymentReasonByID(PaymentReasonID);

            return(new Models.Lookup.PaymentReasonModel(PaymentReason));
        }
        public BusinessEntity.Result DeletePaymentReason(BusinessEntity.Lookup.PaymentReasonEntity PaymentReason)
        {
            BusinessEntity.Result result = new BusinessEntity.Result();
            try
            {
                SchoolInformationManagementSystemDBEntities e = new SchoolInformationManagementSystemDBEntities();
                var original = e.tblPaymentReasons.Find(PaymentReason.ID);
                if (original != null)
                {
                    e.tblPaymentReasons.Remove(e.tblPaymentReasons.Where(x => x.ID == PaymentReason.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 UpdatePaymentReason(BusinessEntity.Lookup.PaymentReasonEntity PaymentReason)
        {
            BusinessEntity.Result result = new BusinessEntity.Result();
            try
            {
                SchoolInformationManagementSystemDBEntities e = new SchoolInformationManagementSystemDBEntities();
                var original = e.tblPaymentReasons.Find(PaymentReason.ID);
                if (original != null)
                {
                    e.Entry(original).CurrentValues.SetValues(PaymentReason);
                    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);
            }
        }
예제 #4
0
 public PaymentReasonModel(BusinessEntity.Lookup.PaymentReasonEntity paymentReason)
 {
     this.ID          = paymentReason.ID;
     this.Name        = paymentReason.Name;
     this.Description = paymentReason.Description;
     this.CreatedBy   = paymentReason.CreatedBy;
     this.CreatedDate = paymentReason.CreatedDate;
 }
예제 #5
0
        public T MapToEntity <T>() where T : class
        {
            BusinessEntity.Lookup.PaymentReasonEntity paymentReason = new BusinessEntity.Lookup.PaymentReasonEntity();
            paymentReason.ID          = this.ID;
            paymentReason.Name        = this.Name;
            paymentReason.Description = this.Description;
            paymentReason.CreatedBy   = this.CreatedBy;
            paymentReason.CreatedDate = this.CreatedDate;

            return(paymentReason as T);
        }
        public BusinessEntity.Result SavePaymentReason(BusinessEntity.Lookup.PaymentReasonEntity PaymentReason)
        {
            BusinessEntity.Result result = new BusinessEntity.Result();
            try
            {
                SchoolInformationManagementSystemDBEntities e = new SchoolInformationManagementSystemDBEntities();
                e.tblPaymentReasons.Add(PaymentReason.MapToModel <DataAccessLogic.tblPaymentReason>());
                e.SaveChanges();

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