示例#1
0
        private void btnOpenTank_Click(object sender, EventArgs e)
        {
            //MessageBox.Show("הוספת פריט למלאי נלווה");
            using (GazOnDevEntities db=new GazOnDevEntities())
            {
                user newrecord = new user();
                newrecord.lastname = txtNewlastname.Text;
                newrecord.firstname = txtNewFirstname.Text;
                newrecord.username = txtNewusername.Text;
                newrecord.password = txtNewpass.Text;
                newrecord.isadmin = chknewadmin.Checked;
                db.AddTousers(newrecord);
               int result = db.SaveChanges();
               if (result > 0)
               {
                   MessageBox.Show("  פעולה הצליחה  ");
                   btnOpenTank.Enabled = false;
               }

            }
        }
示例#2
0
 /// <summary>
 /// Deprecated Method for adding a new object to the users EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTousers(user user)
 {
     base.AddObject("users", user);
 }
示例#3
0
 /// <summary>
 /// Create a new user object.
 /// </summary>
 /// <param name="id">Initial value of the id property.</param>
 public static user Createuser(global::System.Int32 id)
 {
     user user = new user();
     user.id = id;
     return user;
 }
示例#4
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (this.comboBox1.SelectedValue != null)
            {

                selected = (user)this.comboBox1.SelectedItem;

                 txtEditlastname.Text=selected.lastname;
                 txtEditFirstname.Text=selected.firstname ;
              txtEditusername.Text=   selected.username;
               txtEditpassword.Text= selected.password;
                chkeditadmin.Checked=Convert.ToBoolean(selected.isadmin);
                button1.Enabled = true;
                // CurrentAmount = selected.Count;
                /*MessageBox.Show(selcted.Title);
                MessageBox.Show(selcted.Id.ToString());*/
            }
        }