Ejemplo n.º 1
0
 public ManagerRole(Role role)
 {
     ID = role.ID;
     Name = role.Name;
     ShopCart = role.ShopCart;
     Address = role.Address;
     City = role.City;
     Country = role.Country;
     Phone = role.Phone;
     PostalCode = role.PostalCode;
 }
Ejemplo n.º 2
0
 public Role(string username, string password)
     : this()
 {
     try
     {
         using (MySqlDataReader data = DB.Instance.SelectReader(string.Format(loginFormat, username, password)))
         {
             if (data != null && data.HasRows)
             {
                 data.Read();
                 ID = data.GetUInt16("id");
                 Name = data.GetString("first_name");
                 Address = data.GetString("address");
                 City = data.GetString("city");
                 Country = data.GetString("country");
                 PostalCode = data.GetString("postal_code");
                 Phone = data.GetString("phone");
                 if (data.GetBoolean("is_mananger"))
                 {
                     Instance = new ManagerRole(this);
                 }
                 else
                 {
                     Instance = new EmployeeRole(this);
                 }
             }
             else
             {
                 Instance = new Role();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }