Solved

Need to pass dataset or datatable into webservice.

Posted on 2008-06-13
7
1,989 Views
Last Modified: 2013-11-26
public DataSet InsertPriceListHeader() Need to pass a datatable and return a datatable or dataset.

Help on getting started with a datatable.
I
this is what I have this I need to create a datatable then pass it to a stored procedure.

   dr["PRICE_LIST_HDR_ID"] = txtCropYear.Text + txtListNo.Text;              //1
            //dr["TOUGH_DISC_AMT"]    =                           //2
            //dr["DAMP_DISC_AMT"]     =                           //3
            //dr["STONE_DISC_AMT"]    =                           //4
            //dr["TOUGH_STONE_DISC_AMT"] =                        //5
            //dr["DAMP_STONE_DISC_AMT"] =                         //6
            //dr["PRICE_LIST_STATUS_TYPE_NAME"] =                  //7
            //  dr["LOAD_DTM"] =                                 //8 Date Loader

            ////dr["USER_NAME"] =                                   //9
            ////dr["WHT_INDR_FLAG"]   =                             //10
            ////dr["DURUM_INDR_FLAG"] =                             //11
            ////dr["BLY_INDR_FLAG"]   =                             //12
            ////dr["DESIGTD_BLY_INDR_FLAG"] =                       //13

            //dr["LOAD_TYPE_NAME"] =                              //14

            dr["WHT_BASIS_NUM"] = txtWheatBasis.Text == "" ? null : txtWheatBasis.Text;    //15
            dr["DURUM_BASIS_NUM"] = txtDurumBasis.Text == "" ? null : txtDurumBasis.Text;  //16
            dr["BLY_BASIS_NUM"] = txtBarleyBasis.Text == "" ? null : txtBarleyBasis.Text;  //17
            dr["DESIGTD_BLY_BASIS_NUM"] = txtDesBarleyBasis.Text == "" ? null : txtDesBarleyBasis.Text; //18

            ////dr["SRC_FILE_PATH_DESC"] =                        //19
            dr["POOL_PART_CODE"] = "A";                           //20
            dr["SCT_PRICE_LIST_NAME"] = txtListName.Text;         //21
            //dr["SCT_EFFCTV_DTM"] =                              //22
            //dr["ROW_CNT_QTY"] =                                 //23
            //dr["PRICE_SUM_AMT"] =                               //24
            // Call webservice to do update on row?



See attached snippet.
[WebMethod]

        public DataSet InsertPriceListHeader()

        {
 

            string procedureName = "init_price.PRICE_LIST_REPORTING.insert_price_list_hdr";

            try

            {

                Database db = DatabaseFactory.CreateDatabase("InitialPrices.Properties.Settings.ConnectionString");

                DbCommand selectCommand = db.GetStoredProcCommand(procedureName);
 

              //  db.AddInParameter(dbCommand, "p_price_list_hdr_id", DbType.String, txtCropYear.Text + txtListNo.Text);

                db.AddInParameter(dbCommand, "p_wht_tough_disc_amt", DbType.Decimal, 0.00);

                db.AddInParameter(dbCommand, "p_wht_damp_disc_amt", DbType.Decimal, 0.00);

                db.AddInParameter(dbCommand, "p_wht_stone_disc_amt", DbType.Decimal, 0.00);
 

                db.AddInParameter(dbCommand, "p_durum_tough_disc_amt", DbType.Decimal, 0.00);

                db.AddInParameter(dbCommand, "p_durum_damp_disc_amt", DbType.Decimal, 0.00);

                db.AddInParameter(dbCommand, "p_durum_stone_disc_amt", DbType.Decimal, 0.00);
 

                db.AddInParameter(dbCommand, "p_bly_tough_disc_amt", DbType.Decimal, 0.00);

                db.AddInParameter(dbCommand, "p_bly_damp_disc_amt", DbType.Decimal, 0.00);

                db.AddInParameter(dbCommand, "p_bly_stone_disc_amt", DbType.Decimal, 0.00);
 

                db.AddInParameter(dbCommand, "p_desigtd_bly_tough_disc_amt", DbType.Decimal, 0.00);

                db.AddInParameter(dbCommand, "p_desigtd_bly_damp_disc_amt", DbType.Decimal, 0.00);
 

                db.AddInParameter(dbCommand, "p_price_list_status_type_name", DbType.String, "Draft");

                db.AddInParameter(dbCommand, "p_load_dtm", DbType.DateTime, System.DateTime.Now);

                db.AddInParameter(dbCommand, "p_user_name", DbType.String, "Mathieu");
 
 

                db.AddInParameter(dbCommand, "p_wht_indr_flag", DbType.String, "1");          // chkboxWheat.Checked.ToString());    // On check

                db.AddInParameter(dbCommand, "p_durum_indr_flag", DbType.String, "1");        // chkboxDurum.Checked.ToString());

                db.AddInParameter(dbCommand, "p_bly_indr_flag", DbType.String, "1");          // chkboxBarley.Checked.ToString());

                db.AddInParameter(dbCommand, "p_desigtd_bly_indr_flag", DbType.String, "1");  // chkboxDesBarleyBasis.Checked.ToString());
 

                db.AddInParameter(dbCommand, "p_load_type_name", DbType.String, "cccc");
 

                db.AddInParameter(dbCommand, "p_wht_basis_num", DbType.Int32, 1);

                db.AddInParameter(dbCommand, "p_durum_basis_num", DbType.Int32, 1);

                db.AddInParameter(dbCommand, "p_bly_basis_num", DbType.Int32, 1);

                db.AddInParameter(dbCommand, "p_desigtd_bly_basis_num", DbType.Int32, 1);
 
 
 

                db.AddInParameter(dbCommand, "p_src_file_path_desc", DbType.String, "C:");
 

                db.AddInParameter(dbCommand, "p_pool_part_code", DbType.String, "1");
 

                db.AddInParameter(dbCommand, "p_sct_price_list_name", DbType.String, "1");

                db.AddInParameter(dbCommand, "p_sct_effctv_dtm", DbType.DateTime, null);
 

                db.AddInParameter(dbCommand, "p_row_cnt_qty", DbType.Int32, 0);

                db.AddInParameter(dbCommand, "p_price_sum_amt", DbType.Decimal, 0.00);

                db.ExecuteNonQuery(dbCommand);

            }

            catch (Exception ex)

            {

                throw (ex);

            }

            return null;

        }

