using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using CY.Infrastructure.Common;
|
using CY.Model.Inquiry;
|
using System.Data.SqlClient;
|
using System.Data;
|
|
namespace CY.SQLDAL
|
{
|
/// <summary>
|
///
|
/// </summary>
|
public class CommonInquiryHelper
|
{
|
private Database _dataBase = null;
|
|
public CommonInquiryHelper(Database dataBase)
|
{
|
_dataBase = dataBase;
|
}
|
|
public CommonInquiryHelper()
|
{
|
_dataBase = new Database();
|
}
|
|
/// <summary>
|
/// 当厂商或者厂商客户第一次保存时复制全部询价参数
|
/// </summary>
|
/// <param name="condition"></param>
|
/// <returns></returns>
|
public bool CopyALLInquiryParameter(InquiryCondition condition)
|
{
|
|
if (condition == null)
|
{
|
return false;
|
}
|
SqlParameter customerPar = null;
|
if (condition.CustomerId == Guid.Empty)
|
{
|
customerPar = new SqlParameter("@CustomerId", DBNull.Value);
|
}
|
else
|
{
|
customerPar = new SqlParameter("@CustomerId", condition.CustomerId);
|
}
|
SqlParameter[] parameters = {
|
new SqlParameter("@FirmId", SqlDbType.UniqueIdentifier,16),
|
new SqlParameter("@InquiryId", SqlDbType.UniqueIdentifier,16),
|
new SqlParameter("@ActualFirmId", SqlDbType.UniqueIdentifier,16),
|
customerPar
|
};
|
parameters[0].Value = condition.FirmId;
|
parameters[1].Value = condition.InquiryId;
|
parameters[2].Value = condition.ActualFirmId;
|
try
|
{
|
_dataBase.Query("sp_CopyALLInquiryParameter", CommandType.StoredProcedure, parameters);
|
}
|
catch (Exception ex)
|
{
|
throw ex;
|
}
|
return true;
|
}
|
|
/// <summary>
|
/// 恢复数据时删除其已保存的数据
|
/// </summary>
|
/// <param name="inquiryId"></param>
|
/// <returns></returns>
|
public bool DelInquiryParameterData(Guid inquiryId)
|
{
|
SqlParameter[] parameters = {
|
new SqlParameter("@InquiryId", SqlDbType.UniqueIdentifier,16)
|
};
|
parameters[0].Value = inquiryId;
|
try
|
{
|
_dataBase.Query("DelInquiryParameterData", CommandType.StoredProcedure, parameters);
|
}
|
catch (Exception ex)
|
{
|
throw ex;
|
}
|
return true;
|
}
|
}
|
}
|