public UserEditViewModel(UserListViewModel _vm, UserEditView _mw)
 {
     _UserListVM = _vm;
     _Window = _mw;
     OperationType = OpType.Add;
     UserObj = new UserOR();
     //UpdatetxtSource(_Window.gridContent);
     Init();
 }
 public UserEditViewModel(UserListViewModel _vm, UserEditView _mw, UserOR _UserObj)
 {
     _UserListVM = _vm;
     _Window = _mw;
     _SourceObj = _UserObj;
     Init();
     OperationType = OpType.Alert;
     UserObj = new UserOR();
     UserObj.Clone(_UserObj);
 }
Exemple #3
0
 public UserOR Login(string UserName, string pwd)
 {
     string sql = string.Format("select * from t_User where UserPSW='{0}' and UserName='******'", pwd, UserName);
     DataTable dt = db.ExecuteQuery(sql);
     if (dt.Rows.Count > 0)
     {
         DataRow dr = dt.Rows[0];
         UserOR m_User = new UserOR(dr);
         return m_User;
     }
     return null;
 }
Exemple #4
0
 /// <summary>
 /// 插入t_User
 /// </summary>
 public virtual bool Insert(UserOR user)
 {
     string sql = "insert into t_User (UserPSW, UserType, UserName) values ( @UserPSW, @UserType, @UserName)";
     SqlParameter[] parameters = new SqlParameter[]
     {
         //new SqlParameter("@UserID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "UserID", DataRowVersion.Default, user.Userid),
         new SqlParameter("@UserPSW", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "UserPSW", DataRowVersion.Default, user.Userpsw),
         new SqlParameter("@UserType", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "UserType", DataRowVersion.Default, user.Usertype),
         new SqlParameter("@UserName", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "UserName", DataRowVersion.Default, user.Username)
     };
     return db.ExecuteNoQuery(sql, parameters) > -1;
 }
Exemple #5
0
        public ObservableCollection<UserOR> selectAllDate()
        {
            string sql = "select * from t_User";

            DataTable dt = null;
            try
            {
                dt = db.ExecuteQuery(sql);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            ObservableCollection<UserOR> _List = new ObservableCollection<UserOR>();
            foreach (DataRow dr in dt.Rows)
            {
                UserOR obj = new UserOR(dr);
                _List.Add(obj);
            }
            return _List;
        }
Exemple #6
0
 /// <summary>
 /// 更新t_User
 /// </summary>
 public virtual bool Update(UserOR user)
 {
     string sql = "update t_User set  UserPSW = @UserPSW,  UserType = @UserType,  UserName = @UserName where  UserID = @UserID";
     SqlParameter[] parameters = new SqlParameter[]
     {
         new SqlParameter("@UserID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "UserID", DataRowVersion.Default, user.Userid),
         new SqlParameter("@UserPSW", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "UserPSW", DataRowVersion.Default, user.Userpsw),
         new SqlParameter("@UserType", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "UserType", DataRowVersion.Default, user.Usertype),
         new SqlParameter("@UserName", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "UserName", DataRowVersion.Default, user.Username)
     };
     return db.ExecuteNoQuery(sql, parameters) > -1;
 }
Exemple #7
0
 public UserOR selectARowDate(string m_id)
 {
     string sql = string.Format("select * from t_User where  Userid='{0}'", m_id);
     DataTable dt = null;
     try
     {
         dt = db.ExecuteQueryDataSet(sql).Tables[0];
     }
     catch (Exception ex)
     {
         throw ex;
     }
     if (dt == null)
         return null;
     if (dt.Rows.Count == 0)
         return null;
     DataRow dr = dt.Rows[0];
     UserOR m_User = new UserOR(dr);
     return m_User;
 }
 public UserEditViewModel(UserOR _Sta)
 {
     OperationType = OpType.Alert;
     UserObj = _Sta;
 }
 public UserEditView(UserListViewModel _List, UserOR _User)
 {
     InitializeComponent();
     this.DataContext = new UserEditViewModel(_List, this, _User);
 }
Exemple #10
0
 public void Clone(UserOR obj)
 {
     //
     Userid = obj.Userid;
     //密码
     Userpsw = obj.Userpsw;
     //用户类型
     Usertype = obj.Usertype;
     UserTypeShow = obj.UserTypeShow;
     //用户名
     Username = obj.Username;
 }