Ejemplo n.º 1
0
        public List <JCS_DataInterface.Models.Administration.UserAccount> dbSearch(string searchKey)
        {
            List <DbParameter> parameters = new List <DbParameter>();

            parameters.Add(_sqlConn.GetParameter("middlename", searchKey));
            parameters.Add(_sqlConn.GetParameter("lastname", searchKey));
            parameters.Add(_sqlConn.GetParameter("firstname", searchKey));

            List <JCS_DataInterface.Models.Administration.UserAccount> result = new List <JCS_DataInterface.Models.Administration.UserAccount>();

            JCS_DataInterface.Models.Administration.UserAccount resultItem = new JCS_DataInterface.Models.Administration.UserAccount();


            try
            {
                using (DbDataReader dataReader = _sqlConn.GetDataReader("SELECT user_account_id      ,user_level      ,user_branch      ,user_login      ,user_accesskey      ,user_status      ,firstname    " +
                                                                        "  ,middlename      ,lastname      ,address      ,created_on      ,updated_on      ,created_by      ,updated_by      ,employee_reference, password_reset,phone, isAir, isSea, isBranch  FROM  User_Account WHERE middlename LIKE '%'+@middlename+'%' OR firstname LIKE '%'+@firstname+'%' OR lastname LIKE '%'+@lastname+'%'", parameters, System.Data.CommandType.Text))
                {
                    while (dataReader.Read())
                    {
                        resultItem = new Models.Administration.UserAccount();
                        resultItem._userAccountID = dataReader["user_account_id"].ToString();
                        resultItem._userLevel     = dataReader["user_level"].ToString();
                        resultItem._userBranch    = dataReader["user_branch"].ToString();
                        resultItem._userLogin     = dataReader["user_login"].ToString();
                        resultItem._userAccessKey = dataReader["user_accesskey"].ToString();
                        resultItem._userStatus    = dataReader["user_status"].ToString();
                        resultItem._firstname     = dataReader["firstname"].ToString();
                        resultItem._middlename    = dataReader["middlename"].ToString();
                        resultItem._lastname      = dataReader["lastname"].ToString();
                        resultItem._address       = dataReader["address"].ToString();
                        resultItem._createdOn     = dataReader["created_on"].ToString();
                        resultItem._updatedOn     = dataReader["updated_on"].ToString();
                        resultItem._createdBy     = dataReader["created_by"].ToString();
                        resultItem._updatedBy     = dataReader["employee_reference"].ToString();
                        resultItem._passwordReset = dataReader["password_reset"].ToString();
                        resultItem._phoneNumber   = dataReader["phone"].ToString();
                        resultItem._isAir         = dataReader["isAir"].ToString();
                        resultItem._isSea         = dataReader["isSea"].ToString();
                        resultItem._isBranch      = dataReader["isBranch"].ToString();

                        result.Add(resultItem);
                    }
                    return(result);
                }
            }
            catch (Exception ex)
            {
                resultItem._firstname = "Error on JCS_DataInterface.iUserAccount.dbSearch :=> " + ex.Message.ToString();
                result.Add(resultItem);
                return(result);
            }
        }
Ejemplo n.º 2
0
 public UserView(JCS_DataInterface.Models.Administration.UserAccount ua)
 {
     branch = new JCS_DataInterface.Interface.Administration.iSystemBranch("").dbGet(ua._userBranch);
 }