Пример #1
0
        private void W_GETxUpdate()
        {
            try
            {
                oConfigDB        = new cSetting();
                oFoodLandCallAPI = new cFoodLandCallAPI();

                tC_Url = oConfigDB.C_GEToSetting().tCML_Url;
                string tUrl = tC_Url + "CpnUseStaUpd";
                switch (tCpnUseSta)
                {
                case "ใช้งานได้": tCpnUseSta = "0"; break;

                case "ใช้งานไปแล้ว": tCpnUseSta = "1"; break;

                case "ยกเลิก": tCpnUseSta = "2"; break;

                case "หมดอายุ": return;
                }
                oCpnUseStaUpd = new cmlCpnUseStaUpd
                {
                    tCML_CpnCode   = otbCpnCode.Text,
                    tCML_CpnUseSta = tCpnUseSta
                };
                var tResult = oFoodLandCallAPI.C_SETxCpnUseStaUpd(tUrl, oCpnUseStaUpd);
            }
            catch (Exception)
            {
            }
        }
Пример #2
0
        private void W_SETxConfigDB()
        {
            cFoodLandCallAPI oFoodLandCallAPI;
            cmlConnectDB     oConnectDB;
            string           tUrl;

            try
            {
                var oConfigDB = new cSetting();
                tUrl                     = otbUrl.Text + "SETConfigDB";
                oFoodLandCallAPI         = new cFoodLandCallAPI();
                oConnectDB               = new cmlConnectDB();
                oConnectDB.tCML_Server   = otbServerName.Text;
                oConnectDB.tCML_Database = otbDbName.Text;
                oConnectDB.tCML_Username = otbUserName.Text;
                oConnectDB.tCML_Password = otbUserPwd.Text;
                oFoodLandCallAPI.C_SETxConfigDB(tUrl.Trim(), oConnectDB);
                oConnectDB.tCML_Url = otbUrl.Text;
                oConfigDB.C_SETxSetting(oConnectDB);
            }
            catch (Exception oEx)
            {
                throw oEx;
            }
        }
Пример #3
0
 private void ocmGetAllCoupon_Click(object sender, EventArgs e)
 {
     try
     {
         oFoodLandCallAPI = new cFoodLandCallAPI();
         var tUrl          = otbUrl.Text = tC_Url + "CpnStatusAll";
         var oCpnStatusAll = oFoodLandCallAPI.C_GEToDataCpnStatusAll(tUrl.Trim());
         ogdDataCoupon.DataSource = oCpnStatusAll;
     }
     catch (Exception oEx)
     {
         MessageBox.Show("wMain : ocmGetAllCoupon_Click//" + oEx.Message);
     }
 }
Пример #4
0
        private void W_GETxSearchCpnGroup()
        {
            try
            {
                oFoodLandCallAPI = new cFoodLandCallAPI();
                var oCouponReq = new cmlCpnSearchReq
                {
                    tCML_StmCode   = otbSearchStmCode.Text,
                    tCML_CpnUseSta = tSearchCpnSta
                };
                if (oCouponReq.tCML_CpnUseSta.Equals("ทั้งหมด"))
                {
                    string tUrl = tC_Url + "CpnStatusAll";
                    oCpnData = oFoodLandCallAPI.C_GEToDataCpnStatusAll(tUrl.Trim());
                }
                else if (oCouponReq.tCML_CpnUseSta.Equals("NULL"))
                {
                    oCouponReq.tCML_CpnUseSta = "";
                    string tUrl = tC_Url + "CpnSearchByGroup";
                    oCpnData = oFoodLandCallAPI.C_GEToDataCpnByGroup(tUrl.Trim(), oCouponReq);
                }
                else
                {
                    string tUrl = tC_Url + "CpnSearchByGroup";
                    oCpnData = oFoodLandCallAPI.C_GEToDataCpnByGroup(tUrl.Trim(), oCouponReq);
                }
            }
            catch (WebException oEx)
            {
                int nResCode = (int)oEx.Status;

                if (oEx.Status == WebExceptionStatus.ProtocolError || oEx.Status == WebExceptionStatus.ConnectFailure || oEx.Status == WebExceptionStatus.KeepAliveFailure)
                {
                    var response = oEx.Response as HttpWebResponse;
                    if (response != null)
                    {
                        nResCode = (int)response.StatusCode;
                        if (nResCode == 500)
                        {
                            MessageBox.Show("wMain : W_GETxSearchCpnGroup ///" + oEx.Message + "ไม่สามารถติดต่อฐานข้อมูลได้ หรือฐานข้อมูลไม่ถูกต้อง กรุณาตรวจสอบการตั้งค่า");
                        }
                    }
                }
                else
                {
                    MessageBox.Show("wMain : W_GETxSearchCpnGroup ///" + oEx.Message);
                }
            }
        }