Open in new window

0
Comment
Question by:mathieu_cupryk
  • 4
  • 3
7 Comments
 
LVL 6

Expert Comment

by:rafayali
ID: 21780279
You can pass any "thing - object" in the parameters of function. Just as you can put in primitive data types such as integer, you can place any object there. This is because, in essence, integer and other primitives are also objects in .NET. We just dont realize this because we Microsoft has made it easier to use these primitives - that is without instantiating an object.

So, you can change your function declaration like this to accept dataset or datatable and return datatable or dataset

 public DataSet InsertPriceListHeader()

The above is your original version. I will show an example with VB .NET. The concepts are similar so just change it around for C#.

Public InsertPriceListHeader(byval myDt as datatable) as datatable

OR

Public InsertPriceListHeader(byval myDS as dataset) as dataset

All the serialization to and from XML would be handled automatically by ASP .NET Web service when datasets are returned so you pretty much code an asp.net web service in much the same way that you code a function in asp.net. Returning is also similar.

One thing you can do is to create an asp.net web site, test your function. After it is working, wrap that function into [WebMethod]

For all practicle purposes, you could start using the method AS IS once it is wrapped as a webmethod without any further changes - in majority of the cases.
0
 

Author Comment

by:mathieu_cupryk
ID: 21780790
I created a class object:
How should I call the following object when I populate it
I will pass this object through in a web service and return a dataset
[WebMethod]
public DataSet InsertPriceListHeader(...PriceListHeaderObject PLHO)

using System;
using System.Collections.Generic;
using System.Text;

namespace Cwb.InitialPriceReporting
{
    public class PriceListHeaderObject
    {
        private string PRICE_LIST_HDR_ID; // Primary Key

        private decimal WHT_TOUGH_DISC_AMT;
        private decimal WHT_DAMP_DISC_AMT;
        private decimal WHT_STONE_DISC_AMT;

        private decimal BLY_TOUGH_DISC_AMT;
        private decimal BLY_DAMP_DISC_AMT;
        private decimal BLY_STONE_DISC_AMT;

        private decimal DURUM_TOUGH_DISC_AMT;
        private decimal DURUM_DAMP_DISC_AMT;
        private decimal DURUM_STONE_DISC_AMT;

        private decimal DESIGTD_BLY_TOUGH_DISC_AMT;
        private decimal DESIGTD_BLY_DAMP_DISC_AMT;

        private string PRICE_LIST_STATUS_TYPE_NAME;
        private DateTime LOAD_DTM;
        private string USER_NAME;

        private string WHT_INDR_FLAG;
        private string DURUM_INDR_FLAG;
        private string BLY_INDR_FLAG;
        private string DESIGTD_BLY_INDR_FLAG;

        private string LOAD_TYPE_NAME;

        private int WHT_BASIS_NUM;
        private int DURUM_BASIS_NUM;
        private int BLY_BASIS_NUM;
        private int DESIGTD_BLY_BASIS_NUM;

        private string SRC_FILE_PATH_DESC;
        private string POOL_PART_CODE;

