Release Note
http://www.asp.net/whitepapers/mvc4-release-notes
Using Asynchronous Methods in ASP.NET MVC 4
public class AdminAuthorize : AuthorizeAttribute { //return true if username is admin else return false protected override bool AuthorizeCore(HttpContextBase httpContext) { if (!httpContext.User.Identity.IsAuthenticated) { return false; } Users = httpContext.User.Identity.Name.ToLower();
return (Users == "admin"); } }
if (Enum.IsDefined(typeof(EnStatus), this.HttpContext.Request.Form["payment_status"])) { result.status = (EnStatus)Enum.Parse(typeof (EnStatus), this.HttpContext.Request.Form["payment_status"]); }
http://blogs.msdn.com/b/tims/archive/2004/04/02/106310.aspx
A Popup window is a window that float over a window.In this blog post i’m going to to explain how can we create a sexy popup window like message box using xaml.Wpf has a popup control
Syntax
<Popup></Popup>
Popup control can have a child inside the popup tags.If we want to add more contents we can use any layout panels like grid, stackpanel etc. In popup if we set IsOpen property to true then the popup will be displayed and If IsOpen = false then the popup will be closed. In this example we will set IsOpen = true whenever we click on validate button and we will set it to false when we clicked on OK button.
<Popup Name="myPopup" IsOpen="False" PlacementTarget="{Binding ElementName=ProjectTasks}" Placement="Center">
<Grid Width="300" Background="Gray">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Border Grid.RowSpan="3" Background="Gray" BorderBrush="#3a3a3a" BorderThickness="1"/>
<DockPanel Width="300" Background="#3a3a3a" LastChildFill="True">
<Image Source="/Images/Icons/attention.png" Width="15" Height="15" Margin="3" DockPanel.Dock="Left"/>
<TextBlock Padding="3" Grid.Row="0" Background="#3a3a3a" Text="Information" Foreground="White" FontWeight="Bold"/>
</DockPanel>
<TextBlock Width="260" Grid.Row="1" Margin="5" TextWrapping="Wrap" Foreground="white" Text="{Binding Path=ProjectValidateMessage}"></TextBlock>
<Button Width="40" Height="20" Margin="5" Grid.Row="2" x:Name="btnPopup" Click="btnPopup_OnClick" Content="Ok" /> </Grid> </Popup>
Code Behind:
{
this.myPopup.IsOpen = false;
}
public void btnValidate_OnClick(object Sender,RoutedEventArgs e)
{
this.myPopup.IsOpen = true;
}
declare @d datetime
set @d = GETDATE()
select
DATEADD(yyyy, DATEDIFF(yyyy, 0, @d), 0) as [CalendarYear]
select
case
when DATEPART(M, @d) >= 4 then DATEADD(mm, 3, DATEADD(yyyy, DATEDIFF(yyyy, 0, @d), 0))
when DATEPART(M, @d) < 4 then DATEADD(mm, -9, DATEADD(yyyy, DATEDIFF(yyyy, 0, @d), 0))
end as [FinancialYear]
update table set fieldName = 'append string'+ fieldName where conditions
Example:
select *from AM_Invoice where DocumentTypeId = 3 and SalesInvoiceType = 2
update AM_Invoice set InvoiceNumber = 'B/'+InvoiceNumber where DocumentTypeId = 3 and SalesInvoiceType = 2
select *from AM_Invoice where DocumentTypeId = 3 and SalesInvoiceType = 2
result: