Esempio n. 1
0
 public async Task <List <JukeBox.Data.GetLibraryDetail_Result> > GetLibraryDetail(long libraryId, int?clientId)
 {
     using (var db = new JukeBoxEntities())
     {
         return(db.GetLibraryDetail(libraryId, clientId).ToList());
     }
 }
Esempio n. 2
0
 public async Task <List <JukeBox.Data.sp_SalesPerAlbum_Result> > GetAlbumSales(int type, long clientid)
 {
     using (var db = new JukeBoxEntities())
     {
         return(db.sp_SalesPerAlbum(type, clientid).ToList());
     }
 }
Esempio n. 3
0
 public async Task <List <JukeBox.Data.Library> > GetLibraryByClientId(long?clientId)
 {
     using (var db = new JukeBoxEntities())
     {
         return(db.Libraries.Where(x => x.FK_ClientID == clientId).ToList());
     }
 }
Esempio n. 4
0
 public async Task <List <JukeBox.Data.GetLibrary_Result> > GetLibrary(int filter, int?clientId)
 {
     using (var db = new JukeBoxEntities())
     {
         return(db.GetLibrary(filter, clientId).ToList());
     }
 }
Esempio n. 5
0
 public async Task <sp__Purchase_Result> PurchaseOrder(long libraryId, long libraryDetailId, int clientId, int userId)
 {
     using (var db = new JukeBoxEntities())
     {
         return(db.sp__Purchase(libraryId, libraryDetailId, clientId, userId).FirstOrDefault());
     }
 }
Esempio n. 6
0
 public Customer LoginClient(string username, string password)
 {
     using (var db = new JukeBoxEntities())
     {
         return(db.Customers.Where(x => (x.Email == username && x.ClientPassword == password) || (x.CellPhone == username && x.ClientPassword == password)).FirstOrDefault());
     }
 }
Esempio n. 7
0
 public async Task <long> DeleteLibraryDetail(long libraryDetailId, int userId)
 {
     using (var db = new JukeBoxEntities())
     {
         try
         {
             var libraryDetail = db.LibraryDetails.Where(x => x.LibraryDetailID == libraryDetailId).FirstOrDefault();
             libraryDetail.Enabled   = false;
             libraryDetail.CreatedBy = userId;
             db.SaveChanges();
             if (libraryDetail != null)
             {
                 return(libraryDetail.FK_LibraryID);
             }
             else
             {
                 return(-1);
             }
         }
         catch (Exception)
         {
             return(-1);
         }
     }
 }
Esempio n. 8
0
 public async Task <List <JukeBox.Data.GetAllPromotionType_Result> > GetAllPromotion(int?platform)
 {
     using (var db = new JukeBoxEntities())
     {
         return(db.GetAllPromotionType(platform).ToList());
     }
 }
Esempio n. 9
0
 public Customer SearchCustomer(string email)
 {
     using (var db = new JukeBoxEntities())
     {
         return(db.Customers.Where(x => x.Email == email).FirstOrDefault());
     }
 }
Esempio n. 10
0
 public async Task <List <JukeBox.Data.GetPromoionClientMap_Result> > GetPromotionClientMap(int?promotionTypeId, int?promotionCategoryId)
 {
     using (var db = new JukeBoxEntities())
     {
         return(db.GetPromoionClientMap(promotionTypeId, promotionCategoryId).ToList());
     }
 }
Esempio n. 11
0
 private sp__VoucherRedeemProcedure_Result verifyVoucher(int ClientID, string voucherpin, int voucherTypeId, int voucherTransactionTypeId, short voucherStatusId, DateTime redeemDateTime, long voucherReferenceId, decimal flashRandValue, bool isTxComplete, string ReferenceComment)
 {
     using (var db = new JukeBoxEntities())
     {
         return(db.sp__VoucherRedeemProcedure(ClientID, voucherpin, voucherTypeId, voucherTransactionTypeId, voucherStatusId, redeemDateTime, voucherReferenceId, flashRandValue, isTxComplete, ReferenceComment).FirstOrDefault());
     }
 }
Esempio n. 12
0
 public Client  GetClientById(long id)
 {
     using (var db = new JukeBoxEntities())
     {
         return(db.Libraries.Where(x => x.LibraryID == id || x.FK_ClientID == id).Select(u => u.Client).FirstOrDefault());
     }
 }
Esempio n. 13
0
 public Customer GetCustomerById(int customerId)
 {
     using (var db = new JukeBoxEntities())
     {
         return(db.Customers.Where(x => x.CustomerID == customerId).FirstOrDefault());
     }
 }
Esempio n. 14
0
 public User LoginUser(string username, string password)
 {
     using (var db = new JukeBoxEntities())
     {
         return(db.Users.Where(x => x.UserName == username).FirstOrDefault());
     }
 }
