コード例 #1
0
 public List <Country> CountryList()
 {
     using (BIUEFLib.Context.BIUDbContext db = new BIUEFLib.Context.BIUDbContext())
     {
         var list = (from a in db.Country
                     select a).ToList();
         return(list);
     }
 }
コード例 #2
0
 public void NewUser(User NUser)
 {
     using (BIUEFLib.Context.BIUDbContext db = new BIUEFLib.Context.BIUDbContext())
     {
         NUser.Password = EncryptWithMD5(NUser.Password);
         db.User.Add(NUser);
         db.SaveChanges();
     }
 }
コード例 #3
0
 public List <User> UserList()
 {
     using (BIUEFLib.Context.BIUDbContext db = new BIUEFLib.Context.BIUDbContext())
     {
         var list = (from a in db.User
                     select a).ToList();
         return(list);
     }
 }
コード例 #4
0
 public Country GetCountry(int countryId)
 {
     using (BIUEFLib.Context.BIUDbContext db = new BIUEFLib.Context.BIUDbContext())
     {
         var country = (from a in db.Country
                        where a.Code == countryId
                        select a).FirstOrDefault();
         return(country);
     }
 }
コード例 #5
0
 public City GetCity(int cityId)
 {
     using (BIUEFLib.Context.BIUDbContext db = new BIUEFLib.Context.BIUDbContext())
     {
         var city = (from a in db.City
                     where a.Code == cityId
                     select a).FirstOrDefault();
         return(city);
     }
 }
コード例 #6
0
 public Adress GetAdress(int userId)
 {
     using (BIUEFLib.Context.BIUDbContext db = new BIUEFLib.Context.BIUDbContext())
     {
         var adress = (from a in db.Adress
                       where a.UserID == userId
                       select a).FirstOrDefault();
         return(adress);
     }
 }
コード例 #7
0
 public User GetUser(int userId)
 {
     using (BIUEFLib.Context.BIUDbContext db = new BIUEFLib.Context.BIUDbContext())
     {
         var user = (from a in db.User
                     where a.UserID == userId
                     select a).FirstOrDefault();
         return(user);
     }
 }
コード例 #8
0
 public User Login(string email, string password)
 {
     using (BIUEFLib.Context.BIUDbContext db = new BIUEFLib.Context.BIUDbContext())
     {
         string Password = EncryptWithMD5(password);
         var    user     = (from a in db.User
                            where a.Password == Password && a.Email == email
                            select a).FirstOrDefault();
         return(user);
     }
 }
コード例 #9
0
 /// <summary>
 /// Adres ile alakalı CRUD
 /// </summary>
 /// <param name="log"></param>
 public void NewAdress(Adress Adr)
 {
     try
     {
         using (BIUEFLib.Context.BIUDbContext db = new BIUEFLib.Context.BIUDbContext())
         {
             db.Adress.Add(Adr);
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
     }
 }
コード例 #10
0
 /// <summary>
 /// BIU sheması altındaki tablolarda oluşan değişikliklerin kaydını tutmak için oluşturuldu.
 /// </summary>
 /// <param name="log"></param>
 public void WriteBIULog(string logName, string FunctionName, LogType type, string details)
 {
     try
     {
         using (BIUEFLib.Context.BIUDbContext db = new BIUEFLib.Context.BIUDbContext())
         {
             Log log = new Log();
             log.LogName = logName;
             if (type == LogType.Error)
             {
                 log.LogType = "Error";
             }
             else if (type == LogType.Information)
             {
                 log.LogType = "Information";
             }
             else if (type == LogType.Warning)
             {
                 log.LogType = "Warning";
             }
             else if (type == LogType.FailureAudit)
             {
                 log.LogType = "FailureAudit";
             }
             else
             {
                 log.LogType = "SuccessAudit";
             }
             log.Details      = details;
             log.FunctionName = FunctionName;
             log.LogDate      = DateTime.Now;
             db.Log.Add(log);
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine("Beklenmedik bir hata oluştu.");
     }
 }