Tuesday, 28 August 2018

Web Method Over Loading in Web Service?





  1. Web Method Over Loading in Web Service?

  1.  
  2. [WebService]
  3. public class CustomerService : System.Web.Services.WebService  
  4. {   
  5. [Web Method]
  6.     public int GetAddtionOfNumber(int a,int b)  
  7.     {  
  8.           
  9.         return  a + b;  
  10.     }   
  11. //overload method 
  12. [Web Method]
  13.     public int GetAddtionOfNumber(int a, int b,int c)  
  14.     {  
  15.   
  16.         return a + b + c;  
  17.     }  


This Error Resolving using message name property:

  1. [WebService]
  2. public class CustomerService : System.Web.Services.WebService  
  3. {  
  4.     [WebMethod(MessageName = "AdditionOfTwoNumber")]  
  5.     public int GetAddtionOfNumber(int a,int b)  
  6.     {  
  7.        return a + b;
  8.     }  
  9.     [WebMethod(MessageName = "AdditionOfThreeNumber")]  
  10.     public int GetAddtionOfNumber(int a, int b,int c)  
  11.     { 
  12.         return a + b+c;
  13.     } 
  14. }  







Monday, 27 August 2018

How to find the nth highest Price From Products using Ranking Functions?


How to find the nth highest Price From Products using Ranking Functions?

Create the Products Table :

CREATE TABLE [dbo].[Products](
     Product_Name  varchar(50) ,
     Price money,
     Product_Date date
   )

Output :
 Product_Name   Price       Product_Date
 A1   20.00 2018-08-03
 A8   20.00 2018-08-08
 A9   30.00 2018-08-09
 A10                    10.00 2018-08-10
 A12                    50.00 2018-08-12
A13                   10.00 2018-08-13
 A14   80.00 2018-08-14
 A15   10.00 2018-08-15
 A17   90.00 2018-08-03
 A18 10.00 2018-08-03
 A19 40.00        2018-08-04
 A20                   10.00 2018-08-05

Get the Ranking Values Format :
Dense Rank   : 1,1,2,3,3,3,4.......etc
Rank              : 1,1,3,3,3,6........etc
Row Number :1,2,3,4,5,6,7....etc

Query:
select  Price,  Rank() over (order by Price  ) as [Rank] ,
DENSE_RANK() over (order by Price) as [DENSE_RANK],
ROW_NUMBER() over (order by Price) as [ROW_NUMBER()]
from Products

Output :
Price Rank   DENSE_RANK ROW_NUMBER()
10.00 1                   1                             1
10.00 1                   1                             2
10.00 1                   1                            3
10.00 1                   1                             4
10.00 1                   1                            5
20.00 6                   2                             6
20.00 6                   2                             7
30.00 7                   3                             8


Find nth Highest Salary using Dense Rank():  ex: n=2
Query:
SELECT distinct Product_Name,Price,Product_Date
FROM(SELECT Product_Name,Price,Product_Date,DENSE_RANK() over(ORDER BY Price desc) AS rk FROM Products) as a where rk = 2

Output :
Product_Name Price Product_Date
          A1                 80.00 2018-08-03
          A8                 80.00      2018-08-08





Tuesday, 21 August 2018

Gridview Row merging

Gridview rows and column merging in asp.net



Public void Grid_bind()
{
   DataTable dt  = new DataTable();
   dt = obj_Da_get_data();
   Grid_sales_Details.DataSource = dt;
   Grid_sales_Details.DataBind();
   MergeRows(Grid_sales_Details);
}

 protected void gridView_PreRender(object sender, EventArgs e)
   {
            MergeRows(Grid_sales_Details);
   }

 public static void MergeRows(GridView gridView)
     {
                for (int rowIndex = gridView.Rows.Count - 2; rowIndex >= 0; rowIndex--)
                {
                    GridViewRow row = gridView.Rows[rowIndex];
                    GridViewRow previousRow = gridView.Rows[rowIndex + 1];

                    for (int i = 0; i < 13; i++)
                    {
                        if (row.Cells[i].Text == previousRow.Cells[i].Text)
                        {
                            row.Cells[i].RowSpan = previousRow.Cells[i].RowSpan < 2 ? 2 :
                                                   previousRow.Cells[i].RowSpan + 1;
                            previousRow.Cells[i].Visible = false;
                        }
                    }
                    for (int i = row.Cells.Count - 2; i < row.Cells.Count; i++)
                    {
                        if (row.Cells[i].Text == previousRow.Cells[i].Text)
                        {
                            row.Cells[i].RowSpan = previousRow.Cells[i].RowSpan < 2 ? 2 :
                                                   previousRow.Cells[i].RowSpan + 1;
                            previousRow.Cells[i].Visible = false;
                        }
                    }
                }
        }

Top Agile Interview Questions & Answers

Top Agile Interview Questions & Answers 1. What is Agile Testing? The first question of agile interview question tests your k...