Commit 81b5b291eb521a0cec921fab6c255dd147bec1ad

Authored by Harpreet Banwait
1 parent 39596853

Duplicate account number validation work.

400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/LicenseController.cs
... ... @@ -389,5 +389,21 @@ namespace AIAHTML5.ADMIN.API.Controllers
389 389 }
390 390 }
391 391  
  392 + [Route("CheckAccountNumber")]
  393 + [HttpGet]
  394 + public HttpResponseMessage CheckAccountNumber(string AccountNo)
  395 + {
  396 + bool Status = false;
  397 + try
  398 + {
  399 + Status = LicenseModel.CheckAccountNumber(dbContext, AccountNo);
  400 + return Request.CreateResponse(HttpStatusCode.OK, Status.ToString());
  401 + }
  402 + catch (Exception ex)
  403 + {
  404 + // Log exception code goes here
  405 + return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message);
  406 + }
  407 + }
392 408 }
393 409 }
... ...
400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/ReportController.cs
... ... @@ -23,7 +23,8 @@ namespace AIAHTML5.ADMIN.API.Controllers
23 23 [HttpGet]
24 24 public IHttpActionResult GetUsageReport(string sFromDate, string sToDate, string sAccoutNumber, string sZip, int iState, int iCountry)
25 25 {
26   - var lstUsageReport = dbContext.GetUsageReport(sFromDate, sToDate, sAccoutNumber, sZip, iState, iCountry).ToList();
  26 + var spRecordCount = new System.Data.Objects.ObjectParameter("recordCount", 0);
  27 + var lstUsageReport = dbContext.GetUsageReport(sFromDate, sToDate, sAccoutNumber, sZip, iState, iCountry, 1, 5, spRecordCount).ToList();
27 28 return Ok(lstUsageReport);
28 29 }
29 30  
... ...
400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.Context.cs
... ... @@ -1655,7 +1655,7 @@ namespace AIAHTML5.ADMIN.API.Entity
1655 1655 return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<Nullable<int>>("GetTotalLoginsByLicenseEditionId", licenseEditionIdParameter);
1656 1656 }
1657 1657  
1658   - public virtual ObjectResult<GetUsageReport_Result> GetUsageReport(string sFromDate, string sToDate, string sAccoutNumber, string sZip, Nullable<int> iState, Nullable<int> iCountry)
  1658 + public virtual ObjectResult<GetUsageReport_Result> GetUsageReport(string sFromDate, string sToDate, string sAccoutNumber, string sZip, Nullable<int> iState, Nullable<int> iCountry, Nullable<int> pageNo, Nullable<int> pageLength, ObjectParameter recordCount)
1659 1659 {
1660 1660 var sFromDateParameter = sFromDate != null ?
1661 1661 new ObjectParameter("sFromDate", sFromDate) :
... ... @@ -1681,7 +1681,15 @@ namespace AIAHTML5.ADMIN.API.Entity
1681 1681 new ObjectParameter("iCountry", iCountry) :
1682 1682 new ObjectParameter("iCountry", typeof(int));
1683 1683  
1684   - return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<GetUsageReport_Result>("GetUsageReport", sFromDateParameter, sToDateParameter, sAccoutNumberParameter, sZipParameter, iStateParameter, iCountryParameter);
  1684 + var pageNoParameter = pageNo.HasValue ?
  1685 + new ObjectParameter("pageNo", pageNo) :
  1686 + new ObjectParameter("pageNo", typeof(int));
  1687 +
  1688 + var pageLengthParameter = pageLength.HasValue ?
  1689 + new ObjectParameter("pageLength", pageLength) :
  1690 + new ObjectParameter("pageLength", typeof(int));
  1691 +
  1692 + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<GetUsageReport_Result>("GetUsageReport", sFromDateParameter, sToDateParameter, sAccoutNumberParameter, sZipParameter, iStateParameter, iCountryParameter, pageNoParameter, pageLengthParameter, recordCount);
1685 1693 }
1686 1694  
1687 1695 public virtual ObjectResult<GetUsageReport_OLD_PROC_Result> GetUsageReport_OLD_PROC(string sFromDate, string sToDate, string sAccoutNumber, string sZip, Nullable<int> iState, Nullable<int> iCountry)
... ... @@ -3674,5 +3682,23 @@ namespace AIAHTML5.ADMIN.API.Entity
3674 3682  
3675 3683 return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<GetSearchUsers_Result>("GetSearchUsers", sFirstNameParameter, sLastNameParameter, sEmailIdParameter, sAccoutNumberParameter, iUserTypeIdParameter, iAccountTypeIdParameter, iLoginUserTypeParameter, pageNoParameter, pageLengthParameter, recordCount);
3676 3684 }
  3685 +
  3686 + public virtual int InsertIncorrectLoginAttempts(Nullable<int> iUserId)
  3687 + {
  3688 + var iUserIdParameter = iUserId.HasValue ?
  3689 + new ObjectParameter("iUserId", iUserId) :
  3690 + new ObjectParameter("iUserId", typeof(int));
  3691 +
  3692 + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("InsertIncorrectLoginAttempts", iUserIdParameter);
  3693 + }
  3694 +
  3695 + public virtual int usp_CheckAccountNoExists(string accountNo, ObjectParameter status)
  3696 + {
  3697 + var accountNoParameter = accountNo != null ?
  3698 + new ObjectParameter("AccountNo", accountNo) :
  3699 + new ObjectParameter("AccountNo", typeof(string));
  3700 +
  3701 + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("usp_CheckAccountNoExists", accountNoParameter, status);
  3702 + }