        private string SCT_PRICE_LIST_NAME; // SupplyChangeTransformation
        private DateTime SCT_EFFECTV_DTM;
        private int ROW_CNT_QTY;
        private decimal PRICE_SUM_AMT;

        public PriceListHeaderObjects()
        {
            // TODO: Add constructor logic here

        }
        public PriceListHeaderObjects(
        string sPRICE_LIST_HDR_ID,
        decimal dWHT_TOUGH_DISC_AMT,
        decimal dWHT_DAMP_DISC_AMT,
        decimal dWHT_STONE_DISC_AMT,
        decimal dBLY_TOUGH_DISC_AMT,
        decimal dBLY_DAMP_DISC_AMT,
        decimal dBLY_STONE_DISC_AMT,
        decimal dDURUM_TOUGH_DISC_AMT,
        decimal dDURUM_DAMP_DISC_AMT,
        decimal dDURUM_STONE_DISC_AMT,
        decimal dDESIGTD_BLY_TOUGH_DISC_AMT,
        decimal dDESIGTD_BLY_DAMP_DISC_AMT,
        string sPRICE_LIST_STATUS_TYPE_NAME,
        DateTime dtLOAD_DTM,
        string sUSER_NAME,
        string sWHT_INDR_FLAG,
        string sDURUM_INDR_FLAG,
        string sBLY_INDR_FLAG,
        string sDESIGTD_BLY_INDR_FLAG,
        string sLOAD_TYPE_NAME,
        int iWHT_BASIS_NUM,
        int iDURUM_BASIS_NUM,
        int iBLY_BASIS_NUM,
        int iDESIGTD_BLY_BASIS_NUM,
        string sSRC_FILE_PATH_DESC,
        string sPOOL_PART_CODE,
        string sSCT_PRICE_LIST_NAME, // SupplyChangeTransformation
        DateTime dtSCT_EFFECTV_DTM,
        int iROW_CNT_QTY,
        decimal dPRICE_SUM_AMT)
        {
            this.price_list_hdr_id = sPRICE_LIST_HDR_ID;
           
            // Amounts
            this.wht_tough_disc_amt = dWHT_TOUGH_DISC_AMT;
            this.wht_damp_disc_amt = dWHT_DAMP_DISC_AMT;
            this.wht_stone_disc_amt = dWHT_STONE_DISC_AMT;

            this.bly_tough_disc_amt = dBLY_TOUGH_DISC_AMT;
            this.bly_damp_disc_amt = dBLY_DAMP_DISC_AMT;
            this.bly_stone_disc_amt = dBLY_STONE_DISC_AMT;

            this.durum_tough_disc_amt = dDURUM_TOUGH_DISC_AMT;
            this.durum_damp_disc_amt = dDURUM_DAMP_DISC_AMT;
            this.durum_stone_disc_amt = dDURUM_STONE_DISC_AMT;

            this.desigtd_tought_disc_amt = dDESIGTD_BLY_TOUGH_DISC_AMT;
            this.desigtd_damp_disc_amt = dDESIGTD_BLY_DAMP_DISC_AMT;


            this.price_list_status_type_name = sPRICE_LIST_STATUS_TYPE_NAME;
            this.load_dtm = dtLOAD_DTM;
            this.user_name = sUSER_NAME;
           
            //flags
            this.wht_indr_flag   = sWHT_INDR_FLAG;
            this.durum_indr_flag = sDURUM_INDR_FLAG;
            this.bly_indr_flag   = sBLY_INDR_FLAG;
            this.desigtd_bly_indr_flag = sDESIGTD_BLY_INDR_FLAG;


            this.load_type_name = sLOAD_TYPE_NAME;
           
            //basis
            this.wht_basis_num = iWHT_BASIS_NUM;
            this.durum_basis_num = iDURUM_BASIS_NUM;
            this.bly_basis_num = iBLY_BASIS_NUM;
            this.desigtd_bly_basis_num = iDESIGTD_BLY_BASIS_NUM;

           
            this.src_file_path_desc = sSRC_FILE_PATH_DESC;
            this.pool_part_code = sPOOL_PART_CODE;
            this.sct_price_list_name = sSCT_PRICE_LIST_NAME;

            this.sct_effectv_dtm = dtSCT_EFFECTV_DTM;
            this.row_cnt_qty = iROW_CNT_QTY;
            this.price_sum_amt = dPRICE_SUM_AMT;

        }


