コード例 #1
0
 public bool Edit(Channel model)
 {
     bool result = false;
        var ch = _db.Get<Channel>().FirstOrDefault(x =>x.Id==model.Id);
        if(ch!=null)
        {
        ch.Name = model.Name;
        ch.Code = model.Code;
        ch.Description = model.Description;
       result =  _db.Update(ch);
        }
        return result;
 }
コード例 #2
0
 public bool CreateChannel(Channel model)
 {
     var ch = _db.Get<Channel>().FirstOrDefault(x => x.Name == model.Name && x.Code == model.Code);
        if(ch!=null)
        {
        throw new Exception("This Channel Already Exist");
        }
        else
        {
        return _db.Add(new Channel
        {
             Name=model.Name,
             Code=model.Code,
             Description= model.Description
        });
        }
 }
コード例 #3
0
        private Fee GetFeeIfTransactionIsAllowed(TransactionType transactionType, Channel channel, Scheme scheme)
        {
            try
               {
               foreach (var item in scheme.TransactionTypeChannelFees)
               {
                   if (channel != null)
                   {
                       if (item.TransactionType.Code == transactionType.Code && item.Channel.Code == channel.Code)
                       {
                           return item.Fee;
                       }
                   }
               }

               return null;
               }
               catch (Exception ex)
               {
               Logger.Log("Error: while checking if transaction is allowed \n" + ex.Message);
               return null;
               }
        }