예제 #1
0
        public static int ReturnCodePayment()
        {
            DAL.Payment payment    = new DAL.Payment();
            var         newPayment = context.Payments.Add(payment);

            context.SaveChanges();
            return(newPayment.PaymentId);
        }
예제 #2
0
 public static void SavePayment(dtoPayment payment)
 {
     DAL.Payment NewPayment   = dtoPayment.castToDal(payment);
     DAL.Payment ExistPayment = context.Payments.FirstOrDefault(p => p.PaymentId == payment.PaymentId);
     if (ExistPayment != null)
     {
         context.Payments.Remove(ExistPayment);
         context.SaveChanges();
     }
     context.Payments.Add(NewPayment);
     context.SaveChanges();
 }
예제 #3
0
 public static Payment PaymentEdit(Int64 paymentID)
 {
     Payment _payment = new Payment();
        using (var context = new SycousCon())
        {
        try
        {
            _payment = context.Payments.SingleOrDefault(s => s.ID == paymentID);
        }
        catch (Exception ex)
        {
            context.Dispose();
            throw;
        }
        }
        return _payment;
 }
예제 #4
0
        public Boolean UpdateRecord(Object paymentobj)
        {
            Boolean flag = false;
            PaymentClass payment = (PaymentClass)paymentobj;
            try
            {
                Payment _payment = new Payment();
                _payment.ID = Convert.ToInt64(payment.PayemtID);
                if (payment.PaymentAmount != null)
                {
                    _payment.Amount = Convert.ToDecimal( payment.PaymentAmount);
                }
                if (payment.PaymentDate != null)
                {
                    _payment.Date = BAL.Common.DateGB(payment.PaymentDate);
                }
                if (payment.paymentMethod != null)
                {
                  _payment.PaymentType = Convert.ToInt32(payment.paymentMethod);
                }

                if (!String.IsNullOrEmpty(payment.Cheque) != null)
                {
                    _payment.ChequeNo = payment.Cheque;
                }

                if (!String.IsNullOrEmpty(payment.DepositeTo) != null)
                {
                    _payment.Deposite= payment.DepositeTo;
                }
                _payment.ModifyBy = payment.ModifyBy;

                if (_payment.ID != null)
                {
                    flag = DAL.DALPayment.UpdatePayment(_payment);
                }

            }
            catch (Exception ex)
            { throw; }
            return flag;
        }
예제 #5
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Payments EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToPayments(Payment payment)
 {
     base.AddObject("Payments", payment);
 }
예제 #6
0
 /// <summary>
 /// Create a new Payment object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="currencyId">Initial value of the currencyId property.</param>
 /// <param name="totalAmount">Initial value of the TotalAmount property.</param>
 public static Payment CreatePayment(global::System.Int32 id, global::System.Int32 currencyId, global::System.Double totalAmount)
 {
     Payment payment = new Payment();
     payment.Id = id;
     payment.currencyId = currencyId;
     payment.TotalAmount = totalAmount;
     return payment;
 }
 /// <summary>
 /// Создание нового объекта Payment.
 /// </summary>
 /// <param name="id">Исходное значение свойства Id.</param>
 /// <param name="date">Исходное значение свойства Date.</param>
 public static Payment CreatePayment(global::System.Int64 id, global::System.DateTime date)
 {
     Payment payment = new Payment();
     payment.Id = id;
     payment.Date = date;
     return payment;
 }
예제 #8
0
        public static Boolean UpdatePayment(Payment _payment)
        {
            using (TransactionScope scope = new TransactionScope())
               {
               Boolean bol = false;
               using (var context = new SycousCon())
               {
                   try
                   {
                       var Update = context.Payments.Where(c => c.ID == _payment.ID);

                       foreach (Payment p in Update)
                       {
                           if (_payment.Amount != null)
                           {
                               p.Amount = _payment.Amount;
                           }
                           if (_payment.Date != null)
                           {
                               p.Date = _payment.Date;
                           }
                           if (_payment.PaymentType != null)
                           {
                               p.PaymentType = _payment.PaymentType;
                           }

                           if (_payment.ChequeNo != null)
                           {
                               p.ChequeNo = _payment.ChequeNo;
                           }
                           if (_payment.Deposite != null)
                           {
                               p.Deposite = _payment.Deposite;
                           }
                           p.ModifyBy = _payment.ModifyBy;
                           p.ModifyDate = DateTime.Now;
                       }//
                       context.SaveChanges();
                       context.AcceptAllChanges();
                       scope.Complete();
                       context.Dispose();
                       bol = true;
                   }
                   catch (Exception ex)
                   {
                       context.Dispose();
                       throw;
                   }

               }// using
               return bol;
               } //trans
        }
예제 #9
0
 /// <summary>
 /// Create a new Payment object.
 /// </summary>
 /// <param name="id">Initial value of the ID property.</param>
 /// <param name="isDeleted">Initial value of the IsDeleted property.</param>
 public static Payment CreatePayment(global::System.Int64 id, global::System.Int32 isDeleted)
 {
     Payment payment = new Payment();
     payment.ID = id;
     payment.IsDeleted = isDeleted;
     return payment;
 }