Thursday, 28 March 2013

join two table using Linq

   var quaryFirst = from RecordId in dtXMLFILE3.AsEnumerable()
                                 join rowId in dtXMLFILE4.AsEnumerable()
               on RecordId.Field<int>("ColumnName") equals rowId.Field<int>("ColumnName")
                                 join policy in dtXMLFILE5.AsEnumerable()
               on rowId.Field<int>("ColumnName") equals policy.Field<int>("ColumnName")
                                 select new
                                 {
                                     Id = RecordId.Field<int>("ColumnName"),
                                     rId = rowId.Field<int>("ColumnName"),
                                     rr_Id = rowId.Field<int>("ColumnName"),
                                     source = rowId.Field<string>("ColumnName"),
                                     count = rowId.Field<string>("ColumnName"),
                                     dis = policy.Field<string>("ColumnName"),
                                     dm = policy.Field<string>("ColumnName"),
                                     sp = policy.Field<string>("ColumnName"),
                                     Poli = policy.Field<int>("ColumnName")
                                 };

Merge Header or header and subheader in gridview

 protected void gv_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        
        if (e.Row.RowType == DataControlRowType.Header)
        {
            //Build custom header.
            GridView oGridView = (GridView)sender;
            GridViewRow oGridViewRow = new GridViewRow(0, 0, DataControlRowType.Header, DataControlRowState.Insert);
            TableCell oTableCell = new TableCell();

            //Add Department
            oTableCell.Text = "";
            oTableCell.ColumnSpan = 4;
        
            oTableCell.Style.Add("background-color", "#E0F0FD");
            oTableCell.Style.Add("border", "1px solid #8BB7D6");
            oTableCell.Style.Add("font-weight", "bold");
            oTableCell.Style.Add("font-family", "Arial,Helvetica,sans-serif");
            oTableCell.Style.Add("color", "#1077C4");
            oGridViewRow.Cells.Add(oTableCell);

            //Add Emp
            oTableCell = new TableCell();
            oTableCell.Text = "Emp";        
            oTableCell.Style.Add("background-color", "#E0F0FD");
            oTableCell.Style.Add("border", "1px solid #8BB7D6");
            oTableCell.Style.Add("font-weight", "bold");
            oTableCell.Style.Add("font-family", "Arial,Helvetica,sans-serif");          
            oTableCell.Style.Add("color", "#1077C4");
            oTableCell.HorizontalAlign = HorizontalAlign.Center;          
            oTableCell.ColumnSpan = 3;
            oGridViewRow.Cells.Add(oTableCell);

            //Add Salary
            oTableCell = new TableCell();
            oTableCell.Text = "Salary";
            oTableCell.Style.Add("background-color", "#E0F0FD");
            oTableCell.Style.Add("border", "1px solid #8BB7D6");
            oTableCell.Style.Add("font-weight", "bold");
            oTableCell.Style.Add("font-family", "Arial,Helvetica,sans-serif");
            oTableCell.Style.Add("color", "#1077C4");
            oTableCell.HorizontalAlign = HorizontalAlign.Center;         
            oTableCell.ColumnSpan = 3;
            oGridViewRow.Cells.Add(oTableCell);

            oGridView.Controls[0].Controls.AddAt(0, oGridViewRow);
        }
    }

Tuesday, 26 March 2013

Microsoft 70-536 sample questions



Within your application, you need to monitor and control a service installed on the local machine. Which class do you need to use?

A.ServiceController
B.ServiceHost
C.ServiceManager
D.ServiceMonitor
E.ServiceBase




What method would you call on an object of type DirectoryInfo to retrieve a list of all subdirectories under that directory?

A.GetSubDirectories
B.GetDirectories
C.GetFileSystemInfos
D.GetFiles
 

Microsoft 70-536 sample questions

What are the restrictions imposed on the signature of a method that is called when a serialization event occurs?
            A.       Must not have any parameters (void)
            B.       Must not return anything (void)
           C.        Must take a StreamingContext parameter
           D.       Must return a StreamingContext object

You want to encrypt the network communication while sending an email to an smtp server. Which code should you use?

          A.SmtpClient.EnableEncryption = true;
          B.SmtpClient.UseEncryption = true;
         C.SmtpClient.EnableSsl = true;
         D.SmtpClient.UseSsl = true;



·         If a class implements ISerializable, it needs to provide a constructor that takes two parameters. What are the types of those parameters?


A.BinaryFormatter
B.StreamingContext
C.ObjectManager
D.SerializationInfo


·         Which code should you use to create a class that represents a Windows Service?


class Class2 : System.ServiceProcess.WindowsService
    {
        //implementation
    }

    class MyService : System.ServiceProcess.ServiceHost
    {
        //implementation
    }

    class MyService : System.ServiceProcess.ServiceBase
    {
        //implementation
    }

    class MyService : System.ServiceProcess.Service
    {
        //implementation
    }