SHARE
TWEET

Untitled

EraCoder Apr 26th, 2018 107 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5.  
  6. namespace eraproject_site.Models
  7. {
  8.     public class RegistrationUser
  9.     {
  10.         private UserRegistrationInfo _UserRegistrationInfo = new UserRegistrationInfo();
  11.         private DtabaseConnect.CRUD.IEnumTable table = new DtabaseConnect.CRUD.IEnumTable();
  12.         public RegistrationUser(UserRegistrationInfo info)
  13.         {
  14.             _UserRegistrationInfo = info;
  15.         }
  16.  
  17.         public bool AddUser()
  18.         {
  19.             var tt = table.ReturnAllTable();
  20.             foreach (var item in tt.IEnumUsers)
  21.             {
  22.                 if (item.username == _UserRegistrationInfo.username)
  23.                 {
  24.                     return false;
  25.                 }
  26.             }
  27.             try
  28.             {
  29.                 DtabaseConnect.Service.Entity.Users users = new DtabaseConnect.Service.Entity.Users
  30.                 {
  31.                     id_role = 4,
  32.                     username = _UserRegistrationInfo.username,
  33.                     password = _UserRegistrationInfo.password,
  34.                     registration_date = DateTime.Now,
  35.                     emailconfirmed = 0,
  36.                     email = _UserRegistrationInfo.email
  37.                 };
  38.                 DtabaseConnect.CRUD.CUDRoot.AddEntity(users);
  39.  
  40.                 DtabaseConnect.Service.Entity.Account_money account_money = new DtabaseConnect.Service.Entity.Account_money
  41.                 {
  42.                    id_user = users.id,
  43.                    money = 0
  44.                 };
  45.                 DtabaseConnect.CRUD.CUDRoot.AddEntity(account_money);
  46.                 return true;
  47.             }
  48.             catch
  49.             {
  50.                 return false;
  51.             }        
  52.         }
  53.     }
  54.  
  55.     public class UserRegistrationInfo
  56.     {
  57.         public string email { get; set; }
  58.         public string username { get; set; }
  59.         public string password { get; set; }
  60.     }
  61. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top