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();
        }
Пример #4
0
 public static void Delete(DataContext dc, GreenhouseUser greenhouseUser)
 {
     Repository.Delete(dc, greenhouseUser);
 }
Пример #5
0
 public static void Delete(GreenhouseUser greenhouseUser)
 {
     Delete(null, greenhouseUser);
 }
Пример #6
0
 public static int Save(DataContext dc, GreenhouseUser greenhouseUser)
 {
     return(Repository.Save(dc, greenhouseUser));
 }
Пример #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();
 }