Categories
C# Notes

EF DB First -> Code First

We can auto generate Code First POCO Classes using Add Model and Code First From Existing Database Option. When we use above option we we will get our POCO classes but we may encounter few issues with them so we need to take a look back to them again for following things Once model are […]

Categories
C# Notes

Things to take care while working with EF Code First

Code First Can be enabled for existing db or blank db Command for enabling Code First Enabled-Migrations This will generate Migration Folder and Migration Configuration File where by default automaticmigration will be false. Many people consider to change that as that will not apply pending changes to database automatically When we do have change in […]

Categories
C# Notes

Change All Data Type of column from different table to new one

Things that we considered Default Constraint Nullable Renamed Default constraint name to df_tablename_column_name format declare @tData varchar(25) = ‘ decimal(14,2) ‘;–1. for cols without default constraint SELECT N’alter table ‘ + OBJECT_SCHEMA_NAME(T.[object_id],DB_ID()) + ‘.’ + T.[name] + ‘ alter column ‘ + C.[name] + @tData + case when C.[is_nullable] = 0 then ‘ not null […]

Categories
C# Notes

handy css classes with js function

clickLoadAjaxModal clickLoadPage [data-poload] ajaxLoad showLoading hideLoading submitForm cmdPrint CheckAll ajaxSubmit showLoading [Type: function]: this function can be called anytime before calling ajax stuffs, it will simply show loading icon in screen hideLoading [type: function]: This function can be used to close loading icon in screen once ajax process is completed cmdPrint [type: css class]:this class […]

Categories
C# Notes

Notes for Migrating WP Site from one domain to another

for migration of cpanel of wordpress site of one domain to another -> copy files from old cpanel -> to new cpanel export db from old cpanel -> import in new cpanel for above step 2 -> create db in new server, for above step 2 -> create db user and db pass in new […]

Categories
C# Notes

Help Doc For Dynamic ShowHideColumns Related to DataTables

Snippet Sample HTMl Snippet <div class=”dropdown showHideColumns” data-target=”mainTable1″>     <button class=”btn btn-primary dropdown-toggle” type=”button” data-toggle=”dropdown”>         <i class=”fa fa-gear”></i>         Show Hide Columns         <span class=”caret”></span>     </button>     <ul class=”dropdown-menu”></ul> </div> Here data-target=”mainTable1″ -> here mainTable1 represents the id for datatable Required Dependent JS Snippet function ShowHideColumn(target, colIndex) { var mTable = ‘#’ + target; var myDataTable = $(mTable).DataTable(); // Get the column API object var column = myDataTable.column(colIndex); // Toggle the visibility column.visible(!column.visible()); […]

Categories
C# Notes

EF Context CheckList

Normal General Processing Synchronous EF DB Context Data Insert EF DB Context Data Update EF DB Context Data Select EF DB Context Data Delete Bulk Processing Synchronous EF DB Context Data Insert EF DB Context Data Update EF DB Context Data Select EF DB Context Data Delete Normal General Processing Asynchronous EF DB Context Data […]

Categories
C# Notes

For Ajax Add Page

c# aspt.net controller part region url for ajax load blank form create async partiaviewresult action method load respective add form in partial view region url for ajax submit/save Create async JSONResult action method grab/get posted data save them to table if success return json with status true and data with recently added id if fail […]

Categories
C# Notes

For Fixed Header Sample Code

<table class=”table table-striped table-fixed-header table-hover ” id=”reportContent “> <thead id=”pageHeader” class=”header”> <tr> <th colspan=”2″ width=”100px”>&nbsp;</th> <th width=”100px”>Ledger Code</th> <th>Ledger Name</th> <th width=”100px”>Debit</th> <th width=”100px”>Credit</th> </tr> </thead>

Categories
C# Notes MSSQL Projects Sample Codes

Getting Started with .Net MVC c#

Using DB First Approach Database Part MSSQL Management Studio Create DB Tables, Views and Stored Procedure as requirement Visual Studio Application Part Create New Project Create Separate Projects for DAL Add Reference of DAL Project to main project Add Nuget package of Entity Framework to both projects [DAL and Main] Create EDMX Model from Database […]