├── ExecuteAutoEmployee ├── Views │ ├── _ViewStart.cshtml │ ├── EmployeeDetails │ │ ├── _Contrib.cshtml │ │ ├── EmployeePF.cshtml │ │ ├── EmployeeBonus.cshtml │ │ └── Index.cshtml │ ├── Account │ │ ├── ExternalLoginFailure.cshtml │ │ ├── ForgotPasswordConfirmation.cshtml │ │ ├── ConfirmEmail.cshtml │ │ ├── ResetPasswordConfirmation.cshtml │ │ ├── SendCode.cshtml │ │ ├── ForgotPassword.cshtml │ │ ├── _ExternalLoginsListPartial.cshtml │ │ ├── VerifyCode.cshtml │ │ ├── ExternalLoginConfirmation.cshtml │ │ ├── ResetPassword.cshtml │ │ ├── Register.cshtml │ │ └── Login.cshtml │ ├── Home │ │ ├── About.cshtml │ │ ├── Contact.cshtml │ │ └── Index.cshtml │ ├── Shared │ │ ├── Error.cshtml │ │ ├── Lockout.cshtml │ │ ├── _LoginPartial.cshtml │ │ └── _Layout.cshtml │ ├── Benefit │ │ ├── Details.cshtml │ │ └── _Benefits.cshtml │ ├── Manage │ │ ├── AddPhoneNumber.cshtml │ │ ├── VerifyPhoneNumber.cshtml │ │ ├── SetPassword.cshtml │ │ ├── ChangePassword.cshtml │ │ ├── ManageLogins.cshtml │ │ └── Index.cshtml │ ├── Role │ │ └── Index.cshtml │ ├── Employee │ │ ├── Delete.cshtml │ │ ├── Index.cshtml │ │ ├── Create.cshtml │ │ └── Edit.cshtml │ └── Web.config ├── Global.asax ├── favicon.ico ├── Image │ └── eanewlogo.png ├── Scripts │ ├── _references.js │ ├── respond.min.js │ ├── jquery.validate.unobtrusive.min.js │ └── respond.js ├── fonts │ ├── glyphicons-halflings-regular.eot │ ├── glyphicons-halflings-regular.ttf │ └── glyphicons-halflings-regular.woff ├── Models │ ├── BasicBenefits.cs │ ├── AdditionalBenefits.cs │ ├── Benefits.cs │ ├── EmployeeDB.cs │ ├── Employee.cs │ ├── IdentityModels.cs │ ├── ManageViewModels.cs │ └── AccountViewModels.cs ├── App_Start │ ├── FilterConfig.cs │ ├── RouteConfig.cs │ ├── BundleConfig.cs │ ├── Startup.Auth.cs │ └── IdentityConfig.cs ├── Startup.cs ├── Service References │ └── PFServiceClient │ │ ├── Service1.disco │ │ ├── Service12.xsd │ │ ├── configuration.svcinfo │ │ ├── Reference.svcmap │ │ ├── Service1.xsd │ │ ├── Service11.xsd │ │ └── PFService.wsdl ├── Controllers │ ├── HomeController.cs │ ├── EmployeeDetailsController.cs │ ├── BenefitController.cs │ ├── EmployeeController.cs │ └── RoleController.cs ├── Global.asax.cs ├── Migrations │ ├── 201602180529368_InitialCreate.Designer.cs │ ├── 201602180529368_InitialCreate.cs │ ├── Configuration.cs │ └── 201602180529368_InitialCreate.resx ├── Web.Debug.config ├── Web.Release.config ├── Web.publishprofile.config ├── Properties │ └── AssemblyInfo.cs ├── Utility │ └── PFCalculator.cs ├── packages.config ├── Content │ └── Site.css ├── Project_Readme.html └── Web.config ├── PFServiceClient ├── Service1.svc ├── packages.config ├── EmployeeModel.cs ├── Employee.cs ├── IPFService.cs ├── Web.Debug.config ├── Web.Release.config ├── Properties │ └── AssemblyInfo.cs ├── Web.config ├── Service1.svc.cs └── PFServiceClient.csproj ├── Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll ├── DatabaseScript ├── EAEmployeeApp_Windows_Web_DatabaseScript.sql └── Readme.txt ├── azure-pipelines.yml ├── ExecuteAutoEmployee.sln ├── README.md ├── Microsoft.CodeDom.Providers.DotNetCompilerPlatform.xml └── .gitignore /ExecuteAutoEmployee/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "~/Views/Shared/_Layout.cshtml"; 3 | } 4 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Views/EmployeeDetails/_Contrib.cshtml: -------------------------------------------------------------------------------- 1 | @model ExecuteAutoEmployee.Models.Employee 2 | 3 | 4 | -------------------------------------------------------------------------------- /PFServiceClient/Service1.svc: -------------------------------------------------------------------------------- 1 | <%@ ServiceHost Language="C#" Debug="true" Service="PFServiceClient.PFService" CodeBehind="Service1.svc.cs" %> -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Codebehind="Global.asax.cs" Inherits="ExecuteAutoEmployee.MvcApplication" Language="C#" %> 2 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/executeautomation/ExecuteAutomationWebApp/HEAD/ExecuteAutoEmployee/favicon.ico -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Image/eanewlogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/executeautomation/ExecuteAutomationWebApp/HEAD/ExecuteAutoEmployee/Image/eanewlogo.png -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Scripts/_references.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/executeautomation/ExecuteAutomationWebApp/HEAD/ExecuteAutoEmployee/Scripts/_references.js -------------------------------------------------------------------------------- /PFServiceClient/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/executeautomation/ExecuteAutomationWebApp/HEAD/Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll -------------------------------------------------------------------------------- /ExecuteAutoEmployee/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/executeautomation/ExecuteAutomationWebApp/HEAD/ExecuteAutoEmployee/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /ExecuteAutoEmployee/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/executeautomation/ExecuteAutomationWebApp/HEAD/ExecuteAutoEmployee/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /DatabaseScript/EAEmployeeApp_Windows_Web_DatabaseScript.sql: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/executeautomation/ExecuteAutomationWebApp/HEAD/DatabaseScript/EAEmployeeApp_Windows_Web_DatabaseScript.sql -------------------------------------------------------------------------------- /ExecuteAutoEmployee/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/executeautomation/ExecuteAutomationWebApp/HEAD/ExecuteAutoEmployee/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /DatabaseScript/Readme.txt: -------------------------------------------------------------------------------- 1 | EAEmployeeApp_Windows_Web_DatabaseScript 2 | ************************************** 3 | 4 | This script can just be executed on SQL Server Management studio to create EmployeeDB used by the Application -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Views/Account/ExternalLoginFailure.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Login Failure"; 3 | } 4 | 5 |
6 |

@ViewBag.Title.

7 |

Unsuccessful login with service.

8 |
9 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Views/Home/About.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "About"; 3 | } 4 |

@ViewBag.Title.

5 | 6 |

ExecuteAutomation Employee Application v1.0 is a simple web application for showing very few functionality of Employee details.

7 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Views/Shared/Error.cshtml: -------------------------------------------------------------------------------- 1 | @model System.Web.Mvc.HandleErrorInfo 2 | 3 | @{ 4 | ViewBag.Title = "Error"; 5 | } 6 | 7 |

Error.

8 |

An error occurred while processing your request.

9 | 10 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Views/Shared/Lockout.cshtml: -------------------------------------------------------------------------------- 1 | @model System.Web.Mvc.HandleErrorInfo 2 | 3 | @{ 4 | ViewBag.Title = "Locked Out"; 5 | } 6 | 7 |
8 |

Locked out.

9 |

This account has been locked out, please try again later.

10 |
11 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Views/Account/ForgotPasswordConfirmation.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Forgot Password Confirmation"; 3 | } 4 | 5 |
6 |

@ViewBag.Title.

7 |
8 |
9 |

10 | Please check your email to reset your password. 11 |

12 |
13 | 14 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Models/BasicBenefits.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | 6 | namespace ExecuteAutoEmployee.Models 7 | { 8 | public class BasicBenefits 9 | { 10 | public int Id { get; set; } 11 | public string BenefitName { get; set; } 12 | } 13 | } -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Models/AdditionalBenefits.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | 6 | namespace ExecuteAutoEmployee.Models 7 | { 8 | public class AdditionalBenefits 9 | { 10 | public int Id { get; set; } 11 | public string BenefitName { get; set; } 12 | 13 | } 14 | } -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Views/Account/ConfirmEmail.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Confirm Email"; 3 | } 4 | 5 |

@ViewBag.Title.

6 |
7 |

