dal class
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.SqlClient;
using System.Data;
using System.Collections;
namespace DalLibrary
{
public class DalPhone
{
/// <summary>
/// get details of all phones
/// </summary>
/// <returns></returns>
public DataSet GetAllPhone()
{
using(SqlConnection conn=DBConn.GetDbConnection())
{
try
{
SqlCommand cmd = new SqlCommand("usp_GetPhone", conn);
cmd.CommandType = CommandType.StoredProcedure;
SqlDataAdapter adp = new SqlDataAdapter(cmd);
DataSet dtst = new DataSet();
adp.Fill(dtst);
return dtst;
}
catch (Exception)
{
throw;
}
}
}
/// <summary>
/// get a phone details where by phone Id
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
public DataSet GetPhoneById(ArrayList data)
{
using(SqlConnection conn=DBConn.GetDbConnection())
{
try
{
SqlCommand cmd = new SqlCommand("sp", conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@inId",data[0]);
SqlDataAdapter adp = new SqlDataAdapter(cmd);
DataSet dtst = new DataSet();
adp.Fill(dtst);
return dtst;
}
catch (Exception)
{
throw;
}
}
}
/// <summary>
/// insert a phone detail
/// </summary>
/// <param name="arrlst"></param>
/// <returns></returns>
public int SetPhoneData(ArrayList arrlst)
{
using(SqlConnection conn=DBConn.GetDbConnection())
{
try
{
SqlCommand cmd = new SqlCommand("sp",conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@nvcName",arrlst[0]);
cmd.Parameters.AddWithValue("@inAge", arrlst[1]);
return cmd.ExecuteNonQuery();
}
catch (Exception)
{
throw;
}
}
}
/// <summary>
///
/// </summary>
/// <returns></returns>
public void SetPhoneData()
{
//throw new NotImplementedException();
try
{
}
catch (Exception)
{
throw;
}
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.SqlClient;
using System.Data;
using System.Collections;
namespace DalLibrary
{
public class DalPhone
{
/// <summary>
/// get details of all phones
/// </summary>
/// <returns></returns>
public DataSet GetAllPhone()
{
using(SqlConnection conn=DBConn.GetDbConnection())
{
try
{
SqlCommand cmd = new SqlCommand("usp_GetPhone", conn);
cmd.CommandType = CommandType.StoredProcedure;
SqlDataAdapter adp = new SqlDataAdapter(cmd);
DataSet dtst = new DataSet();
adp.Fill(dtst);
return dtst;
}
catch (Exception)
{
throw;
}
}
}
/// <summary>
/// get a phone details where by phone Id
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
public DataSet GetPhoneById(ArrayList data)
{
using(SqlConnection conn=DBConn.GetDbConnection())
{
try
{
SqlCommand cmd = new SqlCommand("sp", conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@inId",data[0]);
SqlDataAdapter adp = new SqlDataAdapter(cmd);
DataSet dtst = new DataSet();
adp.Fill(dtst);
return dtst;
}
catch (Exception)
{
throw;
}
}
}
/// <summary>
/// insert a phone detail
/// </summary>
/// <param name="arrlst"></param>
/// <returns></returns>
public int SetPhoneData(ArrayList arrlst)
{
using(SqlConnection conn=DBConn.GetDbConnection())
{
try
{
SqlCommand cmd = new SqlCommand("sp",conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@nvcName",arrlst[0]);
cmd.Parameters.AddWithValue("@inAge", arrlst[1]);
return cmd.ExecuteNonQuery();
}
catch (Exception)
{
throw;
}
}
}
/// <summary>
///
/// </summary>
/// <returns></returns>
public void SetPhoneData()
{
//throw new NotImplementedException();
try
{
}
catch (Exception)
{
throw;
}
}
}
}
0 comments:
Post a Comment