Пример #1
0
        public static Boolean CreateDirectDebit(DirectDebit mdirectdebit)
        {
            Boolean flag = false;

                using (TransactionScope scope = new TransactionScope())
                {
                    using (var context = new SycousCon())
                    {
                        try
                        {
                            context.DirectDebits.AddObject(mdirectdebit);
                            context.SaveChanges();
                            scope.Complete();
                            context.AcceptAllChanges();
                            flag = true;
                        }
                        catch (Exception ex)
                        {
                            context.Dispose();
                            throw;
                        }
                    }
                }

            return flag;
        }
Пример #2
0
        public static Boolean DeletedDirectDebit(DirectDebit debit)
        {
            using (TransactionScope scope = new TransactionScope())
            {
                Boolean bol = false;
                using (var context = new SycousCon())
                {
                    try
                    {
                        var Update = context.DirectDebits.Where(c => c.ID == debit.ID&& c.IsDeleted==0&&c.IsApproved==0);

                        foreach (DirectDebit p in Update)
                        {
                            p.IsDeleted = 2;
                            p.ModifyBy = debit.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
        }
Пример #3
0
        public static Boolean UpdateDirectDebit(DirectDebit debit)
        {
            using (TransactionScope scope = new TransactionScope())
            {
                Boolean bol = false;
                using (var context = new SycousCon())
                {
                    try
                    {
                        var Update = context.DirectDebits.Where(c => c.ID == debit.ID);

                        foreach (DirectDebit p in Update)
                        {
                            if (debit.AccountHolderName != null)
                            {
                                p.AccountHolderName = debit.AccountHolderName;
                            }

                            if (debit.BankName != null)
                            {
                                p.BankName = debit.BankName;
                            }
                            if (debit.BankSortCode != null)
                            {
                                p.BankSortCode = debit.BankSortCode;
                            }
                            if (debit.AccountNumber != null)
                            {
                                p.AccountNumber = debit.AccountNumber;
                            }
                            if (debit.DirectDebitDate != null)
                            {
                                p.DirectDebitDate = debit.DirectDebitDate;
                            }
                            else
                            { p.DirectDebitDate = null; }

                            if (debit.Email != null)
                            {
                                p.Email = debit.Email;
                            }
                            if (debit.Mobile != null)
                            {
                                p.Mobile = debit.Mobile;
                            }
                            p.DirectDebitType = debit.DirectDebitType;

                            if (debit.Amount != null)
                            {
                                p.Amount = debit.Amount;
                            }
                            if (debit.StartDate != null)
                            {
                                p.StartDate = debit.StartDate;
                            }
                            if (debit.EndDate != null)
                            {
                                p.EndDate = debit.EndDate;
                            }

                            if (debit.DateOfDebitDebit != null)
                            {
                                p.DateOfDebitDebit = debit.DateOfDebitDebit;
                            }
                            else
                            {
                                p.DateOfDebitDebit = null;
                            }

                            p.ModifyBy = debit.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
        }
Пример #4
0
 public static DirectDebit EditDirectDebit(Int64 ID)
 {
     DirectDebit debit = new DirectDebit();
     using (var context = new SycousCon())
     {
         try
         {
             debit = context.DirectDebits.SingleOrDefault(s => s.ID == ID&& s.IsDeleted==0);
         }
         catch (Exception ex)
         {
             context.Dispose();
             throw;
         }
     }
     return debit;
 }
Пример #5
0
        public bool UpdateRecord(Object debitobj)
        {
            Boolean flag = false;
            DirectDebitClass Debit = (DirectDebitClass)debitobj;
            try
            {
                DirectDebit _Debit = new DirectDebit();
                _Debit.ID = Convert.ToInt64(Debit.ID);
                if (Debit.CustomerType != null)
                {
                    _Debit.ConsumerType = Convert.ToInt32(Debit.CustomerType);
                }
                if (Debit.CustomerID != null)
                {
                    _Debit.ConsumerID = Convert.ToInt64(Debit.CustomerID);
                }

                if (Debit.AccountHolderName != null)
                {
                    _Debit.AccountHolderName = Debit.AccountHolderName;
                }

                if (Debit.BankName != null)
                {
                    _Debit.BankName = Debit.BankName;
                }
                if (Debit.BankSortCode != null)
                {
                    _Debit.BankSortCode = Debit.BankSortCode;
                }
                if (Debit.BankAccountNumber != null)
                {
                    _Debit.AccountNumber = Debit.BankAccountNumber;
                }

                if (Debit.DirectDebitDate != null)
                {
                    _Debit.DirectDebitDate = Common.DateGB(Debit.DirectDebitDate.ToString());
                }
                else
                { _Debit.DirectDebitDate = null; }

                if (Debit.Email != null)
                {
                    _Debit.Email = Debit.Email;
                }

                if (Debit.Mobile != null)
                {
                    _Debit.Mobile = Debit.Mobile;
                }
                if (Debit.StartDate != null)
                {
                    _Debit.StartDate = Common.DateGB(Debit.StartDate.ToString());
                }

                if (Debit.EndDate != null)
                {
                    _Debit.EndDate = Common.DateGB(Debit.EndDate.ToString());
                }

                if (Debit.Amount != null)
                {
                    _Debit.Amount = Convert.ToDecimal(Debit.Amount);
                }
                if (Debit.DateOfDebitDebit != null)
                {
                    _Debit.DateOfDebitDebit = Debit.DateOfDebitDebit;
                }
                else
                {
                    _Debit.DateOfDebitDebit = null;
                }

                _Debit.DirectDebitType = Debit.DirectDebitType;

                _Debit.ModifyBy = Debit.modifyBy;
                _Debit.ModifyDate = DateTime.Now;
                if (_Debit.ID != null)
                {
                    flag = DAL.DALDirectDebit.UpdateDirectDebit(_Debit);
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return flag;
        }
Пример #6
0
 public Boolean IsDeletedRecord(Object debitobj)
 {
     Boolean flag = false;
     DirectDebitClass Debit = (DirectDebitClass)debitobj;
     try
     {
         DirectDebit _Debit = new DirectDebit();
         if (Debit.ID != null)
         {
             _Debit.ID = Convert.ToInt64(Debit.ID);
             _Debit.ModifyBy = Debit.modifyBy;
             if( _Debit.ID != null)
             {
                 flag = DAL.DALDirectDebit.DeletedDirectDebit(_Debit);
             }
         }
     }
     catch (Exception ex)
     {
         throw;
     }
     return flag;
 }
Пример #7
0
        public bool AddRecord(Object debitobj)
        {
            Boolean flag = false;
            DirectDebitClass Debit = (DirectDebitClass)debitobj;
            try
            {
                DirectDebit _Debit = new DirectDebit();
                if (Debit.UserType == true)
                {
                    _Debit.ConsumerType = Convert.ToInt32("2"); // consumer
                }
                else
                {
                    _Debit.ConsumerType = Convert.ToInt32("1"); // owner
                }

                if (Debit.CustomerID != null)
                {
                    _Debit.ConsumerID = Convert.ToInt64(Debit.CustomerID);
                }

                if (Debit.AccountHolderName != null)
                {
                    _Debit.AccountHolderName = Debit.AccountHolderName;
                }

                if (Debit.BankName != null)
                {
                    _Debit.BankName = Debit.BankName;
                }
                if (Debit.BankSortCode != null)
                {
                    _Debit.BankSortCode = Debit.BankSortCode;
                }
                if (Debit.BankAccountNumber != null)
                {
                    _Debit.AccountNumber = Debit.BankAccountNumber;
                }

                if (Debit.DirectDebitDate != null)
                {
                    _Debit.DirectDebitDate = Common.DateGB(Debit.DirectDebitDate.ToString());
                }

                if (Debit.Email != null)
                {
                    _Debit.Email = Debit.Email;
                }

                if (Debit.Mobile != null)
                {
                    _Debit.Mobile = Debit.Mobile;
                }
                if (Debit.StartDate != null)
                {
                    _Debit.StartDate = Common.DateGB(Debit.StartDate.ToString());
                }

                if (Debit.Amount != null)
                {
                    _Debit.Amount = Convert.ToDecimal(Debit.Amount);
                }

                _Debit.DirectDebitType = Debit.DirectDebitType;
                _Debit.CreateBy = Debit.CreateBy;
                _Debit.CreateDate = DateTime.Now;
                if ((_Debit.ConsumerID != null) && (_Debit.ConsumerID != null))
                {
                    flag = DAL.DALDirectDebit.CreateDirectDebit(_Debit);
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return flag;
        }
Пример #8
0
 /// <summary>
 /// Deprecated Method for adding a new object to the DirectDebits EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToDirectDebits(DirectDebit directDebit)
 {
     base.AddObject("DirectDebits", directDebit);
 }
Пример #9
0
 /// <summary>
 /// Create a new DirectDebit object.
 /// </summary>
 /// <param name="id">Initial value of the ID property.</param>
 /// <param name="directDebitType">Initial value of the DirectDebitType property.</param>
 /// <param name="isDeleted">Initial value of the IsDeleted property.</param>
 /// <param name="isApproved">Initial value of the IsApproved property.</param>
 public static DirectDebit CreateDirectDebit(global::System.Int64 id, global::System.Boolean directDebitType, global::System.Int32 isDeleted, global::System.Int32 isApproved)
 {
     DirectDebit directDebit = new DirectDebit();
     directDebit.ID = id;
     directDebit.DirectDebitType = directDebitType;
     directDebit.IsDeleted = isDeleted;
     directDebit.IsApproved = isApproved;
     return directDebit;
 }