Exemplo n.º 1
0
         public async Task<List<GetTransaction>> GetTransaction4()
         {
             var _db = new ApplicationDbContext();

             IdentityUser user = await UserManager.FindByIdAsync(User.Identity.GetUserId());
              var kd = (from c in _db.Users where c.UserName==User.Identity.Name select c ).FirstOrDefault();

            
  
             var vv = (from c in _db.Transaction

                       join o in _db.Subscription on new { a = c.Subscription_Code } equals new { a = o.Subscription_Code }

                       join p in _db.Banks on new { a = c.Bank_Code } equals new { a = p.Bank_Code } into sr
                       from x in sr.DefaultIfEmpty()

                       join k in _db.Institutions on new { a = c.Institution_Code } equals new { a = k.Institution_Code }
                       where ((c.Payment_Status == "Paid" && k.Institution_Code==kd.Institution_Code ))

                       //    where ((c.DateCreated.Date == start_date) && (c.DateCreated.Date <= end_date))
                       //      where (c.DateCreated.Date >= start_date.Date && c.DateCreated.Date <= end_date.Date)



                       select new { c.Account_Number, c.amount, c.Transaction_Code, o.Subscription_Name, x.Bank_Name, k.Institution_Name, c.user_id, c.Payment_Status, o.Subscription_Code }).ToList();
          

             List<GetTransaction> xk2 = new List<GetTransaction>();
             foreach (var vv2 in vv)
             {

                 GetTransaction xk = new GetTransaction();
                 xk.Account_Number = vv2.Account_Number;
                 xk.amount = vv2.amount;
                 xk.Bank_Name = vv2.Bank_Name;
                 xk.Institution_Name = vv2.Institution_Name;
                 xk.Subscription_Name = vv2.Subscription_Name;
                 xk.Transaction_Code = vv2.Transaction_Code;
                 xk.User_Name = vv2.user_id;
                 xk.Payment_Status = vv2.Payment_Status;
                 xk.Subscription_Code = vv2.Subscription_Code;

                 xk2.Add(xk);


             }





             return xk2;
         }
Exemplo n.º 2
0
         public async Task<List<GetTransaction>> GetTransaction12()
         {
             try
             {
                 var _db = new ApplicationDbContext();

                 var vv = (from c in _db.Subscription_Details
                           // join d in _db.Subscription_Details on new { a = o.Subscription_Code } equals new { a = d.Subscription_Code }
                           join o in _db.Subscription on new { a = c.Subscription_Code } equals new { a = o.Subscription_Code }

                           //   join k in _db.Institutions on new { a = c.Institution_Code } equals new { a = k.Institution_Code }


                           //where ((c.user_id == d.user_id && c.Transaction_Code== d.Transaction_id))\
                           //    where ((c.user_id == d.user_id))


                           select new { o.Amount, o.Subscription_Name, c.user_id, o.Subscription_Code, Payment_Date =EntityFunctions.TruncateTime(  c.Payment_Date), c.Used, Expiry_Date =EntityFunctions.TruncateTime( c.Expiry_Date.Value) }).Distinct().ToList();


                 List<GetTransaction> xk2 = new List<GetTransaction>();
                 foreach (var vv2 in vv)
                 {

                     GetTransaction xk = new GetTransaction();
                     //   xk.Account_Number = vv2.Account_Number;
                     xk.amount = vv2.Amount;

                     // xk.Institution_Name = vv2.Institution_Name;
                     xk.Subscription_Name = vv2.Subscription_Name;
                     // xk.Transaction_Code = vv2.Transaction_Code;
                     xk.User_Name = vv2.user_id;
                     //  xk.Payment_Status = vv2.Payment_Status3;
                     xk.Subscription_Code = vv2.Subscription_Code;
                     xk.TranDateTime2 = Convert.ToString(vv2.Payment_Date);
                     DateTime tt = DateTime.Now;
                     if (vv2.Subscription_Code == "NG002" && vv2.Payment_Date != null)
                     {
                         if (vv2.Expiry_Date > tt.Date)
                         {
                             xk2.Add(xk);
                             //  return ddp.ID;
                         }

                     }

                     else if (vv2.Subscription_Code == "NG003" && vv2.Payment_Date != null)
                     {
                         if (vv2.Expiry_Date > tt.Date)
                         {
                             xk2.Add(xk);
                             //  return ddp.ID;
                         }

                     }

                     else if (vv2.Subscription_Code == "NG001")
                     {
                         if (!(vv2.Used))
                         {
                             xk2.Add(xk);
                         }

                     }


                     //xk2.Add(xk);


                 }





                 return xk2;

             }
             catch (Exception ee)
             {

                 return null;
             }
         }
