username@email.com
2025-03-07 2fee7b9b90c1acf7a17aef84ee22c2a31b801fe2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
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;
        }
    }
}