SessionId – keeping it the same

If you don’t populate a value in the session of a page then the session Id will reset everytime the page is loaded.

protected void Page_PreInit(object sender, EventArgs e)
{
    //Need this line otherwise it resets the Session Id everytime!
    Session["keepme"] = "True";
}

CreateUserWizard Passsword Strength

To configure the strength of the password used by the CreateUserWizard control it needs to be set in the membership section of your web.config


  
    
    
  

The above example sets it to 7 alphanumeric characters.

Sort Collection

Here is a simple solution based on this article to implement a sort of a generic collection.

public ContentCollection Sort()
{
    List items = (List)Items;
    items.Sort();
    return this;
}

The Content class needs to implement IComparable

Windows shutdown command line

The following article gives a detail list of command line statements that can be used with the Shutdown command. The following snippet shows how to restart a remote computer

Shutdown /m \\computername /r 

HTML Codes

The following article lists all of the HTML codes that can be used in a web page to represent special characters.

CTE – Common Table Expression

The following is an example of a CTE we have used

WITH ProcessedTasks (PatientID, LowestTaskId)
AS
(
SELECT DISTINCT 
    RebatePatientSummary.PatientId, 
    MIN(RebatePayment.TaskEventId) AS Expr1
FROM
    StatementLineAssociatedPayment 
INNER JOIN
    RebatePayment 
    ON StatementLineAssociatedPayment.RebatePaymentId = RebatePayment.Id 
INNER JOIN
    RebatePatientStatementLine 
    ON StatementLineAssociatedPayment.StatementLineId = RebatePatientStatementLine.Id 
INNER JOIN
    RebatePatientSummary 
    ON RebatePatientStatementLine.SummaryId = RebatePatientSummary.Id 
INNER JOIN
    TaskEvent 
    ON RebatePayment.TaskEventId = TaskEvent.Id
WHERE
    (RebatePatientSummary.IssueStatus = 2) 
AND 
    (RebatePayment.TaskEventId <> 0)
AND
    (TaskEvent.EventStatus = 5)
AND 
    taskevent.rebateprocessed = 0
GROUP BY 
    RebatePatientSummary.PatientId
)

SELECT 
    t.Id,
    t.PatientId,
    t.RebateProcessed, 
    p.lowestTaskId, 
    t.SystemTaskId
FROM 
    TaskEvent as t
INNER JOIN 
    ProcessedTasks AS p 
    ON t.PatientId = p.PatientId
AND 
    t.Id <= p.LowestTaskId
WHERE
    EventStatus = 5
AND
    rebateprocessed = 0