-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExampleOfUse.cs
More file actions
94 lines (79 loc) · 3.15 KB
/
ExampleOfUse.cs
File metadata and controls
94 lines (79 loc) · 3.15 KB
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
93
94
using System;
using Microsoft.ApplicationBlocks.Data;
using System.Web;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
namespace CadCards
{
....
public static DataSet GetCadCrd ( Int32 intOperationId, Int32 intUserSecurityId, Object strFromDate, Object strToDate, Object strRunNo)
{
// ( strFromDate and strToDate ) and strRunNo are mutually exclusive
try
{
// check UseCODS flag
if (ConfigurationSettings.AppSettings["UseCODS"].ToLower() == "yes")
{
SqlParameter[] cmdNoParam = {};
string strSQL = "";
// get operation name
strSQL = string.Format(@"
SMALL SQL SELECT STATEMENT HERE ", intOperationId.ToString() );
DataSet objDS = SqlHelper.ExecuteDataset(GetConn()
, CommandType.Text
, strSQL
, cmdNoParam);
string strOperationName = "";
if ( objDS.Tables.Count > 0 )
if ( objDS.Tables[ 0 ].Rows.Count > 0 )
strOperationName = objDS.Tables[ 0 ].Rows[ 0 ][ "OperationName" ].ToString();
// load priority codes/descriptions
strSQL = @"
SMALL SQL SELECT STATEMENT HERE ";
DataSet objPriorityDS = SqlHelper.ExecuteDataset(GetConn()
, CommandType.Text
, strSQL
, cmdNoParam );
// if RunNbr is specified, include it as criteria
strSQL = string.Format(@"
HUGE SQL SELECT STATEMENT HERE
", strOperationName
, strRunNo.ToString());
objDS = SqlHelper.ExecuteDataset( GetCODSConn(), CommandType.Text, strSQL, cmdNoParam );
if( objDS.Tables.Count > 0 )
objDS.Tables[0].TableName = "GetCADCard";
// populate each priority type from the CAD_Historic database
foreach (DataRow objDR in objDS.Tables[ 0 ].Rows)
{
string strSearch = string.Format( "Priority = '{0}'", objDR[ "Priority" ].ToString() );
DataRow[] objPriorityRows = objPriorityDS.Tables[0].Select( strSearch );
if ( objPriorityRows.GetLength( 0 ) > 0 )
objDR["PriorityType"] = objPriorityRows[0]["PriorityDescription"].ToString();
}
// add image column to the dataset for the barcode
objDS.Tables[0].Columns.Add( "BarCode", typeof( System.Byte[] ) );
BarCode39.Weight = BarCode39.BarCodeWeight.Medium;
BarCode39.LeftMargin = 5;
BarCode39.VertAlign = BarCode39.AlignType.Left;
BarCode39.BarCodeHeight = 120;
foreach (DataRow objDR in objDS.Tables[0].Rows)
objDR["BarCode"] = BarCode39.CreateBarCodePNGByteArray(objDR["Company"].ToString(), 4);
return objDS;
}
// this is probably where the changes must be made to retrieve data from CODS instead
SqlParameter[] cmdParam = {
new SqlParameter("@OperationId", intOperationId)
,new SqlParameter("@UserSecurityId", intUserSecurityId)
,new SqlParameter("@FromDate", strFromDate)
,new SqlParameter("@ToDate", strToDate)
,new SqlParameter("@RunNo", strRunNo)
};
return SqlHelper.ExecuteDataset(GetConn(), CommandType.StoredProcedure, "GetCadCard", cmdParam);
}
catch ( Exception e)
{
throw e;
}
}
}