public User()
 {
     _user = new Data.User(ModuleSettings);
     _addr = new Address();
 }
        public int Create()
        {
            _addr = new Address();
            int addrid = _addr.Add(Utils.HTMLToSqlQuote(_address), _postcode, _home, _mobile, _emailAddress, "");
            ID = _user.Create(
                Utils.HTMLToSqlQuote(_name),
                _password,
                Utils.HTMLToSqlQuote(_firstName),
                Utils.HTMLToSqlQuote(_lastName),
                addrid,
                _emailAddress);

            return ID;
        }
 private void LoadFromRow(DataRow row )
 {
     if (row != null)
     {
         ID = Convert.ToInt32(row["UserID"]);
         _name = Utils.sqlQuoteToHTML(row["Name"].ToString());
         _username = Utils.sqlQuoteToHTML(row["Name"].ToString());
         _firstName = Utils.sqlQuoteToHTML(row["FirstName"].ToString());
         _lastName = Utils.sqlQuoteToHTML(row["LastName"].ToString());
         if (row.Table.Columns.Contains("password")) _password = row["password"].ToString();
         try
         {
             _addr = new Address(row);
             _address = _addr.PostalAddress;
             _postcode = _addr.Postcode;
             _emailAddress = _addr.EMail;
             _isApproved = (Convert.ToByte(row["IsApproved"]) == 1);
             if (row["LastLoginDate"] != DBNull.Value)
                 LastLoginDate = Convert.ToDateTime(row["LastLoginDate"]);
             _roles = Convert.ToInt32(row["Roles"]);
         }
         catch (Exception e)
         {
             AppException.LogEvent(String.Format("UserBiz.Address.LoadFromRow: UserID:{0}, UserName:{1} - error:{2} (innerException:{3})", ID, _username, e.Message, e.InnerException));
         }
     }
     else
     {
         _name = "";
         _addr = new Address();
     }
 }
        public void LoadFromRow(DataRow row)
        {
            try
            {
                ID = Convert.ToInt32(row["HelperID"]);
                _Name = row["Name"].ToString();
                _Name = Utils.sqlQuoteToHTML(_Name);
                _Job = row["Job"].ToString();
                _Available = row["Available"].ToString();
                Status = Convert.ToInt32(row["Status"]);
                _Allocated = Convert.ToInt32(row["Allocated"]);
                _judgeID = Convert.ToInt32(row["JudgeID"]);
                _helpDate = Convert.ToDateTime(row["HelpDate"]);
                _jobDetails = row["JobDetails"].ToString();
                if (row["Comments"] != null) Comments = row["Comments"].ToString();

                PopulateJobDetails();

                if (row.Table.Columns.Contains("ShowID"))
                {
                    _ShowID = Convert.ToInt32(row["ShowID"]);
                }
                if (row.Table.Columns.Contains("JudgeName"))
                {
                    _judgeName = row["JudgeName"].ToString();
                }
                if (row.Table.Columns.Contains("RingId"))
                {
                    RingId = Convert.ToInt32(row["RingId"]);
                }

                if (row.Table.Columns.Contains("AddressID"))
                {
                    var value = row["AddressID"];
                    if (value != DBNull.Value)
                    {
                        _AddressID = Convert.ToInt32(value);
                    }
                    else
                    {
                        _AddressID = -1;
                    }
                    _AddressDetails = new Address(_AddressID);
                }
                if (row.Table.Columns.Contains("ShowDetailID"))
                {
                    _showDetailsID = Convert.ToInt32(row["ShowDetailID"]);
                    var value = row["ShowDetailID"];
                    if (value != DBNull.Value)
                    {
                        _showDetailsID = Convert.ToInt32(value);
                    }
                    else
                    {
                        _showDetailsID = -1;
                    }
                }
                if (row.Table.Columns.Contains("RingNo"))
                {
                    var value = row["RingNo"];
                    if (value != DBNull.Value)
                    {
                        _ringNo = Convert.ToInt32(value);
                    }
                    else
                    {
                        _ringNo = -1;
                    }
                }
                if (row.Table.Columns.Contains("HandlerType"))
                {
                    var value = row["HandlerType"];
                    if (value != DBNull.Value)
                    {
                        HandlerType= Convert.ToInt32(value);
                    }
                    else
                    {
                        HandlerType = -1;
                    }
                }
            }
            catch (Exception e )
            {
                AppException.LogEvent("Helpers.LoadFromRow:" + e.Message + " " + e.StackTrace);
            }
        }