8 | Thank you for confirming your email. Please @Html.ActionLink("Click here to Log in", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" }) 9 |

10 |
11 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/App_Start/FilterConfig.cs: -------------------------------------------------------------------------------- 1 | using System.Web; 2 | using System.Web.Mvc; 3 | 4 | namespace ExecuteAutoEmployee 5 | { 6 | public class FilterConfig 7 | { 8 | public static void RegisterGlobalFilters(GlobalFilterCollection filters) 9 | { 10 | filters.Add(new HandleErrorAttribute()); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Startup.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Owin; 2 | using Owin; 3 | 4 | [assembly: OwinStartupAttribute(typeof(ExecuteAutoEmployee.Startup))] 5 | namespace ExecuteAutoEmployee 6 | { 7 | public partial class Startup 8 | { 9 | public void Configuration(IAppBuilder app) 10 | { 11 | ConfigureAuth(app); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Service References/PFServiceClient/Service1.disco: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Views/Account/ResetPasswordConfirmation.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Reset password confirmation"; 3 | } 4 | 5 |
6 |

@ViewBag.Title.

7 |
8 |
9 |

10 | Your password has been reset. Please @Html.ActionLink("click here to log in", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" }) 11 |

12 |
13 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Models/Benefits.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | 6 | namespace ExecuteAutoEmployee.Models 7 | { 8 | public class Benefits 9 | { 10 | public int Id { get; set; } 11 | 12 | public virtual ICollection BasicBenefits { get; set; } 13 | 14 | public virtual ICollection AdditionalBenefits { get; set; } 15 | 16 | } 17 | } -------------------------------------------------------------------------------- /PFServiceClient/EmployeeModel.cs: -------------------------------------------------------------------------------- 1 | using System.Data.Entity; 2 | 3 | namespace PFServiceClient 4 | { 5 | public class EmployeeModel : DbContext 6 | { 7 | public EmployeeModel() 8 | : base("name=EmployeeModel") 9 | { 10 | } 11 | 12 | public virtual DbSet Employees { get; set; } 13 | 14 | protected override void OnModelCreating(DbModelBuilder modelBuilder) 15 | { 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Views/Home/Contact.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Contact"; 3 | } 4 |

@ViewBag.Title.

5 | 6 |
7 | ExecuteAutomation
8 | P: 9 | 012345678 10 |
11 | 12 |
13 | Support: karthik@techgeek.co.in
14 | Bugs: karthik@techgeek.co.in 15 |
-------------------------------------------------------------------------------- /ExecuteAutoEmployee/Models/EmployeeDB.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNet.Identity.EntityFramework; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Data.Entity; 5 | using System.Linq; 6 | using System.Web; 7 | 8 | namespace ExecuteAutoEmployee.Models 9 | { 10 | public class EmployeeDb : IdentityDbContext 11 | { 12 | public EmployeeDb() : base("name=EmployeeDb") 13 | { 14 | 15 | } 16 | 17 | public DbSet Employee { get; set; } 18 | public DbSet Benefits { get; set; } 19 | 20 | } 21 | } -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Views/Benefit/Details.cshtml: -------------------------------------------------------------------------------- 1 | @model ExecuteAutoEmployee.Models.Employee 2 | 3 | 4 | 5 | 6 | 7 | 8 | Details 9 | 10 | 11 |
12 |
13 |
14 | 15 |

Benefits Listed for @Model.Name

16 | 17 |

18 | @Html.Partial("_Benefits", Model.Benefits) 19 |

20 | 21 |

22 | @Html.ActionLink("Back to List", "Index", "Employee", null, null) 23 |

24 | 25 | 26 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Models/Employee.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | 6 | namespace ExecuteAutoEmployee.Models 7 | { 8 | public class Employee 9 | { 10 | public int Id { get; set; } 11 | 12 | public string Name { get; set; } 13 | 14 | public float Salary { get; set; } 15 | 16 | public int DurationWorked { get; set; } 17 | 18 | public int Grade { get; set; } 19 | 20 | public string Email { get; set; } 21 | 22 | public virtual ICollection Benefits { get; set; } 23 | 24 | } 25 | } -------------------------------------------------------------------------------- /PFServiceClient/Employee.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.DataAnnotations; 4 | using System.ComponentModel.DataAnnotations.Schema; 5 | using System.Data.Entity.Spatial; 6 | 7 | namespace PFServiceClient 8 | { 9 | public class Employee 10 | { 11 | public int Id { get; set; } 12 | 13 | public string Name { get; set; } 14 | 15 | public float Salary { get; set; } 16 | 17 | public int DurationWorked { get; set; } 18 | 19 | public int Grade { get; set; } 20 | 21 | public string Email { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/App_Start/RouteConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using System.Web.Routing; 7 | 8 | namespace ExecuteAutoEmployee 9 | { 10 | public class RouteConfig 11 | { 12 | public static void RegisterRoutes(RouteCollection routes) 13 | { 14 | routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 15 | 16 | routes.MapRoute( 17 | name: "Default", 18 | url: "{controller}/{action}/{id}", 19 | defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } 20 | ); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Controllers/HomeController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | 7 | namespace ExecuteAutoEmployee.Controllers 8 | { 9 | public class HomeController : Controller 10 | { 11 | public ActionResult Index() 12 | { 13 | return View(); 14 | } 15 | 16 | public ActionResult About() 17 | { 18 | ViewBag.Message = "Your application description page."; 19 | 20 | return View(); 21 | } 22 | 23 | public ActionResult Contact() 24 | { 25 | ViewBag.Message = "Your contact page."; 26 | 27 | return View(); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Views/Account/SendCode.cshtml: -------------------------------------------------------------------------------- 1 | @model ExecuteAutoEmployee.Models.SendCodeViewModel 2 | @{ 3 | ViewBag.Title = "Send"; 4 | } 5 | 6 |

@ViewBag.Title.

7 | 8 | @using (Html.BeginForm("SendCode", "Account", new { ReturnUrl = Model.ReturnUrl }, FormMethod.Post, new { @class = "form-horizontal", role = "form" })) { 9 | @Html.AntiForgeryToken() 10 | @Html.Hidden("rememberMe", @Model.RememberMe) 11 |

Send verification code

12 |
13 |
14 |
15 | Select Two-Factor Authentication Provider: 16 | @Html.DropDownListFor(model => model.SelectedProvider, Model.Providers) 17 | 18 |
19 |
20 | } 21 | 22 | @section Scripts { 23 | @Scripts.Render("~/bundles/jqueryval") 24 | } 25 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Views/Benefit/_Benefits.cshtml: -------------------------------------------------------------------------------- 1 | @model IEnumerable 2 | 3 | @foreach (var item in Model) 4 | { 5 |
Basic Benefits
6 |
7 | 8 | foreach (var basic in item.BasicBenefits) 9 | { 10 | 11 | 12 | 15 | 16 |
13 | @Html.DisplayFor(modelItem => basic.BenefitName) 14 |
17 | } 18 | 19 |
Additional Benefits
20 |
21 | 22 | foreach (var additional in item.AdditionalBenefits) 23 | { 24 | 25 | 26 | 29 | 30 |
27 | @Html.DisplayFor(modelItem => additional.BenefitName) 28 |
31 | } 32 | } 33 | -------------------------------------------------------------------------------- /PFServiceClient/IPFService.cs: -------------------------------------------------------------------------------- 1 | using System.ServiceModel; 2 | 3 | namespace PFServiceClient 4 | { 5 | // NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IService1" in both code and config file together. 6 | [ServiceContract] 7 | public interface IPFService 8 | { 9 | 10 | [OperationContract] 11 | bool IsPfEligible(Employee employee); 12 | 13 | [OperationContract] 14 | double? GetPfEmployeeContribSofar(Employee employee); 15 | 16 | [OperationContract] 17 | double? GetPfEmployerContribSofar(Employee employee); 18 | 19 | [OperationContract] 20 | bool IsPfEligibleWithId(int empId); 21 | 22 | [OperationContract] 23 | double? GetPfEmployerControlSofarWithId(int empId); 24 | 25 | [OperationContract] 26 | double? GetPfEmployeeControlSofarWithId(int empId); 27 | } 28 | 29 | 30 | } 31 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Global.asax.cs: -------------------------------------------------------------------------------- 1 | using ExecuteAutoEmployee.Migrations; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Data.Entity.Migrations; 5 | using System.Data.Entity.Migrations.Infrastructure; 6 | using System.Linq; 7 | using System.Web; 8 | using System.Web.Mvc; 9 | using System.Web.Optimization; 10 | using System.Web.Routing; 11 | 12 | namespace ExecuteAutoEmployee 13 | { 14 | public class MvcApplication : System.Web.HttpApplication 15 | { 16 | protected void Application_Start() 17 | { 18 | 19 | var migrator = new DbMigrator(new Configuration()); 20 | migrator.Update(); 21 | 22 | 23 | AreaRegistration.RegisterAllAreas(); 24 | FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); 25 | RouteConfig.RegisterRoutes(RouteTable.Routes); 26 | BundleConfig.RegisterBundles(BundleTable.Bundles); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Service References/PFServiceClient/Service12.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Migrations/201602180529368_InitialCreate.Designer.cs: -------------------------------------------------------------------------------- 1 | // 2 | namespace ExecuteAutoEmployee.Migrations 3 | { 4 | using System.CodeDom.Compiler; 5 | using System.Data.Entity.Migrations; 6 | using System.Data.Entity.Migrations.Infrastructure; 7 | using System.Resources; 8 | 9 | [GeneratedCode("EntityFramework.Migrations", "6.1.3-40302")] 10 | public sealed partial class InitialCreate : IMigrationMetadata 11 | { 12 | private readonly ResourceManager Resources = new ResourceManager(typeof(InitialCreate)); 13 | 14 | string IMigrationMetadata.Id 15 | { 16 | get { return "201602180529368_InitialCreate"; } 17 | } 18 | 19 | string IMigrationMetadata.Source 20 | { 21 | get { return null; } 22 | } 23 | 24 | string IMigrationMetadata.Target 25 | { 26 | get { return Resources.GetString("Target"); } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /azure-pipelines.yml: -------------------------------------------------------------------------------- 1 | # ASP.NET 2 | 3 | # Build and test ASP.NET projects. 4 | # Add steps that publish symbols, save build artifacts, deploy, and more: 5 | # https://docs.microsoft.com/azure/devops/pipelines/apps/aspnet/build-aspnet-4 6 | 7 | trigger: 8 | - master 9 | 10 | pool: 11 | vmImage: 'VS2017-Win2016' 12 | 13 | variables: 14 | solution: '**/*.sln' 15 | buildPlatform: 'Any CPU' 16 | buildConfiguration: 'Release' 17 | 18 | steps: 19 | - task: NuGetToolInstaller@0 20 | 21 | - task: NuGetCommand@2 22 | inputs: 23 | restoreSolution: '$(solution)' 24 | 25 | - task: VSBuild@1 26 | inputs: 27 | solution: '$(solution)' 28 | msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)"' 29 | platform: '$(buildPlatform)' 30 | configuration: '$(buildConfiguration)' 31 | 32 | - task: VSTest@2 33 | inputs: 34 | platform: '$(buildPlatform)' 35 | configuration: '$(buildConfiguration)' 36 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Views/Manage/AddPhoneNumber.cshtml: -------------------------------------------------------------------------------- 1 | @model ExecuteAutoEmployee.Models.AddPhoneNumberViewModel 2 | @{ 3 | ViewBag.Title = "Phone Number"; 4 | } 5 | 6 |

@ViewBag.Title.

7 | 8 | @using (Html.BeginForm("AddPhoneNumber", "Manage", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) 9 | { 10 | @Html.AntiForgeryToken() 11 |

Add a phone number

12 |
13 | @Html.ValidationSummary("", new { @class = "text-danger" }) 14 |
15 | @Html.LabelFor(m => m.Number, new { @class = "col-md-2 control-label" }) 16 |
17 | @Html.TextBoxFor(m => m.Number, new { @class = "form-control" }) 18 |
19 |
20 |
21 |
22 | 23 |
24 |
25 | } 26 | 27 | @section Scripts { 28 | @Scripts.Render("~/bundles/jqueryval") 29 | } 30 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Views/Shared/_LoginPartial.cshtml: -------------------------------------------------------------------------------- 1 | @using Microsoft.AspNet.Identity 2 | @if (Request.IsAuthenticated) 3 | { 4 | using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm", @class = "navbar-right" })) 5 | { 6 | @Html.AntiForgeryToken() 7 | 8 | 14 | } 15 | } 16 | else 17 | { 18 | 19 | //Just to mimic 20 | 24 | } 25 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Views/Account/ForgotPassword.cshtml: -------------------------------------------------------------------------------- 1 | @model ExecuteAutoEmployee.Models.ForgotPasswordViewModel 2 | @{ 3 | ViewBag.Title = "Forgot your password?"; 4 | } 5 | 6 |

@ViewBag.Title.

7 | 8 | @using (Html.BeginForm("ForgotPassword", "Account", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) 9 | { 10 | @Html.AntiForgeryToken() 11 |

Enter your email.

12 |
13 | @Html.ValidationSummary("", new { @class = "text-danger" }) 14 |
15 | @Html.LabelFor(m => m.Email, new { @class = "col-md-2 control-label" }) 16 |
17 | @Html.TextBoxFor(m => m.Email, new { @class = "form-control" }) 18 |
19 |
20 |
21 |
22 | 23 |
24 |
25 | } 26 | 27 | @section Scripts { 28 | @Scripts.Render("~/bundles/jqueryval") 29 | } 30 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Views/Manage/VerifyPhoneNumber.cshtml: -------------------------------------------------------------------------------- 1 | @model ExecuteAutoEmployee.Models.VerifyPhoneNumberViewModel 2 | @{ 3 | ViewBag.Title = "Verify Phone Number"; 4 | } 5 | 6 |

@ViewBag.Title.

7 | 8 | @using (Html.BeginForm("VerifyPhoneNumber", "Manage", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) 9 | { 10 | @Html.AntiForgeryToken() 11 | @Html.Hidden("phoneNumber", @Model.PhoneNumber) 12 |

Enter verification code

13 |
@ViewBag.Status
14 |
15 | @Html.ValidationSummary("", new { @class = "text-danger" }) 16 |
17 | @Html.LabelFor(m => m.Code, new { @class = "col-md-2 control-label" }) 18 |
19 | @Html.TextBoxFor(m => m.Code, new { @class = "form-control" }) 20 |
21 |
22 |
23 |
24 | 25 |
26 |
27 | } 28 | 29 | @section Scripts { 30 | @Scripts.Render("~/bundles/jqueryval") 31 | } 32 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Views/EmployeeDetails/EmployeePF.cshtml: -------------------------------------------------------------------------------- 1 | @model ExecuteAutoEmployee.Models.Employee 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | PF Contribution by @Model.Name 10 | 11 | 12 |

PF Contribution by @Model.Name

13 |
14 |
15 |
16 |
17 | @Html.Label("Employee Contribution") 18 |
19 | 20 |
21 | @ViewBag.EmployeeContrib 22 |
23 | 24 |
25 | @Html.DisplayNameFor(model => model.Salary) 26 |
27 | 28 |
29 | @Html.DisplayFor(model => model.Salary) 30 |
31 |
32 | @Html.DisplayNameFor(model => model.Grade) 33 |
34 | 35 |
36 | @Html.DisplayFor(model => model.Grade) 37 |
38 | 39 |
40 |
41 |

42 | @Html.ActionLink("Back to List", "Index") 43 |

44 | 45 | 46 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Views/EmployeeDetails/EmployeeBonus.cshtml: -------------------------------------------------------------------------------- 1 | @model ExecuteAutoEmployee.Models.Employee 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Company Contribution 10 | 11 | 12 |

PF Contribution for @Model.Name by Company

13 |
14 |
15 |
16 |
17 | @Html.Label("Company Contribution") 18 |
19 | 20 |
21 | @ViewBag.EmployerContrib 22 |
23 | 24 |
25 | @Html.DisplayNameFor(model => model.Salary) 26 |
27 | 28 |
29 | @Html.DisplayFor(model => model.Salary) 30 |
31 |
32 | @Html.DisplayNameFor(model => model.Grade) 33 |
34 | 35 |
36 | @Html.DisplayFor(model => model.Grade) 37 |
38 | 39 |
40 |
41 |

42 | @Html.ActionLink("Back to List", "Index") 43 |

44 | 45 | 46 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Views/Account/_ExternalLoginsListPartial.cshtml: -------------------------------------------------------------------------------- 1 | @model ExecuteAutoEmployee.Models.ExternalLoginListViewModel 2 | @using Microsoft.Owin.Security 3 | 4 |

Use another service to log in.

5 |
6 | @{ 7 | var loginProviders = Context.GetOwinContext().Authentication.GetExternalAuthenticationTypes(); 8 | if (loginProviders.Count() == 0) { 9 |
10 |

11 | There are no external authentication services configured. See this article 12 | for details on setting up this ASP.NET application to support logging in via external services. 13 |

14 |
15 | } 16 | else { 17 | using (Html.BeginForm("ExternalLogin", "Account", new { ReturnUrl = Model.ReturnUrl })) { 18 | @Html.AntiForgeryToken() 19 |
20 |

21 | @foreach (AuthenticationDescription p in loginProviders) { 22 | 23 | } 24 |

25 |
26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Models/IdentityModels.cs: -------------------------------------------------------------------------------- 1 | using System.Data.Entity; 2 | using System.Security.Claims; 3 | using System.Threading.Tasks; 4 | using Microsoft.AspNet.Identity; 5 | using Microsoft.AspNet.Identity.EntityFramework; 6 | 7 | namespace ExecuteAutoEmployee.Models 8 | { 9 | // You can add profile data for the user by adding more properties to your ApplicationUser class, please visit http://go.microsoft.com/fwlink/?LinkID=317594 to learn more. 10 | public class ApplicationUser : IdentityUser 11 | { 12 | public async Task GenerateUserIdentityAsync(UserManager manager) 13 | { 14 | // Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType 15 | var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie); 16 | // Add custom user claims here 17 | return userIdentity; 18 | } 19 | } 20 | 21 | public class ApplicationDbContext : IdentityDbContext 22 | { 23 | public ApplicationDbContext() 24 | : base("EmployeeDb", throwIfV1Schema: false) 25 | { 26 | } 27 | 28 | public static ApplicationDbContext Create() 29 | { 30 | return new ApplicationDbContext(); 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Views/EmployeeDetails/Index.cshtml: -------------------------------------------------------------------------------- 1 | @model IEnumerable 2 | 3 | 4 | 5 | 6 | 7 | 8 | Index 9 | 10 | 11 | 12 | 13 | 16 | 19 | 22 | 23 | 24 | 25 | @foreach (var item in Model) { 26 | 27 | 30 | 33 | 36 | 40 | 41 | } 42 | 43 |
14 | @Html.DisplayNameFor(model => model.Name) 15 | 17 | @Html.DisplayNameFor(model => model.Salary) 18 | 20 | @Html.DisplayNameFor(model => model.Grade) 21 |
28 | @Html.DisplayFor(modelItem => item.Name) 29 | 31 | @Html.DisplayFor(modelItem => item.Salary) 32 | 34 | @Html.DisplayFor(modelItem => item.Grade) 35 | 37 | @Html.ActionLink("EmployeePF", "EmployeePF", new { id=item.Id }) | 38 | @Html.ActionLink("EmployeeBonus", "EmployeeBonus", new { id=item.Id }) | 39 |
44 | 45 | 46 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Web.Debug.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 17 | 18 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/App_Start/BundleConfig.cs: -------------------------------------------------------------------------------- 1 | using System.Web; 2 | using System.Web.Optimization; 3 | 4 | namespace ExecuteAutoEmployee 5 | { 6 | public class BundleConfig 7 | { 8 | // For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862 9 | public static void RegisterBundles(BundleCollection bundles) 10 | { 11 | bundles.Add(new ScriptBundle("~/bundles/jquery").Include( 12 | "~/Scripts/jquery-{version}.js")); 13 | 14 | bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include( 15 | "~/Scripts/jquery.validate*")); 16 | 17 | // Use the development version of Modernizr to develop with and learn from. Then, when you're 18 | // ready for production, use the build tool at http://modernizr.com to pick only the tests you need. 19 | bundles.Add(new ScriptBundle("~/bundles/modernizr").Include( 20 | "~/Scripts/modernizr-*")); 21 | 22 | bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include( 23 | "~/Scripts/bootstrap.js", 24 | "~/Scripts/respond.js")); 25 | 26 | bundles.Add(new StyleBundle("~/Content/css").Include( 27 | "~/Content/bootstrap.css", 28 | "~/Content/site.css")); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /PFServiceClient/Web.Debug.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 17 | 18 | 29 | 30 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Web.Release.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 17 | 18 | 19 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Views/Account/VerifyCode.cshtml: -------------------------------------------------------------------------------- 1 | @model ExecuteAutoEmployee.Models.VerifyCodeViewModel 2 | @{ 3 | ViewBag.Title = "Verify"; 4 | } 5 | 6 |

@ViewBag.Title.

7 | 8 | @using (Html.BeginForm("VerifyCode", "Account", new { ReturnUrl = Model.ReturnUrl }, FormMethod.Post, new { @class = "form-horizontal", role = "form" })) { 9 | @Html.AntiForgeryToken() 10 | @Html.Hidden("provider", @Model.Provider) 11 | @Html.Hidden("rememberMe", @Model.RememberMe) 12 |

Enter verification code

13 |
14 | @Html.ValidationSummary("", new { @class = "text-danger" }) 15 |
16 | @Html.LabelFor(m => m.Code, new { @class = "col-md-2 control-label" }) 17 |
18 | @Html.TextBoxFor(m => m.Code, new { @class = "form-control" }) 19 |
20 |
21 |
22 |
23 |
24 | @Html.CheckBoxFor(m => m.RememberBrowser) 25 | @Html.LabelFor(m => m.RememberBrowser) 26 |
27 |
28 |
29 |
30 |
31 | 32 |
33 |
34 | } 35 | 36 | @section Scripts { 37 | @Scripts.Render("~/bundles/jqueryval") 38 | } 39 | -------------------------------------------------------------------------------- /PFServiceClient/Web.Release.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 17 | 18 | 19 | 30 | 31 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Web.publishprofile.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 17 | 18 | 19 | 30 | 31 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Views/Manage/SetPassword.cshtml: -------------------------------------------------------------------------------- 1 | @model ExecuteAutoEmployee.Models.SetPasswordViewModel 2 | @{ 3 | ViewBag.Title = "Create Password"; 4 | } 5 | 6 |

@ViewBag.Title.

7 |

8 | You do not have a local username/password for this site. Add a local 9 | account so you can log in without an external login. 10 |

11 | 12 | @using (Html.BeginForm("SetPassword", "Manage", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) 13 | { 14 | @Html.AntiForgeryToken() 15 | 16 |

Create Local Login

17 |
18 | @Html.ValidationSummary("", new { @class = "text-danger" }) 19 |
20 | @Html.LabelFor(m => m.NewPassword, new { @class = "col-md-2 control-label" }) 21 |
22 | @Html.PasswordFor(m => m.NewPassword, new { @class = "form-control" }) 23 |
24 |
25 |
26 | @Html.LabelFor(m => m.ConfirmPassword, new { @class = "col-md-2 control-label" }) 27 |
28 | @Html.PasswordFor(m => m.ConfirmPassword, new { @class = "form-control" }) 29 |
30 |
31 |
32 |
33 | 34 |
35 |
36 | } 37 | @section Scripts { 38 | @Scripts.Render("~/bundles/jqueryval") 39 | } -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Views/Account/ExternalLoginConfirmation.cshtml: -------------------------------------------------------------------------------- 1 | @model ExecuteAutoEmployee.Models.ExternalLoginConfirmationViewModel 2 | @{ 3 | ViewBag.Title = "Register"; 4 | } 5 |

@ViewBag.Title.

6 |

Associate your @ViewBag.LoginProvider account.

7 | 8 | @using (Html.BeginForm("ExternalLoginConfirmation", "Account", new { ReturnUrl = ViewBag.ReturnUrl }, FormMethod.Post, new { @class = "form-horizontal", role = "form" })) 9 | { 10 | @Html.AntiForgeryToken() 11 | 12 |

Association Form

13 |
14 | @Html.ValidationSummary(true, "", new { @class = "text-danger" }) 15 |

16 | You've successfully authenticated with @ViewBag.LoginProvider. 17 | Please enter a user name for this site below and click the Register button to finish 18 | logging in. 19 |

20 |
21 | @Html.LabelFor(m => m.Email, new { @class = "col-md-2 control-label" }) 22 |
23 | @Html.TextBoxFor(m => m.Email, new { @class = "form-control" }) 24 | @Html.ValidationMessageFor(m => m.Email, "", new { @class = "text-danger" }) 25 |
26 |
27 |
28 |
29 | 30 |
31 |
32 | } 33 | 34 | @section Scripts { 35 | @Scripts.Render("~/bundles/jqueryval") 36 | } 37 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Service References/PFServiceClient/configuration.svcinfo: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("ExecuteAutoEmployee")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("ExecuteAutoEmployee")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("34b85f26-ae8e-45a9-b2bf-ed29cc363fb5")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Revision and Build Numbers 33 | // by using the '*' as shown below: 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Views/Home/Index.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Home"; 3 | } 4 | 5 |
6 | 7 | 8 | 9 | 15 | 16 |
10 | 11 |

Employee App v1.0

12 |

Simplifying details !!!

13 | Visit now » 14 |
17 |
18 | 19 |
20 |
21 |

Features

22 |

23 | Employee App v1.0 features simple and intiuitve way of showing details of Employees within application 24 |

25 |

Learn more »

26 |
27 |
28 |

Who's Building?

29 |

ExecuteAutomation.com is building this application and the application is open-source and free !!!

30 |

Learn more »

31 |
32 |
33 |

Whats new in ExecuteAutomation?

34 |

Executeautomation.com now features more than 200+ free video tutorials on Selenium, Coded UI Testing, Specflow, Appium, TFS, Robotium

35 |

Learn more »

36 |
37 |
-------------------------------------------------------------------------------- /PFServiceClient/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("PFServiceClient")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("PFServiceClient")] 13 | [assembly: AssemblyCopyright("Copyright © 2016")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("fcbc09a8-ca90-419e-bcae-e47727be21a3")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Revision and Build Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Views/Manage/ChangePassword.cshtml: -------------------------------------------------------------------------------- 1 | @model ExecuteAutoEmployee.Models.ChangePasswordViewModel 2 | @{ 3 | ViewBag.Title = "Change Password"; 4 | } 5 | 6 |

@ViewBag.Title.

7 | 8 | @using (Html.BeginForm("ChangePassword", "Manage", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) 9 | { 10 | @Html.AntiForgeryToken() 11 |

Change Password Form

12 |
13 | @Html.ValidationSummary("", new { @class = "text-danger" }) 14 |
15 | @Html.LabelFor(m => m.OldPassword, new { @class = "col-md-2 control-label" }) 16 |
17 | @Html.PasswordFor(m => m.OldPassword, new { @class = "form-control" }) 18 |
19 |
20 |
21 | @Html.LabelFor(m => m.NewPassword, new { @class = "col-md-2 control-label" }) 22 |
23 | @Html.PasswordFor(m => m.NewPassword, new { @class = "form-control" }) 24 |
25 |
26 |
27 | @Html.LabelFor(m => m.ConfirmPassword, new { @class = "col-md-2 control-label" }) 28 |
29 | @Html.PasswordFor(m => m.ConfirmPassword, new { @class = "form-control" }) 30 |
31 |
32 |
33 |
34 | 35 |
36 |
37 | } 38 | @section Scripts { 39 | @Scripts.Render("~/bundles/jqueryval") 40 | } -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Views/Account/ResetPassword.cshtml: -------------------------------------------------------------------------------- 1 | @model ExecuteAutoEmployee.Models.ResetPasswordViewModel 2 | @{ 3 | ViewBag.Title = "Reset password"; 4 | } 5 | 6 |

@ViewBag.Title.

7 | 8 | @using (Html.BeginForm("ResetPassword", "Account", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) 9 | { 10 | @Html.AntiForgeryToken() 11 |

Reset your password.

12 |
13 | @Html.ValidationSummary("", new { @class = "text-danger" }) 14 | @Html.HiddenFor(model => model.Code) 15 |
16 | @Html.LabelFor(m => m.Email, new { @class = "col-md-2 control-label" }) 17 |
18 | @Html.TextBoxFor(m => m.Email, new { @class = "form-control" }) 19 |
20 |
21 |
22 | @Html.LabelFor(m => m.Password, new { @class = "col-md-2 control-label" }) 23 |
24 | @Html.PasswordFor(m => m.Password, new { @class = "form-control" }) 25 |
26 |
27 |
28 | @Html.LabelFor(m => m.ConfirmPassword, new { @class = "col-md-2 control-label" }) 29 |
30 | @Html.PasswordFor(m => m.ConfirmPassword, new { @class = "form-control" }) 31 |
32 |
33 |
34 |
35 | 36 |
37 |
38 | } 39 | 40 | @section Scripts { 41 | @Scripts.Render("~/bundles/jqueryval") 42 | } 43 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Views/Role/Index.cshtml: -------------------------------------------------------------------------------- 1 | @model IEnumerable 2 | 3 | 4 | 5 | 6 | 7 | 8 | List of Users 9 | 10 | 11 |
12 |

List of Users

13 |
14 | 15 | 16 | 17 | 18 | 21 | 24 | 27 | 28 | 29 | 30 | @foreach (var users in Model) 31 | { 32 | using (Html.BeginForm("AssignRole", "Role")) 33 | { 34 | 35 | 39 | 42 | 45 | 48 | 49 | } 50 | 51 | } 52 |
19 | @Html.DisplayNameFor(model => model.UserName) 20 | 22 | @Html.DisplayNameFor(model => model.Email) 23 | 25 | @Html.DisplayNameFor(model => model.Roles) 26 |
36 | @Html.DisplayFor(modelItem => users.UserName) 37 | @Html.Hidden("userName", users.UserName) 38 | 40 | @Html.DisplayFor(modelItem => users.Email) 41 | 43 | @Html.DropDownList("RoleName", (IEnumerable)ViewBag.Roles, "Select Role") 44 | 46 | 47 |
53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25123.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExecuteAutoEmployee", "ExecuteAutoEmployee\ExecuteAutoEmployee.csproj", "{730CE45A-2B5C-486C-B266-0A1477E0B19B}" 7 | ProjectSection(ProjectDependencies) = postProject 8 | {FCBC09A8-CA90-419E-BCAE-E47727BE21A3} = {FCBC09A8-CA90-419E-BCAE-E47727BE21A3} 9 | EndProjectSection 10 | EndProject 11 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PFServiceClient", "PFServiceClient\PFServiceClient.csproj", "{FCBC09A8-CA90-419E-BCAE-E47727BE21A3}" 12 | EndProject 13 | Global 14 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 15 | Debug|Any CPU = Debug|Any CPU 16 | Release|Any CPU = Release|Any CPU 17 | EndGlobalSection 18 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 19 | {730CE45A-2B5C-486C-B266-0A1477E0B19B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 20 | {730CE45A-2B5C-486C-B266-0A1477E0B19B}.Debug|Any CPU.Build.0 = Debug|Any CPU 21 | {730CE45A-2B5C-486C-B266-0A1477E0B19B}.Release|Any CPU.ActiveCfg = Release|Any CPU 22 | {730CE45A-2B5C-486C-B266-0A1477E0B19B}.Release|Any CPU.Build.0 = Release|Any CPU 23 | {FCBC09A8-CA90-419E-BCAE-E47727BE21A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 24 | {FCBC09A8-CA90-419E-BCAE-E47727BE21A3}.Debug|Any CPU.Build.0 = Debug|Any CPU 25 | {FCBC09A8-CA90-419E-BCAE-E47727BE21A3}.Release|Any CPU.ActiveCfg = Release|Any CPU 26 | {FCBC09A8-CA90-419E-BCAE-E47727BE21A3}.Release|Any CPU.Build.0 = Release|Any CPU 27 | EndGlobalSection 28 | GlobalSection(SolutionProperties) = preSolution 29 | HideSolutionNode = FALSE 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Views/Account/Register.cshtml: -------------------------------------------------------------------------------- 1 | @model ExecuteAutoEmployee.Models.RegisterViewModel 2 | @{ 3 | ViewBag.Title = "Register"; 4 | } 5 | 6 |

@ViewBag.Title.

7 | 8 | @using (Html.BeginForm("Register", "Account", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) 9 | { 10 | @Html.AntiForgeryToken() 11 |

Create a new account.

12 |
13 | @Html.ValidationSummary("", new { @class = "text-danger" }) 14 |
15 | @Html.LabelFor(m => m.UserName, new { @class = "col-md-2 control-label" }) 16 |
17 | @Html.TextBoxFor(m => m.UserName, new { @class = "form-control" }) 18 |
19 |
20 |
21 | @Html.LabelFor(m => m.Password, new { @class = "col-md-2 control-label" }) 22 |
23 | @Html.PasswordFor(m => m.Password, new { @class = "form-control" }) 24 |
25 |
26 |
27 | @Html.LabelFor(m => m.ConfirmPassword, new { @class = "col-md-2 control-label" }) 28 |
29 | @Html.PasswordFor(m => m.ConfirmPassword, new { @class = "form-control" }) 30 |
31 |
32 |
33 | @Html.LabelFor(m => m.Email, new { @class = "col-md-2 control-label" }) 34 |
35 | @Html.TextBoxFor(m => m.Email, new { @class = "form-control" }) 36 |
37 |
38 |
39 |
40 | 41 |
42 |
43 | } 44 | 45 | @section Scripts { 46 | @Scripts.Render("~/bundles/jqueryval") 47 | } 48 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ExecuteAutomationWebApp 2 | This application is used for automating selenium and coded UI frameworks course 3 | 4 | #Automation framework development with Selenium C sharp 5 | https://www.udemy.com/framework-development-with-selenium-csharp-advanced 6 | 7 | #Advanced framework development with Coded UI Test 2015 8 | https://www.udemy.com/framework-development-with-cuit 9 | 10 | #How to Compile application ? 11 | All you have to do is 12 | 13 | 1. Clone the repo or download it 14 | 2. Open the project in Visual studio 2013/2015 15 | 3. Just build the project and run in any browser of your interest, the application will launch and ready for automation 16 | 17 | # Advanced Topic 18 | ##What will happen while building project 19 | The project will automatically create database for you in the default database server, since the connection string in Web.config is given as This 20 | ```xml 21 | 22 | 23 | 24 | ``` 25 | 26 | ## Troubleshooting 27 | If the database does not restore for some reasons, then run the database script located in DatabaseScript folder of the repo in SQL Server management studio 28 | 29 | ## ExecuteAutomation Employee App running on public Server 30 | We have deployed ExecuteAutomation Employee App running in public server and it can be accessed from here http://eaapp.somee.com/ 31 | 32 | ### Connection string details 33 | 34 | ```xml 35 | workstation id=EAEmployeeDB.mssql.somee.com;packet size=4096;user id=kartmcad_SQLLogin_1;pwd=wtzaxoan1l;data source=EAEmployeeDB.mssql.somee.com;persist security info=False;initial catalog=EAEmployeeDB 36 | ``` 37 | 38 | ## More articles 39 | For more articles visit http://www.executeautomation.com 40 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Utility/PFCalculator.cs: -------------------------------------------------------------------------------- 1 | using ExecuteAutoEmployee.Models; 2 | using System.Linq; 3 | 4 | namespace ExecuteAutoEmployee.Utility 5 | { 6 | public class PFCalculator 7 | { 8 | 9 | //Get the database 10 | EmployeeDb _employeeDb = new EmployeeDb(); 11 | 12 | 13 | public double? GetPfEmployeeContribSofar(Employee employee) 14 | { 15 | double? salary; 16 | int? totalDuration; 17 | 18 | salary = employee.Salary; 19 | 20 | totalDuration = employee.DurationWorked; 21 | 22 | //Salary * 18% of basic (considering basic as 30% of salary) 23 | 24 | //Basic salary 25 | var basic = (salary * 30) / 100; 26 | 27 | //12% of basic 28 | var contribution = (basic * 18) / 100; 29 | 30 | return (contribution * totalDuration); 31 | 32 | 33 | } 34 | 35 | public double? GetPfEmployerContribSofar(Employee employee) 36 | { 37 | double? salary; 38 | int? totalDuration; 39 | 40 | salary = employee.Salary; 41 | 42 | totalDuration = employee.DurationWorked; 43 | //Salary * 12% of basic (considering basic as 30% of salary) 44 | 45 | //Basic salary 46 | var basic = (salary * 30) / 100; 47 | 48 | //12% of basic 49 | var contribution = (basic * 12) / 100; 50 | 51 | return (contribution * totalDuration); 52 | } 53 | 54 | public bool IsPfEligible(int empId) 55 | { 56 | double? salary; 57 | salary = _employeeDb.Employee.Where(x => x.Id == empId).Select(x => x.Salary).FirstOrDefault(); 58 | 59 | if (salary >= 4000) 60 | return true; 61 | else 62 | return false; 63 | } 64 | } 65 | } -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Views/Employee/Delete.cshtml: -------------------------------------------------------------------------------- 1 | @model ExecuteAutoEmployee.Models.Employee 2 | 3 | 4 | 5 | 6 | 7 | 8 | Delete 9 | 10 | 11 |

Are you sure you want to delete @Model.Name ?

12 |
13 |
14 |
15 |
16 | @Html.DisplayNameFor(model => model.Name) 17 |
18 | 19 |
20 | @Html.DisplayFor(model => model.Name) 21 |
22 | 23 |
24 | @Html.DisplayNameFor(model => model.Salary) 25 |
26 | 27 |
28 | @Html.DisplayFor(model => model.Salary) 29 |
30 | 31 |
32 | @Html.DisplayNameFor(model => model.DurationWorked) 33 |
34 | 35 |
36 | @Html.DisplayFor(model => model.DurationWorked) 37 |
38 | 39 |
40 | @Html.DisplayNameFor(model => model.Grade) 41 |
42 | 43 |
44 | @Html.DisplayFor(model => model.Grade) 45 |
46 | 47 |
48 | @Html.DisplayNameFor(model => model.Email) 49 |
50 | 51 |
52 | @Html.DisplayFor(model => model.Email) 53 |
54 | 55 |
56 | 57 | @using (Html.BeginForm()) { 58 | @Html.AntiForgeryToken() 59 | 60 |
61 | | 62 | @Html.ActionLink("Back to List", "Index") 63 |
64 | } 65 |
66 | 67 | 68 | -------------------------------------------------------------------------------- /Microsoft.CodeDom.Providers.DotNetCompilerPlatform.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Microsoft.CodeDom.Providers.DotNetCompilerPlatform 5 | 6 | 7 | 8 | 9 | Provides access to instances of the .NET Compiler Platform C# code generator and code compiler. 10 | 11 | 12 | 13 | 14 | Default Constructor 15 | 16 | 17 | 18 | 19 | Gets an instance of the .NET Compiler Platform C# code compiler. 20 | 21 | An instance of the .NET Compiler Platform C# code compiler 22 | 23 | 24 | 25 | Provides access to instances of the .NET Compiler Platform VB code generator and code compiler. 26 | 27 | 28 | 29 | 30 | Default Constructor 31 | 32 | 33 | 34 | 35 | Gets an instance of the .NET Compiler Platform VB code compiler. 36 | 37 | An instance of the .NET Compiler Platform VB code compiler 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Views/Web.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Views/Employee/Index.cshtml: -------------------------------------------------------------------------------- 1 | @model IEnumerable 2 | 3 |
4 | @if (Roles.IsUserInRole("Administrator")) 5 | { 6 | @Html.ActionLink("Create New", "Create", null, new { @class = "btn btn-primary", @style = "color:white, text-align:left" }) 7 | } 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 18 | 21 | 24 | 27 | 30 | 31 | 32 | 33 | @foreach (var item in Model) 34 | { 35 | 36 | 39 | 42 | 45 | 48 | 51 | 54 | 57 | 60 | 61 | } 62 | 63 |
16 | @Html.DisplayNameFor(model => model.Name) 17 | 19 | @Html.DisplayNameFor(model => model.Salary) 20 | 22 | @Html.DisplayNameFor(model => model.DurationWorked) 23 | 25 | @Html.DisplayNameFor(model => model.Grade) 26 | 28 | @Html.DisplayNameFor(model => model.Email) 29 |
37 | @Html.DisplayFor(modelItem => item.Name) 38 | 40 | @Html.DisplayFor(modelItem => item.Salary) 41 | 43 | @Html.DisplayFor(modelItem => item.DurationWorked) 44 | 46 | @Html.DisplayFor(modelItem => item.Grade) 47 | 49 | @Html.DisplayFor(modelItem => item.Email) 50 | 52 | @Html.ActionLink("Benefits", "Details", "Benefit", new { id = item.Id }, null) 53 | 55 | @Html.ActionLink("Edit", "Edit", new { id = item.Id }) 56 | 58 | @Html.ActionLink("Delete", "Delete", new { id = item.Id }) 59 |
64 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Views/Shared/_Layout.cshtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | @ViewBag.Title - Execute Automation Employee App 7 | @Styles.Render("~/Content/css") 8 | @Scripts.Render("~/bundles/modernizr") 9 | 10 | 11 | 12 | 40 |
41 | @RenderBody() 42 |
43 |
44 |

© @DateTime.Now.Year - Powered by ExecuteAutomation.com

45 |
46 |
47 | 48 | @Scripts.Render("~/bundles/jquery") 49 | @Scripts.Render("~/bundles/bootstrap") 50 | @RenderSection("scripts", required: false) 51 | 52 | 53 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Controllers/EmployeeDetailsController.cs: -------------------------------------------------------------------------------- 1 | using ExecuteAutoEmployee.Models; 2 | using ExecuteAutoEmployee.Utility; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Web; 7 | using System.Web.Mvc; 8 | 9 | namespace ExecuteAutoEmployee.Controllers 10 | { 11 | [Authorize(Roles = "Administrator,User")] 12 | public class EmployeeDetailsController : Controller 13 | { 14 | 15 | //Get the database 16 | EmployeeDb _employeeDb = new EmployeeDb(); 17 | 18 | PFServiceClient.PFServiceClient pfCalc = new PFServiceClient.PFServiceClient(); 19 | 20 | 21 | // GET: EmployeeDetails 22 | public ActionResult Index(string searchTerm = null) 23 | { 24 | var emp = _employeeDb.Employee.Where(x => searchTerm == null || x.Name.StartsWith(searchTerm)); 25 | return View(emp); 26 | } 27 | 28 | public ActionResult EmployeePF(int id) 29 | { 30 | var employee = _employeeDb.Employee.Find(id); 31 | //Convert to Service Employee 32 | var emp = ConvertToServiceEmp(employee); 33 | 34 | var contrib = pfCalc.GetPfEmployeeContribSofar(emp); 35 | ViewBag.EmployeeContrib = contrib; 36 | 37 | return View(employee); 38 | } 39 | 40 | 41 | public ActionResult EmployeeBonus(int id) 42 | { 43 | var employee = _employeeDb.Employee.Where(x => x.Id == id).FirstOrDefault(); 44 | 45 | //Convert to Service Employee 46 | var emp = ConvertToServiceEmp(employee); 47 | 48 | var contrib = pfCalc.GetPfEmployerContribSofar(emp); 49 | ViewBag.EmployerContrib = contrib; 50 | 51 | return View(employee); 52 | } 53 | 54 | public PFServiceClient.Employee ConvertToServiceEmp(Employee employee) 55 | { 56 | PFServiceClient.Employee emp = new PFServiceClient.Employee() 57 | { 58 | Name = employee.Name, 59 | Id = employee.Id, 60 | DurationWorked = employee.DurationWorked, 61 | Salary = employee.Salary 62 | }; 63 | 64 | return emp; 65 | } 66 | 67 | 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Service References/PFServiceClient/Reference.svcmap: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | false 5 | true 6 | true 7 | 8 | false 9 | false 10 | false 11 | 12 | 13 | true 14 | Auto 15 | true 16 | true 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Controllers/BenefitController.cs: -------------------------------------------------------------------------------- 1 | using ExecuteAutoEmployee.Models; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Web; 6 | using System.Web.Mvc; 7 | 8 | namespace ExecuteAutoEmployee.Controllers 9 | { 10 | public class BenefitController : Controller 11 | { 12 | 13 | //Get the database 14 | EmployeeDb _employeeDb = new EmployeeDb(); 15 | 16 | // GET: Benefit 17 | public ActionResult Index() 18 | { 19 | return View(); 20 | } 21 | 22 | // GET: Benefit/Details/5 23 | public ActionResult Details(int id) 24 | { 25 | var emp = _employeeDb.Employee.Find(id); 26 | return View(emp); 27 | } 28 | 29 | // GET: Benefit/Create 30 | public ActionResult Create() 31 | { 32 | return View(); 33 | } 34 | 35 | // POST: Benefit/Create 36 | [HttpPost] 37 | public ActionResult Create(FormCollection collection) 38 | { 39 | try 40 | { 41 | // TODO: Add insert logic here 42 | 43 | return RedirectToAction("Index"); 44 | } 45 | catch 46 | { 47 | return View(); 48 | } 49 | } 50 | 51 | // GET: Benefit/Edit/5 52 | public ActionResult Edit(int id) 53 | { 54 | return View(); 55 | } 56 | 57 | // POST: Benefit/Edit/5 58 | [HttpPost] 59 | public ActionResult Edit(int id, FormCollection collection) 60 | { 61 | try 62 | { 63 | // TODO: Add update logic here 64 | 65 | return RedirectToAction("Index"); 66 | } 67 | catch 68 | { 69 | return View(); 70 | } 71 | } 72 | 73 | // GET: Benefit/Delete/5 74 | public ActionResult Delete(int id) 75 | { 76 | return View(); 77 | } 78 | 79 | // POST: Benefit/Delete/5 80 | [HttpPost] 81 | public ActionResult Delete(int id, FormCollection collection) 82 | { 83 | try 84 | { 85 | // TODO: Add delete logic here 86 | 87 | return RedirectToAction("Index"); 88 | } 89 | catch 90 | { 91 | return View(); 92 | } 93 | } 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Service References/PFServiceClient/Service1.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /PFServiceClient/Web.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Controllers/EmployeeController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using ExecuteAutoEmployee.Models; 7 | using System.Data.Entity; 8 | 9 | namespace ExecuteAutoEmployee.Controllers 10 | { 11 | public class EmployeeController : Controller 12 | { 13 | //Get the database 14 | EmployeeDb _employeeDb = new EmployeeDb(); 15 | 16 | // GET: Employee 17 | public ActionResult Index(string searchTerm = null) 18 | { 19 | var emp = _employeeDb.Employee.Where(x => searchTerm == null || x.Name.StartsWith(searchTerm)); 20 | return View(emp); 21 | } 22 | 23 | // GET: Employee/Create 24 | public ActionResult Create() 25 | { 26 | return View(); 27 | } 28 | 29 | // POST: Employee/Create 30 | [HttpPost] 31 | [Authorize(Roles = "Administrator")] 32 | public ActionResult Create(Employee employee) 33 | { 34 | if(ModelState.IsValid) 35 | { 36 | _employeeDb.Employee.Add(employee); 37 | _employeeDb.SaveChanges(); 38 | return RedirectToAction("Index", new { id = employee.Id }); 39 | } 40 | 41 | return View(employee); 42 | } 43 | 44 | // GET: Employee/Edit/5 45 | [Authorize(Roles = "Administrator")] 46 | public ActionResult Edit(int id) 47 | { 48 | var employee = _employeeDb.Employee.FirstOrDefault(x => x.Id == id); 49 | return View(employee); 50 | } 51 | 52 | // POST: Employee/Edit/5 53 | [HttpPost] 54 | [Authorize(Roles = "Administrator")] 55 | public ActionResult Edit(Employee employee) 56 | { 57 | if (TryUpdateModel(employee)) 58 | { 59 | _employeeDb.Entry(employee).State = EntityState.Modified; 60 | _employeeDb.SaveChanges(); 61 | return RedirectToAction("Index", new { id = employee.Id }); 62 | } 63 | return View(employee); 64 | } 65 | 66 | // GET: Employee/Delete/5 67 | [Authorize(Roles = "Administrator")] 68 | public ActionResult Delete(int id) 69 | { 70 | var employee = _employeeDb.Employee.FirstOrDefault(x => x.Id == id); 71 | return View(employee); 72 | } 73 | 74 | // POST: Employee/Delete/5 75 | [HttpPost] 76 | [Authorize(Roles = "Administrator")] 77 | public ActionResult Delete(int id, Employee employee) 78 | { 79 | if (TryUpdateModel(employee)) 80 | { 81 | _employeeDb.Entry(employee).State = EntityState.Deleted; 82 | _employeeDb.SaveChanges(); 83 | return RedirectToAction("Index", new { id = employee.Id }); 84 | } 85 | return View(employee); 86 | } 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Models/ManageViewModels.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.ComponentModel.DataAnnotations; 3 | using Microsoft.AspNet.Identity; 4 | using Microsoft.Owin.Security; 5 | 6 | namespace ExecuteAutoEmployee.Models 7 | { 8 | public class IndexViewModel 9 | { 10 | public bool HasPassword { get; set; } 11 | public IList Logins { get; set; } 12 | public string PhoneNumber { get; set; } 13 | public bool TwoFactor { get; set; } 14 | public bool BrowserRemembered { get; set; } 15 | } 16 | 17 | public class ManageLoginsViewModel 18 | { 19 | public IList CurrentLogins { get; set; } 20 | public IList OtherLogins { get; set; } 21 | } 22 | 23 | public class FactorViewModel 24 | { 25 | public string Purpose { get; set; } 26 | } 27 | 28 | public class SetPasswordViewModel 29 | { 30 | [Required] 31 | [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)] 32 | [DataType(DataType.Password)] 33 | [Display(Name = "New password")] 34 | public string NewPassword { get; set; } 35 | 36 | [DataType(DataType.Password)] 37 | [Display(Name = "Confirm new password")] 38 | [Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")] 39 | public string ConfirmPassword { get; set; } 40 | } 41 | 42 | public class ChangePasswordViewModel 43 | { 44 | [Required] 45 | [DataType(DataType.Password)] 46 | [Display(Name = "Current password")] 47 | public string OldPassword { get; set; } 48 | 49 | [Required] 50 | [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)] 51 | [DataType(DataType.Password)] 52 | [Display(Name = "New password")] 53 | public string NewPassword { get; set; } 54 | 55 | [DataType(DataType.Password)] 56 | [Display(Name = "Confirm new password")] 57 | [Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")] 58 | public string ConfirmPassword { get; set; } 59 | } 60 | 61 | public class AddPhoneNumberViewModel 62 | { 63 | [Required] 64 | [Phone] 65 | [Display(Name = "Phone Number")] 66 | public string Number { get; set; } 67 | } 68 | 69 | public class VerifyPhoneNumberViewModel 70 | { 71 | [Required] 72 | [Display(Name = "Code")] 73 | public string Code { get; set; } 74 | 75 | [Required] 76 | [Phone] 77 | [Display(Name = "Phone Number")] 78 | public string PhoneNumber { get; set; } 79 | } 80 | 81 | public class ConfigureTwoFactorViewModel 82 | { 83 | public string SelectedProvider { get; set; } 84 | public ICollection Providers { get; set; } 85 | } 86 | } -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Views/Account/Login.cshtml: -------------------------------------------------------------------------------- 1 | @using ExecuteAutoEmployee.Models 2 | @model LoginViewModel 3 | @{ 4 | ViewBag.Title = "Log in"; 5 | } 6 | 7 |

@ViewBag.Title.

8 |
9 |
10 |
11 | @using (Html.BeginForm("Login", "Account", new { ReturnUrl = ViewBag.ReturnUrl }, FormMethod.Post, new { @class = "form-horizontal", role = "form" })) 12 | { 13 | @Html.AntiForgeryToken() 14 |

Use a local account to log in.

15 |
16 | @Html.ValidationSummary(true, "", new { @class = "text-danger" }) 17 |
18 | @*@Html.LabelFor(m => m.Email, new { @class = "col-md-2 control-label" }) 19 |
20 | @Html.TextBoxFor(m => m.Email, new { @class = "form-control" }) 21 | @Html.ValidationMessageFor(m => m.Email, "", new { @class = "text-danger" }) 22 |
*@ 23 | 24 | @Html.LabelFor(m => m.UserName, new { @class = "col-md-2 control-label" }) 25 |
26 | @Html.TextBoxFor(m => m.UserName, new { @class = "form-control" }) 27 | @Html.ValidationMessageFor(m => m.UserName, "", new { @class = "text-danger" }) 28 |
29 | 30 |
31 |
32 | @Html.LabelFor(m => m.Password, new { @class = "col-md-2 control-label" }) 33 |
34 | @Html.PasswordFor(m => m.Password, new { @class = "form-control" }) 35 | @Html.ValidationMessageFor(m => m.Password, "", new { @class = "text-danger" }) 36 |
37 |
38 |
39 |
40 |
41 | @Html.CheckBoxFor(m => m.RememberMe) 42 | @Html.LabelFor(m => m.RememberMe) 43 |
44 |
45 |
46 |
47 |
48 | 49 |
50 |
51 |

52 | @Html.ActionLink("Register as a new user", "Register") 53 |

54 | @* Enable this once you have account confirmation enabled for password reset functionality 55 |

56 | @Html.ActionLink("Forgot your password?", "ForgotPassword") 57 |

*@ 58 | } 59 |
60 |
61 |
62 | 63 | @section Scripts { 64 | @Scripts.Render("~/bundles/jqueryval") 65 | } -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Views/Manage/ManageLogins.cshtml: -------------------------------------------------------------------------------- 1 | @model ExecuteAutoEmployee.Models.ManageLoginsViewModel 2 | @using Microsoft.Owin.Security 3 | @{ 4 | ViewBag.Title = "Manage your external logins"; 5 | } 6 | 7 |

@ViewBag.Title.

8 | 9 |

@ViewBag.StatusMessage

10 | @{ 11 | var loginProviders = Context.GetOwinContext().Authentication.GetExternalAuthenticationTypes(); 12 | if (loginProviders.Count() == 0) { 13 |
14 |

15 | There are no external authentication services configured. See this article 16 | for details on setting up this ASP.NET application to support logging in via external services. 17 |

18 |
19 | } 20 | else 21 | { 22 | if (Model.CurrentLogins.Count > 0) 23 | { 24 |

Registered Logins

25 | 26 | 27 | @foreach (var account in Model.CurrentLogins) 28 | { 29 | 30 | 31 | 49 | 50 | } 51 | 52 |
@account.LoginProvider 32 | @if (ViewBag.ShowRemoveButton) 33 | { 34 | using (Html.BeginForm("RemoveLogin", "Manage")) 35 | { 36 | @Html.AntiForgeryToken() 37 |
38 | @Html.Hidden("loginProvider", account.LoginProvider) 39 | @Html.Hidden("providerKey", account.ProviderKey) 40 | 41 |
42 | } 43 | } 44 | else 45 | { 46 | @:   47 | } 48 |
53 | } 54 | if (Model.OtherLogins.Count > 0) 55 | { 56 | using (Html.BeginForm("LinkLogin", "Manage")) 57 | { 58 | @Html.AntiForgeryToken() 59 |
60 |

61 | @foreach (AuthenticationDescription p in Model.OtherLogins) 62 | { 63 | 64 | } 65 |

66 |
67 | } 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Views/Employee/Create.cshtml: -------------------------------------------------------------------------------- 1 | @model ExecuteAutoEmployee.Models.Employee 2 | 3 | 4 | 5 | 6 | 7 | 8 | Create new employee 9 | 10 | 11 | @using (Html.BeginForm()) 12 | { 13 | @Html.AntiForgeryToken() 14 | 15 |
16 |

Employee

17 |
18 | @Html.ValidationSummary(true, "", new { @class = "text-danger" }) 19 |
20 | @Html.LabelFor(model => model.Name, htmlAttributes: new { @class = "control-label col-md-2" }) 21 |
22 | @Html.EditorFor(model => model.Name, new { htmlAttributes = new { @class = "form-control" } }) 23 | @Html.ValidationMessageFor(model => model.Name, "", new { @class = "text-danger" }) 24 |
25 |
26 | 27 |
28 | @Html.LabelFor(model => model.Salary, htmlAttributes: new { @class = "control-label col-md-2" }) 29 |
30 | @Html.EditorFor(model => model.Salary, new { htmlAttributes = new { @class = "form-control" } }) 31 | @Html.ValidationMessageFor(model => model.Salary, "", new { @class = "text-danger" }) 32 |
33 |
34 | 35 |
36 | @Html.LabelFor(model => model.DurationWorked, htmlAttributes: new { @class = "control-label col-md-2" }) 37 |
38 | @Html.EditorFor(model => model.DurationWorked, new { htmlAttributes = new { @class = "form-control" } }) 39 | @Html.ValidationMessageFor(model => model.DurationWorked, "", new { @class = "text-danger" }) 40 |
41 |
42 | 43 |
44 | @Html.LabelFor(model => model.Grade, htmlAttributes: new { @class = "control-label col-md-2" }) 45 |
46 | @Html.EditorFor(model => model.Grade, new { htmlAttributes = new { @class = "form-control" } }) 47 | @Html.ValidationMessageFor(model => model.Grade, "", new { @class = "text-danger" }) 48 |
49 |
50 | 51 |
52 | @Html.LabelFor(model => model.Email, htmlAttributes: new { @class = "control-label col-md-2" }) 53 |
54 | @Html.EditorFor(model => model.Email, new { htmlAttributes = new { @class = "form-control" } }) 55 | @Html.ValidationMessageFor(model => model.Email, "", new { @class = "text-danger" }) 56 |
57 |
58 | 59 |
60 |
61 | 62 |
63 |
64 |
65 | } 66 | 67 |
68 | @Html.ActionLink("Back to List", "Index") 69 |
70 | 71 | 72 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Views/Manage/Index.cshtml: -------------------------------------------------------------------------------- 1 | @model ExecuteAutoEmployee.Models.IndexViewModel 2 | @{ 3 | ViewBag.Title = "Manage"; 4 | } 5 | 6 |

@ViewBag.Title.

7 | 8 |

@ViewBag.StatusMessage

9 |
10 |

Change your account settings

11 |
12 |
13 |
Password:
14 |
15 | [ 16 | @if (Model.HasPassword) 17 | { 18 | @Html.ActionLink("Change your password", "ChangePassword") 19 | } 20 | else 21 | { 22 | @Html.ActionLink("Create", "SetPassword") 23 | } 24 | ] 25 |
26 |
External Logins:
27 |
28 | @Model.Logins.Count [ 29 | @Html.ActionLink("Manage", "ManageLogins") ] 30 |
31 | @* 32 | Phone Numbers can used as a second factor of verification in a two-factor authentication system. 33 | 34 | See this article 35 | for details on setting up this ASP.NET application to support two-factor authentication using SMS. 36 | 37 | Uncomment the following block after you have set up two-factor authentication 38 | *@ 39 | @* 40 |
Phone Number:
41 |
42 | @(Model.PhoneNumber ?? "None") [ 43 | @if (Model.PhoneNumber != null) 44 | { 45 | @Html.ActionLink("Change", "AddPhoneNumber") 46 | @:  |  47 | @Html.ActionLink("Remove", "RemovePhoneNumber") 48 | } 49 | else 50 | { 51 | @Html.ActionLink("Add", "AddPhoneNumber") 52 | } 53 | ] 54 |
55 | *@ 56 |
Two-Factor Authentication:
57 |
58 |

59 | There are no two-factor authentication providers configured. See this article 60 | for details on setting up this ASP.NET application to support two-factor authentication. 61 |

62 | @*@if (Model.TwoFactor) 63 | { 64 | using (Html.BeginForm("DisableTwoFactorAuthentication", "Manage", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) 65 | { 66 | @Html.AntiForgeryToken() 67 | Enabled 68 | 69 | 70 | } 71 | } 72 | else 73 | { 74 | using (Html.BeginForm("EnableTwoFactorAuthentication", "Manage", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) 75 | { 76 | @Html.AntiForgeryToken() 77 | Disabled 78 | 79 | 80 | } 81 | }*@ 82 |
83 |
84 |
85 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Views/Employee/Edit.cshtml: -------------------------------------------------------------------------------- 1 | @model ExecuteAutoEmployee.Models.Employee 2 | 3 | 4 | 5 | 6 | 7 | 8 | Edit 9 | 10 | 11 | @using (Html.BeginForm()) 12 | { 13 | @Html.AntiForgeryToken() 14 | 15 |
16 |

Employee

17 |
18 | @Html.ValidationSummary(true, "", new { @class = "text-danger" }) 19 | @Html.HiddenFor(model => model.Id) 20 | 21 |
22 | @Html.LabelFor(model => model.Name, htmlAttributes: new { @class = "control-label col-md-2" }) 23 |
24 | @Html.EditorFor(model => model.Name, new { htmlAttributes = new { @class = "form-control" } }) 25 | @Html.ValidationMessageFor(model => model.Name, "", new { @class = "text-danger" }) 26 |
27 |
28 | 29 |
30 | @Html.LabelFor(model => model.Salary, htmlAttributes: new { @class = "control-label col-md-2" }) 31 |
32 | @Html.EditorFor(model => model.Salary, new { htmlAttributes = new { @class = "form-control" } }) 33 | @Html.ValidationMessageFor(model => model.Salary, "", new { @class = "text-danger" }) 34 |
35 |
36 | 37 |
38 | @Html.LabelFor(model => model.DurationWorked, htmlAttributes: new { @class = "control-label col-md-2" }) 39 |
40 | @Html.EditorFor(model => model.DurationWorked, new { htmlAttributes = new { @class = "form-control" } }) 41 | @Html.ValidationMessageFor(model => model.DurationWorked, "", new { @class = "text-danger" }) 42 |
43 |
44 | 45 |
46 | @Html.LabelFor(model => model.Grade, htmlAttributes: new { @class = "control-label col-md-2" }) 47 |
48 | @Html.EditorFor(model => model.Grade, new { htmlAttributes = new { @class = "form-control" } }) 49 | @Html.ValidationMessageFor(model => model.Grade, "", new { @class = "text-danger" }) 50 |
51 |
52 | 53 |
54 | @Html.LabelFor(model => model.Email, htmlAttributes: new { @class = "control-label col-md-2" }) 55 |
56 | @Html.EditorFor(model => model.Email, new { htmlAttributes = new { @class = "form-control" } }) 57 | @Html.ValidationMessageFor(model => model.Email, "", new { @class = "text-danger" }) 58 |
59 |
60 | 61 |
62 |
63 | 64 |
65 |
66 |
67 | } 68 | 69 |
70 | @Html.ActionLink("Back to List", "Index") 71 |
72 | 73 | 74 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/App_Start/Startup.Auth.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.AspNet.Identity; 3 | using Microsoft.AspNet.Identity.Owin; 4 | using Microsoft.Owin; 5 | using Microsoft.Owin.Security.Cookies; 6 | using Microsoft.Owin.Security.Google; 7 | using Owin; 8 | using ExecuteAutoEmployee.Models; 9 | 10 | namespace ExecuteAutoEmployee 11 | { 12 | public partial class Startup 13 | { 14 | // For more information on configuring authentication, please visit http://go.microsoft.com/fwlink/?LinkId=301864 15 | public void ConfigureAuth(IAppBuilder app) 16 | { 17 | // Configure the db context, user manager and signin manager to use a single instance per request 18 | app.CreatePerOwinContext(ApplicationDbContext.Create); 19 | app.CreatePerOwinContext(ApplicationUserManager.Create); 20 | app.CreatePerOwinContext(ApplicationSignInManager.Create); 21 | 22 | // Enable the application to use a cookie to store information for the signed in user 23 | // and to use a cookie to temporarily store information about a user logging in with a third party login provider 24 | // Configure the sign in cookie 25 | app.UseCookieAuthentication(new CookieAuthenticationOptions 26 | { 27 | AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie, 28 | LoginPath = new PathString("/Account/Login"), 29 | Provider = new CookieAuthenticationProvider 30 | { 31 | // Enables the application to validate the security stamp when the user logs in. 32 | // This is a security feature which is used when you change a password or add an external login to your account. 33 | OnValidateIdentity = SecurityStampValidator.OnValidateIdentity( 34 | validateInterval: TimeSpan.FromMinutes(30), 35 | regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager)) 36 | } 37 | }); 38 | app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie); 39 | 40 | // Enables the application to temporarily store user information when they are verifying the second factor in the two-factor authentication process. 41 | app.UseTwoFactorSignInCookie(DefaultAuthenticationTypes.TwoFactorCookie, TimeSpan.FromMinutes(5)); 42 | 43 | // Enables the application to remember the second login verification factor such as phone or email. 44 | // Once you check this option, your second step of verification during the login process will be remembered on the device where you logged in from. 45 | // This is similar to the RememberMe option when you log in. 46 | app.UseTwoFactorRememberBrowserCookie(DefaultAuthenticationTypes.TwoFactorRememberBrowserCookie); 47 | 48 | // Uncomment the following lines to enable logging in with third party login providers 49 | //app.UseMicrosoftAccountAuthentication( 50 | // clientId: "", 51 | // clientSecret: ""); 52 | 53 | //app.UseTwitterAuthentication( 54 | // consumerKey: "", 55 | // consumerSecret: ""); 56 | 57 | //app.UseFacebookAuthentication( 58 | // appId: "", 59 | // appSecret: ""); 60 | 61 | //app.UseGoogleAuthentication(new GoogleOAuth2AuthenticationOptions() 62 | //{ 63 | // ClientId = "", 64 | // ClientSecret = "" 65 | //}); 66 | } 67 | } 68 | } -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Controllers/RoleController.cs: -------------------------------------------------------------------------------- 1 | using ExecuteAutoEmployee.Models; 2 | using Microsoft.AspNet.Identity; 3 | using Microsoft.AspNet.Identity.EntityFramework; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Web; 8 | using System.Web.Mvc; 9 | 10 | namespace ExecuteAutoEmployee.Controllers 11 | { 12 | [Authorize(Roles = "Administrator")] 13 | public class RoleController : Controller 14 | { 15 | 16 | //Get the database 17 | EmployeeDb _employeeDb = new EmployeeDb(); 18 | 19 | // GET: Role 20 | public ActionResult Index() 21 | { 22 | //Do not display admin user inturn :) 23 | var Users = _employeeDb.Users.Where(x => x.UserName != "admin").ToList(); 24 | 25 | //Get all the Roles 26 | var list = _employeeDb.Roles.OrderBy(role => role.Name).ToList().Select(role => new SelectListItem { Value = role.Name.ToString(), Text = role.Name }).ToList(); 27 | ViewBag.Roles = list; 28 | 29 | return View(Users); 30 | } 31 | 32 | // GET: Role/Details/5 33 | public ActionResult AssignRole(string userName, string roleName) 34 | { 35 | ApplicationUser user = _employeeDb.Users.Where(usr => usr.UserName.Equals(userName, StringComparison.CurrentCultureIgnoreCase)).FirstOrDefault(); 36 | 37 | var userManager = new UserManager(new UserStore(_employeeDb)); 38 | 39 | 40 | if (user != null) 41 | { 42 | userManager.AddToRoleAsync(user.Id, roleName); 43 | 44 | ViewBag.ResultMessage = "Role created successfully !"; 45 | } 46 | else 47 | { 48 | ViewBag.ErrorMessage = "Sorry user is not available"; 49 | } 50 | 51 | 52 | return RedirectToAction("Index"); 53 | } 54 | 55 | // GET: Role/Create 56 | public ActionResult Create() 57 | { 58 | return View(); 59 | } 60 | 61 | // POST: Role/Create 62 | [HttpPost] 63 | public ActionResult Create(FormCollection collection) 64 | { 65 | try 66 | { 67 | // TODO: Add insert logic here 68 | 69 | return RedirectToAction("Index"); 70 | } 71 | catch 72 | { 73 | return View(); 74 | } 75 | } 76 | 77 | // GET: Role/Edit/5 78 | public ActionResult Edit(int id) 79 | { 80 | return View(); 81 | } 82 | 83 | // POST: Role/Edit/5 84 | [HttpPost] 85 | public ActionResult Edit(int id, FormCollection collection) 86 | { 87 | try 88 | { 89 | // TODO: Add update logic here 90 | 91 | return RedirectToAction("Index"); 92 | } 93 | catch 94 | { 95 | return View(); 96 | } 97 | } 98 | 99 | // GET: Role/Delete/5 100 | public ActionResult Delete(int id) 101 | { 102 | return View(); 103 | } 104 | 105 | // POST: Role/Delete/5 106 | [HttpPost] 107 | public ActionResult Delete(int id, FormCollection collection) 108 | { 109 | try 110 | { 111 | // TODO: Add delete logic here 112 | 113 | return RedirectToAction("Index"); 114 | } 115 | catch 116 | { 117 | return View(); 118 | } 119 | } 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Service References/PFServiceClient/Service11.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Models/AccountViewModels.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.ComponentModel.DataAnnotations; 3 | 4 | namespace ExecuteAutoEmployee.Models 5 | { 6 | public class ExternalLoginConfirmationViewModel 7 | { 8 | [Required] 9 | [Display(Name = "Email")] 10 | public string Email { get; set; } 11 | } 12 | 13 | public class ExternalLoginListViewModel 14 | { 15 | public string ReturnUrl { get; set; } 16 | } 17 | 18 | public class SendCodeViewModel 19 | { 20 | public string SelectedProvider { get; set; } 21 | public ICollection Providers { get; set; } 22 | public string ReturnUrl { get; set; } 23 | public bool RememberMe { get; set; } 24 | } 25 | 26 | public class VerifyCodeViewModel 27 | { 28 | [Required] 29 | public string Provider { get; set; } 30 | 31 | [Required] 32 | [Display(Name = "Code")] 33 | public string Code { get; set; } 34 | public string ReturnUrl { get; set; } 35 | 36 | [Display(Name = "Remember this browser?")] 37 | public bool RememberBrowser { get; set; } 38 | 39 | public bool RememberMe { get; set; } 40 | } 41 | 42 | public class ForgotViewModel 43 | { 44 | [Required] 45 | [Display(Name = "Email")] 46 | public string Email { get; set; } 47 | } 48 | 49 | public class LoginViewModel 50 | { 51 | //[Required] 52 | //[Display(Name = "Email")] 53 | //[EmailAddress] 54 | //public string Email { get; set; } 55 | 56 | [Required] 57 | [Display(Name = "UserName")] 58 | public string UserName { get; set; } 59 | 60 | [Required] 61 | [DataType(DataType.Password)] 62 | [Display(Name = "Password")] 63 | public string Password { get; set; } 64 | 65 | [Display(Name = "Remember me?")] 66 | public bool RememberMe { get; set; } 67 | } 68 | 69 | public class RegisterViewModel 70 | { 71 | [Required] 72 | [StringLength(10, ErrorMessage = "The {0} must be at least {2} charecters long.", MinimumLength = 6)] 73 | [Display(Name = "UserName")] 74 | public string UserName { get; set; } 75 | 76 | [Required] 77 | [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)] 78 | [DataType(DataType.Password)] 79 | [Display(Name = "Password")] 80 | public string Password { get; set; } 81 | 82 | [DataType(DataType.Password)] 83 | [Display(Name = "Confirm password")] 84 | [Compare("Password", ErrorMessage = "The password and confirmation password do not match.")] 85 | public string ConfirmPassword { get; set; } 86 | 87 | [Required] 88 | [Display(Name = "Email")] 89 | [EmailAddress] 90 | public string Email { get; set; } 91 | } 92 | 93 | public class ResetPasswordViewModel 94 | { 95 | [Required] 96 | [EmailAddress] 97 | [Display(Name = "Email")] 98 | public string Email { get; set; } 99 | 100 | [Required] 101 | [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)] 102 | [DataType(DataType.Password)] 103 | [Display(Name = "Password")] 104 | public string Password { get; set; } 105 | 106 | [DataType(DataType.Password)] 107 | [Display(Name = "Confirm password")] 108 | [Compare("Password", ErrorMessage = "The password and confirmation password do not match.")] 109 | public string ConfirmPassword { get; set; } 110 | 111 | public string Code { get; set; } 112 | } 113 | 114 | public class ForgotPasswordViewModel 115 | { 116 | [Required] 117 | [EmailAddress] 118 | [Display(Name = "Email")] 119 | public string Email { get; set; } 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /PFServiceClient/Service1.svc.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.Serialization; 5 | using System.ServiceModel; 6 | using System.ServiceModel.Web; 7 | using System.Text; 8 | 9 | namespace PFServiceClient 10 | { 11 | // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in code, svc and config file together. 12 | // NOTE: In order to launch WCF Test Client for testing this service, please select Service1.svc or Service1.svc.cs at the Solution Explorer and start debugging. 13 | public class PFService : IPFService 14 | { 15 | 16 | public double? GetPfEmployeeContribSofar(Employee employee) 17 | { 18 | double? salary; 19 | int? totalDuration; 20 | 21 | salary = employee.Salary; 22 | 23 | totalDuration = employee.DurationWorked; 24 | 25 | //Salary * 18% of basic (considering basic as 30% of salary) 26 | 27 | //Basic salary 28 | var basic = (salary * 30) / 100; 29 | 30 | //12% of basic 31 | var contribution = (basic * 18) / 100; 32 | 33 | return (contribution * totalDuration); 34 | 35 | 36 | } 37 | 38 | public double? GetPfEmployerContribSofar(Employee employee) 39 | { 40 | double? salary; 41 | int? totalDuration; 42 | 43 | salary = employee.Salary; 44 | 45 | totalDuration = employee.DurationWorked; 46 | //Salary * 12% of basic (considering basic as 30% of salary) 47 | 48 | //Basic salary 49 | var basic = (salary * 30) / 100; 50 | 51 | //12% of basic 52 | var contribution = (basic * 12) / 100; 53 | 54 | return (contribution * totalDuration); 55 | } 56 | public bool IsPfEligible(Employee employee) 57 | { 58 | double? salary; 59 | salary = employee.Salary; 60 | 61 | if (salary >= 4000) 62 | return true; 63 | else 64 | return false; 65 | } 66 | 67 | public double? GetPfEmployeeControlSofarWithId(int empId) 68 | { 69 | double? salary; 70 | int? totalDuration; 71 | 72 | using (var employeeEntity = new EmployeeModel()) 73 | { 74 | salary = employeeEntity.Employees.Where(x => x.Id == empId).Select(x => x.Salary).FirstOrDefault(); 75 | totalDuration = employeeEntity.Employees.Where(x => x.Id == empId).Select(x => x.DurationWorked).FirstOrDefault(); 76 | } 77 | 78 | //Salary * 18% of basic (considering basic as 30% of salary) 79 | 80 | //Basic salary 81 | var basic = (salary * 30) / 100; 82 | 83 | //18% of basic 84 | var contribution = (basic * 18) / 100; 85 | 86 | return (contribution * totalDuration); 87 | 88 | 89 | } 90 | 91 | public double? GetPfEmployerControlSofarWithId(int empId) 92 | { 93 | double? salary; 94 | int? totalDuration; 95 | using (var employeeEntity = new EmployeeModel()) 96 | { 97 | salary = employeeEntity.Employees.Where(x => x.Id == empId).Select(x => x.Salary).FirstOrDefault(); 98 | totalDuration = employeeEntity.Employees.Where(x => x.Id == empId).Select(x => x.DurationWorked).FirstOrDefault(); 99 | } 100 | 101 | //Salary * 12% of basic (considering basic as 30% of salary) 102 | 103 | //Basic salary 104 | var basic = (salary * 30) / 100; 105 | 106 | //12% of basic 107 | var contribution = (basic * 12) / 100; 108 | 109 | return (contribution * totalDuration); 110 | } 111 | 112 | public bool IsPfEligibleWithId(int empId) 113 | { 114 | double? salary; 115 | using (var employeeEntity = new EmployeeModel()) 116 | { 117 | salary = employeeEntity.Employees.Where(x => x.Id == empId).Select(x => x.Salary).FirstOrDefault(); 118 | } 119 | 120 | if (salary >= 4000) 121 | return true; 122 | else 123 | return false; 124 | } 125 | 126 | 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Scripts/respond.min.js: -------------------------------------------------------------------------------- 1 | /* NUGET: BEGIN LICENSE TEXT 2 | * 3 | * Microsoft grants you the right to use these script files for the sole 4 | * purpose of either: (i) interacting through your browser with the Microsoft 5 | * website or online service, subject to the applicable licensing or use 6 | * terms; or (ii) using the files as included with a Microsoft product subject 7 | * to that product's license terms. Microsoft reserves all other rights to the 8 | * files not expressly granted by Microsoft, whether by implication, estoppel 9 | * or otherwise. Insofar as a script file is dual licensed under GPL, 10 | * Microsoft neither took the code under GPL nor distributes it thereunder but 11 | * under the terms set out in this paragraph. All notices and licenses 12 | * below are for informational purposes only. 13 | * 14 | * NUGET: END LICENSE TEXT */ 15 | /*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */ 16 | /*! NOTE: If you're already including a window.matchMedia polyfill via Modernizr or otherwise, you don't need this part */ 17 | window.matchMedia=window.matchMedia||(function(e,f){var c,a=e.documentElement,b=a.firstElementChild||a.firstChild,d=e.createElement("body"),g=e.createElement("div");g.id="mq-test-1";g.style.cssText="position:absolute;top:-100em";d.style.background="none";d.appendChild(g);return function(h){g.innerHTML='­';a.insertBefore(d,b);c=g.offsetWidth==42;a.removeChild(d);return{matches:c,media:h}}})(document); 18 | 19 | /*! Respond.js v1.2.0: min/max-width media query polyfill. (c) Scott Jehl. MIT/GPLv2 Lic. j.mp/respondjs */ 20 | (function(e){e.respond={};respond.update=function(){};respond.mediaQueriesSupported=e.matchMedia&&e.matchMedia("only all").matches;if(respond.mediaQueriesSupported){return}var w=e.document,s=w.documentElement,i=[],k=[],q=[],o={},h=30,f=w.getElementsByTagName("head")[0]||s,g=w.getElementsByTagName("base")[0],b=f.getElementsByTagName("link"),d=[],a=function(){var D=b,y=D.length,B=0,A,z,C,x;for(;B-1,minw:F.match(/\(min\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:F.match(/\(max\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/)&&parseFloat(RegExp.$1)+(RegExp.$2||"")})}}j()},l,r,v=function(){var z,A=w.createElement("div"),x=w.body,y=false;A.style.cssText="position:absolute;font-size:1em;width:1em";if(!x){x=y=w.createElement("body");x.style.background="none"}x.appendChild(A);s.insertBefore(x,s.firstChild);z=A.offsetWidth;if(y){s.removeChild(x)}else{x.removeChild(A)}z=p=parseFloat(z);return z},p,j=function(I){var x="clientWidth",B=s[x],H=w.compatMode==="CSS1Compat"&&B||w.body[x]||B,D={},G=b[b.length-1],z=(new Date()).getTime();if(I&&l&&z-l-1?(p||v()):1)}if(!!J){J=parseFloat(J)*(J.indexOf(y)>-1?(p||v()):1)}if(!K.hasquery||(!A||!L)&&(A||H>=C)&&(L||H<=J)){if(!D[K.media]){D[K.media]=[]}D[K.media].push(k[K.rules])}}for(var E in q){if(q[E]&&q[E].parentNode===f){f.removeChild(q[E])}}for(var E in D){var M=w.createElement("style"),F=D[E].join("\n");M.type="text/css";M.media=E;f.insertBefore(M,G.nextSibling);if(M.styleSheet){M.styleSheet.cssText=F}else{M.appendChild(w.createTextNode(F))}q.push(M)}},n=function(x,z){var y=c();if(!y){return}y.open("GET",x,true);y.onreadystatechange=function(){if(y.readyState!=4||y.status!=200&&y.status!=304){return}z(y.responseText)};if(y.readyState==4){return}y.send(null)},c=(function(){var x=false;try{x=new XMLHttpRequest()}catch(y){x=new ActiveXObject("Microsoft.XMLHTTP")}return function(){return x}})();a();respond.update=a;function t(){j(true)}if(e.addEventListener){e.addEventListener("resize",t,false)}else{if(e.attachEvent){e.attachEvent("onresize",t)}}})(this); -------------------------------------------------------------------------------- /ExecuteAutoEmployee/App_Start/IdentityConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Data.Entity; 4 | using System.Linq; 5 | using System.Security.Claims; 6 | using System.Threading.Tasks; 7 | using System.Web; 8 | using Microsoft.AspNet.Identity; 9 | using Microsoft.AspNet.Identity.EntityFramework; 10 | using Microsoft.AspNet.Identity.Owin; 11 | using Microsoft.Owin; 12 | using Microsoft.Owin.Security; 13 | using ExecuteAutoEmployee.Models; 14 | 15 | namespace ExecuteAutoEmployee 16 | { 17 | public class EmailService : IIdentityMessageService 18 | { 19 | public Task SendAsync(IdentityMessage message) 20 | { 21 | // Plug in your email service here to send an email. 22 | return Task.FromResult(0); 23 | } 24 | } 25 | 26 | public class SmsService : IIdentityMessageService 27 | { 28 | public Task SendAsync(IdentityMessage message) 29 | { 30 | // Plug in your SMS service here to send a text message. 31 | return Task.FromResult(0); 32 | } 33 | } 34 | 35 | // Configure the application user manager used in this application. UserManager is defined in ASP.NET Identity and is used by the application. 36 | public class ApplicationUserManager : UserManager 37 | { 38 | public ApplicationUserManager(IUserStore store) 39 | : base(store) 40 | { 41 | } 42 | 43 | public static ApplicationUserManager Create(IdentityFactoryOptions options, IOwinContext context) 44 | { 45 | var manager = new ApplicationUserManager(new UserStore(context.Get())); 46 | // Configure validation logic for usernames 47 | manager.UserValidator = new UserValidator(manager) 48 | { 49 | AllowOnlyAlphanumericUserNames = false, 50 | RequireUniqueEmail = true 51 | }; 52 | 53 | // Configure validation logic for passwords 54 | manager.PasswordValidator = new PasswordValidator 55 | { 56 | RequiredLength = 6, 57 | RequireNonLetterOrDigit = true, 58 | RequireDigit = true, 59 | RequireLowercase = true, 60 | RequireUppercase = true, 61 | }; 62 | 63 | // Configure user lockout defaults 64 | manager.UserLockoutEnabledByDefault = true; 65 | manager.DefaultAccountLockoutTimeSpan = TimeSpan.FromMinutes(5); 66 | manager.MaxFailedAccessAttemptsBeforeLockout = 5; 67 | 68 | // Register two factor authentication providers. This application uses Phone and Emails as a step of receiving a code for verifying the user 69 | // You can write your own provider and plug it in here. 70 | manager.RegisterTwoFactorProvider("Phone Code", new PhoneNumberTokenProvider 71 | { 72 | MessageFormat = "Your security code is {0}" 73 | }); 74 | manager.RegisterTwoFactorProvider("Email Code", new EmailTokenProvider 75 | { 76 | Subject = "Security Code", 77 | BodyFormat = "Your security code is {0}" 78 | }); 79 | manager.EmailService = new EmailService(); 80 | manager.SmsService = new SmsService(); 81 | var dataProtectionProvider = options.DataProtectionProvider; 82 | if (dataProtectionProvider != null) 83 | { 84 | manager.UserTokenProvider = 85 | new DataProtectorTokenProvider(dataProtectionProvider.Create("ASP.NET Identity")); 86 | } 87 | return manager; 88 | } 89 | } 90 | 91 | // Configure the application sign-in manager which is used in this application. 92 | public class ApplicationSignInManager : SignInManager 93 | { 94 | public ApplicationSignInManager(ApplicationUserManager userManager, IAuthenticationManager authenticationManager) 95 | : base(userManager, authenticationManager) 96 | { 97 | } 98 | 99 | public override Task CreateUserIdentityAsync(ApplicationUser user) 100 | { 101 | return user.GenerateUserIdentityAsync((ApplicationUserManager)UserManager); 102 | } 103 | 104 | public static ApplicationSignInManager Create(IdentityFactoryOptions options, IOwinContext context) 105 | { 106 | return new ApplicationSignInManager(context.GetUserManager(), context.Authentication); 107 | } 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Content/Site.css: -------------------------------------------------------------------------------- 1 | body { 2 | padding-top: 50px; 3 | padding-bottom: 20px; 4 | } 5 | 6 | /* Set padding to keep content from hitting the edges */ 7 | .body-content { 8 | padding-left: 15px; 9 | padding-right: 15px; 10 | } 11 | 12 | /* Override the default bootstrap behavior where horizontal description lists 13 | will truncate terms that are too long to fit in the left column 14 | */ 15 | .dl-horizontal dt { 16 | white-space: normal; 17 | } 18 | 19 | /* Set width on the form input elements since they're 100% wide by default */ 20 | input, 21 | select, 22 | textarea { 23 | max-width: 280px; 24 | } 25 | 26 | @charset "utf-8"; 27 | * { 28 | margin: 0px; padding: 0px; 29 | } 30 | .clear { 31 | clear:both;} 32 | .clearleft { 33 | display:block; 34 | clear:left;} 35 | .clearright{ 36 | display:block; 37 | clear:right;} 38 | .hide { 39 | display:none;} 40 | a { 41 | color:#B32C0E; 42 | } 43 | 44 | a:hover { 45 | color:#000000; 46 | text-decoration:none; 47 | } 48 | body { 49 | background: #FFFFFF url(images/bg.jpg) repeat-x; 50 | } 51 | #wrap{ 52 | width:699px; 53 | margin:0px auto 15px auto; 54 | font-family:Verdana, Arial, Helvetica, sans-serif; 55 | font-size:12px; 56 | color:#666666; 57 | } 58 | 59 | /*Header*/ 60 | 61 | #header{ 62 | height:242px; 63 | background:url(images/header.jpg) no-repeat left top; 64 | clear: both; 65 | } 66 | /*Header Menu*/ 67 | #topmenu { 68 | display:block; 69 | list-style:none; 70 | padding:0 0px 0px 278px; 71 | float: right; 72 | width: 415px; 73 | } 74 | #topmenu li { 75 | display:inline; 76 | } 77 | #topmenu a { 78 | display:block; 79 | float:left; 80 | height:28px; 81 | margin:0px 0px 0px0px; 82 | text-decoration:none; 83 | padding:9px 15px 0px 15px; 84 | text-align:center; 85 | } 86 | #topmenu a, #topmenu a:visited, #topmenu a:active { 87 | color:#FFFFFF; 88 | } 89 | #topmenu a:hover{ 90 | color:#ffffff; 91 | background-color: #B52E10; 92 | } 93 | #topmenu .active a, #topmenu .active a:visited, #topmenu .active a:active{ 94 | color:#FFFFFF; 95 | background-color: #B42D0F; 96 | } 97 | 98 | /*Content*/ 99 | #content { 100 | background-color: #FFFFFF; 101 | } 102 | #mainpage { 103 | width:450px; 104 | float:left; 105 | padding:5px 5px 5px 0px; 106 | height:550px 107 | } 108 | #mainpage p { 109 | line-height:22px; 110 | margin:10px 0px 22px 0px; 111 | } 112 | #mainpage blockquote { 113 | background:#efefef; 114 | display:block; 115 | margin:5px; 116 | font:Georgia, "Times New Roman", Times, serif; 117 | font-style:italic;} 118 | h1, h2, h3, h4, h5 { 119 | color:#B32C0E; 120 | font-weight:bold; 121 | font-family: Arial, Helvetica, sans-serif; 122 | } 123 | #mainpage h1 { 124 | font-size:24px; 125 | color: #F2F7F3; 126 | } 127 | #mainpage h2 { 128 | font-size:18px; 129 | padding-top: 20px; 130 | padding-bottom: 5px; 131 | border-bottom: 1px solid #B52E10; 132 | } 133 | #mainpage h3 { 134 | font-size:20px;} 135 | #mainpage h4 { 136 | font-size:18px;} 137 | #mainpage h5 { 138 | font-size:16px;} 139 | .style_2 { 140 | font-size: 7px; 141 | color: #000011; 142 | } 143 | .style_2 a{ 144 | font-size: 7px; 145 | color: #000011; 146 | } 147 | .style_2 a:hover{ 148 | font-size: 7px; 149 | color: #000011; 150 | } 151 | #content #mainpage ol { 152 | margin:10px 10px 10px 25px;} 153 | #content #mainpage ol li { 154 | padding:5px 5px 5px 20px;} 155 | #content #mainpage ul li { 156 | display:block; 157 | padding:0px; 158 | border-bottom: dashed 1px #D6E4A7;} 159 | 160 | 161 | 162 | 163 | /*Sidebar*/ 164 | #sidebar { 165 | margin:0px 0px 0px 0px; 166 | width: 225px; 167 | float: right; 168 | } 169 | #sidebarcontents { 170 | padding:5px 0px 5px 0px; 171 | } 172 | 173 | /*Sidemenu*/ 174 | #menu { 175 | list-style:none; 176 | } 177 | #menu li ul {list-style:none;} 178 | #menu li ul li { 179 | display:block; 180 | height:25px; 181 | border-bottom:solid 1px #efefef;} 182 | #menu li ul a, #menu li ul a:visited, #menu li ul a:active { 183 | display:block; 184 | height:20px; 185 | padding:5px 5px 0px 5px; 186 | text-decoration:none; 187 | color:#333333;} 188 | #menu li ul a:hover { 189 | background:#F8F9F2; 190 | color:#B32C0E; 191 | } 192 | #menu h2 { 193 | display:block; 194 | border-bottom:solid 1px #D2E6CA; 195 | padding:5px; 196 | margin:10px 0px 0px 0px; 197 | font-family: Arial, Helvetica, sans-serif; 198 | font-size:18px; 199 | color:#B32C0E; 200 | font-weight:bold; 201 | } 202 | 203 | /*footer*/ 204 | #footer { 205 | margin:0 auto; 206 | width:685px; 207 | height:75px; 208 | padding:10px; 209 | color:#FFFFFF; 210 | text-align: center; 211 | background:#333333; 212 | font-family: Verdana, Arial, Helvetica, sans-serif; 213 | font-size: 11px; 214 | clear: both; 215 | } 216 | #credit {font-size:10px; 217 | padding:3px;} 218 | #sitename a{ 219 | text-decoration :none; 220 | font-size:24pxx; 221 | color:#FFFFFF; 222 | padding-top:20px; 223 | } 224 | #topbar{ 225 | height:78px; 226 | } 227 | #caption{ 228 | height:50px; 229 | background:url(images/caption.gif) repeat-x top left; 230 | } 231 | .bold{font-size:16px; 232 | color:#FFFFFF; 233 | padding-left:100px; 234 | padding-top:25px; 235 | } 236 | 237 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | bld/ 21 | [Bb]in/ 22 | [Oo]bj/ 23 | [Ll]og/ 24 | [Pp]ackages/ 25 | 26 | # Visual Studio 2015 cache/options directory 27 | .vs/ 28 | # Uncomment if you have tasks that create the project's static files in wwwroot 29 | #wwwroot/ 30 | 31 | # MSTest test Results 32 | [Tt]est[Rr]esult*/ 33 | [Bb]uild[Ll]og.* 34 | 35 | # NUNIT 36 | *.VisualState.xml 37 | TestResult.xml 38 | 39 | # Build Results of an ATL Project 40 | [Dd]ebugPS/ 41 | [Rr]eleasePS/ 42 | dlldata.c 43 | 44 | # DNX 45 | project.lock.json 46 | artifacts/ 47 | 48 | *_i.c 49 | *_p.c 50 | *_i.h 51 | *.ilk 52 | *.meta 53 | *.obj 54 | *.pch 55 | *.pdb 56 | *.pgc 57 | *.pgd 58 | *.rsp 59 | *.sbr 60 | *.tlb 61 | *.tli 62 | *.tlh 63 | *.tmp 64 | *.tmp_proj 65 | *.log 66 | *.vspscc 67 | *.vssscc 68 | .builds 69 | *.pidb 70 | *.svclog 71 | *.scc 72 | 73 | # Chutzpah Test files 74 | _Chutzpah* 75 | 76 | # Visual C++ cache files 77 | ipch/ 78 | *.aps 79 | *.ncb 80 | *.opendb 81 | *.opensdf 82 | *.sdf 83 | *.cachefile 84 | *.VC.db 85 | *.VC.VC.opendb 86 | 87 | # Visual Studio profiler 88 | *.psess 89 | *.vsp 90 | *.vspx 91 | *.sap 92 | 93 | # TFS 2012 Local Workspace 94 | $tf/ 95 | 96 | # Guidance Automation Toolkit 97 | *.gpState 98 | 99 | # ReSharper is a .NET coding add-in 100 | _ReSharper*/ 101 | *.[Rr]e[Ss]harper 102 | *.DotSettings.user 103 | 104 | # JustCode is a .NET coding add-in 105 | .JustCode 106 | 107 | # TeamCity is a build add-in 108 | _TeamCity* 109 | 110 | # DotCover is a Code Coverage Tool 111 | *.dotCover 112 | 113 | # NCrunch 114 | _NCrunch_* 115 | .*crunch*.local.xml 116 | nCrunchTemp_* 117 | 118 | # MightyMoose 119 | *.mm.* 120 | AutoTest.Net/ 121 | 122 | # Web workbench (sass) 123 | .sass-cache/ 124 | 125 | # Installshield output folder 126 | [Ee]xpress/ 127 | 128 | # DocProject is a documentation generator add-in 129 | DocProject/buildhelp/ 130 | DocProject/Help/*.HxT 131 | DocProject/Help/*.HxC 132 | DocProject/Help/*.hhc 133 | DocProject/Help/*.hhk 134 | DocProject/Help/*.hhp 135 | DocProject/Help/Html2 136 | DocProject/Help/html 137 | 138 | # Click-Once directory 139 | publish/ 140 | 141 | # Publish Web Output 142 | *.[Pp]ublish.xml 143 | *.azurePubxml 144 | # TODO: Comment the next line if you want to checkin your web deploy settings 145 | # but database connection strings (with potential passwords) will be unencrypted 146 | *.pubxml 147 | *.publishproj 148 | 149 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 150 | # checkin your Azure Web App publish settings, but sensitive information contained 151 | # in these scripts will be unencrypted 152 | PublishScripts/ 153 | 154 | # NuGet Packages 155 | *.nupkg 156 | # The packages folder can be ignored because of Package Restore 157 | **/packages/* 158 | # except build/, which is used as an MSBuild target. 159 | !**/packages/build/ 160 | # Uncomment if necessary however generally it will be regenerated when needed 161 | #!**/packages/repositories.config 162 | # NuGet v3's project.json files produces more ignoreable files 163 | *.nuget.props 164 | *.nuget.targets 165 | 166 | # Microsoft Azure Build Output 167 | csx/ 168 | *.build.csdef 169 | 170 | # Microsoft Azure Emulator 171 | ecf/ 172 | rcf/ 173 | 174 | # Windows Store app package directories and files 175 | AppPackages/ 176 | BundleArtifacts/ 177 | Package.StoreAssociation.xml 178 | _pkginfo.txt 179 | 180 | # Visual Studio cache files 181 | # files ending in .cache can be ignored 182 | *.[Cc]ache 183 | # but keep track of directories ending in .cache 184 | !*.[Cc]ache/ 185 | 186 | # Others 187 | ClientBin/ 188 | ~$* 189 | *~ 190 | *.dbmdl 191 | *.dbproj.schemaview 192 | *.pfx 193 | *.publishsettings 194 | node_modules/ 195 | orleans.codegen.cs 196 | 197 | # Since there are multiple workflows, uncomment next line to ignore bower_components 198 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 199 | #bower_components/ 200 | 201 | # RIA/Silverlight projects 202 | Generated_Code/ 203 | 204 | # Backup & report files from converting an old project file 205 | # to a newer Visual Studio version. Backup files are not needed, 206 | # because we have git ;-) 207 | _UpgradeReport_Files/ 208 | Backup*/ 209 | UpgradeLog*.XML 210 | UpgradeLog*.htm 211 | 212 | # SQL Server files 213 | *.mdf 214 | *.ldf 215 | 216 | # Business Intelligence projects 217 | *.rdl.data 218 | *.bim.layout 219 | *.bim_*.settings 220 | 221 | # Microsoft Fakes 222 | FakesAssemblies/ 223 | 224 | # GhostDoc plugin setting file 225 | *.GhostDoc.xml 226 | 227 | # Node.js Tools for Visual Studio 228 | .ntvs_analysis.dat 229 | 230 | # Visual Studio 6 build log 231 | *.plg 232 | 233 | # Visual Studio 6 workspace options file 234 | *.opt 235 | 236 | # Visual Studio LightSwitch build output 237 | **/*.HTMLClient/GeneratedArtifacts 238 | **/*.DesktopClient/GeneratedArtifacts 239 | **/*.DesktopClient/ModelManifest.xml 240 | **/*.Server/GeneratedArtifacts 241 | **/*.Server/ModelManifest.xml 242 | _Pvt_Extensions 243 | 244 | # Paket dependency manager 245 | .paket/paket.exe 246 | paket-files/ 247 | 248 | # FAKE - F# Make 249 | .fake/ 250 | 251 | # JetBrains Rider 252 | .idea/ 253 | *.sln.iml 254 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Project_Readme.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Your ASP.NET application 6 | 95 | 96 | 97 | 98 | 102 | 103 |
104 |
105 |

This application consists of:

106 |
    107 |
  • Sample pages showing basic nav between Home, About, and Contact
  • 108 |
  • Theming using Bootstrap
  • 109 |
  • Authentication, if selected, shows how to register and sign in
  • 110 |
  • ASP.NET features managed using NuGet
  • 111 |
112 |
113 | 114 | 131 | 132 |
133 |

Deploy

134 | 139 |
140 | 141 |
142 |

Get help

143 | 147 |
148 |
149 | 150 | 151 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Web.config: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 106 | 107 | 108 | 109 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Scripts/jquery.validate.unobtrusive.min.js: -------------------------------------------------------------------------------- 1 | /* NUGET: BEGIN LICENSE TEXT 2 | * 3 | * Microsoft grants you the right to use these script files for the sole 4 | * purpose of either: (i) interacting through your browser with the Microsoft 5 | * website or online service, subject to the applicable licensing or use 6 | * terms; or (ii) using the files as included with a Microsoft product subject 7 | * to that product's license terms. Microsoft reserves all other rights to the 8 | * files not expressly granted by Microsoft, whether by implication, estoppel 9 | * or otherwise. Insofar as a script file is dual licensed under GPL, 10 | * Microsoft neither took the code under GPL nor distributes it thereunder but 11 | * under the terms set out in this paragraph. All notices and licenses 12 | * below are for informational purposes only. 13 | * 14 | * NUGET: END LICENSE TEXT */ 15 | /* 16 | ** Unobtrusive validation support library for jQuery and jQuery Validate 17 | ** Copyright (C) Microsoft Corporation. All rights reserved. 18 | */ 19 | (function(a){var d=a.validator,b,e="unobtrusiveValidation";function c(a,b,c){a.rules[b]=c;if(a.message)a.messages[b]=a.message}function j(a){return a.replace(/^\s+|\s+$/g,"").split(/\s*,\s*/g)}function f(a){return a.replace(/([!"#$%&'()*+,./:;<=>?@\[\\\]^`{|}~])/g,"\\$1")}function h(a){return a.substr(0,a.lastIndexOf(".")+1)}function g(a,b){if(a.indexOf("*.")===0)a=a.replace("*.",b);return a}function m(c,e){var b=a(this).find("[data-valmsg-for='"+f(e[0].name)+"']"),d=b.attr("data-valmsg-replace"),g=d?a.parseJSON(d)!==false:null;b.removeClass("field-validation-valid").addClass("field-validation-error");c.data("unobtrusiveContainer",b);if(g){b.empty();c.removeClass("input-validation-error").appendTo(b)}else c.hide()}function l(e,d){var c=a(this).find("[data-valmsg-summary=true]"),b=c.find("ul");if(b&&b.length&&d.errorList.length){b.empty();c.addClass("validation-summary-errors").removeClass("validation-summary-valid");a.each(d.errorList,function(){a("
  • ").html(this.message).appendTo(b)})}}function k(d){var b=d.data("unobtrusiveContainer"),c=b.attr("data-valmsg-replace"),e=c?a.parseJSON(c):null;if(b){b.addClass("field-validation-valid").removeClass("field-validation-error");d.removeData("unobtrusiveContainer");e&&b.empty()}}function n(){var b=a(this),c="__jquery_unobtrusive_validation_form_reset";if(b.data(c))return;b.data(c,true);try{b.data("validator").resetForm()}finally{b.removeData(c)}b.find(".validation-summary-errors").addClass("validation-summary-valid").removeClass("validation-summary-errors");b.find(".field-validation-error").addClass("field-validation-valid").removeClass("field-validation-error").removeData("unobtrusiveContainer").find(">*").removeData("unobtrusiveContainer")}function i(b){var c=a(b),f=c.data(e),i=a.proxy(n,b),g=d.unobtrusive.options||{},h=function(e,d){var c=g[e];c&&a.isFunction(c)&&c.apply(b,d)};if(!f){f={options:{errorClass:g.errorClass||"input-validation-error",errorElement:g.errorElement||"span",errorPlacement:function(){m.apply(b,arguments);h("errorPlacement",arguments)},invalidHandler:function(){l.apply(b,arguments);h("invalidHandler",arguments)},messages:{},rules:{},success:function(){k.apply(b,arguments);h("success",arguments)}},attachValidation:function(){c.off("reset."+e,i).on("reset."+e,i).validate(this.options)},validate:function(){c.validate();return c.valid()}};c.data(e,f)}return f}d.unobtrusive={adapters:[],parseElement:function(b,h){var d=a(b),f=d.parents("form")[0],c,e,g;if(!f)return;c=i(f);c.options.rules[b.name]=e={};c.options.messages[b.name]=g={};a.each(this.adapters,function(){var c="data-val-"+this.name,i=d.attr(c),h={};if(i!==undefined){c+="-";a.each(this.params,function(){h[this]=d.attr(c+this)});this.adapt({element:b,form:f,message:i,params:h,rules:e,messages:g})}});a.extend(e,{__dummy__:true});!h&&c.attachValidation()},parse:function(c){var b=a(c),e=b.parents().addBack().filter("form").add(b.find("form")).has("[data-val=true]");b.find("[data-val=true]").each(function(){d.unobtrusive.parseElement(this,true)});e.each(function(){var a=i(this);a&&a.attachValidation()})}};b=d.unobtrusive.adapters;b.add=function(c,a,b){if(!b){b=a;a=[]}this.push({name:c,params:a,adapt:b});return this};b.addBool=function(a,b){return this.add(a,function(d){c(d,b||a,true)})};b.addMinMax=function(e,g,f,a,d,b){return this.add(e,[d||"min",b||"max"],function(b){var e=b.params.min,d=b.params.max;if(e&&d)c(b,a,[e,d]);else if(e)c(b,g,e);else d&&c(b,f,d)})};b.addSingleVal=function(a,b,d){return this.add(a,[b||"val"],function(e){c(e,d||a,e.params[b])})};d.addMethod("__dummy__",function(){return true});d.addMethod("regex",function(b,c,d){var a;if(this.optional(c))return true;a=(new RegExp(d)).exec(b);return a&&a.index===0&&a[0].length===b.length});d.addMethod("nonalphamin",function(c,d,b){var a;if(b){a=c.match(/\W/g);a=a&&a.length>=b}return a});if(d.methods.extension){b.addSingleVal("accept","mimtype");b.addSingleVal("extension","extension")}else b.addSingleVal("extension","extension","accept");b.addSingleVal("regex","pattern");b.addBool("creditcard").addBool("date").addBool("digits").addBool("email").addBool("number").addBool("url");b.addMinMax("length","minlength","maxlength","rangelength").addMinMax("range","min","max","range");b.addMinMax("minlength","minlength").addMinMax("maxlength","minlength","maxlength");b.add("equalto",["other"],function(b){var i=h(b.element.name),j=b.params.other,d=g(j,i),e=a(b.form).find(":input").filter("[name='"+f(d)+"']")[0];c(b,"equalTo",e)});b.add("required",function(a){(a.element.tagName.toUpperCase()!=="INPUT"||a.element.type.toUpperCase()!=="CHECKBOX")&&c(a,"required",true)});b.add("remote",["url","type","additionalfields"],function(b){var d={url:b.params.url,type:b.params.type||"GET",data:{}},e=h(b.element.name);a.each(j(b.params.additionalfields||b.element.name),function(i,h){var c=g(h,e);d.data[c]=function(){var d=a(b.form).find(":input").filter("[name='"+f(c)+"']");return d.is(":checkbox")?d.filter(":checked").val()||d.filter(":hidden").val()||"":d.is(":radio")?d.filter(":checked").val()||"":d.val()}});c(b,"remote",d)});b.add("password",["min","nonalphamin","regex"],function(a){a.params.min&&c(a,"minlength",a.params.min);a.params.nonalphamin&&c(a,"nonalphamin",a.params.nonalphamin);a.params.regex&&c(a,"regex",a.params.regex)});a(function(){d.unobtrusive.parse(document)})})(jQuery); -------------------------------------------------------------------------------- /PFServiceClient/PFServiceClient.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | 8 | 9 | 2.0 10 | {FCBC09A8-CA90-419E-BCAE-E47727BE21A3} 11 | {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} 12 | Library 13 | Properties 14 | PFServiceClient 15 | PFServiceClient 16 | v4.5.2 17 | True 18 | true 19 | true 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | true 28 | full 29 | false 30 | bin\ 31 | DEBUG;TRACE 32 | prompt 33 | 4 34 | 35 | 36 | pdbonly 37 | true 38 | bin\ 39 | TRACE 40 | prompt 41 | 4 42 | 43 | 44 | 45 | ..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll 46 | True 47 | 48 | 49 | ..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll 50 | True 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | Designer 77 | 78 | 79 | 80 | 81 | 82 | 83 | Service1.svc 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | Web.config 96 | 97 | 98 | Web.config 99 | 100 | 101 | 102 | 10.0 103 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | True 113 | True 114 | 10854 115 | / 116 | http://localhost:64978/ 117 | False 118 | False 119 | 120 | 121 | False 122 | 123 | 124 | 125 | 126 | 133 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Migrations/201602180529368_InitialCreate.cs: -------------------------------------------------------------------------------- 1 | namespace ExecuteAutoEmployee.Migrations 2 | { 3 | using System; 4 | using System.Data.Entity.Migrations; 5 | 6 | public partial class InitialCreate : DbMigration 7 | { 8 | public override void Up() 9 | { 10 | CreateTable( 11 | "dbo.Benefits", 12 | c => new 13 | { 14 | Id = c.Int(nullable: false, identity: true), 15 | Employee_Id = c.Int(), 16 | }) 17 | .PrimaryKey(t => t.Id) 18 | .ForeignKey("dbo.Employees", t => t.Employee_Id) 19 | .Index(t => t.Employee_Id); 20 | 21 | CreateTable( 22 | "dbo.AdditionalBenefits", 23 | c => new 24 | { 25 | Id = c.Int(nullable: false, identity: true), 26 | BenefitName = c.String(), 27 | Benefits_Id = c.Int(), 28 | }) 29 | .PrimaryKey(t => t.Id) 30 | .ForeignKey("dbo.Benefits", t => t.Benefits_Id) 31 | .Index(t => t.Benefits_Id); 32 | 33 | CreateTable( 34 | "dbo.BasicBenefits", 35 | c => new 36 | { 37 | Id = c.Int(nullable: false, identity: true), 38 | BenefitName = c.String(), 39 | Benefits_Id = c.Int(), 40 | }) 41 | .PrimaryKey(t => t.Id) 42 | .ForeignKey("dbo.Benefits", t => t.Benefits_Id) 43 | .Index(t => t.Benefits_Id); 44 | 45 | CreateTable( 46 | "dbo.Employees", 47 | c => new 48 | { 49 | Id = c.Int(nullable: false, identity: true), 50 | Name = c.String(), 51 | Salary = c.Single(nullable: false), 52 | DurationWorked = c.Int(nullable: false), 53 | Grade = c.Int(nullable: false), 54 | Email = c.String(), 55 | }) 56 | .PrimaryKey(t => t.Id); 57 | 58 | CreateTable( 59 | "dbo.AspNetRoles", 60 | c => new 61 | { 62 | Id = c.String(nullable: false, maxLength: 128), 63 | Name = c.String(nullable: false, maxLength: 256), 64 | }) 65 | .PrimaryKey(t => t.Id) 66 | .Index(t => t.Name, unique: true, name: "RoleNameIndex"); 67 | 68 | CreateTable( 69 | "dbo.AspNetUserRoles", 70 | c => new 71 | { 72 | UserId = c.String(nullable: false, maxLength: 128), 73 | RoleId = c.String(nullable: false, maxLength: 128), 74 | }) 75 | .PrimaryKey(t => new { t.UserId, t.RoleId }) 76 | .ForeignKey("dbo.AspNetRoles", t => t.RoleId, cascadeDelete: true) 77 | .ForeignKey("dbo.AspNetUsers", t => t.UserId, cascadeDelete: true) 78 | .Index(t => t.UserId) 79 | .Index(t => t.RoleId); 80 | 81 | CreateTable( 82 | "dbo.AspNetUsers", 83 | c => new 84 | { 85 | Id = c.String(nullable: false, maxLength: 128), 86 | Email = c.String(maxLength: 256), 87 | EmailConfirmed = c.Boolean(nullable: false), 88 | PasswordHash = c.String(), 89 | SecurityStamp = c.String(), 90 | PhoneNumber = c.String(), 91 | PhoneNumberConfirmed = c.Boolean(nullable: false), 92 | TwoFactorEnabled = c.Boolean(nullable: false), 93 | LockoutEndDateUtc = c.DateTime(), 94 | LockoutEnabled = c.Boolean(nullable: false), 95 | AccessFailedCount = c.Int(nullable: false), 96 | UserName = c.String(nullable: false, maxLength: 256), 97 | }) 98 | .PrimaryKey(t => t.Id) 99 | .Index(t => t.UserName, unique: true, name: "UserNameIndex"); 100 | 101 | CreateTable( 102 | "dbo.AspNetUserClaims", 103 | c => new 104 | { 105 | Id = c.Int(nullable: false, identity: true), 106 | UserId = c.String(nullable: false, maxLength: 128), 107 | ClaimType = c.String(), 108 | ClaimValue = c.String(), 109 | }) 110 | .PrimaryKey(t => t.Id) 111 | .ForeignKey("dbo.AspNetUsers", t => t.UserId, cascadeDelete: true) 112 | .Index(t => t.UserId); 113 | 114 | CreateTable( 115 | "dbo.AspNetUserLogins", 116 | c => new 117 | { 118 | LoginProvider = c.String(nullable: false, maxLength: 128), 119 | ProviderKey = c.String(nullable: false, maxLength: 128), 120 | UserId = c.String(nullable: false, maxLength: 128), 121 | }) 122 | .PrimaryKey(t => new { t.LoginProvider, t.ProviderKey, t.UserId }) 123 | .ForeignKey("dbo.AspNetUsers", t => t.UserId, cascadeDelete: true) 124 | .Index(t => t.UserId); 125 | 126 | } 127 | 128 | public override void Down() 129 | { 130 | DropForeignKey("dbo.AspNetUserRoles", "UserId", "dbo.AspNetUsers"); 131 | DropForeignKey("dbo.AspNetUserLogins", "UserId", "dbo.AspNetUsers"); 132 | DropForeignKey("dbo.AspNetUserClaims", "UserId", "dbo.AspNetUsers"); 133 | DropForeignKey("dbo.AspNetUserRoles", "RoleId", "dbo.AspNetRoles"); 134 | DropForeignKey("dbo.Benefits", "Employee_Id", "dbo.Employees"); 135 | DropForeignKey("dbo.BasicBenefits", "Benefits_Id", "dbo.Benefits"); 136 | DropForeignKey("dbo.AdditionalBenefits", "Benefits_Id", "dbo.Benefits"); 137 | DropIndex("dbo.AspNetUserLogins", new[] { "UserId" }); 138 | DropIndex("dbo.AspNetUserClaims", new[] { "UserId" }); 139 | DropIndex("dbo.AspNetUsers", "UserNameIndex"); 140 | DropIndex("dbo.AspNetUserRoles", new[] { "RoleId" }); 141 | DropIndex("dbo.AspNetUserRoles", new[] { "UserId" }); 142 | DropIndex("dbo.AspNetRoles", "RoleNameIndex"); 143 | DropIndex("dbo.BasicBenefits", new[] { "Benefits_Id" }); 144 | DropIndex("dbo.AdditionalBenefits", new[] { "Benefits_Id" }); 145 | DropIndex("dbo.Benefits", new[] { "Employee_Id" }); 146 | DropTable("dbo.AspNetUserLogins"); 147 | DropTable("dbo.AspNetUserClaims"); 148 | DropTable("dbo.AspNetUsers"); 149 | DropTable("dbo.AspNetUserRoles"); 150 | DropTable("dbo.AspNetRoles"); 151 | DropTable("dbo.Employees"); 152 | DropTable("dbo.BasicBenefits"); 153 | DropTable("dbo.AdditionalBenefits"); 154 | DropTable("dbo.Benefits"); 155 | } 156 | } 157 | } 158 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Service References/PFServiceClient/PFService.wsdl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Migrations/Configuration.cs: -------------------------------------------------------------------------------- 1 | using ExecuteAutoEmployee.Models; 2 | 3 | namespace ExecuteAutoEmployee.Migrations 4 | { 5 | using Microsoft.AspNet.Identity; 6 | using Microsoft.AspNet.Identity.EntityFramework; 7 | using System; 8 | using System.Collections.Generic; 9 | using System.Data.Entity; 10 | using System.Data.Entity.Migrations; 11 | using System.Linq; 12 | 13 | internal sealed class Configuration : DbMigrationsConfiguration 14 | { 15 | public Configuration() 16 | { 17 | AutomaticMigrationsEnabled = false; 18 | ContextKey = "EmployeeDb"; 19 | } 20 | 21 | protected override void Seed(ExecuteAutoEmployee.Models.EmployeeDb context) 22 | { 23 | 24 | //Create users and roles 25 | var roleManager = new RoleManager(new RoleStore(context)); 26 | var userManager = new UserManager(new UserStore(context)); 27 | 28 | 29 | //Create different roles 30 | if (!roleManager.RoleExists("Administrator")) 31 | { 32 | roleManager.Create(new IdentityRole("Administrator")); 33 | } 34 | if (!roleManager.RoleExists("User")) 35 | { 36 | roleManager.Create(new IdentityRole("User")); 37 | } 38 | if (!roleManager.RoleExists("Guest")) 39 | { 40 | roleManager.Create(new IdentityRole("Guest")); 41 | } 42 | 43 | //Create users 44 | var admin = new ApplicationUser { UserName = "admin" }; 45 | var user = new ApplicationUser { UserName = "user" }; 46 | var guest = new ApplicationUser { UserName = "guest" }; 47 | 48 | //Assign roles 49 | if (userManager.FindByName("admin") == null) 50 | { 51 | var result = userManager.Create(admin, "password"); 52 | 53 | if (result.Succeeded) 54 | { 55 | userManager.AddToRole(admin.Id, "Administrator"); 56 | } 57 | } 58 | 59 | if (userManager.FindByName("user") == null) 60 | { 61 | var result = userManager.Create(user, "password"); 62 | 63 | if (result.Succeeded) 64 | { 65 | userManager.AddToRole(user.Id, "User"); 66 | } 67 | } 68 | 69 | if (userManager.FindByName("guest") == null) 70 | { 71 | var result = userManager.Create(guest, "password"); 72 | 73 | if (result.Succeeded) 74 | { 75 | userManager.AddToRole(guest.Id, "Guest"); 76 | } 77 | } 78 | 79 | 80 | context.Employee.AddOrUpdate( 81 | r => r.Name, 82 | new Employee() 83 | { 84 | Id = 1, 85 | Name = "Karthik", 86 | Salary = 4000, 87 | DurationWorked = 24, 88 | Grade = 1, 89 | Email = "karthik@executeautomation.com", 90 | Benefits = new List() 91 | { 92 | new Benefits() 93 | { 94 | Id = 1, 95 | AdditionalBenefits = new List() 96 | { 97 | new AdditionalBenefits() 98 | { 99 | BenefitName = "Car" 100 | }, 101 | new AdditionalBenefits() 102 | { 103 | BenefitName = "DriverHire" 104 | }, 105 | new AdditionalBenefits() 106 | { 107 | BenefitName = "HolidayClaim" 108 | } 109 | }, 110 | BasicBenefits = new List() 111 | { 112 | new BasicBenefits() 113 | { 114 | BenefitName = "Hospital" 115 | }, 116 | new BasicBenefits() 117 | { 118 | BenefitName = "Gym" 119 | }, 120 | new BasicBenefits() 121 | { 122 | BenefitName = "Dental" 123 | } 124 | } 125 | 126 | } 127 | } 128 | }, 129 | 130 | new Employee() 131 | { 132 | Id = 2, 133 | Name = "Prashanth", 134 | Salary = 7000, 135 | DurationWorked = 30, 136 | Grade = 2, 137 | Email = "prashanth@executeautomation.com", 138 | Benefits = new List() 139 | { 140 | new Benefits() 141 | { 142 | Id = 2, 143 | AdditionalBenefits = new List() 144 | { 145 | new AdditionalBenefits() 146 | { 147 | BenefitName = "Car" 148 | }, 149 | new AdditionalBenefits() 150 | { 151 | BenefitName = "DriverHire" 152 | }, 153 | }, 154 | BasicBenefits = new List() 155 | { 156 | new BasicBenefits() 157 | { 158 | BenefitName = "Hospital" 159 | }, 160 | new BasicBenefits() 161 | { 162 | BenefitName = "Gym" 163 | }, 164 | new BasicBenefits() 165 | { 166 | BenefitName = "Dental" 167 | } 168 | } 169 | 170 | } 171 | } 172 | }, 173 | 174 | new Employee() 175 | { 176 | Id = 3, 177 | Name = "Ramesh", 178 | Salary = 3500, 179 | DurationWorked = 13, 180 | Grade = 2, 181 | Email = "ramesh@executeautomation.com", 182 | Benefits = new List() 183 | { 184 | new Benefits() 185 | { 186 | Id = 3, 187 | AdditionalBenefits = new List() 188 | { 189 | new AdditionalBenefits() 190 | { 191 | BenefitName = "Car" 192 | } 193 | }, 194 | BasicBenefits = new List() 195 | { 196 | new BasicBenefits() 197 | { 198 | BenefitName = "Hospital" 199 | }, 200 | new BasicBenefits() 201 | { 202 | BenefitName = "Dental" 203 | } 204 | } 205 | 206 | } 207 | } 208 | 209 | }, 210 | 211 | new Employee() 212 | { 213 | Id = 4, 214 | Name = "John", 215 | Salary = 2500, 216 | DurationWorked = 18, 217 | Grade = 3, 218 | Email = "john@executeautomation.com", 219 | Benefits = new List() 220 | { 221 | new Benefits() 222 | { 223 | Id = 4, 224 | AdditionalBenefits = new List() 225 | { 226 | new AdditionalBenefits() 227 | { 228 | BenefitName = "Bike" 229 | } 230 | }, 231 | BasicBenefits = new List() 232 | { 233 | new BasicBenefits() 234 | { 235 | BenefitName = "Hospital" 236 | } 237 | } 238 | 239 | } 240 | } 241 | 242 | } 243 | ); 244 | 245 | } 246 | } 247 | } 248 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Migrations/201602180529368_InitialCreate.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | H4sIAAAAAAAEAO1d227kuBF9D5B/EPSUBN5uXzKDieHehadtb4yM7cG0Z5M3g5bYbWF06ZWoWRvBftk+5JPyCyF15V2kWt0tbwbz4hbJU8Wq4q2KrPnvb/85++E5Cp2vMM2CJJ65R5ND14Gxl/hBvJq5OVp+98794fs//uHs0o+enZ/qeiekHm4ZZzP3CaH16XSaeU8wAtkkCrw0yZIlmnhJNAV+Mj0+PPzb9OhoCjGEi7Ec5+xTHqMggsUP/HOexB5coxyEN4kPw6z6jksWBapzCyKYrYEHZ+7lM/RyBM9zlFxG6zB5gXBStnKd8zAAmKMFDJeuA+I4QQBhfk8/Z3CB0iReLdb4AwjvX9YQ11uCMINVP07b6qZdOjwmXZq2DWsoL89QElkCHp1UMpryzXtJ2m1kiKV4iaWNXkivC0nO3PcwhssAYZHxxE7nYUoq6gQ9qZsfOJJKB42ZYGsi/w6ceR6iPIWzGOYoBeGB8zF/DAPvH/DlPvkC41mchyHNMGYZlzEf8KePabKGKXr5BJdVN65915my7aZ8w6YZ1abs4HWMTo5d5xYTB48hbOyBEsYCJSn8Efc2BQj6HwFCMI0JBiwkKlC/BV+DVdGUo3ru+wH5DMJW9J9gWFTNnoJ1abSNYB9k9a/SJPqUhJT6JNUeFkmeergX90l33XuQriAy78V7kAWeWQe4qhLemRpqttlqMo7Ppq19a61eJtRe9i8CfRsJUy2tSk7kR00Uz8h4kXGdG/D8AcYr9DRz8Z/YVIJn6NdfKkY+xwFek3AjlOawp/Y5i+w38dEY33Q+ep3XWump7lap3zSto7UFFYtEFiAE6UtDBhMJoaRXepCLPC16/M8k/QI7JaTH+jEFPtwM4jICQTi85NQLuG7trg37QbZsC4XCii3W2Gixrm2PgOuG702zCz7P1rcQTeqGkxLyKsVwv2B1T2jEA8e4XTvOj03H+cnR4/Lk3Zu3wD95+1d48mb3Y15iS0fH74xsydKEO8b+8Zu3g1BVmjQ+26Vye6b1/VBVaw1aLBUsWlJlEJMmUMObdY06ftMmnIrmLa1KOtRnJNQkdj0aan63S9f8xLNeY+UVpkUk0ve4w6K87t3Q7myha3E3nRoNqMyTeBmkUbujeZ9gQwSxNc8fQZbhmcH/O8ietr+jw1aUYoNdIBCtt07t41MSw9s8eiTjYHe0BlPN/S/JFfDwRv0yJq02xvuQeF+SHF3G/gXe9H9GXg1Ift4HkTnAIOycex7MsitszNCfJ3mMNttZk4lq31uTeQiCSL434abUh7pquz+R1xD2KIpqtp69D8kqiM1YrauqWS1rdLJaVbNllYCZcVrVVDNaVOjks6w12M6v0NDwW78Cdvx7v7G7Mva1cSzUR4hufW0qKP0EwnxvXjnabItJYPjRUMCOfzQUbOLPXwOf7EoMDkR1ZQxvVF9+1uoecxxnux4OTDd3TXw3c4BquJxnWeIFxSjgvHayqCDbEbyZcyxChGX/6Lgd7iY2+4AsgJi1mXs4mRwJ4jKjUi+YFBVZAI6l9xdeRpQ0DIXExnk6OVeEIYcTjTyASRNgA1NDCUR056pY1fh2Wy7bUIqVGNReYQMR9++8xPen4lDnCGxZZN3RLJtHLj8P38UXMIQIOudeeQFkDjKviBbw8zDmw4IxiexEp6JWhuTyDVzClDQCxG+Q4cUtiJG4kgSxF6xB2CklrqXhro/0vaHBl1zANYwJwU5JmBCX+xAJAw0dTildErIwRMVBT6XzrlMfNZfyrr2d2GTHcVNhl9WRZyuGqZfYDoxTLxITBpT+8H0YaHW8NzUA/qw/NgPlnAwKA61OITsxUFZiezBQViSvzkBLr46p/jkXz9jMk/Ut7X5Z14prD7bJyGNkplke13AbhFvAlNtmXzxKvBiYu8qRkVVnQt4wCOQCIuF+Rns2FPbIwl6bxZAdsgQ0WaUOXO6YIjLIlnegtccJAagt6sCo/LsCALtX7wDhB5oOsB2MHaDVbQNR7PykY8FcHSLQclfttCxga3e+FrZaHzlYapyIJiy9wky1MLjxzA9pO+9G02l6WAnThJ0vg8I0GEFTVkA2wuMGk0ZuGneHjcOjt7Tk7g0aTjsv2MtIck1NFE+H88PQ/UH1QjUpGTo7DMTbQxSyG06iLLp8IabeEKoP1USpEYXGeUHhSCbfjYWiCq2KgjE5m9uczqmOVcrQCKjjJK0QUt2ZwaVULwPdUpIdEG2OiBtJiTvOKaRUd2ZwKVU22i0kySHF4piykYjYI8VAg60OVjS736bsbFq+0as+nE0Vj/nObsB6HcQr6nFf9cVZlC/75t8t7J+6RSXG1GOkze/VG0ooScEKcqWYNOb0KkgzdAEQeAQkVDP3I6EatddXbLBqQtx2XtRevdmqG5C/q/Wt+92d5GRU4Vzh7kXkeFWEwWWrjtDUIa8syd16SdR9noR5FKtPekTfHGXhHCb0VTgts7IzkqzRbrGXjLuRDaRtArKZ3FWtmUc3NAxTMBo9du1e+w0THajJWNG3/6Y4+vw+kM5UeAbqUjfdjqZEFal0o0KonzLRGPU3cxT+LRONxpeZo1avmmiw6pM5RnXzmcaoPo3GflUbtF7Gyzic7A1Y33zfRrwnBYm71YGV1Tjz+itMDaESe+2upgWvcmGrUeqINo2iinLvTYEqT0O/XRnnOO2xJetC2M44s5kKtRjUOwIBjCozR2WfetCYbInFssa+52BWN7bIgkv61QbDJF3QC08hUXkNcwriOw0aXSw1R5a82KChJcU9sCU882XmqJJHHTSwpNgcu33hwU+mI17JlC7GjZeyMvKz2VqmwNjOzDjMUkjdm6eBqM+WWNXNeAGs+j5Kq1K6ZDe2qjLwt5lVKTDUMxFz85ydiLTX5dWYzHVyZrLXXadX49nZ7rYthPXayl2Q0nCsldNRimDv+CKea0VWCk00V5Sp0YzUwMiviFCsbMal8sJK73lTyxzel5QsONcZeWPQvC8w7Dvv6O9vVVxw186guMZWbjidgqQR7jFZkDRm/n9jPJIAvpWL8EFjMubWooz699RDgzeAoSjvEYzKRjQ97rYRIaDIV2kWzSawyAUQz6pgXnfKUCG6V1ZxnXr1x+fTlwzBaEIqTBY/h/MwgOQ0Ule4AXGwhBkqX/65x4dHx1y20fFk/pxmmc/k1dCk/2SVtoMHvAGRaucTXetEG5QhUnSE65jXsQ+fZ+6/i3anzvW/HqimB85dilV96hw6v9IsbPDQtfO93muVuCS1X/wVpN4TSP8Ugec/6+WnxMt6aJBqugUN6h4TflPeyJUnDwy+Wr0NpjA2k2IKQThQHsWi25tkUewDwKRZspBLv0yEOzelukfiA/QBzKd7kJJOk7+Kzwd4O/g5Dn7OccE9FigZqXxCnWESl+kjbCNNM2cuVTz1lU3ZWW9DDbPJ56y4KZtuwE3vlHSvd0BJJx7dgOifzu0xsJ8XZancNls2ZOnaNkKUpGQbCm8QEapSrvXBUqZb8/FPVKRbs+usPP1aH9aUqdf6LMd84jXzaahuucelRhIAe7XbxXGtTUJ+q40GupjDapsbP0UQ63eZ4mmw1VGSwWkw7H2a9m7SNg2RgUgV8eubjMnp+cZccxN7+PfkJrf3RaodUZ4dZDnomb5qkExVYgyvR2aq12AdXQ8DxmgY9mm8hkjbZWVfA1mC5gnA8JZgYwQdob0dGEHPdGZjyWDW5k3Yb+KyXeYq01wv/12lKBtBUh1JAoz9JyLbta2p7n+OPJuTXbqxkRlblRZl/0nFdm1sqmuhIzc2q9RhI7O1fa2fe7Y04yV074nAxBwCvFqra2r8JRxdrq/yptLM9R8TrPzSKbH9TGAyqtvPGCbt6/BJxWRk6tJuEuwuWiDDFkvlWCSil+ffUBFrh7iSYFtFTVSd+EOwHH66E82Gr6Ena9fXapum7WxVR09WkS5HR7tatbW0qzp62ookNPtPmmaf7Es9kbzqVGg9sp7JZrTXleXMPquZlbjGl8VMmgNJlsWxY+uleN0kzQc55qxl7NDVJ6TsOmYrZCLPQjnmJGWDCIVZOhTP4IYXyrZykg0ikiGHjkUOMvFpAN7u5zG5ZlH+uoBZsGohyIOHGHrMRr+pcx0vk/q8wXFUV+HikzcQAR+fAs5TFCyBh3AxuWFR/DcyRdSazLyP0L+O73K0zhHuMoweQybcS84tOvpFojWW57O7NfmVDdEFzGZAbqbcxe/zIPQbvq8kEVEFBDkQVfcZiC4RudewemmQbpPYEKgSX3OOu4d42cJg2V28AF9hH96w+X2AK+C9tPFvFUi3Ilixn10EYJWCKKsw2vb4J7ZhP3r+/n9nvr2MeocAAA== 122 | 123 | 124 | dbo 125 | 126 | -------------------------------------------------------------------------------- /ExecuteAutoEmployee/Scripts/respond.js: -------------------------------------------------------------------------------- 1 | /* NUGET: BEGIN LICENSE TEXT 2 | * 3 | * Microsoft grants you the right to use these script files for the sole 4 | * purpose of either: (i) interacting through your browser with the Microsoft 5 | * website or online service, subject to the applicable licensing or use 6 | * terms; or (ii) using the files as included with a Microsoft product subject 7 | * to that product's license terms. Microsoft reserves all other rights to the 8 | * files not expressly granted by Microsoft, whether by implication, estoppel 9 | * or otherwise. Insofar as a script file is dual licensed under GPL, 10 | * Microsoft neither took the code under GPL nor distributes it thereunder but 11 | * under the terms set out in this paragraph. All notices and licenses 12 | * below are for informational purposes only. 13 | * 14 | * NUGET: END LICENSE TEXT */ 15 | /*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */ 16 | /*! NOTE: If you're already including a window.matchMedia polyfill via Modernizr or otherwise, you don't need this part */ 17 | window.matchMedia = window.matchMedia || (function(doc, undefined){ 18 | 19 | var bool, 20 | docElem = doc.documentElement, 21 | refNode = docElem.firstElementChild || docElem.firstChild, 22 | // fakeBody required for 23 | fakeBody = doc.createElement('body'), 24 | div = doc.createElement('div'); 25 | 26 | div.id = 'mq-test-1'; 27 | div.style.cssText = "position:absolute;top:-100em"; 28 | fakeBody.style.background = "none"; 29 | fakeBody.appendChild(div); 30 | 31 | return function(q){ 32 | 33 | div.innerHTML = '­'; 34 | 35 | docElem.insertBefore(fakeBody, refNode); 36 | bool = div.offsetWidth == 42; 37 | docElem.removeChild(fakeBody); 38 | 39 | return { matches: bool, media: q }; 40 | }; 41 | 42 | })(document); 43 | 44 | 45 | 46 | 47 | /*! Respond.js v1.2.0: min/max-width media query polyfill. (c) Scott Jehl. MIT/GPLv2 Lic. j.mp/respondjs */ 48 | (function( win ){ 49 | //exposed namespace 50 | win.respond = {}; 51 | 52 | //define update even in native-mq-supporting browsers, to avoid errors 53 | respond.update = function(){}; 54 | 55 | //expose media query support flag for external use 56 | respond.mediaQueriesSupported = win.matchMedia && win.matchMedia( "only all" ).matches; 57 | 58 | //if media queries are supported, exit here 59 | if( respond.mediaQueriesSupported ){ return; } 60 | 61 | //define vars 62 | var doc = win.document, 63 | docElem = doc.documentElement, 64 | mediastyles = [], 65 | rules = [], 66 | appendedEls = [], 67 | parsedSheets = {}, 68 | resizeThrottle = 30, 69 | head = doc.getElementsByTagName( "head" )[0] || docElem, 70 | base = doc.getElementsByTagName( "base" )[0], 71 | links = head.getElementsByTagName( "link" ), 72 | requestQueue = [], 73 | 74 | //loop stylesheets, send text content to translate 75 | ripCSS = function(){ 76 | var sheets = links, 77 | sl = sheets.length, 78 | i = 0, 79 | //vars for loop: 80 | sheet, href, media, isCSS; 81 | 82 | for( ; i < sl; i++ ){ 83 | sheet = sheets[ i ], 84 | href = sheet.href, 85 | media = sheet.media, 86 | isCSS = sheet.rel && sheet.rel.toLowerCase() === "stylesheet"; 87 | 88 | //only links plz and prevent re-parsing 89 | if( !!href && isCSS && !parsedSheets[ href ] ){ 90 | // selectivizr exposes css through the rawCssText expando 91 | if (sheet.styleSheet && sheet.styleSheet.rawCssText) { 92 | translate( sheet.styleSheet.rawCssText, href, media ); 93 | parsedSheets[ href ] = true; 94 | } else { 95 | if( (!/^([a-zA-Z:]*\/\/)/.test( href ) && !base) 96 | || href.replace( RegExp.$1, "" ).split( "/" )[0] === win.location.host ){ 97 | requestQueue.push( { 98 | href: href, 99 | media: media 100 | } ); 101 | } 102 | } 103 | } 104 | } 105 | makeRequests(); 106 | }, 107 | 108 | //recurse through request queue, get css text 109 | makeRequests = function(){ 110 | if( requestQueue.length ){ 111 | var thisRequest = requestQueue.shift(); 112 | 113 | ajax( thisRequest.href, function( styles ){ 114 | translate( styles, thisRequest.href, thisRequest.media ); 115 | parsedSheets[ thisRequest.href ] = true; 116 | makeRequests(); 117 | } ); 118 | } 119 | }, 120 | 121 | //find media blocks in css text, convert to style blocks 122 | translate = function( styles, href, media ){ 123 | var qs = styles.match( /@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi ), 124 | ql = qs && qs.length || 0, 125 | //try to get CSS path 126 | href = href.substring( 0, href.lastIndexOf( "/" )), 127 | repUrls = function( css ){ 128 | return css.replace( /(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g, "$1" + href + "$2$3" ); 129 | }, 130 | useMedia = !ql && media, 131 | //vars used in loop 132 | i = 0, 133 | j, fullq, thisq, eachq, eql; 134 | 135 | //if path exists, tack on trailing slash 136 | if( href.length ){ href += "/"; } 137 | 138 | //if no internal queries exist, but media attr does, use that 139 | //note: this currently lacks support for situations where a media attr is specified on a link AND 140 | //its associated stylesheet has internal CSS media queries. 141 | //In those cases, the media attribute will currently be ignored. 142 | if( useMedia ){ 143 | ql = 1; 144 | } 145 | 146 | 147 | for( ; i < ql; i++ ){ 148 | j = 0; 149 | 150 | //media attr 151 | if( useMedia ){ 152 | fullq = media; 153 | rules.push( repUrls( styles ) ); 154 | } 155 | //parse for styles 156 | else{ 157 | fullq = qs[ i ].match( /@media *([^\{]+)\{([\S\s]+?)$/ ) && RegExp.$1; 158 | rules.push( RegExp.$2 && repUrls( RegExp.$2 ) ); 159 | } 160 | 161 | eachq = fullq.split( "," ); 162 | eql = eachq.length; 163 | 164 | for( ; j < eql; j++ ){ 165 | thisq = eachq[ j ]; 166 | mediastyles.push( { 167 | media : thisq.split( "(" )[ 0 ].match( /(only\s+)?([a-zA-Z]+)\s?/ ) && RegExp.$2 || "all", 168 | rules : rules.length - 1, 169 | hasquery: thisq.indexOf("(") > -1, 170 | minw : thisq.match( /\(min\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/ ) && parseFloat( RegExp.$1 ) + ( RegExp.$2 || "" ), 171 | maxw : thisq.match( /\(max\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/ ) && parseFloat( RegExp.$1 ) + ( RegExp.$2 || "" ) 172 | } ); 173 | } 174 | } 175 | 176 | applyMedia(); 177 | }, 178 | 179 | lastCall, 180 | 181 | resizeDefer, 182 | 183 | // returns the value of 1em in pixels 184 | getEmValue = function() { 185 | var ret, 186 | div = doc.createElement('div'), 187 | body = doc.body, 188 | fakeUsed = false; 189 | 190 | div.style.cssText = "position:absolute;font-size:1em;width:1em"; 191 | 192 | if( !body ){ 193 | body = fakeUsed = doc.createElement( "body" ); 194 | body.style.background = "none"; 195 | } 196 | 197 | body.appendChild( div ); 198 | 199 | docElem.insertBefore( body, docElem.firstChild ); 200 | 201 | ret = div.offsetWidth; 202 | 203 | if( fakeUsed ){ 204 | docElem.removeChild( body ); 205 | } 206 | else { 207 | body.removeChild( div ); 208 | } 209 | 210 | //also update eminpx before returning 211 | ret = eminpx = parseFloat(ret); 212 | 213 | return ret; 214 | }, 215 | 216 | //cached container for 1em value, populated the first time it's needed 217 | eminpx, 218 | 219 | //enable/disable styles 220 | applyMedia = function( fromResize ){ 221 | var name = "clientWidth", 222 | docElemProp = docElem[ name ], 223 | currWidth = doc.compatMode === "CSS1Compat" && docElemProp || doc.body[ name ] || docElemProp, 224 | styleBlocks = {}, 225 | lastLink = links[ links.length-1 ], 226 | now = (new Date()).getTime(); 227 | 228 | //throttle resize calls 229 | if( fromResize && lastCall && now - lastCall < resizeThrottle ){ 230 | clearTimeout( resizeDefer ); 231 | resizeDefer = setTimeout( applyMedia, resizeThrottle ); 232 | return; 233 | } 234 | else { 235 | lastCall = now; 236 | } 237 | 238 | for( var i in mediastyles ){ 239 | var thisstyle = mediastyles[ i ], 240 | min = thisstyle.minw, 241 | max = thisstyle.maxw, 242 | minnull = min === null, 243 | maxnull = max === null, 244 | em = "em"; 245 | 246 | if( !!min ){ 247 | min = parseFloat( min ) * ( min.indexOf( em ) > -1 ? ( eminpx || getEmValue() ) : 1 ); 248 | } 249 | if( !!max ){ 250 | max = parseFloat( max ) * ( max.indexOf( em ) > -1 ? ( eminpx || getEmValue() ) : 1 ); 251 | } 252 | 253 | // if there's no media query at all (the () part), or min or max is not null, and if either is present, they're true 254 | if( !thisstyle.hasquery || ( !minnull || !maxnull ) && ( minnull || currWidth >= min ) && ( maxnull || currWidth <= max ) ){ 255 | if( !styleBlocks[ thisstyle.media ] ){ 256 | styleBlocks[ thisstyle.media ] = []; 257 | } 258 | styleBlocks[ thisstyle.media ].push( rules[ thisstyle.rules ] ); 259 | } 260 | } 261 | 262 | //remove any existing respond style element(s) 263 | for( var i in appendedEls ){ 264 | if( appendedEls[ i ] && appendedEls[ i ].parentNode === head ){ 265 | head.removeChild( appendedEls[ i ] ); 266 | } 267 | } 268 | 269 | //inject active styles, grouped by media type 270 | for( var i in styleBlocks ){ 271 | var ss = doc.createElement( "style" ), 272 | css = styleBlocks[ i ].join( "\n" ); 273 | 274 | ss.type = "text/css"; 275 | ss.media = i; 276 | 277 | //originally, ss was appended to a documentFragment and sheets were appended in bulk. 278 | //this caused crashes in IE in a number of circumstances, such as when the HTML element had a bg image set, so appending beforehand seems best. Thanks to @dvelyk for the initial research on this one! 279 | head.insertBefore( ss, lastLink.nextSibling ); 280 | 281 | if ( ss.styleSheet ){ 282 | ss.styleSheet.cssText = css; 283 | } 284 | else { 285 | ss.appendChild( doc.createTextNode( css ) ); 286 | } 287 | 288 | //push to appendedEls to track for later removal 289 | appendedEls.push( ss ); 290 | } 291 | }, 292 | //tweaked Ajax functions from Quirksmode 293 | ajax = function( url, callback ) { 294 | var req = xmlHttp(); 295 | if (!req){ 296 | return; 297 | } 298 | req.open( "GET", url, true ); 299 | req.onreadystatechange = function () { 300 | if ( req.readyState != 4 || req.status != 200 && req.status != 304 ){ 301 | return; 302 | } 303 | callback( req.responseText ); 304 | } 305 | if ( req.readyState == 4 ){ 306 | return; 307 | } 308 | req.send( null ); 309 | }, 310 | //define ajax obj 311 | xmlHttp = (function() { 312 | var xmlhttpmethod = false; 313 | try { 314 | xmlhttpmethod = new XMLHttpRequest(); 315 | } 316 | catch( e ){ 317 | xmlhttpmethod = new ActiveXObject( "Microsoft.XMLHTTP" ); 318 | } 319 | return function(){ 320 | return xmlhttpmethod; 321 | }; 322 | })(); 323 | 324 | //translate CSS 325 | ripCSS(); 326 | 327 | //expose update for re-running respond later on 328 | respond.update = ripCSS; 329 | 330 | //adjust on resize 331 | function callMedia(){ 332 | applyMedia( true ); 333 | } 334 | if( win.addEventListener ){ 335 | win.addEventListener( "resize", callMedia, false ); 336 | } 337 | else if( win.attachEvent ){ 338 | win.attachEvent( "onresize", callMedia ); 339 | } 340 | })(this); 341 | --------------------------------------------------------------------------------