84 lines
3.8 KiB
C#
84 lines
3.8 KiB
C#
using Ease.Core.DataAccess;
|
|
using HRM.BO;
|
|
using Microsoft.Data.SqlClient;
|
|
using NPOI.OpenXmlFormats.Spreadsheet;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace HRM.DA
|
|
{
|
|
internal class PMSObjectiveProgressAttachmentDA
|
|
{
|
|
#region Insert
|
|
internal static void Insert(TransactionContext tc, PMSObjectiveProgressAttachment item)
|
|
{
|
|
tc.ExecuteNonQuery(@"delete from PMSOBJECTIVEPROGRESSATTACHMENT where PMSOBJECTIVEPROGRESSATTACHMENTID =%n", item.ID);
|
|
|
|
string strQuery = @"INSERT INTO PMSOBJECTIVEPROGRESSATTACHMENT (PMSOBJECTIVEPROGRESSATTACHMENTID, PMSOBJECTIVEPROGRESSID, FILENAME, UPLOADTIME, FILEDATA, FILETYPE)
|
|
VALUES (@pmsobjectiveprogressattachmentid, @pmsobjectiveprogressid, @filename, @uploadtime, @filedata, @filetype)";
|
|
|
|
SqlCommand cmd = new SqlCommand(strQuery, (SqlConnection)tc.Connection);
|
|
cmd.Parameters.Add("@pmsobjectiveprogressattachmentid", SqlDbType.Int).Value = item.ID;
|
|
cmd.Parameters.Add("@pmsobjectiveprogressid", SqlDbType.Int).Value = item.PMSObjectiveProgressID;
|
|
cmd.Parameters.Add("@filename", SqlDbType.VarChar).Value = item.FileName;
|
|
cmd.Parameters.Add("@uploadtime", SqlDbType.DateTime).Value = item.UploadTime;
|
|
cmd.Parameters.Add("@filedata", SqlDbType.Binary).Value = item.FileData;
|
|
cmd.Parameters.Add("@filetype", SqlDbType.Int).Value = item.FileType;
|
|
cmd.ExecuteNonQuery();
|
|
|
|
|
|
|
|
}
|
|
|
|
#endregion Insert
|
|
|
|
#region Update
|
|
internal static void Update(TransactionContext tc, PMSObjectiveProgressAttachment item)
|
|
{
|
|
string strQuery = @"UPDATE dbo.PMSOBJECTIVEPROGRESSATTACHMENT
|
|
SET PMSOBJECTIVEPROGRESSID = @pmsobjectiveprogressid,
|
|
FILENAME = @filename,
|
|
UPLOADTIME = @uploadtime,
|
|
FILEDATA = @filedata,
|
|
FILETYPE = @filetype
|
|
where PMSOBJECTIVEPROGRESSATTACHMENTID = @pmsobjectiveprogressattachmentid";
|
|
|
|
SqlCommand cmd = new SqlCommand(strQuery, (SqlConnection)tc.Connection);
|
|
cmd.Parameters.Add("@pmsobjectiveprogressattachmentid", SqlDbType.Int).Value = item.ID;
|
|
cmd.Parameters.Add("@pmsobjectiveprogressid", SqlDbType.Int).Value = item.PMSObjectiveProgressID;
|
|
cmd.Parameters.Add("@filename", SqlDbType.VarChar).Value = item.FileName;
|
|
cmd.Parameters.Add("@uploadtime", SqlDbType.DateTime).Value = item.UploadTime;
|
|
cmd.Parameters.Add("@filedata", SqlDbType.Binary).Value = item.FileData;
|
|
cmd.Parameters.Add("@filetype", SqlDbType.Int).Value = item.FileType;
|
|
cmd.ExecuteNonQuery();
|
|
}
|
|
#endregion Update
|
|
|
|
#region GetAll
|
|
internal static IDataReader Get(TransactionContext tc)
|
|
{
|
|
string sql = SQLParser.MakeSQL("SELECT * FROM PMSOBJECTIVEPROGRESSATTACHMENT");
|
|
return tc.ExecuteReader(sql);
|
|
}
|
|
#endregion
|
|
|
|
#region Get functions
|
|
|
|
internal static IDataReader Get(TransactionContext tc, int id)
|
|
{
|
|
string sql = SQLParser.MakeSQL("SELECT * FROM PMSOBJECTIVEPROGRESSATTACHMENT WHERE PMSOBJECTIVEPROGRESSATTACHMENTID = %n", id);
|
|
return tc.ExecuteReader(sql);
|
|
}
|
|
internal static IDataReader GetByPMSObjectiveProgressID(TransactionContext tc, int pmsObjectiveProgressID)
|
|
{
|
|
string sql = SQLParser.MakeSQL("SELECT * FROM PMSOBJECTIVEPROGRESSATTACHMENT WHERE PMSOBJECTIVEPROGRESSID = %n", pmsObjectiveProgressID);
|
|
return tc.ExecuteReader(sql);
|
|
}
|
|
#endregion
|
|
}
|
|
}
|