Exemplo n.º 1
0
 public static void SaveUser(User u)
 {
     if (u==null) return;
     string sql = "UPDATE users SET Key=?, Name=?, Email=?, Language=?, Picture=?, NumInvitees=?, ConfirmationDate=?, NumConfirmed=? WHERE UserID=?";
     int modrows = DbAccess.ExecuteUpdate(
         sql,
         u.Key,
         u.Name,
         u.Email,
         u.Language,
         u.Picture,
         u.NumInvitees,
         (u.ConfirmationDate.HasValue ? u.ConfirmationDate.Value : DateTime.MinValue),
         (u.NumConfirmed.HasValue ? u.NumConfirmed.Value : 0),
         u.ID);
     if (modrows != 1)
     {
         throw new Exception(string.Format("Modified {0} rows, expected 1.", modrows));
     }
 }
Exemplo n.º 2
0
 private static string getImgPath(User u)
 {
     return getImgPath(u.Picture);
 }
Exemplo n.º 3
0
 public static string getMiniAvatar(User u)
 {
     return string.Format("<div class='miniavatar' style=\"background-image: url('{0}'); background-size: contain; background-repeat: no-repeat; \"></div>", getImgPath(u));
 }
Exemplo n.º 4
0
 private void setDbgUserData(User u)
 {
     string html = "<div id='dbg' style='position:absolute; background-color: yellow; z-index:99; opacity: 0.33;'>";
     html += "DEBUG:<br>";
     html += u.ToString();
     html += "<br/>UICulture:" + System.Threading.Thread.CurrentThread.CurrentUICulture;
     html += "</div>";
     dbgUserData.Text = html;
 }
Exemplo n.º 5
0
 private void LoadUserRec()
 {
     if (_u != null) return;
     string userKey = HttpContext.Current.User.Identity.Name;
     if (userKey != null && userKey != "")
     {
         _u = DataAccess.LoadUser(-1, userKey);
     }
 }
Exemplo n.º 6
0
 private static User LoadUser(DataRow theRow)
 {
     User theUser = new User(
         (Int64)theRow["UserID"],
         (string)theRow["Key"],
         (string)theRow["Name"],
         (string)(theRow["DisplayName"] is DBNull ? null : theRow["DisplayName"]),
         (string)(theRow["Email"] is DBNull ? null : theRow["Email"]),
         (string)(theRow["Language"] is DBNull ? null : theRow["Language"]),
         (string)(theRow["Picture"] is DBNull ? null : theRow["Picture"]),
         (Int64) theRow["NumInvitees"]);
     if (!(theRow["ConfirmationDate"] is System.DBNull))
     {
         theUser.ConfirmationDate = (DateTime)theRow["ConfirmationDate"];
     }
     if (!(theRow["NumConfirmed"] is System.DBNull))
     {
         theUser.NumConfirmed = (Int64)theRow["NumConfirmed"];
     }
     return theUser;
 }
Exemplo n.º 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            LoadUserRec();
            u = _u;
            if (!IsPostBack)
            {
                loadVisibilities();
                for (int i = 1; i <= u.NumInvitees; i++)
                {
                    rdoPlusList.Items.Add(new ListItem(convertGuestNum(i), "" + i));
                    rdoPlusList.SelectedIndex = 0;
                }

                if (u.NumConfirmed.HasValue)
                {
                    if (u.NumConfirmed.Value == 0)
                    {
                        rdoNo.Checked = true;
                    }
                    else
                    {
                        rdoYes.Checked = true;
                        rdoPlusList.SelectedValue = "" + u.NumConfirmed.Value;
                    }

                }
                else
                    rdoPlusList.SelectedIndex = 0;
            }

            loadGuestStatusText();
            setRadioTextAlign(rdoYes);
            setRadioTextAlign(rdoNo);
            setRadioTextAlign(rdoPlusList);

            //Show Guest List
            DataTable GVDataTable = DataAccess.LoadGuestList();
            guestListGV.DataSource = GVDataTable;
            guestListGV.DataBind();

            // Style buttons
            SetCultureOnButton(btnEditToggle);
        }
Exemplo n.º 8
0
 public Comment(String text, DateTime commDate, User user)
 {
     this.text = text;
     this.commDate = commDate;
     this.user = user;
 }