* Price.cs:

* Service.cs:
* Price.cs:
* PhysicalProduct.cs: Billing

* SetPrice.cs: Billing


* MyClass.cs:
* ResultPages.cs:
* NpgsqlRoleProvider.cs:
* NpgsqlProfileProvider.cs:
* NpgsqlMembershipProvider.cs: xml doc

* SalesCatalog.csproj: cleanning

* YavscModel.csproj: coding policies
main
Paul Schneider 11 years ago
parent 6dfe83308e
commit 7b0dd0c1e2
11 changed files with 457 additions and 54 deletions

@ -15,6 +15,9 @@ using System.Web.Configuration;
namespace Npgsql.Web namespace Npgsql.Web
{ {
/// <summary>
/// Npgsql membership provider.
/// </summary>
public sealed class NpgsqlMembershipProvider: MembershipProvider public sealed class NpgsqlMembershipProvider: MembershipProvider
{ {
@ -34,7 +37,11 @@ namespace Npgsql.Web
// //
// System.Configuration.Provider.ProviderBase.Initialize Method // System.Configuration.Provider.ProviderBase.Initialize Method
// //
/// <summary>
/// Initialize the specified name and config.
/// </summary>
/// <param name="name">Name.</param>
/// <param name="config">Config.</param>
public override void Initialize (string name, NameValueCollection config) public override void Initialize (string name, NameValueCollection config)
{ {
// //
@ -134,54 +141,87 @@ namespace Npgsql.Web
private int pMaxInvalidPasswordAttempts; private int pMaxInvalidPasswordAttempts;
private int pPasswordAttemptWindow; private int pPasswordAttemptWindow;
private MembershipPasswordFormat pPasswordFormat; private MembershipPasswordFormat pPasswordFormat;
/// <summary>
/// Gets or sets the name of the application.
/// </summary>
/// <value>The name of the application.</value>
public override string ApplicationName { public override string ApplicationName {
get { return pApplicationName; } get { return pApplicationName; }
set { pApplicationName = value; } set { pApplicationName = value; }
} }
/// <summary>
/// Gets a value indicating whether this <see cref="Npgsql.Web.NpgsqlMembershipProvider"/> enable password reset.
/// </summary>
/// <value><c>true</c> if enable password reset; otherwise, <c>false</c>.</value>
public override bool EnablePasswordReset { public override bool EnablePasswordReset {
get { return pEnablePasswordReset; } get { return pEnablePasswordReset; }
} }
/// <summary>
/// Gets a value indicating whether this <see cref="Npgsql.Web.NpgsqlMembershipProvider"/> enable password retrieval.
/// </summary>
/// <value><c>true</c> if enable password retrieval; otherwise, <c>false</c>.</value>
public override bool EnablePasswordRetrieval { public override bool EnablePasswordRetrieval {
get { return pEnablePasswordRetrieval; } get { return pEnablePasswordRetrieval; }
} }
/// <summary>
/// Gets a value indicating whether this <see cref="Npgsql.Web.NpgsqlMembershipProvider"/> requires question and answer.
/// </summary>
/// <value><c>true</c> if requires question and answer; otherwise, <c>false</c>.</value>
public override bool RequiresQuestionAndAnswer { public override bool RequiresQuestionAndAnswer {
get { return pRequiresQuestionAndAnswer; } get { return pRequiresQuestionAndAnswer; }
} }
/// <summary>
/// Gets a value indicating whether this <see cref="Npgsql.Web.NpgsqlMembershipProvider"/> requires unique email.
/// </summary>
/// <value><c>true</c> if requires unique email; otherwise, <c>false</c>.</value>
public override bool RequiresUniqueEmail { public override bool RequiresUniqueEmail {
get { return pRequiresUniqueEmail; } get { return pRequiresUniqueEmail; }
} }
/// <summary>
/// Gets the max invalid password attempts.
/// </summary>
/// <value>The max invalid password attempts.</value>
public override int MaxInvalidPasswordAttempts { public override int MaxInvalidPasswordAttempts {
get { return pMaxInvalidPasswordAttempts; } get { return pMaxInvalidPasswordAttempts; }
} }
/// <summary>
/// Gets the password attempt window.
/// </summary>
/// <value>The password attempt window.</value>
public override int PasswordAttemptWindow { public override int PasswordAttemptWindow {
get { return pPasswordAttemptWindow; } get { return pPasswordAttemptWindow; }
} }
/// <summary>
/// Gets the password format.
/// </summary>
/// <value>The password format.</value>
public override MembershipPasswordFormat PasswordFormat { public override MembershipPasswordFormat PasswordFormat {
get { return pPasswordFormat; } get { return pPasswordFormat; }
} }
private int pMinRequiredNonAlphanumericCharacters; private int pMinRequiredNonAlphanumericCharacters;
/// <summary>
/// Gets the minimum required non alphanumeric characters.
/// </summary>
/// <value>The minimum required non alphanumeric characters.</value>
public override int MinRequiredNonAlphanumericCharacters { public override int MinRequiredNonAlphanumericCharacters {
get { return pMinRequiredNonAlphanumericCharacters; } get { return pMinRequiredNonAlphanumericCharacters; }
} }
private int pMinRequiredPasswordLength; private int pMinRequiredPasswordLength;
/// <summary>
/// Gets the minimum length of the required password.
/// </summary>
/// <value>The minimum length of the required password.</value>
public override int MinRequiredPasswordLength { public override int MinRequiredPasswordLength {
get { return pMinRequiredPasswordLength; } get { return pMinRequiredPasswordLength; }
} }
private string pPasswordStrengthRegularExpression; private string pPasswordStrengthRegularExpression;
/// <summary>
/// Gets the password strength regular expression.
/// </summary>
/// <value>The password strength regular expression.</value>
public override string PasswordStrengthRegularExpression { public override string PasswordStrengthRegularExpression {
get { return pPasswordStrengthRegularExpression; } get { return pPasswordStrengthRegularExpression; }
} }
@ -193,7 +233,14 @@ namespace Npgsql.Web
// //
// MembershipProvider.ChangePassword // MembershipProvider.ChangePassword
// //
/// <Docs>To be added.</Docs>
/// <param name="newPwd">To be added.</param>
/// <summary>
/// Changes the password.
/// </summary>
/// <returns><c>true</c>, if password was changed, <c>false</c> otherwise.</returns>
/// <param name="username">Username.</param>
/// <param name="oldPwd">Old pwd.</param>
public override bool ChangePassword (string username, string oldPwd, string newPwd) public override bool ChangePassword (string username, string oldPwd, string newPwd)
{ {
if (!ValidateUser (username, oldPwd)) if (!ValidateUser (username, oldPwd))
@ -233,7 +280,15 @@ namespace Npgsql.Web
// //
// MembershipProvider.ChangePasswordQuestionAndAnswer // MembershipProvider.ChangePasswordQuestionAndAnswer
// //
/// <Docs>To be added.</Docs>
/// <param name="newPwdAnswer">To be added.</param>
/// <summary>
/// Changes the password question and answer.
/// </summary>
/// <returns><c>true</c>, if password question and answer was changed, <c>false</c> otherwise.</returns>
/// <param name="username">Username.</param>
/// <param name="password">Password.</param>
/// <param name="newPwdQuestion">New pwd question.</param>
public override bool ChangePasswordQuestionAndAnswer (string username, public override bool ChangePasswordQuestionAndAnswer (string username,
string password, string password,
string newPwdQuestion, string newPwdQuestion,
@ -268,6 +323,20 @@ namespace Npgsql.Web
// MembershipProvider.CreateUser // MembershipProvider.CreateUser
// //
/// <Docs>Creates an User.</Docs>
/// <summary>
/// To be added.
/// </summary>
/// <remarks>To be added.</remarks>
/// <returns>The user.</returns>
/// <param name="username">Username.</param>
/// <param name="password">Password.</param>
/// <param name="email">E-mail.</param>
/// <param name="passwordQuestion">Password question.</param>
/// <param name="passwordAnswer">Password answer.</param>
/// <param name="isApproved">If set to <c>true</c> is approved.</param>
/// <param name="providerUserKey">To be added.</param>
/// <param name="status">Status.</param>
public override MembershipUser CreateUser (string username, public override MembershipUser CreateUser (string username,
string password, string password,
string email, string email,
@ -397,7 +466,15 @@ namespace Npgsql.Web
// //
// MembershipProvider.GetAllUsers // MembershipProvider.GetAllUsers
// //
/// <Docs>To be added.</Docs>
/// <param name="totalRecords">To be added.</param>
/// <returns>To be added.</returns>
/// <since version=".NET 2.0"></since>
/// <summary>
/// Gets all users.
/// </summary>
/// <param name="pageIndex">Page index.</param>
/// <param name="pageSize">Page size.</param>
public override MembershipUserCollection GetAllUsers (int pageIndex, int pageSize, out int totalRecords) public override MembershipUserCollection GetAllUsers (int pageIndex, int pageSize, out int totalRecords)
{ {
MembershipUserCollection users = new MembershipUserCollection (); MembershipUserCollection users = new MembershipUserCollection ();
@ -448,7 +525,10 @@ namespace Npgsql.Web
// //
// MembershipProvider.GetNumberOfUsersOnline // MembershipProvider.GetNumberOfUsersOnline
// //
/// <summary>
/// Gets the number of users online.
/// </summary>
/// <returns>The number of users online.</returns>
public override int GetNumberOfUsersOnline () public override int GetNumberOfUsersOnline ()
{ {
int numOnline = 0; int numOnline = 0;
@ -479,7 +559,13 @@ namespace Npgsql.Web
// //
// MembershipProvider.GetPassword // MembershipProvider.GetPassword
// //
/// <Docs>To be added.</Docs>
/// <summary>
/// Gets the password.
/// </summary>
/// <returns>The password.</returns>
/// <param name="username">Username.</param>
/// <param name="answer">Answer.</param>
public override string GetPassword (string username, string answer) public override string GetPassword (string username, string answer)
{ {
string password = ""; string password = "";
@ -592,6 +678,12 @@ namespace Npgsql.Web
// //
// MembershipProvider.GetUser(object, bool) // MembershipProvider.GetUser(object, bool)
// //
/// <summary>
/// Gets the user.
/// </summary>
/// <returns>The user.</returns>
/// <param name="providerUserKey">Provider user key.</param>
/// <param name="userIsOnline">If set to <c>true</c> user is online.</param>
public override MembershipUser GetUser (object providerUserKey, bool userIsOnline) public override MembershipUser GetUser (object providerUserKey, bool userIsOnline)
{ {
MembershipUser u = null; MembershipUser u = null;
@ -686,7 +778,11 @@ namespace Npgsql.Web
// //
// MembershipProvider.UnlockUser // MembershipProvider.UnlockUser
// //
/// <summary>
/// Unlocks the user.
/// </summary>
/// <returns><c>true</c>, if user was unlocked, <c>false</c> otherwise.</returns>
/// <param name="username">Username.</param>
public override bool UnlockUser (string username) public override bool UnlockUser (string username)
{ {
int rowsAffected = 0; int rowsAffected = 0;
@ -712,7 +808,11 @@ namespace Npgsql.Web
// //
// MembershipProvider.GetUserNameByEmail // MembershipProvider.GetUserNameByEmail
// //
/// <summary>
/// Gets the user name by email.
/// </summary>
/// <returns>The user name by email.</returns>
/// <param name="email">Email.</param>
public override string GetUserNameByEmail (string email) public override string GetUserNameByEmail (string email)
{ {
string username = ""; string username = "";
@ -734,7 +834,13 @@ namespace Npgsql.Web
// //
// MembershipProvider.ResetPassword // MembershipProvider.ResetPassword
// //
/// <Docs>To be added.</Docs>
/// <summary>
/// Resets the password.
/// </summary>
/// <returns>The password.</returns>
/// <param name="username">Username.</param>
/// <param name="answer">Answer.</param>
public override string ResetPassword (string username, string answer) public override string ResetPassword (string username, string answer)
{ {
int rowsAffected = 0; int rowsAffected = 0;
@ -818,7 +924,10 @@ namespace Npgsql.Web
// //
// MembershipProvider.UpdateUser // MembershipProvider.UpdateUser
// //
/// <summary>
/// Updates the user.
/// </summary>
/// <param name="user">User.</param>
public override void UpdateUser (MembershipUser user) public override void UpdateUser (MembershipUser user)
{ {
using (NpgsqlConnection conn = new NpgsqlConnection (connectionString)) { using (NpgsqlConnection conn = new NpgsqlConnection (connectionString)) {
@ -842,7 +951,13 @@ namespace Npgsql.Web
// //
// MembershipProvider.ValidateUser // MembershipProvider.ValidateUser
// //
/// <Docs>To be added.</Docs>
/// <summary>
/// Validates the user.
/// </summary>
/// <returns><c>true</c>, if user was validated, <c>false</c> otherwise.</returns>
/// <param name="username">Username.</param>
/// <param name="password">Password.</param>
public override bool ValidateUser (string username, string password) public override bool ValidateUser (string username, string password)
{ {
bool isValid = false; bool isValid = false;
@ -1022,7 +1137,12 @@ namespace Npgsql.Web
// CheckPassword // CheckPassword
// Compares password values based on the MembershipPasswordFormat. // Compares password values based on the MembershipPasswordFormat.
// //
/// <summary>
/// Checks the password.
/// </summary>
/// <returns><c>true</c>, if password was checked, <c>false</c> otherwise.</returns>
/// <param name="password">Password.</param>
/// <param name="dbpassword">Dbpassword.</param>
private bool CheckPassword (string password, string dbpassword) private bool CheckPassword (string password, string dbpassword)
{ {
string pass1 = password; string pass1 = password;
@ -1049,7 +1169,11 @@ namespace Npgsql.Web
// EncodePassword // EncodePassword
// Encrypts, Hashes, or leaves the password clear based on the PasswordFormat. // Encrypts, Hashes, or leaves the password clear based on the PasswordFormat.
// //
/// <summary>
/// Encodes the password.
/// </summary>
/// <returns>The password.</returns>
/// <param name="password">Password.</param>
private string EncodePassword (string password) private string EncodePassword (string password)
{ {
string encodedPassword = password; string encodedPassword = password;
@ -1118,7 +1242,16 @@ namespace Npgsql.Web
// //
// MembershipProvider.FindUsersByName // MembershipProvider.FindUsersByName
// //
/// <Docs>To be added.</Docs>
/// <param name="pageSize">To be added.</param>
/// <summary>
/// Finds user by their name.
/// The name can use wilcards : % or ? (used in a Npgsql LIKE clause)
/// </summary>
/// <returns>An user's MembershipUser collection taching that name ...</returns>
/// <param name="usernameToMatch">Username to match.</param>
/// <param name="pageIndex">Page index.</param>
/// <param name="totalRecords">Total records.</param>
public override MembershipUserCollection FindUsersByName (string usernameToMatch, int pageIndex, int pageSize, out int totalRecords) public override MembershipUserCollection FindUsersByName (string usernameToMatch, int pageIndex, int pageSize, out int totalRecords)
{ {
MembershipUserCollection users = new MembershipUserCollection (); MembershipUserCollection users = new MembershipUserCollection ();
@ -1168,6 +1301,16 @@ namespace Npgsql.Web
// MembershipProvider.FindUsersByEmail // MembershipProvider.FindUsersByEmail
// //
/// <Docs>To be added.</Docs>
/// <param name="pageSize">To be added.</param>
/// <summary>
/// To be added.
/// </summary>
/// <remarks>To be added.</remarks>
/// <returns>The users by email.</returns>
/// <param name="emailToMatch">Email to match.</param>
/// <param name="pageIndex">Page index.</param>
/// <param name="totalRecords">Total records.</param>
public override MembershipUserCollection FindUsersByEmail (string emailToMatch, int pageIndex, int pageSize, out int totalRecords) public override MembershipUserCollection FindUsersByEmail (string emailToMatch, int pageIndex, int pageSize, out int totalRecords)
{ {
MembershipUserCollection users = new MembershipUserCollection (); MembershipUserCollection users = new MembershipUserCollection ();

@ -5,15 +5,25 @@ using Npgsql;
namespace Npgsql.Web namespace Npgsql.Web
{ {
/// <summary>
/// Npgsql profile provider.
/// </summary>
public class NpgsqlProfileProvider: ProfileProvider public class NpgsqlProfileProvider: ProfileProvider
{ {
private string connectionString; private string connectionString;
private string applicationName; private string applicationName;
/// <summary>
/// Initializes a new instance of the <see cref="Npgsql.Web.NpgsqlProfileProvider"/> class.
/// </summary>
public NpgsqlProfileProvider () public NpgsqlProfileProvider ()
{ {
} }
/// <summary>
/// Initialize the specified iname and config.
/// </summary>
/// <param name="iname">Iname.</param>
/// <param name="config">Config.</param>
public override void Initialize (string iname, System.Collections.Specialized.NameValueCollection config) public override void Initialize (string iname, System.Collections.Specialized.NameValueCollection config)
{ {
// get the // get the
@ -29,27 +39,61 @@ namespace Npgsql.Web
} }
#region implemented abstract members of System.Web.Profile.ProfileProvider #region implemented abstract members of System.Web.Profile.ProfileProvider
/// <summary>
/// Deletes the inactive profiles.
/// </summary>
/// <returns>The inactive profiles.</returns>
/// <param name="authenticationOption">Authentication option.</param>
/// <param name="userInactiveSinceDate">User inactive since date.</param>
public override int DeleteInactiveProfiles (ProfileAuthenticationOption authenticationOption, DateTime userInactiveSinceDate) public override int DeleteInactiveProfiles (ProfileAuthenticationOption authenticationOption, DateTime userInactiveSinceDate)
{ {
throw new System.NotImplementedException (); throw new System.NotImplementedException ();
} }
/// <summary>
/// Deletes the profiles.
/// </summary>
/// <returns>The profiles.</returns>
/// <param name="usernames">Usernames.</param>
public override int DeleteProfiles (string[] usernames) public override int DeleteProfiles (string[] usernames)
{ {
throw new System.NotImplementedException (); throw new System.NotImplementedException ();
} }
/// <summary>
/// Deletes the profiles.
/// </summary>
/// <returns>The profiles.</returns>
/// <param name="profiles">Profiles.</param>
public override int DeleteProfiles (ProfileInfoCollection profiles) public override int DeleteProfiles (ProfileInfoCollection profiles)
{ {
throw new System.NotImplementedException (); throw new System.NotImplementedException ();
} }
/// <Docs>To be added.</Docs>
/// <param name="userInactiveSinceDate">To be added.</param>
/// <param name="pageSize">To be added.</param>
/// <summary>
/// To be added.
/// </summary>
/// <remarks>To be added.</remarks>
/// <returns>The inactive profiles by user name.</returns>
/// <param name="authenticationOption">Authentication option.</param>
/// <param name="usernameToMatch">Username to match.</param>
/// <param name="pageIndex">Page index.</param>
/// <param name="totalRecords">Total records.</param>
public override ProfileInfoCollection FindInactiveProfilesByUserName (ProfileAuthenticationOption authenticationOption, string usernameToMatch, DateTime userInactiveSinceDate, int pageIndex, int pageSize, out int totalRecords) public override ProfileInfoCollection FindInactiveProfilesByUserName (ProfileAuthenticationOption authenticationOption, string usernameToMatch, DateTime userInactiveSinceDate, int pageIndex, int pageSize, out int totalRecords)
{ {
throw new System.NotImplementedException (); throw new System.NotImplementedException ();
} }
/// <Docs>To be added.</Docs>
/// <param name="pageIndex">To be added.</param>
/// <param name="totalRecords">To be added.</param>
/// <returns>To be added.</returns>
/// <since version=".NET 2.0"></since>
/// <summary>
/// Finds the name of the profiles by user.
/// </summary>
/// <param name="authenticationOption">Authentication option.</param>
/// <param name="usernameToMatch">Username to match.</param>
/// <param name="pageSize">Page size.</param>
public override ProfileInfoCollection FindProfilesByUserName (ProfileAuthenticationOption authenticationOption, string usernameToMatch, int pageIndex, int pageSize, out int totalRecords) public override ProfileInfoCollection FindProfilesByUserName (ProfileAuthenticationOption authenticationOption, string usernameToMatch, int pageIndex, int pageSize, out int totalRecords)
{ {
if (pageIndex < 0) if (pageIndex < 0)
@ -99,17 +143,41 @@ namespace Npgsql.Web
} }
return c; return c;
} }
/// <Docs>To be added.</Docs>
/// <param name="pageIndex">To be added.</param>
/// <param name="totalRecords">To be added.</param>
/// <returns>To be added.</returns>
/// <since version=".NET 2.0"></since>
/// <summary>
/// Gets all inactive profiles.
/// </summary>
/// <param name="authenticationOption">Authentication option.</param>
/// <param name="userInactiveSinceDate">User inactive since date.</param>
/// <param name="pageSize">Page size.</param>
public override ProfileInfoCollection GetAllInactiveProfiles (ProfileAuthenticationOption authenticationOption, DateTime userInactiveSinceDate, int pageIndex, int pageSize, out int totalRecords) public override ProfileInfoCollection GetAllInactiveProfiles (ProfileAuthenticationOption authenticationOption, DateTime userInactiveSinceDate, int pageIndex, int pageSize, out int totalRecords)
{ {
throw new System.NotImplementedException (); throw new System.NotImplementedException ();
} }
/// <Docs>To be added.</Docs>
/// <param name="pageSize">To be added.</param>
/// <summary>
/// To be added.
/// </summary>
/// <remarks>To be added.</remarks>
/// <returns>The all profiles.</returns>
/// <param name="authenticationOption">Authentication option.</param>
/// <param name="pageIndex">Page index.</param>
/// <param name="totalRecords">Total records.</param>
public override ProfileInfoCollection GetAllProfiles (ProfileAuthenticationOption authenticationOption, int pageIndex, int pageSize, out int totalRecords) public override ProfileInfoCollection GetAllProfiles (ProfileAuthenticationOption authenticationOption, int pageIndex, int pageSize, out int totalRecords)
{ {
throw new System.NotImplementedException (); throw new System.NotImplementedException ();
} }
/// <summary>
/// Gets the number of inactive profiles.
/// </summary>
/// <returns>The number of inactive profiles.</returns>
/// <param name="authenticationOption">Authentication option.</param>
/// <param name="userInactiveSinceDate">User inactive since date.</param>
public override int GetNumberOfInactiveProfiles (ProfileAuthenticationOption authenticationOption, DateTime userInactiveSinceDate) public override int GetNumberOfInactiveProfiles (ProfileAuthenticationOption authenticationOption, DateTime userInactiveSinceDate)
{ {
throw new System.NotImplementedException (); throw new System.NotImplementedException ();
@ -118,7 +186,12 @@ namespace Npgsql.Web
#endregion #endregion
#region implemented abstract members of System.Configuration.SettingsProvider #region implemented abstract members of System.Configuration.SettingsProvider
/// <summary>
/// Gets the property values.
/// </summary>
/// <returns>The property values.</returns>
/// <param name="context">Context.</param>
/// <param name="collection">Collection.</param>
public override SettingsPropertyValueCollection GetPropertyValues (SettingsContext context, SettingsPropertyCollection collection) public override SettingsPropertyValueCollection GetPropertyValues (SettingsContext context, SettingsPropertyCollection collection)
{ {
SettingsPropertyValueCollection c = new SettingsPropertyValueCollection (); SettingsPropertyValueCollection c = new SettingsPropertyValueCollection ();
@ -157,7 +230,11 @@ namespace Npgsql.Web
return c; return c;
} }
/// <summary>
/// Sets the property values.
/// </summary>
/// <param name="context">Context.</param>
/// <param name="collection">Collection.</param>
public override void SetPropertyValues (SettingsContext context, SettingsPropertyValueCollection collection) public override void SetPropertyValues (SettingsContext context, SettingsPropertyValueCollection collection)
{ {
// get the unique id of the profile // get the unique id of the profile
@ -220,7 +297,10 @@ namespace Npgsql.Web
} }
} }
} }
/// <summary>
/// Gets or sets the name of the application.
/// </summary>
/// <value>The name of the application.</value>
public override string ApplicationName { public override string ApplicationName {
get { get {
return applicationName; return applicationName;

@ -41,13 +41,33 @@ using System.Linq;
namespace Npgsql.Web namespace Npgsql.Web
{ {
/// <summary>
/// Npgsql role provider.
/// </summary>
public class NpgsqlRoleProvider: RoleProvider public class NpgsqlRoleProvider: RoleProvider
{ {
/// <summary>
/// The name.
/// </summary>
protected string name = "NpgsqlRoleProvider"; protected string name = "NpgsqlRoleProvider";
/// <summary>
/// The name of the connection string.
/// </summary>
protected string connectionStringName = "pgProvider"; protected string connectionStringName = "pgProvider";
/// <summary>
/// The name of the application.
/// </summary>
protected string applicationName = "/"; protected string applicationName = "/";
/// <summary>
/// The connection string.
/// </summary>
protected string connectionString = string.Empty; protected string connectionString = string.Empty;
/// <summary>
/// Initialize the specified iname and config.
/// </summary>
/// <param name="iname">Iname.</param>
/// <param name="config">Config.</param>
public override void Initialize (string iname, System.Collections.Specialized.NameValueCollection config) public override void Initialize (string iname, System.Collections.Specialized.NameValueCollection config)
{ {
try { try {
@ -82,6 +102,12 @@ namespace Npgsql.Web
} }
} }
/// <Docs>To be added.</Docs>
/// <summary>
/// Adds the users to roles.
/// </summary>
/// <param name="usernames">Usernames.</param>
/// <param name="roleNames">Role names.</param>
public override void AddUsersToRoles (string[] usernames, string[] roleNames) public override void AddUsersToRoles (string[] usernames, string[] roleNames)
{ {
if (usernames.Any (x => x == null) || roleNames.Any (x => x == null)) { if (usernames.Any (x => x == null) || roleNames.Any (x => x == null)) {
@ -113,6 +139,10 @@ namespace Npgsql.Web
} }
/// <summary>
/// Gets or sets the name of the application.
/// </summary>
/// <value>The name of the application.</value>
public override string ApplicationName { public override string ApplicationName {
get { get {
return applicationName; return applicationName;
@ -122,6 +152,11 @@ namespace Npgsql.Web
} }
} }
/// <Docs>To be added.</Docs>
/// <summary>
/// Creates the role.
/// </summary>
/// <param name="roleName">Role name.</param>
public override void CreateRole (string roleName) public override void CreateRole (string roleName)
{ {
if (roleName == null) if (roleName == null)
@ -148,6 +183,13 @@ namespace Npgsql.Web
} }
/// <Docs>To be added.</Docs>
/// <summary>
/// Deletes the role.
/// </summary>
/// <returns><c>true</c>, if role was deleted, <c>false</c> otherwise.</returns>
/// <param name="roleName">Role name.</param>
/// <param name="throwOnPopulatedRole">If set to <c>true</c> throw on populated role.</param>
public override bool DeleteRole (string roleName, bool throwOnPopulatedRole) public override bool DeleteRole (string roleName, bool throwOnPopulatedRole)
{ {
if (roleName == null) if (roleName == null)
@ -173,11 +215,23 @@ namespace Npgsql.Web
return true; return true;
} }
/// <summary>
/// Finds the users in role.
/// </summary>
/// <returns>The users in role.</returns>
/// <param name="roleName">Role name.</param>
/// <param name="usernameToMatch">Username to match.</param>
public override string[] FindUsersInRole (string roleName, string usernameToMatch) public override string[] FindUsersInRole (string roleName, string usernameToMatch)
{ {
return GetUsersInRole (roleName, usernameToMatch); return GetUsersInRole (roleName, usernameToMatch);
} }
/// <summary>
/// Gets the users in role.
/// </summary>
/// <returns>The users in role.</returns>
/// <param name="rolename">Rolename.</param>
/// <param name="usernameToMatch">Username to match.</param>
protected string[] GetUsersInRole (string rolename, string usernameToMatch) protected string[] GetUsersInRole (string rolename, string usernameToMatch)
{ {
if (rolename == null) if (rolename == null)
@ -206,6 +260,10 @@ namespace Npgsql.Web
} }
} }
/// <summary>
/// Gets all roles.
/// </summary>
/// <returns>The all roles.</returns>
public override string[] GetAllRoles () public override string[] GetAllRoles ()
{ {
using (var conn = new NpgsqlConnection(connectionString)) { using (var conn = new NpgsqlConnection(connectionString)) {
@ -227,6 +285,11 @@ namespace Npgsql.Web
} }
} }
/// <summary>
/// Gets the roles for user.
/// </summary>
/// <returns>The roles for user.</returns>
/// <param name="username">Username.</param>
public override string[] GetRolesForUser (string username) public override string[] GetRolesForUser (string username)
{ {
if (username == null) if (username == null)
@ -252,6 +315,13 @@ namespace Npgsql.Web
} }
} }
/// <Docs>To be added.</Docs>
/// <summary>
/// Gets the users in role.
/// </summary>
/// <returns>The users in role.</returns>
/// <param name="roleName">Role name.</param>
public override string[] GetUsersInRole (string roleName) public override string[] GetUsersInRole (string roleName)
{ {
if (string.IsNullOrEmpty (roleName)) if (string.IsNullOrEmpty (roleName))
@ -277,6 +347,13 @@ namespace Npgsql.Web
} }
} }
/// <Docs>To be added.</Docs>
/// <summary>
/// Determines whether this instance is user in role the specified username roleName.
/// </summary>
/// <returns><c>true</c> if this instance is user in role the specified username roleName; otherwise, <c>false</c>.</returns>
/// <param name="username">Username.</param>
/// <param name="roleName">Role name.</param>
public override bool IsUserInRole (string username, string roleName) public override bool IsUserInRole (string username, string roleName)
{ {
if (username == null || roleName == null) if (username == null || roleName == null)
@ -303,6 +380,12 @@ namespace Npgsql.Web
} }
/// <Docs>To be added.</Docs>
/// <summary>
/// Removes the users from roles.
/// </summary>
/// <param name="usernames">Usernames.</param>
/// <param name="roleNames">Role names.</param>
public override void RemoveUsersFromRoles (string[] usernames, string[] roleNames) public override void RemoveUsersFromRoles (string[] usernames, string[] roleNames)
{ {
if (usernames.Any (x => x == null) || roleNames.Any (x => x == null)) { if (usernames.Any (x => x == null) || roleNames.Any (x => x == null)) {
@ -333,6 +416,12 @@ namespace Npgsql.Web
} }
/// <Docs>Tests if a given role name exists.</Docs>
/// <summary>
/// Tests if a given role name exists.
/// </summary>
/// <returns><c>true</c>, if exists was roled, <c>false</c> otherwise.</returns>
/// <param name="roleName">Role name.</param>
public override bool RoleExists (string roleName) public override bool RoleExists (string roleName)
{ {
using (var conn = new NpgsqlConnection(connectionString)) { using (var conn = new NpgsqlConnection(connectionString)) {
@ -347,13 +436,21 @@ namespace Npgsql.Web
} }
} }
} }
/// <summary>
/// Gets the name of this provider,
/// should correspond to the item key
/// in the configuration collection of providers.
/// </summary>
/// <value>The name.</value>
public override string Name { public override string Name {
get { get {
return name; return name;
} }
} }
/// <summary>
/// Gets the description for this provider.
/// </summary>
/// <value>The description.</value>
public override string Description { public override string Description {
get { get {
return "PostgreSQL ASP.Net Role Provider class"; return "PostgreSQL ASP.Net Role Provider class";

@ -58,7 +58,6 @@
<None Include="catalog.xsd" /> <None Include="catalog.xsd" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Folder Include="Model\" />
<Folder Include="XmlImplementation\" /> <Folder Include="XmlImplementation\" />
<Folder Include="Tests\" /> <Folder Include="Tests\" />
</ItemGroup> </ItemGroup>

@ -7,6 +7,9 @@ using System.ComponentModel;
namespace Yavsc.WebControls namespace Yavsc.WebControls
{ {
/// <summary>
/// Result pages.
/// </summary>
[ [
AspNetHostingPermission (SecurityAction.Demand, AspNetHostingPermission (SecurityAction.Demand,
Level = AspNetHostingPermissionLevel.Minimal), Level = AspNetHostingPermissionLevel.Minimal),
@ -18,11 +21,18 @@ namespace Yavsc.WebControls
] ]
public class ResultPages: WebControl public class ResultPages: WebControl
{ {
/// <summary>
/// Initializes a new instance of the <see cref="Yavsc.WebControls.ResultPages"/> class.
/// </summary>
public ResultPages () public ResultPages ()
{ {
} }
/// <summary>
/// Gets or sets the results per page.
/// </summary>
/// <value>The results per page.</value>
[Bindable (true)] [Bindable (true)]
[DefaultValue(10)] [DefaultValue(10)]
public int ResultsPerPage { public int ResultsPerPage {
@ -35,6 +45,10 @@ namespace Yavsc.WebControls
} }
/// <summary>
/// Gets or sets the result count.
/// </summary>
/// <value>The result count.</value>
[Bindable (true)] [Bindable (true)]
[DefaultValue(0)] [DefaultValue(0)]
public int ResultCount { public int ResultCount {
@ -47,6 +61,10 @@ namespace Yavsc.WebControls
} }
} }
/// <summary>
/// Gets or sets the text.
/// </summary>
/// <value>The text.</value>
[Bindable (true)] [Bindable (true)]
[DefaultValue("Pages:")] [DefaultValue("Pages:")]
[Localizable(true)] [Localizable(true)]
@ -60,7 +78,11 @@ namespace Yavsc.WebControls
ViewState["Text"] = value; ViewState["Text"] = value;
} }
} }
/// <summary>
/// Gets or sets the action.
/// </summary>
/// <value>The action.</value>
[Bindable (true)] [Bindable (true)]
[DefaultValue("")] [DefaultValue("")]
public string Action { public string Action {
@ -75,6 +97,10 @@ namespace Yavsc.WebControls
} }
/// <summary>
/// Gets or sets the current page.
/// </summary>
/// <value>The current page.</value>
[Bindable (true)] [Bindable (true)]
[DefaultValue(0)] [DefaultValue(0)]
public int CurrentPage { public int CurrentPage {

@ -1,19 +1,12 @@
using System; using System;
namespace Yavsc.Model.FrontOffice namespace Yavsc.Model.FrontOffice.Billing
{ {
/// <summary> /// <summary>
/// Price. /// Price.
/// </summary> /// </summary>
public class Price: Scalar public class Price: Scalar
{ {
/// <summary>
/// Initializes a new instance of the <see cref="Yavsc.Model.FrontOffice.Price"/> class.
/// </summary>
public Price ()
{
}
decimal quantity; decimal quantity;
#region implemented abstract members of SalesCatalog.Value #region implemented abstract members of SalesCatalog.Value

@ -0,0 +1,40 @@
//
// ServiceForfait.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// Copyright (c) 2015 Paul Schneider
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.ComponentModel.DataAnnotations;
namespace Yavsc.Model.FrontOffice.Billing
{
/// <summary>
/// A set price.
/// </summary>
public class SetPrice: Price
{
/// <summary>
/// Gets or sets the minimum count.
/// </summary>
/// <value>The minimum count.</value>
[Range(0,int.MaxValue)]
public int MinCount { get; set; }
}
}

@ -1,4 +1,5 @@
using System; using System;
using Yavsc.Model.FrontOffice.Billing;
namespace Yavsc.Model.FrontOffice namespace Yavsc.Model.FrontOffice
{ {

@ -1,4 +1,5 @@
using System; using System;
using Yavsc.Model.FrontOffice.Billing;
namespace Yavsc.Model.FrontOffice namespace Yavsc.Model.FrontOffice
{ {
@ -19,6 +20,11 @@ namespace Yavsc.Model.FrontOffice
/// </summary> /// </summary>
/// <value>The hour price.</value> /// <value>The hour price.</value>
public Price HourPrice { get; set; } public Price HourPrice { get; set; }
/// <summary>
/// Gets or sets the set prices.
/// </summary>
/// <value>The set prices.</value>
public SetPrice[] SetPrices { get; set; }
#region implemented abstract members of Product #region implemented abstract members of Product
/// <summary> /// <summary>

@ -110,7 +110,6 @@
<Compile Include="FrontOffice\Catalog\Option.cs" /> <Compile Include="FrontOffice\Catalog\Option.cs" />
<Compile Include="FrontOffice\Catalog\Period.cs" /> <Compile Include="FrontOffice\Catalog\Period.cs" />
<Compile Include="FrontOffice\Catalog\PhysicalProduct.cs" /> <Compile Include="FrontOffice\Catalog\PhysicalProduct.cs" />
<Compile Include="FrontOffice\Catalog\Price.cs" />
<Compile Include="FrontOffice\Catalog\Product.cs" /> <Compile Include="FrontOffice\Catalog\Product.cs" />
<Compile Include="FrontOffice\Catalog\ProductCategory.cs" /> <Compile Include="FrontOffice\Catalog\ProductCategory.cs" />
<Compile Include="FrontOffice\Catalog\ProductImage.cs" /> <Compile Include="FrontOffice\Catalog\ProductImage.cs" />
@ -137,6 +136,8 @@
<Compile Include="Google\CalendarEntryList.cs" /> <Compile Include="Google\CalendarEntryList.cs" />
<Compile Include="FrontOffice\CommandStatus.cs" /> <Compile Include="FrontOffice\CommandStatus.cs" />
<Compile Include="FrontOffice\CommandSet.cs" /> <Compile Include="FrontOffice\CommandSet.cs" />
<Compile Include="FrontOffice\Catalog\Billing\SetPrice.cs" />
<Compile Include="FrontOffice\Catalog\Billing\Price.cs" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup> <ItemGroup>
@ -148,12 +149,13 @@
<Folder Include="Google\" /> <Folder Include="Google\" />
<Folder Include="FrontOffice\" /> <Folder Include="FrontOffice\" />
<Folder Include="FrontOffice\Catalog\" /> <Folder Include="FrontOffice\Catalog\" />
<Folder Include="FrontOffice\Catalog\Billing\" />
</ItemGroup> </ItemGroup>
<ProjectExtensions> <ProjectExtensions>
<MonoDevelop> <MonoDevelop>
<Properties> <Properties>
<Policies> <Policies>
<DotNetNamingPolicy DirectoryNamespaceAssociation="PrefixedFlat" ResourceNamePolicy="FileFormatDefault" /> <DotNetNamingPolicy DirectoryNamespaceAssociation="PrefixedHierarchical" ResourceNamePolicy="FileFormatDefault" />
</Policies> </Policies>
</Properties> </Properties>
</MonoDevelop> </MonoDevelop>

@ -9,18 +9,31 @@ using Yavsc.Model.FrontOffice;
namespace Yavsc namespace Yavsc
{ {
/// <summary>
/// Main class.
/// </summary>
public class MainClass public class MainClass
{ {
/// <summary>
/// Gets or sets the service URL.
/// </summary>
/// <value>The service URL.</value>
public static string ServiceUrl{ get; set; } public static string ServiceUrl{ get; set; }
/// <summary>
/// The entry point of the program, where the program control starts and ends.
/// </summary>
/// <param name="args">The command-line arguments.</param>
public static void Main(string [] args) public static void Main(string [] args)
{ {
foreach (string s in args) { foreach (string s in args) {
if (Uri.IsWellFormedUriString (s,UriKind.Absolute)) { if (Uri.IsWellFormedUriString (s,UriKind.Absolute)) {
// TODO create a client // TODO create command usage
ServiceUrl = s;
break;
} }
GetCatalog ();
} }
GetCatalog ();
} }
static HttpClient GetClient() static HttpClient GetClient()
{ {
@ -56,7 +69,10 @@ namespace Yavsc
Console.WriteLine("{0} ({1})", (int)response.StatusCode, response.ReasonPhrase); Console.WriteLine("{0} ({1})", (int)response.StatusCode, response.ReasonPhrase);
} }
} }
/// <summary>
/// Ups the load.
/// </summary>
/// <param name="fileName">File name.</param>
public void UpLoad(string fileName) public void UpLoad(string fileName)
{ {
using (var client = GetClient()) using (var client = GetClient())

Loading…