Skip to content

Commit

Permalink
Refactoring and update on dashboard module.
Browse files Browse the repository at this point in the history
  • Loading branch information
binodnp committed Dec 12, 2015
1 parent 0667294 commit 20741e8
Show file tree
Hide file tree
Showing 184 changed files with 1,181 additions and 965 deletions.
22 changes: 22 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Copyright (c) 2015 MixERP Inc. Pvt. Ltd.


Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:


The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.


THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
2 changes: 1 addition & 1 deletion src/Frapid.Web/Application/NPocoConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public static class NPocoConfig
{
public static void Register()
{
Provider.Setup(typeof(IPoco));
DbProvider.Setup(typeof(IPoco));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public async Task<ActionResult> FacebookSignInAsync(FacebookAccount account)
try
{
LoginResult result =
await auth.AuthenticateAsync(account, GetRemoteUser());
await auth.AuthenticateAsync(account, this.RemoteUser);
return OnAuthenticated(result);
}
catch (NpgsqlException)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public async Task<ActionResult> GoogleSignInAsync(GoogleAccount account)
{
GoogleAuthentication oauth = new GoogleAuthentication();
LoginResult result =
await oauth.AuthenticateAsync(account, GetRemoteUser());
await oauth.AuthenticateAsync(account, this.RemoteUser);
return OnAuthenticated(result);
}
catch (NpgsqlException)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public async Task<ActionResult> IndexAsync(ResetInfo model)
return Redirect("/");
}

model.Browser = GetRemoteUser().Browser;
model.IpAddress = GetRemoteUser().IpAddress;
model.Browser = this.RemoteUser.Browser;
model.IpAddress = this.RemoteUser.IpAddress;

if (DAL.Reset.HasActiveResetRequest(model.Email))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ public ActionResult Do(SignInInfo model)
return Redirect("/");
}

model.Browser = this.GetRemoteUser().Browser;
model.IpAddress = this.GetRemoteUser().IpAddress;
model.Browser = this.RemoteUser.Browser;
model.IpAddress = this.RemoteUser.IpAddress;

try
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ public async Task<ActionResult> PostAsync(Registration model)
throw new PasswordConfirmException("Passwords do not match.");
}

model.Browser = GetRemoteUser().Browser;
model.IpAddress = GetRemoteUser().IpAddress;
model.Browser = this.RemoteUser.Browser;
model.IpAddress = this.RemoteUser.IpAddress;