3677 3703 }
3678 3704 }
... ...
400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.edmx
... ... @@ -2184,9 +2184,6 @@ warning 6002: The table/view &#39;AIADatabaseV5.dbo.VocabTermNumberToSystemMap&#39; does
2184 2184 <Parameter Name="sLicenseAccount" Type="varchar" Mode="In" />
2185 2185 <Parameter Name="iEditionId" Type="int" Mode="In" />
2186 2186 </Function>
2187   - <Function Name="GetLicenseIdByUserId" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo">
2188   - <Parameter Name="iUserId" Type="int" Mode="In" />
2189   - </Function>
2190 2187 <Function Name="GetLicenseIdEditionIdByUserId" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo">
2191 2188 <Parameter Name="iUserId" Type="int" Mode="In" />
2192 2189 </Function>
... ... @@ -2294,6 +2291,9 @@ warning 6002: The table/view &#39;AIADatabaseV5.dbo.VocabTermNumberToSystemMap&#39; does
2294 2291 <Parameter Name="sZip" Type="varchar" Mode="In" />
2295 2292 <Parameter Name="iState" Type="int" Mode="In" />
2296 2293 <Parameter Name="iCountry" Type="int" Mode="In" />
  2294 + <Parameter Name="pageNo" Type="int" Mode="In" />
  2295 + <Parameter Name="pageLength" Type="int" Mode="In" />
  2296 + <Parameter Name="recordCount" Type="int" Mode="InOut" />
2297 2297 </Function>
2298 2298 <Function Name="GetUsageReport_OLD_PROC" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo">
2299 2299 <Parameter Name="sFromDate" Type="varchar" Mode="In" />
... ... @@ -2355,6 +2355,9 @@ warning 6002: The table/view &#39;AIADatabaseV5.dbo.VocabTermNumberToSystemMap&#39; does
2355 2355 <Function Name="InsertIncorrectLoginAttempt" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo">
2356 2356 <Parameter Name="iUserId" Type="int" Mode="In" />
2357 2357 </Function>
  2358 + <Function Name="InsertIncorrectLoginAttempts" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo">
  2359 + <Parameter Name="iUserId" Type="int" Mode="In" />
  2360 + </Function>
2358 2361 <Function Name="InsertLoginDetail" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo">
2359 2362 <Parameter Name="iUserId" Type="int" Mode="In" />
2360 2363 </Function>
... ... @@ -2636,6 +2639,10 @@ warning 6002: The table/view &#39;AIADatabaseV5.dbo.VocabTermNumberToSystemMap&#39; does
2636 2639 <Parameter Name="EmailId" Type="varchar" Mode="In" />
2637 2640 <Parameter Name="Status" Type="int" Mode="InOut" />
2638 2641 </Function>
  2642 + <Function Name="usp_CheckAccountNoExists" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo">
  2643 + <Parameter Name="AccountNo" Type="varchar" Mode="In" />
  2644 + <Parameter Name="Status" Type="bit" Mode="InOut" />
  2645 + </Function>
