private void DeleteGreenhouseUser(ListViewItem item)
        {
            var g = GreenhouseUser.All().Where(gu => gu.GreenhouseID == _webContext.GreenhouseIdSession && gu.Username == ((Literal)item.FindControl("litUsername")).Text).SingleOrDefault();

            g.Delete();
            Bind();
        }
        public IQueryable <GreenhouseUser> LoadGreenhouseUsers(DataContext dc, int greenhouseUserID)
        {
            Usernames.Clear();
            var r = GreenhouseUser.All(dc).ByGreenhouseID(greenhouseUserID);

            foreach (var user in r)
            {
                Usernames.Add(user.Username);
            }
            return(r);
        }
        protected void butAddUsers_Click(object sender, EventArgs e)
        {
            var userid = new Guid(ddlUsers.SelectedValue);

            if (GreenhouseUser.All().Where(gu => gu.UserID == userid).SingleOrDefault() == null)
            {
                new GreenhouseUser
                {
                    UserID       = userid,
                    GreenhouseID = _webContext.GreenhouseIdSession,
                }.Save();
            }
            Bind();
        }
Beispiel #4
0
 public static void Delete(DataContext dc, GreenhouseUser greenhouseUser)
 {
     Repository.Delete(dc, greenhouseUser);
 }
Beispiel #5
0
 public static void Delete(GreenhouseUser greenhouseUser)
 {
     Delete(null, greenhouseUser);
 }
Beispiel #6
0
 public static int Save(DataContext dc, GreenhouseUser greenhouseUser)
 {
     return(Repository.Save(dc, greenhouseUser));
 }
Beispiel #7
0
 public static int Save(GreenhouseUser greenhouseUser)
 {
     return(Save(null, greenhouseUser));
 }
 protected void butAddUsers_Click(object sender, EventArgs e)
 {
     var userid = new Guid(ddlUsers.SelectedValue);
     if (GreenhouseUser.Find().ByUserID(userid).ByGreenhouseID(WebContext.GreenhouseIdSession).SingleOrDefault() == null)
     {
         var g = new GreenhouseUser
             {
                 UserID = userid,
                 GreenhouseID = WebContext.GreenhouseIdSession,
             };
         g.Save();
     }
     Bind();
 }