Mapper.CreateMap<Registration, DTO.Registration>();
DTO.Registration registration = Mapper.Map<DTO.Registration>(model);
Expand Down
25 changes: 13 additions & 12 deletions src/Frapid.Web/Areas/Frapid.Config/DataAccess/AccessType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Linq;
using Frapid.Configuration;
using Frapid.DataAccess;
using Frapid.DataAccess.Models;
using Frapid.DbPolicy;
using Frapid.Framework.Extensions;
using Npgsql;
Expand Down Expand Up @@ -315,7 +316,7 @@ public Frapid.Config.Entities.AccessType GetLast()
/// </summary>
/// <returns>Returns an enumerable custom field collection for the table config.access_types</returns>
/// <exception cref="UnauthorizedException">Thown when the application user does not have sufficient privilege to perform this action.</exception>
public IEnumerable<Frapid.DataAccess.CustomField> GetCustomFields(string resourceId)
public IEnumerable<Frapid.DataAccess.Models.CustomField> GetCustomFields(string resourceId)
{
if (string.IsNullOrWhiteSpace(this._Catalog))
{
Expand All @@ -339,21 +340,21 @@ public Frapid.Config.Entities.AccessType GetLast()
if (string.IsNullOrWhiteSpace(resourceId))
{
sql = "SELECT * FROM config.custom_field_definition_view WHERE table_name='config.access_types' ORDER BY field_order;";
return Factory.Get<Frapid.DataAccess.CustomField>(this._Catalog, sql);
return Factory.Get<Frapid.DataAccess.Models.CustomField>(this._Catalog, sql);
}

sql = "SELECT * from config.get_custom_field_definition('config.access_types'::text, @0::text) ORDER BY field_order;";
return Factory.Get<Frapid.DataAccess.CustomField>(this._Catalog, sql, resourceId);
return Factory.Get<Frapid.DataAccess.Models.CustomField>(this._Catalog, sql, resourceId);
}

/// <summary>
/// Displayfields provide a minimal name/value context for data binding the row collection of config.access_types.
/// </summary>
/// <returns>Returns an enumerable name and value collection for the table config.access_types</returns>
/// <exception cref="UnauthorizedException">Thown when the application user does not have sufficient privilege to perform this action.</exception>
public IEnumerable<Frapid.DataAccess.DisplayField> GetDisplayFields()
public IEnumerable<Frapid.DataAccess.Models.DisplayField> GetDisplayFields()
{
List<Frapid.DataAccess.DisplayField> displayFields = new List<Frapid.DataAccess.DisplayField>();
List<Frapid.DataAccess.Models.DisplayField> displayFields = new List<Frapid.DataAccess.Models.DisplayField>();

if (string.IsNullOrWhiteSpace(this._Catalog))
{
Expand Down Expand Up @@ -408,7 +409,7 @@ public Frapid.Config.Entities.AccessType GetLast()
/// <param name="accessType">The instance of "AccessType" class to insert or update.</param>
/// <param name="customFields">The custom field collection.</param>
/// <exception cref="UnauthorizedException">Thown when the application user does not have sufficient privilege to perform this action.</exception>
public object AddOrEdit(dynamic accessType, List<Frapid.DataAccess.CustomField> customFields)
public object AddOrEdit(dynamic accessType, List<Frapid.DataAccess.Models.CustomField> customFields)
{
if (string.IsNullOrWhiteSpace(this._Catalog))
{
Expand Down Expand Up @@ -675,10 +676,10 @@ public void Delete(int accessTypeId)
return Factory.Get<Frapid.Config.Entities.AccessType>(this._Catalog, sql, offset);
}

public List<Frapid.DataAccess.Filter> GetFilters(string catalog, string filterName)
public List<Frapid.DataAccess.Models.Filter> GetFilters(string catalog, string filterName)
{
const string sql = "SELECT * FROM config.filters WHERE object_name='config.access_types' AND lower(filter_name)=lower(@0);";
return Factory.Get<Frapid.DataAccess.Filter>(catalog, sql, filterName).ToList();
return Factory.Get<Frapid.DataAccess.Models.Filter>(catalog, sql, filterName).ToList();
}

/// <summary>
Expand All @@ -687,7 +688,7 @@ public void Delete(int accessTypeId)
/// <param name="filters">The list of filter conditions.</param>
/// <returns>Returns number of rows of "AccessType" class using the filter.</returns>
/// <exception cref="UnauthorizedException">Thown when the application user does not have sufficient privilege to perform this action.</exception>
public long CountWhere(List<Frapid.DataAccess.Filter> filters)
public long CountWhere(List<Frapid.DataAccess.Models.Filter> filters)
{
if (string.IsNullOrWhiteSpace(this._Catalog))
{
Expand Down Expand Up @@ -720,7 +721,7 @@ public long CountWhere(List<Frapid.DataAccess.Filter> filters)
/// <param name="filters">The list of filter conditions.</param>
/// <returns>Returns collection of "AccessType" class.</returns>
/// <exception cref="UnauthorizedException">Thown when the application user does not have sufficient privilege to perform this action.</exception>
public IEnumerable<Frapid.Config.Entities.AccessType> GetWhere(long pageNumber, List<Frapid.DataAccess.Filter> filters)
public IEnumerable<Frapid.Config.Entities.AccessType> GetWhere(long pageNumber, List<Frapid.DataAccess.Models.Filter> filters)
{
if (string.IsNullOrWhiteSpace(this._Catalog))
{
Expand Down Expand Up @@ -782,7 +783,7 @@ public long CountFiltered(string filterName)
}
}

List<Frapid.DataAccess.Filter> filters = this.GetFilters(this._Catalog, filterName);
List<Frapid.DataAccess.Models.Filter> filters = this.GetFilters(this._Catalog, filterName);
Sql sql = Sql.Builder.Append("SELECT COUNT(*) FROM config.access_types WHERE 1 = 1");
Frapid.DataAccess.FilterManager.AddFilters(ref sql, new Frapid.Config.Entities.AccessType(), filters);

Expand Down Expand Up @@ -816,7 +817,7 @@ public long CountFiltered(string filterName)
}
}

List<Frapid.DataAccess.Filter> filters = this.GetFilters(this._Catalog, filterName);
List<Frapid.DataAccess.Models.Filter> filters = this.GetFilters(this._Catalog, filterName);

long offset = (pageNumber - 1) * 10;
Sql sql = Sql.Builder.Append("SELECT * FROM config.access_types WHERE 1 = 1");
Expand Down
25 changes: 13 additions & 12 deletions src/Frapid.Web/Areas/Frapid.Config/DataAccess/App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Linq;
using Frapid.Configuration;
using Frapid.DataAccess;
using Frapid.DataAccess.Models;
using Frapid.DbPolicy;
using Frapid.Framework.Extensions;
using Npgsql;
Expand Down Expand Up @@ -315,7 +316,7 @@ public Frapid.Config.Entities.App GetLast()
/// </summary>
/// <returns>Returns an enumerable custom field collection for the table config.apps</returns>
/// <exception cref="UnauthorizedException">Thown when the application user does not have sufficient privilege to perform this action.</exception>
public IEnumerable<Frapid.DataAccess.CustomField> GetCustomFields(string resourceId)
public IEnumerable<Frapid.DataAccess.Models.CustomField> GetCustomFields(string resourceId)
{
if (string.IsNullOrWhiteSpace(this._Catalog))
{
Expand All @@ -339,21 +340,21 @@ public Frapid.Config.Entities.App GetLast()
if (string.IsNullOrWhiteSpace(resourceId))
{
sql = "SELECT * FROM config.custom_field_definition_view WHERE table_name='config.apps' ORDER BY field_order;";
return Factory.Get<Frapid.DataAccess.CustomField>(this._Catalog, sql);
return Factory.Get<Frapid.DataAccess.Models.CustomField>(this._Catalog, sql);
}

sql = "SELECT * from config.get_custom_field_definition('config.apps'::text, @0::text) ORDER BY field_order;";
return Factory.Get<Frapid.DataAccess.CustomField>(this._Catalog, sql, resourceId);
return Factory.Get<Frapid.DataAccess.Models.CustomField>(this._Catalog, sql, resourceId);
}

/// <summary>
/// Displayfields provide a minimal name/value context for data binding the row collection of config.apps.
/// </summary>
/// <returns>Returns an enumerable name and value collection for the table config.apps</returns>
/// <exception cref="UnauthorizedException">Thown when the application user does not have sufficient privilege to perform this action.</exception>
public IEnumerable<Frapid.DataAccess.DisplayField> GetDisplayFields()
public IEnumerable<Frapid.DataAccess.Models.DisplayField> GetDisplayFields()
{
List<Frapid.DataAccess.DisplayField> displayFields = new List<Frapid.DataAccess.DisplayField>();
List<Frapid.DataAccess.Models.DisplayField> displayFields = new List<Frapid.DataAccess.Models.DisplayField>();

if (string.IsNullOrWhiteSpace(this._Catalog))
{
Expand Down Expand Up @@ -408,7 +409,7 @@ public Frapid.Config.Entities.App GetLast()
/// <param name="app">The instance of "App" class to insert or update.</param>
/// <param name="customFields">The custom field collection.</param>
/// <exception cref="UnauthorizedException">Thown when the application user does not have sufficient privilege to perform this action.</exception>
public object AddOrEdit(dynamic app, List<Frapid.DataAccess.CustomField> customFields)
public object AddOrEdit(dynamic app, List<Frapid.DataAccess.Models.CustomField> customFields)
{
if (string.IsNullOrWhiteSpace(this._Catalog))
{
Expand Down Expand Up @@ -675,10 +676,10 @@ public void Delete(string appName)
return Factory.Get<Frapid.Config.Entities.App>(this._Catalog, sql, offset);
}

public List<Frapid.DataAccess.Filter> GetFilters(string catalog, string filterName)
public List<Frapid.DataAccess.Models.Filter> GetFilters(string catalog, string filterName)
{
const string sql = "SELECT * FROM config.filters WHERE object_name='config.apps' AND lower(filter_name)=lower(@0);";
return Factory.Get<Frapid.DataAccess.Filter>(catalog, sql, filterName).ToList();
return Factory.Get<Frapid.DataAccess.Models.Filter>(catalog, sql, filterName).ToList();
}

/// <summary>
Expand All @@ -687,7 +688,7 @@ public void Delete(string appName)
/// <param name="filters">The list of filter conditions.</param>
/// <returns>Returns number of rows of "App" class using the filter.</returns>
/// <exception cref="UnauthorizedException">Thown when the application user does not have sufficient privilege to perform this action.</exception>
public long CountWhere(List<Frapid.DataAccess.Filter> filters)
public long CountWhere(List<Frapid.DataAccess.Models.Filter> filters)
{
if (string.IsNullOrWhiteSpace(this._Catalog))
{
Expand Down Expand Up @@ -720,7 +721,7 @@ public long CountWhere(List<Frapid.DataAccess.Filter> filters)
/// <param name="filters">The list of filter conditions.</param>
/// <returns>Returns collection of "App" class.</returns>
/// <exception cref="UnauthorizedException">Thown when the application user does not have sufficient privilege to perform this action.</exception>
public IEnumerable<Frapid.Config.Entities.App> GetWhere(long pageNumber, List<Frapid.DataAccess.Filter> filters)
public IEnumerable<Frapid.Config.Entities.App> GetWhere(long pageNumber, List<Frapid.DataAccess.Models.Filter> filters)
{
if (string.IsNullOrWhiteSpace(this._Catalog))
{
Expand Down Expand Up @@ -782,7 +783,7 @@ public long CountFiltered(string filterName)
}
}

List<Frapid.DataAccess.Filter> filters = this.GetFilters(this._Catalog, filterName);
List<Frapid.DataAccess.Models.Filter> filters = this.GetFilters(this._Catalog, filterName);
Sql sql = Sql.Builder.Append("SELECT COUNT(*) FROM config.apps WHERE 1 = 1");
Frapid.DataAccess.FilterManager.AddFilters(ref sql, new Frapid.Config.Entities.App(), filters);

Expand Down Expand Up @@ -816,7 +817,7 @@ public long CountFiltered(string filterName)
}
}

List<Frapid.DataAccess.Filter> filters = this.GetFilters(this._Catalog, filterName);
List<Frapid.DataAccess.Models.Filter> filters = this.GetFilters(this._Catalog, filterName);

long offset = (pageNumber - 1) * 10;
Sql sql = Sql.Builder.Append("SELECT * FROM config.apps WHERE 1 = 1");
Expand Down
Loading

0 comments on commit 20741e8

Please sign in to comment.