2639 2646 <Function Name="usp_DB_TblRowCOUNT" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo" />
2640 2647 <Function Name="usp_DeleteLicenseUserGroup" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo">
2641 2648 <Parameter Name="UserGroupId" Type="int" Mode="In" />
... ... @@ -5942,6 +5949,9 @@ FROM [dbo].[VocabTermNumberToSystemMap] AS [VocabTermNumberToSystemMap]&lt;/Definin
5942 5949 <Parameter Name="sZip" Mode="In" Type="String" />
5943 5950 <Parameter Name="iState" Mode="In" Type="Int32" />
5944 5951 <Parameter Name="iCountry" Mode="In" Type="Int32" />
  5952 + <Parameter Name="pageNo" Mode="In" Type="Int32" />
  5953 + <Parameter Name="pageLength" Mode="In" Type="Int32" />
  5954 + <Parameter Name="recordCount" Mode="InOut" Type="Int32" />
5945 5955 </FunctionImport>
5946 5956 <FunctionImport Name="GetUsageReport_OLD_PROC" ReturnType="Collection(AIADatabaseV5Model.GetUsageReport_OLD_PROC_Result)">
5947 5957 <Parameter Name="sFromDate" Mode="In" Type="String" />
... ... @@ -6517,6 +6527,13 @@ FROM [dbo].[VocabTermNumberToSystemMap] AS [VocabTermNumberToSystemMap]&lt;/Definin
6517 6527 <Parameter Name="pageLength" Mode="In" Type="Int32" />
6518 6528 <Parameter Name="recordCount" Mode="InOut" Type="Int32" />
6519 6529 </FunctionImport>
  6530 + <FunctionImport Name="InsertIncorrectLoginAttempts">
  6531 + <Parameter Name="iUserId" Mode="In" Type="Int32" />
  6532 + </FunctionImport>
  6533 + <FunctionImport Name="usp_CheckAccountNoExists">
  6534 + <Parameter Name="AccountNo" Mode="In" Type="String" />
  6535 + <Parameter Name="Status" Mode="InOut" Type="Boolean" />
  6536 + </FunctionImport>
6520 6537 </EntityContainer>
6521 6538 <ComplexType Name="DA_GetBaseLayer_Result">
6522 6539 <Property Type="Int32" Name="Id" Nullable="false" />
... ... @@ -9346,7 +9363,6 @@ FROM [dbo].[VocabTermNumberToSystemMap] AS [VocabTermNumberToSystemMap]&lt;/Definin
9346 9363 </ComplexTypeMapping>
9347 9364 </ResultMapping>
9348 9365 </FunctionImportMapping>
9349   - <FunctionImportMapping FunctionImportName="GetLicenseIdByUserId" FunctionName="AIADatabaseV5Model.Store.GetLicenseIdByUserId" />
9350 9366 <FunctionImportMapping FunctionImportName="GetLicenseIdEditionIdByUserId" FunctionName="AIADatabaseV5Model.Store.GetLicenseIdEditionIdByUserId">
9351 9367 <ResultMapping>
9352 9368 <ComplexTypeMapping TypeName="AIADatabaseV5Model.GetLicenseIdEditionIdByUserId_Result">
... ... @@ -10080,6 +10096,8 @@ FROM [dbo].[VocabTermNumberToSystemMap] AS [VocabTermNumberToSystemMap]&lt;/Definin
10080 10096 </ComplexTypeMapping>
10081 10097 </ResultMapping>
10082 10098 </FunctionImportMapping>
  10099 + <FunctionImportMapping FunctionImportName="InsertIncorrectLoginAttempts" FunctionName="AIADatabaseV5Model.Store.InsertIncorrectLoginAttempts" />
  10100 + <FunctionImportMapping FunctionImportName="usp_CheckAccountNoExists" FunctionName="AIADatabaseV5Model.Store.usp_CheckAccountNoExists" />
