|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Configuration;
using System.Data.SqlClient;
using System.Data;
/// <summary>
/// Summary description for ImageCls
/// </summary>
public class ImageCls
{
SqlConnection mycon;
public ImageCls()
{
string contring = WebConfigurationManager.ConnectionStrings["ApplicationServices"].ConnectionString;
mycon = new SqlConnection(contring);
}
public DataTable GetImage()
{
SqlCommand cmd = new SqlCommand("spGetImage", mycon);
cmd.CommandType = CommandType.StoredProcedure;
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
return dt;
}
public void SaveImage(Dictionary<string, string> parameters)
{
string cmdtxt = string.Empty;
string cmdval = string.Empty;
SqlCommand cmd = new SqlCommand("spSaveImage", mycon);
cmd.CommandType = CommandType.StoredProcedure;
for (int i = 0; i < parameters.Count; i++)
{
cmd.Parameters.AddWithValue("@" + parameters.ElementAt(i).Key, parameters.ElementAt(i).Value);
}
cmd.Connection = mycon;
if (mycon.State == ConnectionState.Closed)
{
mycon.Open();
}
cmd.ExecuteNonQuery();
mycon.Close();
}
public void DeleteImage(int ImageID)
{
string cmdtxt = string.Empty;
string cmdval = string.Empty;
SqlCommand cmd = new SqlCommand("spDeleteImage", mycon);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@ImageID", ImageID);
cmd.Connection = mycon;
if (mycon.State == ConnectionState.Closed)
{
mycon.Open();
}
cmd.ExecuteNonQuery();
mycon.Close();
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I am flexible, responsive, creative and enthusiastic with ability to manage multiple initiatives with deadline. I have willingness to pick up and develop new skills and ability to balance a number of conflicting priorities and make decisions. I am results oriented - focused on productive and high-yield activities.