        public string price_list_hdr_id
        {
            get { return PRICE_LIST_HDR_ID; }
            set { PRICE_LIST_HDR_ID = value; }
        }
        // wheat
        public decimal wht_tough_disc_amt
        {
            get { return WHT_TOUGH_DISC_AMT; }
            set { WHT_TOUGH_DISC_AMT = value; }
        }
        public decimal wht_damp_disc_amt
        {
            get { return WHT_DAMP_DISC_AMT; }
            set { WHT_DAMP_DISC_AMT = value; }
        }
        public decimal wht_stone_disc_amt
        {
            get { return WHT_STONE_DISC_AMT; }
            set { WHT_STONE_DISC_AMT = value; }
        }
        // durum
        public decimal durum_tough_disc_amt
        {
            get { return DURUM_TOUGH_DISC_AMT; }
            set { DURUM_TOUGH_DISC_AMT = value; }
        }
        public decimal durum_damp_disc_amt
        {
            get { return DURUM_DAMP_DISC_AMT; }
            set { DURUM_DAMP_DISC_AMT = value; }
        }
        public decimal durum_stone_disc_amt
        {
            get { return DURUM_STONE_DISC_AMT; }
            set { DURUM_STONE_DISC_AMT = value; }
        }
        // barley
        public decimal bly_tough_disc_amt
        {
            get { return BLY_TOUGH_DISC_AMT; }
            set { BLY_TOUGH_DISC_AMT = value; }
        }
        public decimal bly_damp_disc_amt
        {
            get { return BLY_DAMP_DISC_AMT; }
            set { BLY_DAMP_DISC_AMT = value; }
        }
        public decimal bly_stone_disc_amt
        {
            get { return BLY_STONE_DISC_AMT; }
            set { BLY_STONE_DISC_AMT = value; }
        }
        // des
        public decimal desigtd_tought_disc_amt
        {
            get { return DESIGTD_BLY_TOUGH_DISC_AMT; }
            set { DESIGTD_BLY_TOUGH_DISC_AMT = value; }
        }
        public decimal desigtd_damp_disc_amt
        {
            get { return DESIGTD_BLY_DAMP_DISC_AMT; }
            set { DESIGTD_BLY_DAMP_DISC_AMT = value; }
        }
        //  
 
        // PriceListStatus
        public string price_list_status_type_name
        {
            get { return PRICE_LIST_STATUS_TYPE_NAME; }
            set { PRICE_LIST_STATUS_TYPE_NAME = value; }
        }


        public DateTime load_dtm
        {
            get { return LOAD_DTM; }
            set { LOAD_DTM = value; }
        }


        public string user_name
        {
            get { return USER_NAME; }
            set { USER_NAME = value; }
        }


        public string wht_indr_flag
        {
            get { return WHT_INDR_FLAG; }
            set { WHT_INDR_FLAG = value; }
        }


        public string durum_indr_flag
        {
            get { return DURUM_INDR_FLAG; }
            set { DURUM_INDR_FLAG = value; }
        }


        public string bly_indr_flag
        {
            get { return BLY_INDR_FLAG; }
            set { BLY_INDR_FLAG = value; }
        }


        public string desigtd_bly_indr_flag
        {
            get { return DESIGTD_BLY_INDR_FLAG; }
            set { DESIGTD_BLY_INDR_FLAG = value; }
        }


        public string load_type_name
        {
            get { return LOAD_TYPE_NAME; }
            set { LOAD_TYPE_NAME = value; }
        }
       
        public int wht_basis_num
        {
            get { return WHT_BASIS_NUM; }
            set { WHT_BASIS_NUM = value; }
        }


        public int durum_basis_num
        {
            get { return DURUM_BASIS_NUM; }
            set { DURUM_BASIS_NUM = value; }
        }

        public int bly_basis_num
        {
            get { return BLY_BASIS_NUM; }
            set { BLY_BASIS_NUM = value; }
        }


        public int desigtd_bly_basis_num
        {
            get { return DESIGTD_BLY_BASIS_NUM; }
            set { DESIGTD_BLY_BASIS_NUM = value; }
        }

        public string src_file_path_desc
        {
            get { return SRC_FILE_PATH_DESC; }
            set { SRC_FILE_PATH_DESC = value; }
        }

        public string pool_part_code
        {
            get { return POOL_PART_CODE; }
            set { POOL_PART_CODE = value; }
        }

        public string sct_price_list_name
        {
            get { return SCT_PRICE_LIST_NAME; }
            set { SCT_PRICE_LIST_NAME = value; }
        }

        public DateTime sct_effectv_dtm
        {
            get { return SCT_EFFECTV_DTM; }
            set { SCT_EFFECTV_DTM = value; }
        }
        public int row_cnt_qty
        {
            get { return ROW_CNT_QTY; }
            set { ROW_CNT_QTY = value; }
        }
        public decimal price_sum_amt
        {
            get { return PRICE_SUM_AMT; }
            set { PRICE_SUM_AMT = value; }
        }

    }
}
0
 
