Tuesday, March 17, 2015

what is the benefit of bundling in asp.net mvc

Bundling and Minification is more useful in production than in development. It can significantly improve your first page hit download time.
  • Bundling reduces the number of individual HTTP requests to server by combining multiple CSS files and Javascript files into single CSS file and javascript file.
  • Minification reduces the file download size of CSS and javascript files by removing whitespace, comments and other unnecessary characters.
Such small advantages are more pronounced in a production environment than in development. So it is better to go with Bundling and Minification in production.
Specific to your question there is no palpable benefit in bundling/minification during runtime. This feature is there just to make the developer's work easier. So it is even better to go with manually bundled/minified assets in production if you are sure about what you are doing.
Update: According to MSDN there is a real benefit in bundling/minification during runtime
Bundling and minification in ASP.NET 4.5 is performed at runtime, so that the process can identify the user agent (for example IE, Mozilla, etc.), and thus, improve the compression by targeting the user browser (for instance, removing stuff that is Mozilla specific when the request comes from IE).`
The power of dynamic bundling is that you can include static JavaScript, as well as other files in languages that compiles into JavaScript.`
For example, CoffeeScript is a programming language that compiles into JavaScript

Monday, February 16, 2015

RDLC report using xsd in c# with drill down report



using Microsoft.Reporting.WebForms;
using ImprisonmentTypeTableAdapters;
protected void Page_Load(object sender, EventArgs e)
    {
     
        String userAgent = Request.ServerVariables.Get("HTTP_USER_AGENT");
        if (userAgent.Contains("MSIE 7.0"))
        {
            ReportViewer1.Style.Add("margin-bottom", "30px");
        }
    }

protected void btnReport_Click(object sender, EventArgs e)
    {
        ViewState["level"] = 0;
        getReportData();
    }
    private void getReportData()
    {

        int JailCode = Convert.ToInt32(ddlJail.SelectedValue);
        int DistCode = Convert.ToInt32(ddlDistName.SelectedValue);
        Report_ImprisonmentTimeTableAdapter ta = new Report_ImprisonmentTimeTableAdapter();
        ImprisonmentType.Report_ImprisonmentTimeDataTable dt = new ImprisonmentType.Report_ImprisonmentTimeDataTable();

        try
        {
            ta.Fill(dt, Convert.ToInt32(ddlYear.SelectedValue), Convert.ToInt32(ddlMonth.SelectedValue), Convert.ToInt32(ddlDay.SelectedValue), JailCode,DistCode);
        }
        catch
        {
            DataRow[] dr = null;
            dr = dt.GetErrors();
        }
        ReportViewer1.Visible = true;
        ReportDataSource rds = new ReportDataSource();
        ReportViewer1.Reset();
        ReportViewer1.ProcessingMode = ProcessingMode.Local;
        LocalReport rep = ReportViewer1.LocalReport;
        rep.Refresh();
        rep.ReportPath = "RDLCReport/rdlc/State_Prisoner_ImprisonmentTime.rdlc";



        rds.Name = "ImprisonmentType_Report_ImprisonmentTime";
        rds.Value = dt;
        rep.DataSources.Add(rds);


        ReportParameter[] parms = new ReportParameter[4];
        parms[0] = new ReportParameter("Year", ddlYear.SelectedValue, true);
        parms[1] = new ReportParameter("Month", ddlMonth.SelectedValue, true);
        parms[2] = new ReportParameter("Day", ddlDay.SelectedValue, true);
        parms[3] = new ReportParameter("JailName", ddlJail.SelectedItem.Text, true);
        this.ReportViewer1.LocalReport.SetParameters(parms);
        rep.Refresh();
    }


    protected void DemoDrillthroughEventHandler(object sender, DrillthroughEventArgs e)
    {
        try
        {
            if (ViewState["level"] != null)
            {
                int level = Convert.ToInt32(ViewState["level"]);
                ViewState["level"] = ++level;
                btnBack.Visible = true;
            }
            LocalReport localreport = (LocalReport)e.Report;
            ReportViewer1.Visible = true;
            ReportViewer1.Reset();
            ReportViewer1.ProcessingMode = ProcessingMode.Local;
            localreport.Refresh();
            ReportParameterInfoCollection DrillThroughValues = e.Report.GetParameters();
            string Year = DrillThroughValues["Year"].Values[0];
            string Month = DrillThroughValues["Month"].Values[0];
            string Day = DrillThroughValues["Day"].Values[0];
            string JailCode = DrillThroughValues["JailCode"].Values[0];

            Report_ImprisonmentTime_DrillTableAdapter ta = new Report_ImprisonmentTime_DrillTableAdapter();
            ImprisonmentType.Report_ImprisonmentTime_DrillDataTable dt = new ImprisonmentType.Report_ImprisonmentTime_DrillDataTable();
            try
            {
                ta.Fill(dt, Convert.ToInt32(Year), Convert.ToInt32(Month), Convert.ToInt32(Day), int.Parse(JailCode));
            }
            catch
            {
                DataRow[] dr = null;
                dr = dt.GetErrors();
            }
            ReportDataSource level1datasource = new ReportDataSource();
            localreport.ReportPath = "RDLCReport/rdlc/State_Prisoner_ImprisonmentTime_Drill.rdlc";
            level1datasource = new ReportDataSource("ImprisonmentType_Report_ImprisonmentTime_Drill", dt);
            localreport.DataSources.Clear();
            localreport.DataSources.Add(level1datasource);
            localreport.Refresh();
        }
        catch (Exception ex)
        {
        }
    }
    protected void btnBack_Click(object sender, EventArgs e)
    {
        if (ViewState["level"] != null)
        {
            int level = Convert.ToInt32(ViewState["level"]);
            if (level == 1)
            {
                getReportData();
                btnBack.Visible = false;
            }
            ViewState["level"] = --level;
        }
    }