Exemplo n.º 3
0
         public async Task<List<GetTransaction>> GetTransaction3()
         {
             var _db = new ApplicationDbContext();


             var vv = (from c in _db.Transaction

                       join o in _db.Subscription on new { a = c.Subscription_Code } equals new { a = o.Subscription_Code }

                       join p in _db.Banks on new { a = c.Bank_Code } equals new { a = p.Bank_Code } into sr
                       from x in sr.DefaultIfEmpty()

                       join k in _db.Institutions on new { a = c.Institution_Code } equals new { a = k.Institution_Code }
                     //  where ((c.Payment_Status == "Paid"))

                       //    where ((c.DateCreated.Date == start_date) && (c.DateCreated.Date <= end_date))
                       //      where (c.DateCreated.Date >= start_date.Date && c.DateCreated.Date <= end_date.Date)



                       select new { c.Account_Number, c.amount, c.Transaction_Code, o.Subscription_Name, x.Bank_Name, k.Institution_Name, c.user_id, c.Payment_Status, o.Subscription_Code ,c.Order_Id,c.Transaction_Status}).ToList();

             List<GetTransaction> xk2 = new List<GetTransaction>();
             foreach (var vv2 in vv)
             {

                 GetTransaction xk = new GetTransaction();
                 xk.Account_Number = vv2.Account_Number;
                 xk.amount = vv2.amount;
                 xk.Bank_Name = vv2.Bank_Name;
                 xk.Institution_Name = vv2.Institution_Name;
                 xk.Subscription_Name = vv2.Subscription_Name;
                 xk.Transaction_Code = vv2.Transaction_Code;
                 xk.User_Name = vv2.user_id;
                 xk.Payment_Status = vv2.Payment_Status;
                 xk.Subscription_Code = vv2.Subscription_Code;
                 xk.Order_Id = vv2.Order_Id;
                 xk.Transaction_Status = vv2.Transaction_Status;

                 xk2.Add(xk);


             }





             return xk2;
         }
Exemplo n.º 4
0
         public async Task<GetTransaction> GetTransaction([FromUri] String property1)
         {
             var _db = new ApplicationDbContext();


             var vv = (from c in _db.Transaction

                       join o in _db.Subscription on new { a = c.Subscription_Code } equals new { a = o.Subscription_Code }

                       join p in _db.Banks on new { a = c.Bank_Code } equals new { a = p.Bank_Code }
                       into sr
                       from x in sr.DefaultIfEmpty()

                       join k in _db.Institutions on new { a = c.Institution_Code } equals new { a = k.Institution_Code }
                       where ((c.Transaction_Code == property1))

                       //    where ((c.DateCreated.Date == start_date) && (c.DateCreated.Date <= end_date))
                       //      where (c.DateCreated.Date >= start_date.Date && c.DateCreated.Date <= end_date.Date)



                       select new { c.Account_Number, c.amount,c.Transaction_Code, o.Subscription_Name, x.Bank_Name,k.Institution_Name ,c.user_id,c.Transaction_Date,c.Payment_Status}).FirstOrDefault();

             GetTransaction xk = new GetTransaction();
             xk.Account_Number = vv.Account_Number;
             xk.amount = vv.amount;
             xk.Bank_Name = vv.Bank_Name;
             xk.Institution_Name = vv.Institution_Name;
             xk.Subscription_Name = vv.Subscription_Name;
             xk.Transaction_Code = vv.Transaction_Code;
             xk.User_Name = vv.user_id;

             xk.ResponseDescription2 = vv.Payment_Status;
             xk.TranDateTime2 =Convert.ToString( vv.Transaction_Date);

           





             return xk;
         }