LVL 6

Expert Comment

by:rafayali
ID: 21781005
The general way to call a web service (public Internet object) is to add a WEB REFERENCE in Visual Studio. Once the web reference is added, VS generates a proxy class and includes it in your project. Then, you can use that proxy class just like you use any other class.

So, lets say you published a web service class. Published is just a fancy term to upload the class file to a server (the class file has webmethods), alongwith the .asmx file. Let say the complete endpoint (again a fancy term to denote a url of a web service) is http://www.webservices.com/mywebservice.asmx.

Now, go into VS, WEB REFERENCES and add a reference to http://www.webservices.com/mywebservice.asmx

Once, this is done, you have access to the proxy class in your code and use it like any other class.

Dim myObject as new webservice_class_added_to_project.

then call myObject.method() or assign properties, although Microsoft recommends not to use properties in web services, since it is against the principles. But, there is nothing stopping you from using them either.

0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 

Author Comment

by:mathieu_cupryk
ID: 21781283
// Call the web service.
 PriceListHeaderObject PLHO = new PriceListHeaderObject();
               .....

InitialPrices.InitialPriceReportingWS.InitialPriceReportingService WS =
  new InitialPrices.InitialPriceReportingWS.InitialPriceReportingService();

 ds = WS.InsertPriceListHeader(PLHO); // How is the webservice going to know about the object in its parameters

public void InsertPriceListHeader(PriceListHeaderObject PLHO)
               
Now there is a windows application and a webapplication the object is defined in the windows application.

Now the webservice is created in the webapplication and  the object the object
0
 

Author Comment

by:mathieu_cupryk
ID: 21781433
Error      1      The type or namespace name 'PriceListHeaderObject' could not be found (are you missing a using directive or an assembly reference?)      C:\SvnWork\InitialPriceReporting\DotNet\InitialPriceReportingService\App_Code\InitialPriceReportingService.cs      36      43      C:\...\InitialPriceReportingService\
Error      2      No overload for method 'InsertPriceListHeader' takes '1' arguments      C:\SvnWork\InitialPriceReporting\DotNet\InitialPriceReporting\Form1.cs      175      22      InitialPriceReporting
See file for more information.
object.jpg
0
 
LVL 6

Accepted Solution

by:
rafayali earned 500 total points
ID: 21782638
What i get from the screenshot is that you want to pass an object of class PriceListHeader into the web service?

PriceListHeaderObject does not exist????????? PriceListHeader exists.

Can you clarify what you are doing? Because, your initial q said how to pass a ds or dt? Here, you are passing a custom object.

0
 

Author Comment

by:mathieu_cupryk
ID: 21782836
I am passing a custom object.

But I add it to my web service and I cannot see it?
public DataSet InsertPriceListHeader(PriceListHeaderObject PLHO) this sees the object

