/// <summary> /// Create a new user object. /// </summary> /// <param name="user_name">Initial value of the user_name property.</param> /// <param name="adminBSC_VTT">Initial value of the adminBSC_VTT property.</param> /// <param name="adminBSC_TTKD">Initial value of the adminBSC_TTKD property.</param> public static user Createuser(global::System.String user_name, global::System.Boolean adminBSC_VTT, global::System.Boolean adminBSC_TTKD) { user user = new user(); user.user_name = user_name; user.adminBSC_VTT = adminBSC_VTT; user.adminBSC_TTKD = adminBSC_TTKD; return user; }
private void SaveData(LoadOperation<user> lo) { if (lo.Entities.Count() > 0) { MessageBox.Show("User " + this.txtusername.Text.Trim().ToUpper() + " đã tồn tại"); } else { string m_username, m_pass, m_hoten, m_dt, menu,huyen; bool m_gt, m_sua, m_admin, m_admin119, m_lock; m_username = this.txtusername.Text.Trim(); m_pass = callF.EncrytedString(this.txtpass.Text.Trim()); m_hoten = this.txthoten.Text.Trim(); m_dt = this.txtphone.Text.Trim(); m_gt = chkgt.IsChecked == true ? true : false; // nhomtd = FunAndPro.GetSelectedKeyValue(cmbmaloai, rowLoai); menu = FunAndPro.GetSelectedKeyValue(cmbmenu, rowMenu); huyen = FunAndPro.GetSelectedKeyValue(cmbhuyentd, rowHuyen); m_sua = chkSua.IsChecked == true ? true : false; m_admin = chkadmin.IsChecked == true ? true : false; m_admin119 = chkadmin119.IsChecked == true ? true : false; m_lock = chklock.IsChecked == true ? true : false; if (m_username != "" && m_pass != "" && m_hoten != "" && menu != "") { user us = new user { user_name = m_username, m_password = m_pass, hoten = m_hoten, namsinh = dngaysinh.DateTime, gioitinh = m_gt, phone = m_dt, sua = m_sua, admin=m_admin, admin119 = m_admin119, lock_usr=false, lan_dau = true, m_menu = menu, huyen=cmbhuyen.GetKeyValue(cmbhuyen.SelectedIndex).ToString(), huyentd=huyen, themes=0 }; Listuser.users.Add(us); Listuser.SubmitChanges(OnSubmitCompleted, true); this.txtusername.Text = ""; this.txtpass.Text = ""; this.txthoten.Text = ""; this.txtphone.Text = ""; chkgt.IsChecked = false; cmbmenu.UnselectAllItems(); cmbhuyentd.UnselectAllItems(); cmbhuyen.EditValue = null; chkSua.IsChecked = false; chkadmin.IsChecked = false; chkadmin119.IsChecked = false; chklock.IsChecked = false; this.txtusername.Focus(); username_callback = m_username; } else MessageBox.Show("Nhập chưa đủ thông tin"); } }
/// <summary> /// Deprecated Method for adding a new object to the users EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddTousers(user user) { base.AddObject("users", user); }