Example #1
0
        public List <Tdpa_Log_MaterialReq> mfn_GetList_MaterialReq(
            int communityID,
            long importID,
            long sysLogID,
            out int errCode,
            out string errText)
        {
            string strProcedureName =
                $"{className}.{MethodBase.GetCurrentMethod().Name}";

            WriteLog.Instance.WriteBeginSplitter(strProcedureName);
            try
            {
                List <Tdpa_Log_MaterialReq> datas = new List <Tdpa_Log_MaterialReq>();

                #region 执行数据库函数或存储过程
                try
                {
                    using (IRAPSQLConnection conn =
                               new IRAPSQLConnection(
                                   TParams.Instance.DBConnectionStr))
                    {
                        long   partitioningKey = communityID * 10000;
                        string strSQL          =
                            "SELECT * " +
                            "FROM IRAPDPA..dpa_Log_MaterialReq " +
                            $"WHERE PartitioningKey={partitioningKey} AND " +
                            $"ImportID={importID}";
                        WriteLog.Instance.Write(strSQL, strProcedureName);

                        IList <Tdpa_Log_MaterialReq> lstDatas =
                            conn.List <Tdpa_Log_MaterialReq>(
                                $"PartitioningKey={partitioningKey} AND " +
                                $"ImportID={importID}",
                                "IRAPDPA..dpa_Log_MaterialReq");
                        datas   = lstDatas.ToList();
                        errCode = 0;
                        errText = string.Format("调用成功!共获得 {0} 条记录", datas.Count);
                        WriteLog.Instance.Write(errText, strProcedureName);
                    }
                }
                catch (Exception error)
                {
                    errCode = 99000;
                    errText = string.Format("执行 SQL 时发生异常:{0}", error.Message);
                    WriteLog.Instance.Write(errText, strProcedureName);
                    WriteLog.Instance.Write(error.StackTrace, strProcedureName);
                }
                #endregion

                return(datas);
            }
            finally
            {
                WriteLog.Instance.WriteEndSplitter(strProcedureName);
            }
        }