<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
    Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>


                    ShowPrintButton="true" Visible="false" ZoomMode="Percent" OnDrillthrough="DemoDrillthroughEventHandler" >
               





Thursday, December 11, 2014

Global Search Feature of MS CRM 2015

Initially we have to use other plugins to use this feature in MS CRM earlier versions but now in MS CRM 2015 web client is also available by MS it self.

User can see the box in top right navigation bar , there you can enter the text for searching and MS CRM 2015 will provide the results with related entities list .

You can further filter records with Filter With dropdown is just next to Global Search Text Box.


 You can also configure the quick find global search . for this follow the below steps:

Settings > Administration > System Settings > Set up Quick Find




 You can add maximum 10 entities for global search using select button, and also can change the order of entities in which they appear while searching . Internally global search use quick find column to search data.






What topics you need to cover to be a good MS Dynamics CRM developer

Here are following few topics you need to be good for be a good MS Dynamics CRM developer


  1. Good Knowledge of  existing entities are going to be used in MS Dynamics
  2. Create New Plugin,Deployment of Plugin and debug the plugin
  3. Java Script
  4. Solution
  5. Dialogs
  6. Reports(Bids and SSRS )
  7. Data Import (Scribe and SSRS)
  8. Workflow Process

Sunday, November 16, 2014

Create a simple workflow in MS CRM 2013 with Email Template

I am going to create a simple workflow in MS CRM 2013 that will sends an email whenever new account is created.

We can use account template of email to for  email content or we can create our own email template also .

For creating our own email template .

Go to Settings => Templates = > Email Templates 
Click on New 
it will open a dialogue box which will ask for type of Email templates. Here we are going to use
Template Type = Account .


A new window will open and ask for info related to Template like subject and body of message. you can add fields info also in subject or body content.



After valid input press save and close button . Now email template is ready . You can check that in Email Templates list also with Email Type is Account .

Next our task is to create a workflow for this . Please follow following steps.

Please Go To Settings = > Processes => New 

This will open a new window with required info about process . We are going to create a New Blank Work flow. Now press OK .

In the nex window Select following options

Scope = Organization and Start When = Record is created.

Now selects the first row and click on Add Step

here you can select send email  choose "Use Template" and click on Set Propeties to set the To and From options. 

Now click on save and Activate the Process. 




Now you will be able to see your process in Process list with name of  
"Send Email To verify account"


Now go to  Sales and Account and Create a New Account by click on Create .

After creating a new account you can see the status of your workflow by  Clicking on

Settings => Processes => Your WorkFlow name

and new window will open , now check process session it will show you the status of your process.


Note : here i am using web hosted version of MS CRM 2013 for example . 




Sunday, June 15, 2014

minimize the window on cross button click event just like skype or other VOIP apps in WPF

I have to create a WPF app where user click on cross button its should minimize the app on task bar instead of closing , its same as skype perform.

        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525" Closing="Window_Closing">
   
     
   
 private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            WindowState = WindowState.Minimized;
            e.Cancel = true;
        }

Friday, June 13, 2014

Laziness, Impatience and Hubris

"The three chief virtues of a programmer are: Laziness, Impatience and Hubris." - Larry Wall

Laziness: I'm too lazy to do the same task repeatedly so write scripts to do that task for me. This makes people think I am intelligent.

Impatience: I'm too impatient to wait for my code to run so rewrite the code to improve performance. This makes people think I am a good programmer.

Hubris: When someone asks if I can do something I just say Yes, then go find out how to do it (Google!). This makes people think I can do anything.

Ultimately, it means I can make a career out of being Lazy, Impatient, and Hubris tic(?).

.net core

 Sure, here are 50 .NET Core architect interview questions along with answers: 1. **What is .NET Core, and how does it differ from the tradi...