Esempio n. 15
0
 public async Task <List <JukeBox.Data.LibraryType> > GetLibraryType()
 {
     using (var db = new JukeBoxEntities())
     {
         return(db.LibraryTypes.ToList());
     }
 }
Esempio n. 16
0
 public async Task <JukeBox.Data.InsertVote_Result> Vote(int?promotionTypeId, int?promoMapId, int clientId, int customerId)
 {
     using (var db = new JukeBoxEntities())
     {
         return(db.InsertVote(promotionTypeId, promoMapId, clientId, customerId).FirstOrDefault());
     }
 }
Esempio n. 17
0
 public int SaveClient(Client client)
 {
     using (var db = new JukeBoxEntities())
     {
         try
         {
             if (client.ClientID > 0)
             {
                 var clientToUpdate = db.Clients.Where(x => x.ClientID == client.ClientID).FirstOrDefault();
                 clientToUpdate.Initials          = client.Initials;
                 clientToUpdate.FirstName         = client.FirstName;
                 clientToUpdate.LastName          = client.LastName;
                 clientToUpdate.Email             = client.Email;
                 clientToUpdate.DateOfBirth       = client.DateOfBirth;
                 clientToUpdate.Gender            = client.Gender;
                 clientToUpdate.IdentityTypeValue = client.IdentityTypeValue;
                 clientToUpdate.CellPhone         = client.CellPhone;
                 clientToUpdate.BalanceAvailable  = client.BalanceAvailable;
                 clientToUpdate.ClientPassword    = client.ClientPassword;
                 clientToUpdate.ClientTitle       = client.ClientTitle;
                 clientToUpdate.ArtistImage       = client.ArtistImage;
                 db.SaveChanges();
                 return(1);
             }
             else
             {
                 var _client = new Client
                 {
                     ClientTitle       = client.ClientTitle,
                     FK_ClientStatusID = client.FK_ClientStatusID,
                     FK_CompanyID      = client.FK_CompanyID,
                     FK_CountryID      = client.FK_CountryID,
                     DateOfBirth       = client.DateOfBirth,
                     FK_IdentityTypeID = client.FK_IdentityTypeID,
                     Initials          = client.Initials,
                     Gender            = client.Gender,
                     IdentityTypeValue = client.IdentityTypeValue,
                     CreatedBy         = client.CreatedBy,
                     FirstName         = client.FirstName,
                     LastName          = client.LastName,
                     ClientPassword    = client.ClientPassword,
                     CellPhone         = client.CellPhone,
                     DateCreated       = DateTime.Now,
                     Email             = client.Email,
                     BalanceAvailable  = 0,
                     ArtistImage       = client.ArtistImage,
                     Enabled           = true
                 };
                 db.Clients.Add(_client);
                 db.SaveChanges();
                 return(1);
             }
         }
         catch (Exception e)
         {
             // TO DO'
             return(-1);
         }
     }
 }
Esempio n. 18
0
 public async Task <decimal?> getSalesReport(int?TypeId)
 {
     using (var db = new JukeBoxEntities())
     {
         return(db.sp_Sales_Report(TypeId).FirstOrDefault());
     }
 }
Esempio n. 19
0
 public async Task <short?> getMembersReport(int?TypeId)
 {
     using (var db = new JukeBoxEntities())
     {
         return(db.sp_NumberOfMembers_Report(TypeId).FirstOrDefault());
     }
 }
Esempio n. 20
0
 public async Task <Add_ClientPromotion_Result> AddClientPromotion(int?promotionCategoryMapId, int?promotionCategoryId, int?promotionTypeId, int?clientId, bool?enabled)
 {
     using (var db = new JukeBoxEntities())
     {
         return(db.Add_ClientPromotion(promotionCategoryMapId, promotionCategoryId, promotionTypeId, clientId, enabled).FirstOrDefault());
     }
 }
Esempio n. 21
0
 public async Task <List <JukeBox.Data.GetPromotionCategoryByPromoTypeId_Result> > GetPromotionCategory(int?PromoTypeId)
 {
     using (var db = new JukeBoxEntities())
     {
         return(db.GetPromotionCategoryByPromoTypeId(PromoTypeId).ToList());
     }
 }
Esempio n. 22
0
 public List <Client> GetAllClient()
 {
     using (var db = new JukeBoxEntities())
     {
         return(db.Clients.Where(x => x.Enabled == true).ToList());
     }
 }
Esempio n. 23
0
 public async Task <Create_Library_Detail_Result> CreateLibraryDetail(long libraryDetailId, int libraryId,
                                                                      short librarySatus, string libraryDetailName, string librayFilePath, decimal price, int userId)
 {
     using (var db = new JukeBoxEntities())
     {
         return(db.Create_Library_Detail(libraryDetailId, libraryId, librarySatus, libraryDetailName, librayFilePath, price, userId).FirstOrDefault());
     }
 }
Esempio n. 24
0
 public async Task <Create_Library_Result> CreateLibrary(long libraryId, int clientId,
                                                         short libraryType, string libraryName, string libraryDes, string librayFilePath, decimal price, int userId)
 {
     using (var db = new JukeBoxEntities())
     {
         return(db.Create_Library(libraryId, clientId, libraryType, libraryName, librayFilePath, libraryDes, price, userId).FirstOrDefault());
     }
 }
Esempio n. 25
0
 public async Task <Create_PromotionCategory_Result> CreatePromotionCategory(int?promotionCategoryId, int?promotionTypeId, string promotionCategoryName,
                                                                             string promotionImage, bool?enabled, bool?allArtist)
 {
     using (var db = new JukeBoxEntities())
     {
         return(db.Create_PromotionCategory(promotionCategoryId, promotionTypeId, promotionCategoryName, promotionImage, enabled, allArtist).FirstOrDefault());
     }
 }
Esempio n. 26
0
 public async Task <Create_PromotionType_Result> CreatePromotionType(int?promotionTypeId, string promotionTypeName,
                                                                     decimal?amount, string promotionImage, DateTime?promotionDateStart, DateTime?promotionDateEnd, bool?hasCategory, bool?enabled, bool?allArtist)
 {
     using (var db = new JukeBoxEntities())
     {
         return(db.Create_PromotionType(promotionTypeId, promotionTypeName, amount, promotionImage, promotionDateEnd, promotionDateStart, hasCategory, enabled, allArtist).FirstOrDefault());
     }
 }
Esempio n. 27
0
 public int ResetPasword(string password, string code)
 {
     using (var db = new JukeBoxEntities())
     {
         var clientToUpdate = db.Customers.Where(x => x.ClientPassword == code).FirstOrDefault();
         clientToUpdate.ClientPassword = password;
         db.SaveChanges();
         return(1);
     }
 }
Esempio n. 28
0
 public string  SaveCustomer(Customer client)
 {
     using (var db = new JukeBoxEntities())
     {
         try
         {
             if (client.CustomerID > 0)
             {
                 var customerToUpdate = db.Customers.Find(client.CustomerID);
                 customerToUpdate.FirstName     = client.FirstName;
                 customerToUpdate.LastName      = client.LastName;
                 customerToUpdate.CellPhone     = client.CellPhone.Trim();
                 customerToUpdate.Email         = client.Email.ToLower().Trim();
                 customerToUpdate.ImageFilePath = client.ImageFilePath;
                 db.SaveChanges();
                 return("Success");
             }
             else
             {
                 var customerEmail = db.Customers.Where(x => x.Email == client.Email).FirstOrDefault();
                 if (customerEmail != null)
                 {
                     return("Email Already Exists");
                 }
                 var customerPhone = db.Customers.Where(x => x.CellPhone == client.CellPhone).FirstOrDefault();
                 if (customerPhone != null)
                 {
                     return("CellPhone Already Exists");
                 }
                 var _customer = new Customer
                 {
                     FirstName           = client.FirstName,
                     LastName            = client.LastName,
                     ClientPassword      = client.ClientPassword,
                     CellPhone           = client.CellPhone,
                     FK_CustomerStatusID = 1,
                     DateCreated         = DateTime.Now,
                     Email            = client.Email,
                     BalanceAvailable = 0,
                     ImageFilePath    = client.ImageFilePath
                 };
                 db.Customers.Add(_customer);
                 db.SaveChanges();
                 return("Success");
             }
         }
         catch (Exception e)
         {
             // TO DO'
             return("Failed");
         }
     }
 }
Esempio n. 29
0
 public async Task <bool> DeletePromtionType(int promotionTypeId)
 {
     using (var db = new JukeBoxEntities())
     {
         try
         {
             var library = db.PromotionTypes.Where(x => x.PromotionTypeId == promotionTypeId).FirstOrDefault();
             library.Enabled = false;
             db.SaveChanges();
             return(true);
         }
         catch (Exception)
         {
             return(false);
         }
     }
 }
Esempio n. 30
0
 public async Task <bool> DeleteLibrary(long libraryId, int userId)
 {
     using (var db = new JukeBoxEntities())
     {
         try
         {
             var library = db.Libraries.Where(x => x.LibraryID == libraryId).FirstOrDefault();
             library.Enabled   = false;
             library.CreatedBy = userId;
             db.SaveChanges();
             return(true);
         }
         catch (Exception)
         {
             return(false);
         }
     }
 }