Beispiel #1
0
 public List <ThanaModel> GetThana(int districtId = -1, int thanaId = -1)
 {
     using (var con = ConnectionGetway.GetConnection())
     {
         var thana = con.Query <ThanaModel>($@"Select * FROM tblThana WHERE DistrictId =  (CASE WHEN {districtId}<>-1 THEN {districtId} ELSE DistrictId END) AND Id = (CASE WHEN {thanaId}<>-1 THEN {thanaId} ELSE Id END)  ORDER BY Name").ToList();
         return(thana);
     }
 }
Beispiel #2
0
 public List <DistrictModel> GetDistrict(int districtId = -1)
 {
     using (var con = ConnectionGetway.GetConnection())
     {
         var districts = con.Query <DistrictModel>($"Select * FROM tblDistricts WHERE Id = CASE WHEN {districtId}<>-1 THEN {districtId} ELSE Id END ORDER BY Name").ToList();
         return(districts);
     }
 }
Beispiel #3
0
 public UserViewModel Get <UserViewModel>(string userName, string password)
 {
     using (var con = ConnectionGetway.GetConnection())
     {
         string query = $"SELECT * FROM tblUsers WHERE Name='{userName}' AND Password='******'";
         return(con.Query <UserViewModel>(query).FirstOrDefault());
     }
 }
Beispiel #4
0
 public UserModel Get(int id)
 {
     using (var con = ConnectionGetway.GetConnection())
     {
         string query = $"SELECT * FROM tblUsers WHERE Id={id}";
         return(con.Query <UserModel>(query).FirstOrDefault());
     }
 }
Beispiel #5
0
 public bool ChangePassword(UserModel user)
 {
     using (var con = ConnectionGetway.GetConnection())
     {
         string query = $"UPDATE tblUsers SET Password = '******' WHERE Code = '{user.Code}' AND CompanyCode='{user.CompanyCode}'";
         return(con.Execute(query) > 0);
     }
 }