10083 10101 </EntityContainerMapping>
10084 10102 </Mapping>
10085 10103 </edmx:Mappings>
... ...
400-SOURCECODE/AIAHTML5.ADMIN.API/Models/LicenseModel.cs
... ... @@ -421,6 +421,19 @@ namespace AIAHTML5.ADMIN.API.Models
421 421 }
422 422 }
423 423  
  424 + public static bool CheckAccountNumber(AIADatabaseV5Entities dbContext, string AccountNo)
  425 + {
  426 + var spStatus = new System.Data.Objects.ObjectParameter("Status", 0);
  427 + try
  428 + {
  429 + dbContext.usp_CheckAccountNoExists(AccountNo, spStatus);
  430 + return (bool)spStatus.Value;
  431 + }
  432 + catch (Exception ex)
  433 + {
  434 + return false;
  435 + }
  436 + }
424 437 }
425 438  
426 439 public class LicenseTypeModel
... ...
400-SOURCECODE/AIAHTML5.ADMIN.Web/src/app/app.module.ts
... ... @@ -89,8 +89,8 @@ import { NumberOnlyDirective } from &#39;./shared/numberonlydirective&#39;;
89 89 // useClass: MyInterceptor,
90 90 // multi: true
91 91 //}
92   - { provide: APP_BASE_HREF, useValue: '/Admin-UI' }
93   - //{ provide: APP_BASE_HREF, useValue: '/' }
  92 + //{ provide: APP_BASE_HREF, useValue: '/Admin-UI' }
  93 + { provide: APP_BASE_HREF, useValue: '/' }
94 94  
95 95 ],
96 96 bootstrap: [AppComponent]
... ...
400-SOURCECODE/AIAHTML5.ADMIN.Web/src/app/components/SubscriptionPrice/subscriptionprice.component.html
... ... @@ -149,6 +149,7 @@
149 149 <label for="duration" class="col-sm-4 control-label">Duration <span class="red">*</span> :</label>
150 150 <div class="col-sm-7">
151 151 <input type="text" class="form-control" id="duration" formControlName="duration" maxlength="2">
  152 + <span class="help-block">(in Months)</span>
152 153 <div *ngIf="insertSubscriptionPriceFrm.controls.duration.hasError('required') && insertSubscriptionPriceFrm.controls.duration.dirty" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;">Subscription duration is required</div>
153 154 <div *ngIf="insertSubscriptionPriceFrm.controls.duration.hasError('pattern') && insertSubscriptionPriceFrm.controls.duration.dirty" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;">Subscription duration must be numeric</div>
154 155 </div>
... ...
500-DBDump/AIA-StoredProcedures/usp_CheckAccountNoExists.sql 0 → 100644
  1 +SET QUOTED_IDENTIFIER ON
  2 +GO
  3 +SET ANSI_NULLS ON
  4 +GO
  5 +
  6 +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[usp_CheckAccountNoExists]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  7 +drop procedure [dbo].[usp_CheckAccountNoExists]
  8 +GO
  9 +
  10 +-- ====================================================
  11 +-- Author: Magic Software
  12 +-- Create date: 06-March-2018
  13 +-- Description: To get all the Editions
  14 +-- ====================================================
  15 +create PROCEDURE [dbo].[usp_CheckAccountNoExists]
  16 + @AccountNo varchar(50), @Status bit out
  17 + -- Add the parameters for the stored procedure here
  18 +AS
  19 +BEGIN
  20 + -- SET NOCOUNT ON added to prevent extra result sets from
  21 + -- interfering with SELECT statements.
  22 + SET NOCOUNT ON;
  23 + set @Status = 0;
  24 + -- Insert statements for procedure here
  25 + if(exists(select * from License where Lower(AccountNumber) = Lower(@AccountNo)))
  26 + begin
  27 + set @Status = 1;
  28 + end
  29 +END
  30 +
  31 +GO
  32 +SET QUOTED_IDENTIFIER OFF
  33 +GO
  34 +SET ANSI_NULLS ON
  35 +GO
  36 +
  37 +
  38 +
  39 +
... ...