Subversion Repository Public Repository

ChrisCompleteCodeTrunk

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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Data;
using System.Data.Odbc;

namespace ATTP_WS
{
    /// <summary>
    /// Summary description for OrderService
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]
    public class OrderService : System.Web.Services.WebService
    {
        [WebMethod]
        public bool TestOrderAmt(int storeNum, int orderId, double amt)
        {
            bool ret = false;
            string query = "";

            try
            {
                DataTable results = new DataTable("OrderResult");

                OdbcConnection odbc = new OdbcConnection();
                odbc.ConnectionString = "DSN=xfODBC";
                odbc.Open();

                query = "SELECT * FROM POSHDR WHERE PSTOR=" + storeNum.ToString() + " AND PORDR=" + orderId.ToString();
                OdbcCommand cmd = new OdbcCommand(query, odbc);
                OdbcDataReader r = cmd.ExecuteReader();
                results.Load(r);
                cmd.Dispose();
                r.Dispose();

                if (results.Rows.Count > 0)
                {
                    double actualAmt = double.Parse(results.Rows[0]["PPAMT"].ToString());

                    if (amt == actualAmt)
                        ret = true;
                }
            }
            catch (Exception ex)
            {
                ret = true;
            }

            return ret;
        }

        [WebMethod]
        public bool DoesOrderExist(int storeNum, int orderId)
        {
            bool ret = false;
            string query = "";

            try
            {
                DataTable results = new DataTable("OrderResult");

                OdbcConnection odbc = new OdbcConnection();
                odbc.ConnectionString = "DSN=xfODBC";
                odbc.Open();

                query = "SELECT * FROM POSHDR WHERE PSTOR=" + storeNum.ToString() + " AND PORDR=" + orderId.ToString();
                OdbcCommand cmd = new OdbcCommand(query, odbc);
                OdbcDataReader r = cmd.ExecuteReader();
                results.Load(r);
                cmd.Dispose();
                r.Dispose();

                if (results.Rows.Count > 0)
                    ret = true;
            }
            catch (Exception ex)
            {
                ret = true;
            }

            return ret;
        }
    }
}

Commits for ChrisCompleteCodeTrunk/ATTP/ATPP_WS/OrderService.asmx.cs

Diff revisions: vs.
Revision Author Commited Message
1 BBDSCHRIS picture BBDSCHRIS Wed 22 Aug, 2018 20:08:03 +0000