Esempio n. 1
0
        /// <summary>
        /// GetListForLogin
        /// Calls [usp_selectAll_PartSearch_for_Login]
        /// </summary>
        public override List <PartSearchDetails> GetListForLogin(System.Int32?loginNo, System.String partSearch)
        {
            SqlConnection cn  = null;
            SqlCommand    cmd = null;

            try {
                cn                 = new SqlConnection(this.ConnectionString);
                cmd                = new SqlCommand("usp_selectAll_PartSearch_for_Login", cn);
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandTimeout = 30;
                cmd.Parameters.Add("@LoginNo", SqlDbType.Int).Value         = loginNo;
                cmd.Parameters.Add("@PartSearch", SqlDbType.NVarChar).Value = partSearch;
                cn.Open();
                DbDataReader             reader = ExecuteReader(cmd);
                List <PartSearchDetails> lst    = new List <PartSearchDetails>();
                while (reader.Read())
                {
                    PartSearchDetails obj = new PartSearchDetails();
                    obj.SearchPart = GetReaderValue_String(reader, "SearchPart", "");
                    obj.LoginNo    = GetReaderValue_NullableInt32(reader, "LoginNo", null);
                    obj.DLUP       = GetReaderValue_NullableDateTime(reader, "DLUP", null);
                    lst.Add(obj);
                    obj = null;
                }
                return(lst);
            } catch (SqlException sqlex) {
                //LogException(sqlex);
                throw new Exception("Failed to get PartSearchs", sqlex);
            } finally {
                cmd.Dispose();
                cn.Close();
                cn.Dispose();
            }
        }
Esempio n. 2
0
        private static PartSearch PopulateFromDBDetailsObject(PartSearchDetails obj)
        {
            PartSearch objNew = new PartSearch();

            objNew.PartSearchID = obj.PartSearchID;
            objNew.SearchPart   = obj.SearchPart;
            objNew.LoginNo      = obj.LoginNo;
            objNew.DLUP         = obj.DLUP;
            return(objNew);
        }