public static ADUser SelectByUserNameAndPassword(string UserName, string Password) { DatabaseHelper oDatabaseHelper = new DatabaseHelper(); bool ExecutionState = false; oDatabaseHelper.AddParameter("@UserName", UserName); oDatabaseHelper.AddParameter("@Password", Password); // The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure. oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output); IDataReader dr = oDatabaseHelper.ExecuteReader("gsp_ADUser_SelectUserNameAndPassword", ref ExecutionState); if (dr.Read()) { ADUser obj = new ADUser(); PopulateObjectFromReader(obj, dr); dr.Close(); oDatabaseHelper.Dispose(); return obj; } else { dr.Close(); oDatabaseHelper.Dispose(); return null; } }
/// <summary> /// This method will return an object representing the record matching the primary key information specified. /// </summary> /// /// <param name="pk" type="ADUserPrimaryKey">Primary Key information based on which data is to be fetched.</param> /// /// <returns>object of class ADUser</returns> public ADUser SelectOne(ADUserPrimaryKey pk) { _aDUserWCF = new ADUser(); _aDUser = POS.DataLayer.ADUserBase.SelectOne(new POS.DataLayer.ADUserPrimaryKey(pk.UserID)); _aDUserWCF.UserID = _aDUser.UserID; _aDUserWCF.UserFullName = _aDUser.UserFullName; _aDUserWCF.UserName = _aDUser.UserName; _aDUserWCF.Password = _aDUser.Password; _aDUserWCF.GroupID = _aDUser.GroupID; _aDUserWCF.Email = _aDUser.Email; _aDUserWCF.Address = _aDUser.Address; _aDUserWCF.Phone = _aDUser.Phone; _aDUserWCF.Mobile = _aDUser.Mobile; return(_aDUserWCF); }
/// <summary> /// This method will return an object representing the record matching the primary key information specified. /// </summary> /// /// <param name="pk" type="ADUserPrimaryKey">Primary Key information based on which data is to be fetched.</param> /// /// <returns>object of class ADUser</returns> public ADUser SelectOne(ADUserPrimaryKey pk) { _aDUserWCF = new ADUser(); _aDUser = POS.DataLayer.ADUserBase.SelectOne(new POS.DataLayer.ADUserPrimaryKey(pk.UserID)); _aDUserWCF.UserID = _aDUser.UserID; _aDUserWCF.UserFullName = _aDUser.UserFullName; _aDUserWCF.UserName = _aDUser.UserName; _aDUserWCF.Password = _aDUser.Password; _aDUserWCF.GroupID = _aDUser.GroupID; _aDUserWCF.Email = _aDUser.Email; _aDUserWCF.Address = _aDUser.Address; _aDUserWCF.Phone = _aDUser.Phone; _aDUserWCF.Mobile = _aDUser.Mobile; return _aDUserWCF; }
/// <summary> /// This method will return a list of objects representing all records in the table. /// </summary> /// /// <returns>list of objects of class ADUser in the form of object of ADUserCollection </returns> public ADUserCollection SelectAll() { ADUserCollection aDUserCollection = new ADUserCollection(); foreach (POS.DataLayer.ADUser _aDUser in POS.DataLayer.ADUserBase.SelectAll()) { _aDUserWCF = new ADUser(); _aDUserWCF.UserID = _aDUser.UserID; _aDUserWCF.UserFullName = _aDUser.UserFullName; _aDUserWCF.UserName = _aDUser.UserName; _aDUserWCF.Password = _aDUser.Password; _aDUserWCF.GroupID = _aDUser.GroupID; _aDUserWCF.Email = _aDUser.Email; _aDUserWCF.Address = _aDUser.Address; _aDUserWCF.Phone = _aDUser.Phone; _aDUserWCF.Mobile = _aDUser.Mobile; aDUserCollection.Add(_aDUserWCF); } return aDUserCollection; }
/// <summary> /// This method will get row(s) from the database using the value of the field specified /// along with the details of the child table. /// </summary> /// /// <param name="pk" type="ADUserPrimaryKey">Primary Key information based on which data is to be fetched.</param> /// /// <returns>object of class ADUser</returns> /// /// <remarks> /// /// <RevisionHistory> /// Author Date Description /// DLGenerator 3/7/2015 2:37:27 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// public static ADUser SelectOneWithBDCustomerAccountsUsingCreatedBy(ADUserPrimaryKey pk) { DatabaseHelper oDatabaseHelper = new DatabaseHelper(); bool ExecutionState = false; ADUser obj=null; // Pass the values of all key parameters to the stored procedure. System.Collections.Specialized.NameValueCollection nvc = pk.GetKeysAndValues(); foreach (string key in nvc.Keys) { oDatabaseHelper.AddParameter("@" + key,nvc[key] ); } // The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure. oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output); IDataReader dr=oDatabaseHelper.ExecuteReader("gsp_ADUser_SelectOneWithBDCustomerAccountsUsingCreatedBy", ref ExecutionState); if (dr.Read()) { obj= new ADUser(); PopulateObjectFromReader(obj,dr); dr.NextResult(); //Get the child records. obj.BDCustomerAccountCollectionUsingCreatedBy=BDCustomerAccount.PopulateObjectsFromReader(dr); } dr.Close(); oDatabaseHelper.Dispose(); return obj; }
/// <summary> /// This method will return an object representing the record matching the primary key information specified. /// </summary> /// /// <param name="pk" type="ADUserPrimaryKey">Primary Key information based on which data is to be fetched.</param> /// /// <returns>object of class ADUser</returns> /// /// <remarks> /// /// <RevisionHistory> /// Author Date Description /// DLGenerator 3/7/2015 2:37:27 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// public static ADUser SelectOne(ADUserPrimaryKey pk) { DatabaseHelper oDatabaseHelper = new DatabaseHelper(); bool ExecutionState = false; // Pass the values of all key parameters to the stored procedure. System.Collections.Specialized.NameValueCollection nvc = pk.GetKeysAndValues(); foreach (string key in nvc.Keys) { oDatabaseHelper.AddParameter("@" + key,nvc[key] ); } // The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure. oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output); IDataReader dr=oDatabaseHelper.ExecuteReader("gsp_ADUser_SelectbyPrimaryKey", ref ExecutionState); if (dr.Read()) { ADUser obj=new ADUser(); PopulateObjectFromReader(obj,dr); dr.Close(); oDatabaseHelper.Dispose(); return obj; } else { dr.Close(); oDatabaseHelper.Dispose(); return null; } }
/// <summary> /// Populates the fields for multiple objects from the columns found in an open reader. /// </summary> /// /// <param name="rdr" type="IDataReader">An object that implements the IDataReader interface</param> /// /// <returns>Object of ADUserCollection</returns> /// /// <remarks> /// /// <RevisionHistory> /// Author Date Description /// DLGenerator 3/7/2015 2:37:27 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// internal static ADUserCollection PopulateObjectsFromReaderWithCheckingReader(IDataReader rdr, DatabaseHelper oDatabaseHelper) { ADUserCollection list = new ADUserCollection(); if (rdr.Read()) { ADUser obj = new ADUser(); PopulateObjectFromReader(obj, rdr); list.Add(obj); while (rdr.Read()) { obj = new ADUser(); PopulateObjectFromReader(obj, rdr); list.Add(obj); } oDatabaseHelper.Dispose(); return list; } else { oDatabaseHelper.Dispose(); return null; } }
/// <summary> /// Populates the fields for multiple objects from the columns found in an open reader. /// </summary> /// /// <param name="rdr" type="IDataReader">An object that implements the IDataReader interface</param> /// /// <returns>Object of ADUserCollection</returns> /// /// <remarks> /// /// <RevisionHistory> /// Author Date Description /// DLGenerator 3/7/2015 2:37:27 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// internal static ADUserCollection PopulateObjectsFromReader(IDataReader rdr) { ADUserCollection list = new ADUserCollection(); while (rdr.Read()) { ADUser obj = new ADUser(); PopulateObjectFromReader(obj,rdr); list.Add(obj); } return list; }
///<summary> /// This method will update one new row into the database using the property Information /// </summary> /// /// <param name="aDUser" type="ADUser">This ADUser will be updated in the database.</param> /// /// <returns>True if succeeded</returns> public bool Update(ADUser aDUser) { _aDUser=POS.DataLayer.ADUser.SelectOne(new POS.DataLayer.ADUserPrimaryKey(aDUser.UserID)); _aDUser.UserFullName=aDUser.UserFullName; _aDUser.UserName=aDUser.UserName; _aDUser.Password=aDUser.Password; _aDUser.GroupID=aDUser.GroupID; _aDUser.Email=aDUser.Email; _aDUser.Address=aDUser.Address; _aDUser.Phone=aDUser.Phone; _aDUser.Mobile=aDUser.Mobile; return _aDUser.Update(); }
/// <summary> /// This method will return a list of objects representing the specified number of entries from the specified record number in the table /// using the value of the field specified /// </summary> /// /// <param name="field" type="string">Field of the class ADUser</param> /// <param name="fieldValue" type="object">Value for the field specified.</param> /// <param name="fieldValue2" type="object">Value for the field specified.</param> /// <param name="typeOperation" type="TypeOperation">Operator that is used if fieldValue2=null or fieldValue2="".</param> /// <param name="orderByStatement" type="string">The field value to number.</param> /// <param name="pageSize" type="int">Number of records returned.</param> /// <param name="skipPages" type="int">The number of missing pages.</param> /// /// <returns>List of object of class ADUser in the form of an object of class ADUserCollection</returns> public ADUserCollection SelectByFieldPaged(string field, object fieldValue, object fieldValue2, TypeOperation typeOperation, int pageSize, int skipPages, string orderByStatement) { ADUserCollection aDUserCollection = new ADUserCollection(); foreach (POS.DataLayer.ADUser _aDUser in POS.DataLayer.ADUserBase.SelectByFieldPaged(field, fieldValue, fieldValue2, typeOperation, pageSize, skipPages, orderByStatement)) { _aDUserWCF = new ADUser(); _aDUserWCF.UserID = _aDUser.UserID; _aDUserWCF.UserFullName = _aDUser.UserFullName; _aDUserWCF.UserName = _aDUser.UserName; _aDUserWCF.Password = _aDUser.Password; _aDUserWCF.GroupID = _aDUser.GroupID; _aDUserWCF.Email = _aDUser.Email; _aDUserWCF.Address = _aDUser.Address; _aDUserWCF.Phone = _aDUser.Phone; _aDUserWCF.Mobile = _aDUser.Mobile; aDUserCollection.Add(_aDUserWCF); } return aDUserCollection; }
/// <summary> /// This method will return a list of objects representing the specified number of entries from the specified record number in the table. /// </summary> /// /// <param name="pageSize" type="int">Number of records returned.</param> /// <param name="skipPages" type="int">The number of missing pages.</param> /// <param name="orderByStatement" type="string">The field value to number.</param> /// /// <returns>list of objects of class ADUser in the form of an object of class ADUserCollection </returns> public ADUserCollection SelectAllPaged(int? pageSize, int? skipPages, string orderByStatement) { ADUserCollection aDUserCollection = new ADUserCollection(); foreach (POS.DataLayer.ADUser _aDUser in POS.DataLayer.ADUserBase.SelectAllPaged(pageSize, skipPages, orderByStatement)) { _aDUserWCF = new ADUser(); _aDUserWCF.UserID = _aDUser.UserID; _aDUserWCF.UserFullName = _aDUser.UserFullName; _aDUserWCF.UserName = _aDUser.UserName; _aDUserWCF.Password = _aDUser.Password; _aDUserWCF.GroupID = _aDUser.GroupID; _aDUserWCF.Email = _aDUser.Email; _aDUserWCF.Address = _aDUser.Address; _aDUserWCF.Phone = _aDUser.Phone; _aDUserWCF.Mobile = _aDUser.Mobile; aDUserCollection.Add(_aDUserWCF); } return aDUserCollection; }
/// <summary> /// This method will insert one new row into the database using the property Information /// </summary> /// /// <param name="aDUser" type="ADUser">This ADUser will be inserted in the database.</param> /// /// <returns>True if succeeded</returns> public bool Insert(ADUser aDUser) { _aDUser = new POS.DataLayer.ADUser(); _aDUser.UserID=aDUser.UserID; _aDUser.UserFullName=aDUser.UserFullName; _aDUser.UserName=aDUser.UserName; _aDUser.Password=aDUser.Password; _aDUser.GroupID=aDUser.GroupID; _aDUser.Email=aDUser.Email; _aDUser.Address=aDUser.Address; _aDUser.Phone=aDUser.Phone; _aDUser.Mobile=aDUser.Mobile; return _aDUser.Insert(); }