Tuesday, 28 June 2022

sql store proc

 CREATE PROCEDURE dbo.StudentAttendenceReport 'daily'

    @daytype nvarchar(20)

  

AS

  

  IF @daytype ='weekly'

    BEGIN

      SELECT * FROM [dbo].[Tbl_Daily_Attendance]

WHERE ADate BETWEEN DATEADD(d,-7,

CONVERT(nvarchar(10),GETDATE(),101)) 

AND CONVERT(nvarchar(10),GETDATE(),101)

    END



  IF @daytype ='daily'

    BEGIN


SELECT*  FROM [dbo].[Tbl_Daily_Attendance]

WHERE ADate = CONVERT(nvarchar(10),

GETDATE(),101);

END

  IF @daytype ='monthly'

    BEGIN

SELECT * FROM [dbo].[Tbl_Daily_Attendance]

WHERE ADate BETWEEN DATEADD(d,-30,

CONVERT(nvarchar(10),GETDATE(),101)) 

AND CONVERT(nvarchar(10),GETDATE(),101)


END

Thursday, 23 June 2022

Cross issue

  <httpProtocol>

  <customHeaders>

  <add name="Access-Control-Allow-Origin" value="*" />

  <add name="Access-Control-Allow-Headers" value="Origin, X-Requested-With, Content-Type, Accept, Authorization" />

  <add name="Access-Control-Allow-Methods" value="GET, POST, PUT, DELETE, OPTIONS" />

  <add name="Access-Control-Allow-Credentials" value="true" />

  </customHeaders>

  </httpProtocol>


here cross issue due to the header not origin so i resolved header issue by allowing line 2 it is working 

fine cross is not only origin also depends on headers.

Wednesday, 22 June 2022

Return scalare value from storeprocedure using entity

 Today issue is to return scalare value from storeprocedure using entity .

>>i have tried excuted the count value in asp.net core but unable to find solution

>> i used dapper using the excuted the scaler value done in the dbcontext

moreover dapper is faster than context.


read this dapper file for clear

https://www.learndapper.com/selecting-scalar-values


Wednesday, 15 June 2022

asp.net core storedprocedure

 in asp.net core be careful with this namespace

using System.Data.SqlClient;


using Microsoft.Data.SqlClient;

microsoft is correct pls verify for storeprocedure before you update the data.

Wednesday, 8 June 2022

fileUpload in asp.net core

 NOTE:access denied due to not giving file name

var path = Path.Combine(_hostEnvironment.WebRootPath, "Uploads","Messages",  MessageID.ToString());

                        bool basePathExists = System.IO.Directory.Exists(path);

                        if (!basePathExists) Directory.CreateDirectory(path);

                        //while upload file you set path as well as filename then you dont get error accessdenied(imp)

                        var filePath = Path.Combine(path, message.uploadfilename.FileName);

                        using (var fileStream = new FileStream(filePath, FileMode.Create))

                        {

                            message.uploadfilename.CopyTo(fileStream);

                        }

basic code to upload file based on created id after save imp


https://codewithmukesh.com/blog/file-upload-in-aspnet-core-mvc/

Wednesday, 1 June 2022

azure database

 

azure firewall setting allow azure to access database then it will work fine'

default angular value select

   <select class="form-control" *ngFor="let f of campList">

          <option value="" [disabled]="true">Select </option>
                       <option>{{f.campaignName}}</option>
                       </select>

 <li [class.activeclass]="targetingTab=='tab1'"> <a (click)="targetingTab='tab1'"> Country</a>
                                                                    </li>
https://napster2210.github.io/ngx-spinner/

https://stackblitz.com/examples/package/bootstrap-icons

later work on spinner

angluar loader

 <div *ngIf="isLoading" class="loader" >

        <mat-progress-spinner
          color="primary"
          mode="indeterminate">
        </mat-progress-spinner>
    </div>

.loader{
    border-radius: 10px;
    height: 70px;
    left: 50%;
    position: absolute;
    top: 50%;
    transform: translate(-50%,-50%);
    width: 70px;
    z-index: 3;
    opacity: 0.5;
}

7 Common mistakes in Dot Net — You can avoid

  There are many common mistakes made during .NET (ASP.NET, .NET Core) development, which affect performance, security, and code… Code Crack...