Posts

Showing posts from 2018

Recent

SQL Server Symmetric Key & Certificate based Encryption With AES_256 Algorithm

--  Create SYMMETRIC KEY  &  CERTIFICATE CREATE MASTER KEY ENCRYPTION BY PASSWORD  =   ' newPasswordForEncryption ' ; CREATE CERTIFICATE MyCertificate     WITH SUBJECT  =   ' MyCryptographyCertificate ' ; CREATE SYMMETRIC KEY MySymetricKey     WITH IDENTITY_VALUE  =   ' MyCryptoIdentityValue '   ,          ALGORITHM  =  AES_256  ,          KEY_SOURCE  =   ' $dggfg@9e& '     ENCRYPTION BY CERTIFICATE OHCertificate ; SELECT  *  FROM   sys . symmetric_keys ;   --  returns created key --  Create SYMMETRIC KEY  &  CERTIFICATE --  Create Sp to Open CLose SYMMETRIC KEY Or You can create  &  use Scalar  Function SET QUOTED_IDENTIFIER ON ; SET ANSI_NULLS ON ; GO --   ============================================= --   Author :   Yawahang Rai --  Create  date :   12 / 20 / 2016 --   Description :   Function  To Open Close Symetric Key --   ============================================= CREATE PROCEDURE dbo . SfOpenCloseKeys (     @Task  CHAR  ( 5 ))

Ad Hoc Query / Dynamic Query Implementation

---  Dynamic script workout DECLARE     @ SQL      NVARCHAR ( 500 ) ,     @ SQLOut      NVARCHAR ( 500 ) ,     @ UserName  NVARCHAR ( 50 ) ,     @ Columns     NVARCHAR ( 100 ) ,     @ ParmDefinition  NVARCHAR ( 100 ) ,     @ ParmDefinitionOut  NVARCHAR ( 100 ) ,     @ Table     NVARCHAR ( 128 ) ,     @ PersonID    INT ; CREATE TABLE #Person (    [PersonId]  INT ,    [FirstName]  NVARCHAR ( 25 ) ,    [LastName]   NVARCHAR ( 25 ) ,    [UserName]   NVARCHAR ( 50 ) ) ; INSERT INTO #Person VALUES    (  1 ,  N ' Default ' ,  N ' Default ' ,  N ' Default.com.np '  ) ,    (  2 ,  N ' Mik ' ,  N ' User ' ,  N ' admin@ad.com '  ) ,    (  3 ,  N ' Kaww ' ,  N ' Poudel ' ,  N ' jhjv@gg.com.np '  ) ; SET  @ Columns  =   ' FirstName, LastName,UserName ' ; SET  @ Table  =   ' #Person ' ; SET  @ PersonID  =   2 ; --  adhoc  -  script SET  @ SQL  =   ' SELECT  '   +   @ Columns  +   '  FROM  '   +  

Truncate All Tables with Foreign Keys SQL

SET QUOTED_IDENTIFIER ON ; SET ANSI_NULLS ON ; GO --   ============================================= --   Author :     Yawahang Rai --  Create  date :   12 / 18 / 2018 --   Description :  Stored Procedure To Truncate all data --   ============================================= ALTER PROCEDURE dbo . UtlResetDatabase AS     BEGIN         SET NOCOUNT ON ;         DECLARE  @ i INT  ,                  @ TableName  VARCHAR  ( 80 )  ,                  @ ColumnName  VARCHAR  ( 80 )  ,                  @ ReferencedTableName  VARCHAR  ( 80 )  ,                  @ ReferencedColumnName  VARCHAR  ( 80 )  ,                  @ ConstraintName  VARCHAR  ( 250 )  ,                  @ CreateStatement  VARCHAR  (MAX)  ,                  @ DropStatement  VARCHAR  (MAX)  ,                  @ CreateStatementTemp  VARCHAR  (MAX)  ,                  @ DropStatementTemp  VARCHAR  (MAX)  ,                  @ Statement  VARCHAR  (MAX) ;         SET  @ i  =   1 ;         SET  @ CreateStatement  =   ' ALTER TABL

Print Html table in new window

  printReport(): void {     let gridWindow = window.open(null, 'Print', 'toolbar=no, menubar=no, dialog=no, location=no, status=yes, resizable=yes, scrollbars=yes');     let htmlStart =       '<!DOCTYPE html>' +       '<html>' +       '<head>' +       '<meta charset="utf-8" />' +       '<title>' + this.report + '</title>' +       '<style type="text/css" media="print">@page {margin: 0.38in 0.1in 0.4in 0.1in;}</style>' + // print margin       '<style type="text/css">table{width:100%;margin-bottom:1rem;background-color:transparent;border-collapse:collapse}table thead{background:#dee2e6}table thead th{vertical-align:bottom;padding:.2rem;border:none;border-left:.5px solid #c1c6cc;border-right:.5px solid #c1c6cc;text-align:center}table tbody tr td{border-left:.5px solid #dee2e6;border-right:.5px solid #dee2e6;padd

Kendo Excel Export

https://stackblitz.com/edit/angular-stiojo?embed=1&file=app/app.component.ts import   {   Component   }   from   "@angular/core" ; import   {  products  }   from   "./products" ; @ Component ({   selector :   "my-app" ,   template :   `     <button type="button" class="k-button" (click)="excelexport.save()">       Export To Excel     </button>     <kendo-excelexport [data]="data" fileName="Products.xlsx" #excelexport>       <kendo-excelexport-column *ngFor="let col of columns" [field]="col.name">       </kendo-excelexport-column>     </kendo-excelexport>   ` }) export   class   AppComponent   {    public  data :   any []   =  products ;    public  columns  =   [{  name :   "ProductName"   },   {  name :   "QuantityPerUnit"   }]; }

Kendo Pdf Export

https://stackblitz.com/edit/ng-kendo-pdf-export-kk-12?embed=1&file=app/app.component.ts&view=preview import   {   Component   }   from   "@angular/core" ; import   {  products  }   from   "./products" ; @ Component ({   selector :   "my-app" ,   template :   `     <div class="example-config">       <button kendo-button (click)="pdf.saveAs('table.pdf')">         Save As PDF...       </button>     </div>     <kendo-pdf-export       *ngIf="reportPdfGrid"       paperSize="A4"       margin="2cm"       landscape="true"       repeatHeaders="true"       scale="0.8"     >       <table>         <thead>           <tr>             <th *ngFor="let col of columns">{{ col.name }}</th>           </tr>         </thead>         <tbody>           <tr *ngFor="let dat of gridData"

Kendo Grid Export To Excel All Data

  https://stackblitz.com/edit/angular-tud43m?embed=1&file=app/app.component.ts import   {   Component   }   from   "@angular/core" ; import   {  process  }   from   "@progress/kendo-data-query" ; import   {   ExcelExportData   }   from   "@progress/kendo-angular-excel-export" ; import   {  products  }   from   "./products" ; @ Component ({   selector :   "my-app" ,   template :   `     <kendo-grid       [kendoGridBinding]="products"       [height]="400"       [group]="group"       [pageable]="true"       [pageSize]="10"     >       <ng-template kendoGridToolbarTemplate>         <button type="button" kendoGridExcelCommand icon="file-excel">           Export to Excel         </button>       </ng-template>       <kendo-grid-column field="ProductID" title="Product ID" [width]="200">       </kendo