Пример #5
0
 private void ocmSearchCpnCode_Click(object sender, EventArgs e)
 {
     try
     {
         oFoodLandCallAPI = new cFoodLandCallAPI();
         var tUrl        = otbUrl.Text = tC_Url + "CpnSearchByCpnCode";
         var oCouponCode = new cmlCouponCode();
         oCouponCode.tCML_CpnCode = otbSearchCpnCode.Text;
         var oCpnStatusAll = oFoodLandCallAPI.C_GEToDataCpnByCode(tUrl.Trim(), oCouponCode);
         ogdDataCoupon.DataSource = oCpnStatusAll;
     }
     catch (Exception oEx)
     {
         throw oEx;
     }
 }
Пример #6
0
 private void W_GETxSearchCpnByCode()
 {
     try
     {
         oFoodLandCallAPI = new cFoodLandCallAPI();
         var tUrl        = tC_Url + "CpnSearchByCpnCode";
         var oCouponCode = new cmlCouponCode
         {
             tCML_CpnCode = otbSearchCpnCode.Text
         };
         oCpnData = oFoodLandCallAPI.C_GEToDataCpnByCode(tUrl.Trim(), oCouponCode);
     }
     catch (Exception oEx)
     {
         MessageBox.Show("wMain : W_GETxSearchCpnByCode ///" + oEx.Message);
     }
 }
Пример #7
0
        private void ocmSearchCpnGroup_Click(object sender, EventArgs e)
        {
            try
            {
                oFoodLandCallAPI = new cFoodLandCallAPI();
                var tUrl = otbUrl.Text = tC_Url + "CpnSearchByGroup";

                var oCouponReq = new cmlCpnSearchReq();
                oCouponReq.tCML_StmCode   = otbSearchStmCode.Text;
                oCouponReq.tCML_CpnUseSta = ocbSearchCpnSta.Text;
                var oCpnStatusAll = oFoodLandCallAPI.C_GEToDataCpnByGroup(tUrl.Trim(), oCouponReq);
                ogdDataCoupon.DataSource = oCpnStatusAll;
            }
            catch (Exception oEx)
            {
                throw oEx;
            }
        }
Пример #8
0
 private void ocmVoid_Click(object sender, EventArgs e)
 {
     try
     {
         oFoodLandCallAPI = new cFoodLandCallAPI();
         cmlCouponRes oCouponRes = new cmlCouponRes();
         otbUrl.Text          = otbUrl.Text = tC_Url + "Void".Trim();
         oCouponRes           = oFoodLandCallAPI.C_SEToCouponSta(otbUrl.Text, otbSendCoupon.Text);
         otbStatusCode.Text   = oCouponRes.tCML_StatusCode;
         otbStatusDescTH.Text = oCouponRes.tCML_StatusDescTH;
         otbStatusDescEN.Text = oCouponRes.tCML_StatusDescEN;
         otbPrintDesc.Text    = oCouponRes.tCML_PrintDesc;
         otbRefCode.Text      = oCouponRes.tCML_RefCode;
         otbTranDateTime.Text = oCouponRes.tCML_TranDateTime;
     }
     catch (Exception oEx)
     {
         MessageBox.Show("wMain : ocmVoid_Click//" + oEx.Message);
     }
 }
Пример #9
0
        private void ocmCreate_Click(object sender, EventArgs e)
        {
            try
            {
                oFoodLandCallAPI = new cFoodLandCallAPI();
                cmlCouponRes oCouponRes = new cmlCouponRes();
                cmlCouponReq oCouponReq = new cmlCouponReq();
                otbUrl.Text             = tC_Url + "Create";
                oCouponReq.tCML_WhoUpd  = otbWhoUpd.Text;
                oCouponReq.tCML_WhoIns  = otbWhoIns.Text;
                oCouponReq.tCML_StmCode = otbStmCode.Text;
                oCouponReq.tCML_TmnNum  = otbTmnNum.Text;
                oCouponReq.tCML_CpnCode = otbCpnCode.Text;
                oCouponReq.tCML_CpnExp  = otbCpnExp.Text;
                oCouponReq.tCML_CpnAmt  = otbCpnAmt.Text;

                oCouponRes     = oFoodLandCallAPI.C_SEToCreateCoupon(otbUrl.Text.Trim(), oCouponReq);
                otbResult.Text = oCouponRes.tCML_CpnMSg;
            }
            catch (Exception oEx)
            {
                MessageBox.Show("wMain : ocmCreate_Click//" + oEx.Message);
            }
        }