======================================================
sing System;
using System.Data;
using System.Data.Common;
using System.Web;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.ComponentModel;
using System.Diagnostics;
using System.Configuration;
using System.Xml;
using Microsoft.Practices.EnterpriseLibrary.Data;



    #region Data Objects

    public class PriceListHeaderObject
    {
        private string PRICE_LIST_HDR_ID; // Primary Key

        private decimal WHT_TOUGH_DISC_AMT;
        private decimal WHT_DAMP_DISC_AMT;
        private decimal WHT_STONE_DISC_AMT;

        private decimal BLY_TOUGH_DISC_AMT;
        private decimal BLY_DAMP_DISC_AMT;
        private decimal BLY_STONE_DISC_AMT;

        private decimal DURUM_TOUGH_DISC_AMT;
        private decimal DURUM_DAMP_DISC_AMT;
        private decimal DURUM_STONE_DISC_AMT;

        private decimal DESIGTD_BLY_TOUGH_DISC_AMT;
        private decimal DESIGTD_BLY_DAMP_DISC_AMT;

        private string PRICE_LIST_STATUS_TYPE_NAME;
        private DateTime LOAD_DTM;
        private string USER_NAME;

        private string WHT_INDR_FLAG;
        private string DURUM_INDR_FLAG;
        private string BLY_INDR_FLAG;
        private string DESIGTD_BLY_INDR_FLAG;

        private string LOAD_TYPE_NAME;

        private int WHT_BASIS_NUM;
        private int DURUM_BASIS_NUM;
        private int BLY_BASIS_NUM;
        private int DESIGTD_BLY_BASIS_NUM;

        private string SRC_FILE_PATH_DESC;
        private string POOL_PART_CODE;

        private string SCT_PRICE_LIST_NAME; // SupplyChangeTransformation
        private DateTime SCT_EFFECTV_DTM;
        private int ROW_CNT_QTY;
        private decimal PRICE_SUM_AMT;

        public PriceListHeaderObject()
        {
            // TODO: Add constructor logic here

        }
        public PriceListHeaderObject(
        string sPRICE_LIST_HDR_ID,
        decimal dWHT_TOUGH_DISC_AMT,
        decimal dWHT_DAMP_DISC_AMT,
        decimal dWHT_STONE_DISC_AMT,
        decimal dBLY_TOUGH_DISC_AMT,
        decimal dBLY_DAMP_DISC_AMT,
        decimal dBLY_STONE_DISC_AMT,
        decimal dDURUM_TOUGH_DISC_AMT,
        decimal dDURUM_DAMP_DISC_AMT,
        decimal dDURUM_STONE_DISC_AMT,
        decimal dDESIGTD_BLY_TOUGH_DISC_AMT,
        decimal dDESIGTD_BLY_DAMP_DISC_AMT,
        string sPRICE_LIST_STATUS_TYPE_NAME,
        DateTime dtLOAD_DTM,
        string sUSER_NAME,
        string sWHT_INDR_FLAG,
        string sDURUM_INDR_FLAG,
        string sBLY_INDR_FLAG,
        string sDESIGTD_BLY_INDR_FLAG,
        string sLOAD_TYPE_NAME,
        int iWHT_BASIS_NUM,
        int iDURUM_BASIS_NUM,
        int iBLY_BASIS_NUM,
        int iDESIGTD_BLY_BASIS_NUM,
        string sSRC_FILE_PATH_DESC,
        string sPOOL_PART_CODE,
        string sSCT_PRICE_LIST_NAME, // SupplyChangeTransformation
        DateTime dtSCT_EFFECTV_DTM,
        int iROW_CNT_QTY,
        decimal dPRICE_SUM_AMT)
        {
            this.price_list_hdr_id = sPRICE_LIST_HDR_ID;

            // Amounts
            this.wht_tough_disc_amt = dWHT_TOUGH_DISC_AMT;
            this.wht_damp_disc_amt = dWHT_DAMP_DISC_AMT;
            this.wht_stone_disc_amt = dWHT_STONE_DISC_AMT;

            this.bly_tough_disc_amt = dBLY_TOUGH_DISC_AMT;
            this.bly_damp_disc_amt = dBLY_DAMP_DISC_AMT;
            this.bly_stone_disc_amt = dBLY_STONE_DISC_AMT;

            this.durum_tough_disc_amt = dDURUM_TOUGH_DISC_AMT;
            this.durum_damp_disc_amt = dDURUM_DAMP_DISC_AMT;
            this.durum_stone_disc_amt = dDURUM_STONE_DISC_AMT;

            this.desigtd_tought_disc_amt = dDESIGTD_BLY_TOUGH_DISC_AMT;
            this.desigtd_damp_disc_amt = dDESIGTD_BLY_DAMP_DISC_AMT;


            this.price_list_status_type_name = sPRICE_LIST_STATUS_TYPE_NAME;
            this.load_dtm = dtLOAD_DTM;
            this.user_name = sUSER_NAME;

            //flags
            this.wht_indr_flag = sWHT_INDR_FLAG;
            this.durum_indr_flag = sDURUM_INDR_FLAG;
            this.bly_indr_flag = sBLY_INDR_FLAG;
            this.desigtd_bly_indr_flag = sDESIGTD_BLY_INDR_FLAG;


            this.load_type_name = sLOAD_TYPE_NAME;

            //basis
            this.wht_basis_num = iWHT_BASIS_NUM;
            this.durum_basis_num = iDURUM_BASIS_NUM;
            this.bly_basis_num = iBLY_BASIS_NUM;
            this.desigtd_bly_basis_num = iDESIGTD_BLY_BASIS_NUM;


            this.src_file_path_desc = sSRC_FILE_PATH_DESC;
            this.pool_part_code = sPOOL_PART_CODE;
            this.sct_price_list_name = sSCT_PRICE_LIST_NAME;

            this.sct_effectv_dtm = dtSCT_EFFECTV_DTM;
            this.row_cnt_qty = iROW_CNT_QTY;
            this.price_sum_amt = dPRICE_SUM_AMT;

        }


        public string price_list_hdr_id
        {
            get { return PRICE_LIST_HDR_ID; }
            set { PRICE_LIST_HDR_ID = value; }
        }
        // wheat
        public decimal wht_tough_disc_amt
        {
            get { return WHT_TOUGH_DISC_AMT; }
            set { WHT_TOUGH_DISC_AMT = value; }
        }
        public decimal wht_damp_disc_amt
        {
            get { return WHT_DAMP_DISC_AMT; }
            set { WHT_DAMP_DISC_AMT = value; }
        }
        public decimal wht_stone_disc_amt
        {
            get { return WHT_STONE_DISC_AMT; }
            set { WHT_STONE_DISC_AMT = value; }
        }
        // durum
        public decimal durum_tough_disc_amt
        {
            get { return DURUM_TOUGH_DISC_AMT; }
            set { DURUM_TOUGH_DISC_AMT = value; }
        }
        public decimal durum_damp_disc_amt
        {
            get { return DURUM_DAMP_DISC_AMT; }
            set { DURUM_DAMP_DISC_AMT = value; }
        }
        public decimal durum_stone_disc_amt
        {
            get { return DURUM_STONE_DISC_AMT; }
            set { DURUM_STONE_DISC_AMT = value; }
        }
        // barley
        public decimal bly_tough_disc_amt
        {
            get { return BLY_TOUGH_DISC_AMT; }
            set { BLY_TOUGH_DISC_AMT = value; }
        }
        public decimal bly_damp_disc_amt
        {
            get { return BLY_DAMP_DISC_AMT; }
            set { BLY_DAMP_DISC_AMT = value; }
        }
        public decimal bly_stone_disc_amt
        {
            get { return BLY_STONE_DISC_AMT; }
            set { BLY_STONE_DISC_AMT = value; }
        }
        // des
        public decimal desigtd_tought_disc_amt
        {
            get { return DESIGTD_BLY_TOUGH_DISC_AMT; }
            set { DESIGTD_BLY_TOUGH_DISC_AMT = value; }
        }
        public decimal desigtd_damp_disc_amt
        {
            get { return DESIGTD_BLY_DAMP_DISC_AMT; }
            set { DESIGTD_BLY_DAMP_DISC_AMT = value; }
        }
        //  

        // PriceListStatus
        public string price_list_status_type_name
        {
            get { return PRICE_LIST_STATUS_TYPE_NAME; }
            set { PRICE_LIST_STATUS_TYPE_NAME = value; }
        }


        public DateTime load_dtm
        {
            get { return LOAD_DTM; }
            set { LOAD_DTM = value; }
        }


        public string user_name
        {
            get { return USER_NAME; }
            set { USER_NAME = value; }
        }


        public string wht_indr_flag
        {
            get { return WHT_INDR_FLAG; }
            set { WHT_INDR_FLAG = value; }
        }


        public string durum_indr_flag
        {
            get { return DURUM_INDR_FLAG; }
            set { DURUM_INDR_FLAG = value; }
        }


        public string bly_indr_flag
        {
            get { return BLY_INDR_FLAG; }
            set { BLY_INDR_FLAG = value; }
        }


        public string desigtd_bly_indr_flag
        {
            get { return DESIGTD_BLY_INDR_FLAG; }
            set { DESIGTD_BLY_INDR_FLAG = value; }
        }


        public string load_type_name
        {
            get { return LOAD_TYPE_NAME; }
            set { LOAD_TYPE_NAME = value; }
        }

        public int wht_basis_num
        {
            get { return WHT_BASIS_NUM; }
            set { WHT_BASIS_NUM = value; }
        }


        public int durum_basis_num
        {
            get { return DURUM_BASIS_NUM; }
            set { DURUM_BASIS_NUM = value; }
        }

        public int bly_basis_num
        {
            get { return BLY_BASIS_NUM; }
            set { BLY_BASIS_NUM = value; }
        }


        public int desigtd_bly_basis_num
        {
            get { return DESIGTD_BLY_BASIS_NUM; }
            set { DESIGTD_BLY_BASIS_NUM = value; }
        }

        public string src_file_path_desc
        {
            get { return SRC_FILE_PATH_DESC; }
            set { SRC_FILE_PATH_DESC = value; }
        }

        public string pool_part_code
        {
            get { return POOL_PART_CODE; }
            set { POOL_PART_CODE = value; }
        }

        public string sct_price_list_name
        {
            get { return SCT_PRICE_LIST_NAME; }
            set { SCT_PRICE_LIST_NAME = value; }
        }

        public DateTime sct_effectv_dtm
        {
            get { return SCT_EFFECTV_DTM; }
            set { SCT_EFFECTV_DTM = value; }
        }
        public int row_cnt_qty
        {
            get { return ROW_CNT_QTY; }
            set { ROW_CNT_QTY = value; }
        }
        public decimal price_sum_amt
        {
            get { return PRICE_SUM_AMT; }
            set { PRICE_SUM_AMT = value; }
        }

    }
    #endregion

    [WebService(Namespace = "http://tempuri.org/")]
    public class InitialPriceReportingService : System.Web.Services.WebService
    {

       

        public InitialPriceReportingService()
        {

            //Uncomment the following line if using designed components
            //InitializeComponent();
        }





        [WebMethod]
        public DataSet GetPriceListHeader()
        {
           
            string procedureName = "init_price.PRICE_LIST_REPORTING.select_all_price_list_hdr"; //schema.stored procedure
            try
            {
                Database db = DatabaseFactory.CreateDatabase("InitialPrices.Properties.Settings.ConnectionString");      
                DbCommand selectCommand = db.GetStoredProcCommand(procedureName);
                return db.ExecuteDataSet(selectCommand);

            }
            catch (Exception ex)
            {
                throw (ex);
            }
           
        }

       
        [WebMethod]
        public DataSet InsertPriceListHeader(PriceListHeaderObject PLHO)
        {

            string procedureName = "init_price.PRICE_LIST_REPORTING.insert_price_list_hdr";
            try
            {
                Database db = DatabaseFactory.CreateDatabase("InitialPrices.Properties.Settings.ConnectionString");
                DbCommand selectCommand = db.GetStoredProcCommand(procedureName);

                //  db.AddInParameter(dbCommand, "p_price_list_hdr_id", DbType.String, txtCropYear.Text + txtListNo.Text);
                db.AddInParameter(dbCommand, "p_wht_tough_disc_amt", DbType.Decimal, 0.00);
                db.AddInParameter(dbCommand, "p_wht_damp_disc_amt", DbType.Decimal, 0.00);
                db.AddInParameter(dbCommand, "p_wht_stone_disc_amt", DbType.Decimal, 0.00);

                db.AddInParameter(dbCommand, "p_durum_tough_disc_amt", DbType.Decimal, 0.00);
                db.AddInParameter(dbCommand, "p_durum_damp_disc_amt", DbType.Decimal, 0.00);
                db.AddInParameter(dbCommand, "p_durum_stone_disc_amt", DbType.Decimal, 0.00);

                db.AddInParameter(dbCommand, "p_bly_tough_disc_amt", DbType.Decimal, 0.00);
                db.AddInParameter(dbCommand, "p_bly_damp_disc_amt", DbType.Decimal, 0.00);
                db.AddInParameter(dbCommand, "p_bly_stone_disc_amt", DbType.Decimal, 0.00);

                db.AddInParameter(dbCommand, "p_desigtd_bly_tough_disc_amt", DbType.Decimal, 0.00);
                db.AddInParameter(dbCommand, "p_desigtd_bly_damp_disc_amt", DbType.Decimal, 0.00);

                db.AddInParameter(dbCommand, "p_price_list_status_type_name", DbType.String, "Draft");
                db.AddInParameter(dbCommand, "p_load_dtm", DbType.DateTime, System.DateTime.Now);
                db.AddInParameter(dbCommand, "p_user_name", DbType.String, "Mathieu");


                db.AddInParameter(dbCommand, "p_wht_indr_flag", DbType.String, "1");          // chkboxWheat.Checked.ToString());    // On check
                db.AddInParameter(dbCommand, "p_durum_indr_flag", DbType.String, "1");        // chkboxDurum.Checked.ToString());
                db.AddInParameter(dbCommand, "p_bly_indr_flag", DbType.String, "1");          // chkboxBarley.Checked.ToString());
                db.AddInParameter(dbCommand, "p_desigtd_bly_indr_flag", DbType.String, "1");  // chkboxDesBarleyBasis.Checked.ToString());

                db.AddInParameter(dbCommand, "p_load_type_name", DbType.String, "cccc");

                db.AddInParameter(dbCommand, "p_wht_basis_num", DbType.Int32, 1);
                db.AddInParameter(dbCommand, "p_durum_basis_num", DbType.Int32, 1);
                db.AddInParameter(dbCommand, "p_bly_basis_num", DbType.Int32, 1);
                db.AddInParameter(dbCommand, "p_desigtd_bly_basis_num", DbType.Int32, 1);



                db.AddInParameter(dbCommand, "p_src_file_path_desc", DbType.String, "C:");

                db.AddInParameter(dbCommand, "p_pool_part_code", DbType.String, "1");

                db.AddInParameter(dbCommand, "p_sct_price_list_name", DbType.String, "1");
                db.AddInParameter(dbCommand, "p_sct_effctv_dtm", DbType.DateTime, null);

                db.AddInParameter(dbCommand, "p_row_cnt_qty", DbType.Int32, 0);
                db.AddInParameter(dbCommand, "p_price_sum_amt", DbType.Decimal, 0.00);
                db.ExecuteNonQuery(dbCommand);
            }
            catch (Exception ex)
            {
                throw (ex);
            }
            return null;
        }



        [WebMethod(Description = "Gets the server time and returns it as a string")]
        public string ServerTime()
        {
            string time;
            time = System.DateTime.Now.ToLongDateString();
            return time;
        }

     
       

     

       
    }


0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now