Example #1
0
 public DamageData(int Damage, DAMAGE_TYPE type, CIGameObject Damager, RESPONSE ExpectResponce)
 {
     this.Damage         = Damage;
     this.DamageType     = type;
     this.Damager        = Damager;
     this.ExpectResponce = ExpectResponce;
 }
Example #2
0
        private void HandleResponse(GAISReader gr)
        {
            RESPONSE id = (RESPONSE)gr.ReadInt32();

            if (id == RESPONSE.NICKNAME_TAKEN)
            {
                tcpClient.Close();
                MessageBox.Show("Nickname Taken!");
                pForm.SetVisibility(true);
            }
        }
Example #3
0
        private void Serialize <TThing>()
            where TThing : Thing, new()
        {
            var thing   = new TThing();
            var context = Factory.Create(thing, new ThingOption());

            var message = JsonSerializer.Serialize(context.Response,
                                                   new ThingOption().ToJsonSerializerOptions());

            FluentAssertions.Json.JsonAssertionExtensions.Should(JToken.Parse(message))
            .BeEquivalentTo(JToken.Parse(RESPONSE.Replace("{0}", thing.Name)));
        }
Example #4
0
 private void btnCreate_Click(object sender, EventArgs e)
 {
     if (cbbResponseType.SelectedIndex == -1 || rtbResponseMessage.Text.Length == 0)
     {
         MessageBox.Show("Vui lòng chọn loại phản hồi và điền vào lời nhắn phản hồi!");
     }
     else
     {
         RESPONSE response = new RESPONSE();
         response.accountId     = a.accountId;
         response.reportId      = reportId;
         response.message       = rtbResponseMessage.Text;
         response.responseType  = cbbResponseType.SelectedIndex + 1;
         response.responsedDate = DateTime.Now;
         BUS_AdminData.Instance.BUS_SetResponse(response);
         MessageBox.Show("Tạo phản hồi thành công!");
         del(zoneId, check, dateStart, dateEnd);
         this.Close();
     }
 }
Example #5
0
        private async Task LogResponse(HttpContext context, RequestDelegate next)
        {
            var originalBodyStream = context.Response.Body;
            var rmsm = new RecyclableMemoryStreamManager();

            await using var responseBody = rmsm.GetStream();
            context.Response.Body        = responseBody;
            await next(context);

            context.Response.Body.Seek(0, SeekOrigin.Begin);
            var text = await new StreamReader(context.Response.Body).ReadToEndAsync();

            context.Response.Body.Seek(0, SeekOrigin.Begin);


            if (context.Request.Path.Value.Contains("/Account/Login"))
            {
                text = RequestVerificationTokenRegEx.Match(text).Value;
                _logger.LogInformation(@$ "
<RESPONSE statusCode='{context.Response.StatusCode}'>{(context.Response.StatusCode == 302 ? " \ n <LOCATION> < ![CDATA[" + context.Response.Headers[" Location "].ToString() + "]] > < / LOCATION > " : " ")}
     <URL>
{IndentAll(context.Request.Path.Value, 80, 10)}
        private void btnVerify_Click(object sender, EventArgs e)
        {
            // Prepare input text
            lblResultInfo.Text = "";
            txbLogin.Text.Trim();
            txbLogin.Text.ToUpper();
            txbPassword.Text.Trim();
            txbPassword.Text.ToUpper();

            RESPONSE response = checkCredentials(txbLogin.Text, txbPassword.Text);

            switch (response)
            {
            case RESPONSE.VERIFIED:
                DialogResult = DialogResult.OK;
                return;

            case RESPONSE.USERNAME_UNKNOWN:
                lblResultInfo.Text = "User unknown, please try again!";
                break;

            case RESPONSE.PASSWORD_UNKNOWN:
                lblResultInfo.Text = "User password incorrect, please try again!";
                break;

            case RESPONSE.PERMISSION_DENIED:
                lblResultInfo.Text = "Permissions are not granted to this user for win verification";
                break;

            default:
                lblResultInfo.Text = "User unknown, please try again!";
                break;
            }

            txbPassword.Text = "";
            txbLogin.Text    = "";
        }
    public RESPONSE REQUEST(string TX_ID, string LOG_ID, string VENDOR_ID, string SERVICE_ID, string METHOD, string COUNTER_NO, string TERM_NO, string POS_TAX_ID, string SERVICE_RUN_NO, string RECORD_STATUS, string CLIENT_SERVICE_RUN, string AMOUNT_RECEIVED, string VAT_AMOUNT, string BILL_TYPE, string REFERENCE_1, string REFERENCE_2, string REFERENCE_3, string REFERENCE_4, string CUSTOMER_NAME, string CUSTOMER_ADDR_1, string CUSTOMER_ADDR_2, string CUSTOMER_ADDR_3, string CUSTOMER_TEL_NO, string ZONE, string R_SERVICE_RUNNO, string CANCEL_OPERATING, string OPERATING_BY_STAFF, string SYSTEM_DATE_TIME, string USERID, string PASSWORD)
    {
        //Instantiate object from class

        //สร้าง object ของคลาส RESPONSE สำหรับใช้เป็น output ของ Web Services
        RESPONSE obj = new RESPONSE();
        //สร้าง object ของคลาส Running Reference สำหรับใช้เป็นหมายเลขอ้างอิงการ Request และ Response จาก CS-711
        RefRunningTBForCounterServiceBLL runningobj = new RefRunningTBForCounterServiceBLL();

        refnum = runningobj.AddRefRunningTBAndReturnForCounterService();
        //สร้าง object ของคลาส Logging สำหรับใช้บันทึก Log การ Request และ Response จาก CS-711
        WSLogForCounterServiceBLL logobj = new WSLogForCounterServiceBLL();

        //กำหนดค่าให้ตัวแปร output
        opTX_ID      = TX_ID;
        opLOG_ID     = LOG_ID;
        opVENDOR_ID  = VENDOR_ID;
        opSERVICE_ID = SERVICE_ID;
        opMETHOD     = METHOD;

        //LogRequest: Insert Log Request - บันทึก Log การ Request ที่ส่งมาจาก CS-711
        logobj.AddWSLogRequest(USERID, ipaddress, "Request", "service", METHOD, refnum, TX_ID, LOG_ID, VENDOR_ID, SERVICE_ID, METHOD, COUNTER_NO, TERM_NO, POS_TAX_ID, SERVICE_RUN_NO, RECORD_STATUS, CLIENT_SERVICE_RUN, AMOUNT_RECEIVED, VAT_AMOUNT, BILL_TYPE, REFERENCE_1, REFERENCE_2, REFERENCE_3, REFERENCE_4, CUSTOMER_NAME, CUSTOMER_ADDR_1, CUSTOMER_ADDR_2, CUSTOMER_ADDR_3, CUSTOMER_TEL_NO, ZONE, R_SERVICE_RUNNO, CANCEL_OPERATING, OPERATING_BY_STAFF, SYSTEM_DATE_TIME, USERID, PASSWORD);

        //ตรวจสอบว่า CS-711 ส่ง Input Parameters ที่จำเป็นมาให้ครบหรือไม่?
        //ถ้า CS-711 ส่ง Input Parameters ที่จำเป็นมาให้ไม่ครบ บันทึก Log Response และ return output
        if (TX_ID == "" && LOG_ID == "" && VENDOR_ID == "" && SERVICE_ID == "" && METHOD == "" && COUNTER_NO == "" && TERM_NO == "" && POS_TAX_ID == "" && SERVICE_RUN_NO == "" && RECORD_STATUS == "" && CLIENT_SERVICE_RUN == "" && AMOUNT_RECEIVED == "" && VAT_AMOUNT == "" && BILL_TYPE == "" && ZONE == "" && R_SERVICE_RUNNO == "" && OPERATING_BY_STAFF == "")
        {
            opSUCCESS = "False";
            opCODE    = "9MTLXXXX";
            opDESC    = "กรอกข้อมูล Input ที่จำเป็นมาให้ไม่ครบ";

            //กำหนดค่าให้ฟิลด์ต่างๆ ของ object สำหรับ RESPONSE class
            obj.TX_ID           = opTX_ID;
            obj.LOG_ID          = opLOG_ID;
            obj.VENDOR_ID       = opVENDOR_ID;
            obj.SERVICE_ID      = opSERVICE_ID;
            obj.METHOD          = opMETHOD;
            obj.SUCCESS         = opSUCCESS;
            obj.CODE            = opCODE;
            obj.DESC            = opDESC;
            obj.REFERENCE_1     = opREFERENCE_1;
            obj.REFERENCE_2     = opREFERENCE_2;
            obj.REFERENCE_3     = opREFERENCE_3;
            obj.REFERENCE_4     = opREFERENCE_4;
            obj.CUSTOMER_NAME   = opCUSTOMER_NAME;
            obj.CUSTOMER_ADDR_1 = opCUSTOMER_ADDR_1;
            obj.CUSTOMER_ADDR_2 = opCUSTOMER_ADDR_2;
            obj.CUSTOMER_ADDR_3 = opCUSTOMER_ADDR_3;
            obj.CUSTOMER_TEL_NO = opCUSTOMER_TEL_NO;
            obj.RETURN1         = opRETURN1;
            obj.RETURN2         = opRETURN2;
            obj.RETURN3         = opRETURN3;
            obj.AMOUNT_RECEIVED = opAMOUNT_RECEIVED;
            obj.PRINT_SLIP      = opPRINT_SLIP;

            //LogResponse: Insert Log Response - บันทึก Log Response ว่า CS-711 ส่ง Input Parameters ที่จำเป็นมาให้ไม่ครบ
            logobj.AddWSLogResponse(USERID, ipaddress, "Response", "service", METHOD, refnum, obj.TX_ID, obj.LOG_ID, obj.VENDOR_ID, obj.SERVICE_ID, obj.METHOD, obj.SUCCESS, obj.CODE, obj.DESC, obj.REFERENCE_1, obj.REFERENCE_2, obj.REFERENCE_3, obj.REFERENCE_4, obj.CUSTOMER_NAME, obj.CUSTOMER_ADDR_1, obj.CUSTOMER_ADDR_2, obj.CUSTOMER_ADDR_3, obj.CUSTOMER_TEL_NO, obj.RETURN1, obj.RETURN2, obj.RETURN3, obj.AMOUNT_RECEIVED, obj.PRINT_SLIP);

            return(obj);
        }
        // ถ้า CS-711 ส่ง Input Parameters ที่จำเป็นมาให้ครบ ให้ดำเนินการตรวจสอบข้อมูลในระบบ
        else
        {
            //ตรวจสอบว่า CS-711 ส่ง Request Method อะไร มาให้ MTL และตรวจสอบข้อมูลในระบบ ผ่าน Web Services ภายใน
            try
            {
                //ตรวจสอบว่า CS-711 ต้องการเรียกใช้ Method อะไร?
                switch (opMETHOD)
                {
                case "DataExchange":
                    //ตรวจสอบข้อมูลในระบบ ผ่าน Web Services ภายใน
                    try
                    {
                        if (true)
                        {
                            opSUCCESS         = "True";
                            opCODE            = "100";
                            opDESC            = "SUCCESS";
                            opAMOUNT_RECEIVED = "";
                        }
                        else
                        {
                            opSUCCESS = "False";
                            opCODE    = "9MTLXXX";
                            opDESC    = "erererererererer";
                        }
                    }
                    catch (Exception ex)
                    {
                        opSUCCESS = "False";
                        opCODE    = "9MTLXXX";
                        opDESC    = ex.ToString();
                    }
                    break;

                case "DataExchangeConfirm":
                    //ตรวจสอบข้อมูลในระบบ ผ่าน Web Services ภายใน
                    try
                    {
                        if (true)
                        {
                            opSUCCESS         = "True";
                            opCODE            = "100";
                            opDESC            = "SUCCESS";
                            opAMOUNT_RECEIVED = "";
                        }
                        else
                        {
                            opSUCCESS = "False";
                            opCODE    = "9MTLXXX";
                            opDESC    = "erererererererer";
                        }
                    }
                    catch (Exception ex)
                    {
                        opSUCCESS = "False";
                        opCODE    = "9MTLXXX";
                        opDESC    = ex.ToString();
                    }
                    break;

                case "DataExchangeCancel":
                    //ตรวจสอบข้อมูลในระบบ ผ่าน Web Services ภายใน
                    try
                    {
                        if (true)
                        {
                            opSUCCESS         = "True";
                            opCODE            = "100";
                            opDESC            = "SUCCESS";
                            opAMOUNT_RECEIVED = "";
                        }
                        else
                        {
                            opSUCCESS = "False";
                            opCODE    = "9MTLXXX";
                            opDESC    = "erererererererer";
                        }
                    }
                    catch (Exception ex)
                    {
                        opSUCCESS = "False";
                        opCODE    = "9MTLXXX";
                        opDESC    = ex.ToString();
                    }
                    break;

                case "OR":
                    //ตรวจสอบข้อมูลในระบบ ผ่าน Web Services ภายใน
                    try
                    {
                        if (true)
                        {
                            opSUCCESS         = "True";
                            opCODE            = "100";
                            opDESC            = "SUCCESS";
                            opAMOUNT_RECEIVED = "";
                        }
                        else
                        {
                            opSUCCESS = "False";
                            opCODE    = "9MTLXXX";
                            opDESC    = "erererererererer";
                        }
                    }
                    catch (Exception ex)
                    {
                        opSUCCESS = "False";
                        opCODE    = "9MTLXXX";
                        opDESC    = ex.ToString();
                    }
                    break;

                case "ORConfirm":
                    //ตรวจสอบข้อมูลในระบบ ผ่าน Web Services ภายใน
                    try
                    {
                        if (true)
                        {
                            opSUCCESS         = "True";
                            opCODE            = "100";
                            opDESC            = "SUCCESS";
                            opAMOUNT_RECEIVED = "";
                        }
                        else
                        {
                            opSUCCESS = "False";
                            opCODE    = "9MTLXXX";
                            opDESC    = "erererererererer";
                        }
                    }
                    catch (Exception ex)
                    {
                        opSUCCESS = "False";
                        opCODE    = "9MTLXXX";
                        opDESC    = ex.ToString();
                    }
                    break;

                case "ORCancel":
                    //ตรวจสอบข้อมูลในระบบ ผ่าน Web Services ภายใน
                    try
                    {
                        if (true)
                        {
                            opSUCCESS         = "True";
                            opCODE            = "100";
                            opDESC            = "SUCCESS";
                            opAMOUNT_RECEIVED = "";
                        }
                        else
                        {
                            opSUCCESS = "False";
                            opCODE    = "9MTLXXX";
                            opDESC    = "erererererererer";
                        }
                    }
                    catch (Exception ex)
                    {
                        opSUCCESS = "False";
                        opCODE    = "9MTLXXX";
                        opDESC    = ex.ToString();
                    }
                    break;

                default:
                    opSUCCESS = "False";
                    opCODE    = "9MTLXXX";
                    opDESC    = "ไม่ได้ส่ง Method ตามที่ตกลงมาให้";
                    break;
                }

                //กำหนดค่าให้ฟิลด์ต่างๆ ของ object สำหรับ RESPONSE class
                obj.TX_ID           = opTX_ID;
                obj.LOG_ID          = opLOG_ID;
                obj.VENDOR_ID       = opVENDOR_ID;
                obj.SERVICE_ID      = opSERVICE_ID;
                obj.METHOD          = opMETHOD;
                obj.SUCCESS         = opSUCCESS;
                obj.CODE            = opCODE;
                obj.DESC            = opDESC;
                obj.REFERENCE_1     = opREFERENCE_1;
                obj.REFERENCE_2     = opREFERENCE_2;
                obj.REFERENCE_3     = opREFERENCE_3;
                obj.REFERENCE_4     = opREFERENCE_4;
                obj.CUSTOMER_NAME   = opCUSTOMER_NAME;
                obj.CUSTOMER_ADDR_1 = opCUSTOMER_ADDR_1;
                obj.CUSTOMER_ADDR_2 = opCUSTOMER_ADDR_2;
                obj.CUSTOMER_ADDR_3 = opCUSTOMER_ADDR_3;
                obj.CUSTOMER_TEL_NO = opCUSTOMER_TEL_NO;
                obj.RETURN1         = opRETURN1;
                obj.RETURN2         = opRETURN2;
                obj.RETURN3         = opRETURN3;
                obj.AMOUNT_RECEIVED = opAMOUNT_RECEIVED;
                obj.PRINT_SLIP      = opPRINT_SLIP;

                //LogResponse: Insert Log Response - บันทึก Log Response ผลที่ได้จากการตรวจสอบข้อมูลในระบบ
                logobj.AddWSLogResponse(USERID, ipaddress, "Response", "service", METHOD, refnum, obj.TX_ID, obj.LOG_ID, obj.VENDOR_ID, obj.SERVICE_ID, obj.METHOD, obj.SUCCESS, obj.CODE, obj.DESC, obj.REFERENCE_1, obj.REFERENCE_2, obj.REFERENCE_3, obj.REFERENCE_4, obj.CUSTOMER_NAME, obj.CUSTOMER_ADDR_1, obj.CUSTOMER_ADDR_2, obj.CUSTOMER_ADDR_3, obj.CUSTOMER_TEL_NO, obj.RETURN1, obj.RETURN2, obj.RETURN3, obj.AMOUNT_RECEIVED, obj.PRINT_SLIP);

                return(obj);
            }
            catch (Exception ex)
            {
                opSUCCESS = "False";
                opCODE    = "9MTLXXX";
                opDESC    = ex.ToString();

                //กำหนดค่าให้ฟิลด์ต่างๆ ของ object สำหรับ RESPONSE class
                obj.TX_ID           = opTX_ID;
                obj.LOG_ID          = opLOG_ID;
                obj.VENDOR_ID       = opVENDOR_ID;
                obj.SERVICE_ID      = opSERVICE_ID;
                obj.METHOD          = opMETHOD;
                obj.SUCCESS         = opSUCCESS;
                obj.CODE            = opCODE;
                obj.DESC            = opDESC;
                obj.REFERENCE_1     = opREFERENCE_1;
                obj.REFERENCE_2     = opREFERENCE_2;
                obj.REFERENCE_3     = opREFERENCE_3;
                obj.REFERENCE_4     = opREFERENCE_4;
                obj.CUSTOMER_NAME   = opCUSTOMER_NAME;
                obj.CUSTOMER_ADDR_1 = opCUSTOMER_ADDR_1;
                obj.CUSTOMER_ADDR_2 = opCUSTOMER_ADDR_2;
                obj.CUSTOMER_ADDR_3 = opCUSTOMER_ADDR_3;
                obj.CUSTOMER_TEL_NO = opCUSTOMER_TEL_NO;
                obj.RETURN1         = opRETURN1;
                obj.RETURN2         = opRETURN2;
                obj.RETURN3         = opRETURN3;
                obj.AMOUNT_RECEIVED = opAMOUNT_RECEIVED;
                obj.PRINT_SLIP      = opPRINT_SLIP;

                //LogResponse: Insert Log Response - บันทึก Log Response ว่าการเรียก Request เพื่อตรวจสอบข้อมูลในระบบไม่สำเร็จ
                logobj.AddWSLogResponse(USERID, ipaddress, "Response", "service", METHOD, refnum, obj.TX_ID, obj.LOG_ID, obj.VENDOR_ID, obj.SERVICE_ID, obj.METHOD, obj.SUCCESS, obj.CODE, obj.DESC, obj.REFERENCE_1, obj.REFERENCE_2, obj.REFERENCE_3, obj.REFERENCE_4, obj.CUSTOMER_NAME, obj.CUSTOMER_ADDR_1, obj.CUSTOMER_ADDR_2, obj.CUSTOMER_ADDR_3, obj.CUSTOMER_TEL_NO, obj.RETURN1, obj.RETURN2, obj.RETURN3, obj.AMOUNT_RECEIVED, obj.PRINT_SLIP);

                return(obj);
            }
        }
    }
Example #8
0
 public override void UpdateToSynchronized(Event e, RESPONSE response)
 {
     database.ExecuteNonQuery (string.Format("UPDATE EVENT SET  SYNCHRONIZED = '{1}', RESPONSE = '{2}' WHERE EventID ='{0}'", e.Id, bool.TrueString, response.ToString()));
 }
Example #9
0
 public abstract void UpdateToSynchronized(Event e, RESPONSE response);
Example #10
0
 public void BUS_SetResponse(RESPONSE response)
 {
     DAL_AdminData.Instance.DAL_SetResponse(response);
 }
        public QualityIssue UpdateIssue(QualityIssue theIssue)
        {
            bool     success;
            decimal  decVal;
            RESPONSE response = null;

            theIssue.Status = QualityIssue.UpdateStatus.Pending;


            if (IssueCtl().PageMode == PageUseMode.Active)
            {
                // re-activate issue
                IssueCtl().qualityIssue.IssueOccur.STATUS = ddlStatus.SelectedValue;
                IssueCtl().qualityIssue.SetTasksOpen("C", DateTime.UtcNow.AddDays(14));
                IssueCtl().qualityIssue.StatusChanged = true;
                theIssue.Status = QualityIssue.UpdateStatus.Success;

                return(theIssue = IssueCtl().qualityIssue);
            }

            // trading partners or personse responsible can only add to the response list
            if (IssueCtl().PageMode == PageUseMode.EditPartial)
            {
                if (!string.IsNullOrEmpty(uclResponse.ResponseInput.Trim()))
                {
                    IssueCtl().qualityIssue.TeamResponse.CreateResponse(20, IssueCtl().qualityIssue.IssueOccur.QIO_ID, "", SessionManager.UserContext.Person.PERSON_ID, uclResponse.ResponseInput, SessionManager.UserContext.HRLocation.Company.COMPANY_NAME);
                    IssueCtl().qualityIssue.SetTasksStatus("R", TaskStatus.AwaitingClosure, SessionManager.UserContext.Person.PERSON_ID);
                    theIssue.Status = QualityIssue.UpdateStatus.Success;
                    return(theIssue = IssueCtl().qualityIssue);
                }
            }

            if (radIssueDate.SelectedDate.HasValue == false ||
                string.IsNullOrEmpty(ddlIncidentSeverity2.SelectedValue) ||
                IssueCtl().qualityIssue.IssueOccur.PART_ID == null ||
                IssueCtl().qualityIssue.IssueOccur.PART_ID < 1 ||
                (theIssue.IssueOccur.QS_ACTIVITY == "CST" && string.IsNullOrEmpty(ddlPartType.SelectedValue) ||
                 string.IsNullOrEmpty(tbNCTotalQty.Text) ||
                 string.IsNullOrEmpty(tbNCSampleQty.Text) ||
                 string.IsNullOrEmpty(tbNCNonConformQty.Text) ||
                 string.IsNullOrEmpty(ddlResponsibleLocation.SelectedValue)))
            {
                theIssue.Status = QualityIssue.UpdateStatus.RequiredInputs;
                return(theIssue);
            }

            if ((!string.IsNullOrEmpty(tbActCost.Text) || !string.IsNullOrEmpty(tbPotCost.Text)) && string.IsNullOrEmpty(ddlCurrency.SelectedValue))
            {
                theIssue.Status = QualityIssue.UpdateStatus.Incomplete;
                return(theIssue);
            }

            // update the INCIDENT record
            IssueCtl().qualityIssue.IssueOccur.QS_ACTIVITY = ddlIncidentType.SelectedValue;
            IssueCtl().qualityIssue.Incident.INCIDENT_DT   = (DateTime)radIssueDate.SelectedDate;
            IssueCtl().qualityIssue.Incident.DESCRIPTION   = tbIssueDesc.Text.Trim();

            IssueCtl().qualityIssue.SetDetectedLocation(Convert.ToDecimal(ddlReportedLocation.SelectedValue));
            IssueCtl().qualityIssue.SetResponsibleLocation(Convert.ToDecimal(ddlResponsibleLocation.SelectedValue));

            IssueCtl().qualityIssue.IssueOccur.RELATED_PARTS = tbRelatedParts.Text;

            if (!string.IsNullOrEmpty(ddlPartType.SelectedValue))
            {
                IssueCtl().qualityIssue.IssueOccur.PART_TYPE = ddlPartType.SelectedValue;
            }
            else
            {
                IssueCtl().qualityIssue.IssueOccur.PART_TYPE = null;
            }

            IssueCtl().qualityIssue.IssueOccur.SEVERITY = ddlIncidentSeverity2.SelectedValue;
            IssueCtl().qualityIssue.IssueOccur.QI_OCCUR_ITEM.First().LOT_NUM = tbNCLotNum.Text;

            if (decimal.TryParse(tbNCTotalQty.Text.Trim(), out decVal))
            {
                IssueCtl().qualityIssue.IssueOccur.QI_OCCUR_ITEM.First().TOTAL_QTY = decVal;
            }
            if (decimal.TryParse(tbNCSampleQty.Text.Trim(), out decVal))
            {
                IssueCtl().qualityIssue.IssueOccur.QI_OCCUR_ITEM.First().INSPECT_QTY = decVal;
            }
            if (decimal.TryParse(tbNCNonConformQty.Text.Trim(), out decVal))
            {
                IssueCtl().qualityIssue.IssueOccur.QI_OCCUR_ITEM.First().INSPECT_NC_QTY = decVal;
            }

            IssueCtl().qualityIssue.IssueOccur.QI_OCCUR_ITEM.First().TOTAL_NC_QTY = (IssueCtl().qualityIssue.IssueOccur.QI_OCCUR_ITEM.First().INSPECT_NC_QTY / IssueCtl().qualityIssue.IssueOccur.QI_OCCUR_ITEM.First().INSPECT_QTY) * IssueCtl().qualityIssue.IssueOccur.QI_OCCUR_ITEM.First().TOTAL_QTY;

            IssueCtl().qualityIssue.IssueOccur.QI_OCCUR_ITEM.First().QI_OCCUR_NC.First().PROBLEM_AREA  = "";
            IssueCtl().qualityIssue.IssueOccur.QI_OCCUR_ITEM.First().QI_OCCUR_NC.First().NONCONF_ID    = null;
            IssueCtl().qualityIssue.IssueOccur.QI_OCCUR_ITEM.First().QI_OCCUR_NC.First().PROBLEM_COUNT = 0;
            if (!string.IsNullOrEmpty(uclNC.ProblemArea))
            {
                IssueCtl().qualityIssue.IssueOccur.OCCUR_DESC = uclNC.ProblemAreaDesc;
                IssueCtl().qualityIssue.IssueOccur.QI_OCCUR_ITEM.First().QI_OCCUR_NC.First().PROBLEM_AREA = IssueCtl().qualityIssue.IssueOccur.PROBLEM_AREA = uclNC.ProblemArea;
                if (!string.IsNullOrEmpty(uclNC.NCDefect))
                {
                    IssueCtl().qualityIssue.IssueOccur.QI_OCCUR_ITEM.First().QI_OCCUR_NC.First().NONCONF_ID = Convert.ToDecimal(uclNC.NCDefect);
                    int NCCount = 0;
                    if (int.TryParse(uclNC.NCCount, out NCCount) == true)
                    {
                        IssueCtl().qualityIssue.IssueOccur.QI_OCCUR_ITEM.First().QI_OCCUR_NC.First().PROBLEM_COUNT = NCCount;
                    }
                    else
                    {
                        IssueCtl().qualityIssue.IssueOccur.QI_OCCUR_ITEM.First().QI_OCCUR_NC.First().PROBLEM_COUNT = 1;
                    }
                }
            }

            foreach (GridViewRow row in gvMeasureGrid.Rows)
            {
                try
                {
                    QI_OCCUR_NC      sample  = IssueCtl().qualityIssue.IssueOccur.QI_OCCUR_ITEM.First().QI_OCCUR_NC.FirstOrDefault();
                    QI_OCCUR_MEASURE measure = sample.QI_OCCUR_MEASURE.FirstOrDefault();
                    if (sample != null && measure != null)
                    {
                        measure.QIO_SAMPLE_ID = sample.QIO_SAMPLE_ID;
                        measure.MEASURE_NUM   = 1;
                        measure.MEASURE_NAME  = ((TextBox)row.Cells[0].FindControl("tbMeasureName")).Text;
                        TextBox tb = (TextBox)row.Cells[0].FindControl("tbMeasureValue");
                        if (!string.IsNullOrEmpty(tb.Text))
                        {
                            measure.MEASURE_IND   = true;
                            measure.MEASURE_VALUE = Convert.ToDecimal(tb.Text);
                        }
                    }
                }
                catch { }
            }

            IssueCtl().qualityIssue.IssueOccur.QI_OCCUR_ITEM.First().QI_OCCUR_NC.First().SAMPLE_COMMENTS = tbObservations.Text.Trim();

            IssueCtl().qualityIssue.IssueOccur.DISPOSITION   = ddlDisposition.SelectedValue;
            IssueCtl().qualityIssue.IssueOccur.PROBCASE_REQD = cb8DRequired.Checked;
            IssueCtl().qualityIssue.IssueOccur.REF_OPERATION = tb8DRef.Text;

            if (IssueCtl().qualityIssue.IssueOccur.QS_ACTIVITY == "CST")
            {
                IssueCtl().qualityIssue.IssueOccur.REF_OPERATION = tb8DRef.Text;
            }
            else if (IssueCtl().qualityIssue.IssueOccur.QS_ACTIVITY == "RCV")
            {
                IssueCtl().qualityIssue.IssueOccur.REF_OPERATION = tbReceipt.Text;
            }
            else
            {
                IssueCtl().qualityIssue.IssueOccur.REF_OPERATION = "";
            }

            decimal value = 0;

            if (!string.IsNullOrEmpty(tbActCost.Text) && decimal.TryParse(tbActCost.Text, out value))
            {
                IssueCtl().qualityIssue.IssueOccur.EST_ACT_COST     = value;
                IssueCtl().qualityIssue.IssueOccur.ACT_COST_COMMENT = tbActCostNote.Text;
            }
            else
            {
                IssueCtl().qualityIssue.IssueOccur.EST_ACT_COST     = null;
                IssueCtl().qualityIssue.IssueOccur.ACT_COST_COMMENT = "";
            }

            IssueCtl().qualityIssue.IssueOccur.CURRENCY_CODE = ddlCurrency.SelectedValue;

            if (!string.IsNullOrEmpty(tbPotCost.Text) && decimal.TryParse(tbPotCost.Text, out value))
            {
                IssueCtl().qualityIssue.IssueOccur.EST_POT_COST     = value;
                IssueCtl().qualityIssue.IssueOccur.POT_COST_COMMENT = tbPotCostNote.Text;
            }
            else
            {
                IssueCtl().qualityIssue.IssueOccur.EST_POT_COST     = null;
                IssueCtl().qualityIssue.IssueOccur.POT_COST_COMMENT = "";
            }

            IssueCtl().qualityIssue.IssueOccur.RELATED_INCIDENTS = tbDupIssue.Text;

            /*
             * string[] args = uclQISearch1.Text.Split(' ');
             * if (args.Length > 0 && !string.IsNullOrEmpty(args[0]) && args[0] != WebSiteCommon.FormatID(IssueCtl().qualityIssue.Incident.INCIDENT_ID, 6))
             *  IssueCtl().qualityIssue.IssueOccur.RELATED_INCIDENTS = args[0];
             */
            // create person response tasks if not currently existing
            IssueCtl().qualityIssue.IssueOccur.INIT_ACTION = null;
            if (ddlResponsible.CheckedItems.Count > 0 && !string.IsNullOrEmpty(ddlResponseTime.SelectedValue))
            {
                IssueCtl().qualityIssue.IssueOccur.INIT_ACTION = ddlResponseTime.SelectedValue;
            }

            IssueCtl().qualityIssue.UpdateTasks(new decimal[1] {
                (decimal)IssueCtl().qualityIssue.Incident.CREATE_PERSON
            }, "C", 14, false);

            IssueCtl().qualityIssue.ResponseRequired = cbResponseAlert.Checked;

            IssueCtl().qualityIssue.UpdateTasks(Array.ConvertAll(ddlResponsible.Items.Where(l => l.Checked).Select(l => l.Value).ToArray(), new Converter <string, decimal>(decimal.Parse)),
                                                "R", Convert.ToInt32(IssueCtl().qualityIssue.IssueOccur.INIT_ACTION), IssueCtl().qualityIssue.ResponseRequired);

            if (!string.IsNullOrEmpty(uclResponse.ResponseInput.Trim()))
            {
                IssueCtl().qualityIssue.TeamResponse.CreateResponse(20, IssueCtl().qualityIssue.IssueOccur.QIO_ID, "", SessionManager.UserContext.Person.PERSON_ID, uclResponse.ResponseInput, SessionManager.UserContext.HRLocation.Company.COMPANY_NAME);
            }

            // complete all tasks when the issue is closed
            if (IssueCtl().qualityIssue.IssueOccur.STATUS != ddlStatus.SelectedValue && ddlStatus.SelectedValue == "C")
            {
                IssueCtl().qualityIssue.SetTasksStatus("C", TaskStatus.Complete, SessionManager.UserContext.Person.PERSON_ID);
                IssueCtl().qualityIssue.SetTasksStatus("R", TaskStatus.Complete, SessionManager.UserContext.Person.PERSON_ID);
                IssueCtl().qualityIssue.StatusChanged = true;
            }

            IssueCtl().qualityIssue.IssueOccur.STATUS = ddlStatus.SelectedValue;

            if (cbNotify.Checked)  // td: to test mail functions
            {
                IssueCtl().qualityIssue.ResetIndicators(true);
                IssueCtl().qualityIssue.StatusChanged = false;
            }

            //btnPrintLabel.OnClientClick = "Popup('../Quality/QualityIssue_Label.aspx?issue=" + qualityIssue.IssueOccur.QIO_ID.ToString() + "', 'newPage', 600, 450); return false;";

            IssueCtl().qualityIssue.Status = QualityIssue.UpdateStatus.Success;
            return(theIssue = IssueCtl().qualityIssue);
        }
Example #12
0
 private static LogMessage Create(string message, object[] args)
 {
     return(RESPONSE.Create(LogMessageLevel.ERROR, message, args));
 }
    public RESPONSE REQUEST(string TX_ID, string LOG_ID, string VENDOR_ID, string SERVICE_ID, string METHOD, string COUNTER_NO, string TERM_NO, string POS_TAX_ID, string SERVICE_RUN_NO, string RECORD_STATUS, string CLIENT_SERVICE_RUN, string AMOUNT_RECEIVED, string VAT_AMOUNT, string BILL_TYPE, string REFERENCE_1, string REFERENCE_2, string REFERENCE_3, string REFERENCE_4, string CUSTOMER_NAME, string CUSTOMER_ADDR_1, string CUSTOMER_ADDR_2, string CUSTOMER_ADDR_3, string CUSTOMER_TEL_NO, string ZONE, string R_SERVICE_RUNNO, string CANCEL_OPERATING, string OPERATING_BY_STAFF, string SYSTEM_DATE_TIME, string USERID, string PASSWORD)
    {
        //Instantiate object from class

        //สร้าง object ของคลาส RESPONSE สำหรับใช้เป็น output ของ Web Services
        RESPONSE obj = new RESPONSE();
        //สร้าง object ของคลาส Running Reference สำหรับใช้เป็นหมายเลขอ้างอิงการ Request และ Response จาก CS-711
        RefRunningTBForCounterServiceBLL runningobj = new RefRunningTBForCounterServiceBLL();
        refnum = runningobj.AddRefRunningTBAndReturnForCounterService();
        //สร้าง object ของคลาส Logging สำหรับใช้บันทึก Log การ Request และ Response จาก CS-711
        WSLogForCounterServiceBLL logobj = new WSLogForCounterServiceBLL();

        //กำหนดค่าให้ตัวแปร output
        opTX_ID = TX_ID;
        opLOG_ID = LOG_ID;
        opVENDOR_ID = VENDOR_ID;
        opSERVICE_ID = SERVICE_ID;
        opMETHOD = METHOD;

        //LogRequest: Insert Log Request - บันทึก Log การ Request ที่ส่งมาจาก CS-711
        logobj.AddWSLogRequest(USERID, ipaddress, "Request", "service", METHOD, refnum, TX_ID, LOG_ID, VENDOR_ID, SERVICE_ID, METHOD, COUNTER_NO, TERM_NO, POS_TAX_ID, SERVICE_RUN_NO, RECORD_STATUS, CLIENT_SERVICE_RUN, AMOUNT_RECEIVED, VAT_AMOUNT, BILL_TYPE, REFERENCE_1, REFERENCE_2, REFERENCE_3, REFERENCE_4, CUSTOMER_NAME, CUSTOMER_ADDR_1, CUSTOMER_ADDR_2, CUSTOMER_ADDR_3, CUSTOMER_TEL_NO, ZONE, R_SERVICE_RUNNO, CANCEL_OPERATING, OPERATING_BY_STAFF, SYSTEM_DATE_TIME, USERID, PASSWORD);

        //ตรวจสอบว่า CS-711 ส่ง Input Parameters ที่จำเป็นมาให้ครบหรือไม่?
        //ถ้า CS-711 ส่ง Input Parameters ที่จำเป็นมาให้ไม่ครบ บันทึก Log Response และ return output
        if (TX_ID == "" && LOG_ID == "" && VENDOR_ID == "" && SERVICE_ID == "" && METHOD == "" && COUNTER_NO == "" && TERM_NO == "" && POS_TAX_ID == "" && SERVICE_RUN_NO == "" && RECORD_STATUS == "" && CLIENT_SERVICE_RUN == "" && AMOUNT_RECEIVED == "" && VAT_AMOUNT == "" && BILL_TYPE == "" && ZONE == "" && R_SERVICE_RUNNO == "" && OPERATING_BY_STAFF == "")
        {
            opSUCCESS = "False";
            opCODE = "9MTLXXXX";
            opDESC = "กรอกข้อมูล Input ที่จำเป็นมาให้ไม่ครบ";

            //กำหนดค่าให้ฟิลด์ต่างๆ ของ object สำหรับ RESPONSE class
            obj.TX_ID = opTX_ID;
            obj.LOG_ID = opLOG_ID;
            obj.VENDOR_ID = opVENDOR_ID;
            obj.SERVICE_ID = opSERVICE_ID;
            obj.METHOD = opMETHOD;
            obj.SUCCESS = opSUCCESS;
            obj.CODE = opCODE;
            obj.DESC = opDESC;
            obj.REFERENCE_1 = opREFERENCE_1;
            obj.REFERENCE_2 = opREFERENCE_2;
            obj.REFERENCE_3 = opREFERENCE_3;
            obj.REFERENCE_4 = opREFERENCE_4;
            obj.CUSTOMER_NAME = opCUSTOMER_NAME;
            obj.CUSTOMER_ADDR_1 = opCUSTOMER_ADDR_1;
            obj.CUSTOMER_ADDR_2 = opCUSTOMER_ADDR_2;
            obj.CUSTOMER_ADDR_3 = opCUSTOMER_ADDR_3;
            obj.CUSTOMER_TEL_NO = opCUSTOMER_TEL_NO;
            obj.RETURN1 = opRETURN1;
            obj.RETURN2 = opRETURN2;
            obj.RETURN3 = opRETURN3;
            obj.AMOUNT_RECEIVED = opAMOUNT_RECEIVED;
            obj.PRINT_SLIP = opPRINT_SLIP;

            //LogResponse: Insert Log Response - บันทึก Log Response ว่า CS-711 ส่ง Input Parameters ที่จำเป็นมาให้ไม่ครบ
            logobj.AddWSLogResponse(USERID, ipaddress, "Response", "service", METHOD, refnum, obj.TX_ID, obj.LOG_ID, obj.VENDOR_ID, obj.SERVICE_ID, obj.METHOD, obj.SUCCESS, obj.CODE, obj.DESC, obj.REFERENCE_1, obj.REFERENCE_2, obj.REFERENCE_3, obj.REFERENCE_4, obj.CUSTOMER_NAME, obj.CUSTOMER_ADDR_1, obj.CUSTOMER_ADDR_2, obj.CUSTOMER_ADDR_3, obj.CUSTOMER_TEL_NO, obj.RETURN1, obj.RETURN2, obj.RETURN3, obj.AMOUNT_RECEIVED, obj.PRINT_SLIP);

            return obj;
        }
        // ถ้า CS-711 ส่ง Input Parameters ที่จำเป็นมาให้ครบ ให้ดำเนินการตรวจสอบข้อมูลในระบบ
        else
        {
            //ตรวจสอบว่า CS-711 ส่ง Request Method อะไร มาให้ MTL และตรวจสอบข้อมูลในระบบ ผ่าน Web Services ภายใน
            try
            {
                //ตรวจสอบว่า CS-711 ต้องการเรียกใช้ Method อะไร?
                switch (opMETHOD)
                {
                    case "DataExchange":
                        //ตรวจสอบข้อมูลในระบบ ผ่าน Web Services ภายใน
                        try
                        {

                            if (true)
                            {
                                opSUCCESS = "True";
                                opCODE = "100";
                                opDESC = "SUCCESS";
                                opAMOUNT_RECEIVED = "";
                            }
                            else
                            {
                                opSUCCESS = "False";
                                opCODE = "9MTLXXX";
                                opDESC = "erererererererer";
                            }
                        }
                        catch (Exception ex)
                        {
                            opSUCCESS = "False";
                            opCODE = "9MTLXXX";
                            opDESC = ex.ToString();
                        }
                        break;
                    case "DataExchangeConfirm":
                        //ตรวจสอบข้อมูลในระบบ ผ่าน Web Services ภายใน
                        try
                        {

                            if (true)
                            {
                                opSUCCESS = "True";
                                opCODE = "100";
                                opDESC = "SUCCESS";
                                opAMOUNT_RECEIVED = "";
                            }
                            else
                            {
                                opSUCCESS = "False";
                                opCODE = "9MTLXXX";
                                opDESC = "erererererererer";
                            }
                        }
                        catch (Exception ex)
                        {
                            opSUCCESS = "False";
                            opCODE = "9MTLXXX";
                            opDESC = ex.ToString();
                        }
                        break;
                    case "DataExchangeCancel":
                        //ตรวจสอบข้อมูลในระบบ ผ่าน Web Services ภายใน
                        try
                        {

                            if (true)
                            {
                                opSUCCESS = "True";
                                opCODE = "100";
                                opDESC = "SUCCESS";
                                opAMOUNT_RECEIVED = "";
                            }
                            else
                            {
                                opSUCCESS = "False";
                                opCODE = "9MTLXXX";
                                opDESC = "erererererererer";
                            }
                        }
                        catch (Exception ex)
                        {
                            opSUCCESS = "False";
                            opCODE = "9MTLXXX";
                            opDESC = ex.ToString();
                        }
                        break;
                    case "OR":
                        //ตรวจสอบข้อมูลในระบบ ผ่าน Web Services ภายใน
                        try
                        {

                            if (true)
                            {
                                opSUCCESS = "True";
                                opCODE = "100";
                                opDESC = "SUCCESS";
                                opAMOUNT_RECEIVED = "";
                            }
                            else
                            {
                                opSUCCESS = "False";
                                opCODE = "9MTLXXX";
                                opDESC = "erererererererer";
                            }
                        }
                        catch (Exception ex)
                        {
                            opSUCCESS = "False";
                            opCODE = "9MTLXXX";
                            opDESC = ex.ToString();
                        }
                        break;
                    case "ORConfirm":
                        //ตรวจสอบข้อมูลในระบบ ผ่าน Web Services ภายใน
                        try
                        {

                            if (true)
                            {
                                opSUCCESS = "True";
                                opCODE = "100";
                                opDESC = "SUCCESS";
                                opAMOUNT_RECEIVED = "";
                            }
                            else
                            {
                                opSUCCESS = "False";
                                opCODE = "9MTLXXX";
                                opDESC = "erererererererer";
                            }
                        }
                        catch (Exception ex)
                        {
                            opSUCCESS = "False";
                            opCODE = "9MTLXXX";
                            opDESC = ex.ToString();
                        }
                        break;
                    case "ORCancel":
                        //ตรวจสอบข้อมูลในระบบ ผ่าน Web Services ภายใน
                        try
                        {

                            if (true)
                            {
                                opSUCCESS = "True";
                                opCODE = "100";
                                opDESC = "SUCCESS";
                                opAMOUNT_RECEIVED = "";
                            }
                            else
                            {
                                opSUCCESS = "False";
                                opCODE = "9MTLXXX";
                                opDESC = "erererererererer";
                            }
                        }
                        catch (Exception ex)
                        {
                            opSUCCESS = "False";
                            opCODE = "9MTLXXX";
                            opDESC = ex.ToString();
                        }
                        break;
                    default:
                        opSUCCESS = "False";
                        opCODE = "9MTLXXX";
                        opDESC = "ไม่ได้ส่ง Method ตามที่ตกลงมาให้";
                        break;
                }

                //กำหนดค่าให้ฟิลด์ต่างๆ ของ object สำหรับ RESPONSE class
                obj.TX_ID = opTX_ID;
                obj.LOG_ID = opLOG_ID;
                obj.VENDOR_ID = opVENDOR_ID;
                obj.SERVICE_ID = opSERVICE_ID;
                obj.METHOD = opMETHOD;
                obj.SUCCESS = opSUCCESS;
                obj.CODE = opCODE;
                obj.DESC = opDESC;
                obj.REFERENCE_1 = opREFERENCE_1;
                obj.REFERENCE_2 = opREFERENCE_2;
                obj.REFERENCE_3 = opREFERENCE_3;
                obj.REFERENCE_4 = opREFERENCE_4;
                obj.CUSTOMER_NAME = opCUSTOMER_NAME;
                obj.CUSTOMER_ADDR_1 = opCUSTOMER_ADDR_1;
                obj.CUSTOMER_ADDR_2 = opCUSTOMER_ADDR_2;
                obj.CUSTOMER_ADDR_3 = opCUSTOMER_ADDR_3;
                obj.CUSTOMER_TEL_NO = opCUSTOMER_TEL_NO;
                obj.RETURN1 = opRETURN1;
                obj.RETURN2 = opRETURN2;
                obj.RETURN3 = opRETURN3;
                obj.AMOUNT_RECEIVED = opAMOUNT_RECEIVED;
                obj.PRINT_SLIP = opPRINT_SLIP;

                //LogResponse: Insert Log Response - บันทึก Log Response ผลที่ได้จากการตรวจสอบข้อมูลในระบบ
                logobj.AddWSLogResponse(USERID, ipaddress, "Response", "service", METHOD, refnum, obj.TX_ID, obj.LOG_ID, obj.VENDOR_ID, obj.SERVICE_ID, obj.METHOD, obj.SUCCESS, obj.CODE, obj.DESC, obj.REFERENCE_1, obj.REFERENCE_2, obj.REFERENCE_3, obj.REFERENCE_4, obj.CUSTOMER_NAME, obj.CUSTOMER_ADDR_1, obj.CUSTOMER_ADDR_2, obj.CUSTOMER_ADDR_3, obj.CUSTOMER_TEL_NO, obj.RETURN1, obj.RETURN2, obj.RETURN3, obj.AMOUNT_RECEIVED, obj.PRINT_SLIP);

                return obj;
            }
            catch (Exception ex)
            {
                opSUCCESS = "False";
                opCODE = "9MTLXXX";
                opDESC = ex.ToString();

                //กำหนดค่าให้ฟิลด์ต่างๆ ของ object สำหรับ RESPONSE class
                obj.TX_ID = opTX_ID;
                obj.LOG_ID = opLOG_ID;
                obj.VENDOR_ID = opVENDOR_ID;
                obj.SERVICE_ID = opSERVICE_ID;
                obj.METHOD = opMETHOD;
                obj.SUCCESS = opSUCCESS;
                obj.CODE = opCODE;
                obj.DESC = opDESC;
                obj.REFERENCE_1 = opREFERENCE_1;
                obj.REFERENCE_2 = opREFERENCE_2;
                obj.REFERENCE_3 = opREFERENCE_3;
                obj.REFERENCE_4 = opREFERENCE_4;
                obj.CUSTOMER_NAME = opCUSTOMER_NAME;
                obj.CUSTOMER_ADDR_1 = opCUSTOMER_ADDR_1;
                obj.CUSTOMER_ADDR_2 = opCUSTOMER_ADDR_2;
                obj.CUSTOMER_ADDR_3 = opCUSTOMER_ADDR_3;
                obj.CUSTOMER_TEL_NO = opCUSTOMER_TEL_NO;
                obj.RETURN1 = opRETURN1;
                obj.RETURN2 = opRETURN2;
                obj.RETURN3 = opRETURN3;
                obj.AMOUNT_RECEIVED = opAMOUNT_RECEIVED;
                obj.PRINT_SLIP = opPRINT_SLIP;

                //LogResponse: Insert Log Response - บันทึก Log Response ว่าการเรียก Request เพื่อตรวจสอบข้อมูลในระบบไม่สำเร็จ
                logobj.AddWSLogResponse(USERID, ipaddress, "Response", "service", METHOD, refnum, obj.TX_ID, obj.LOG_ID, obj.VENDOR_ID, obj.SERVICE_ID, obj.METHOD, obj.SUCCESS, obj.CODE, obj.DESC, obj.REFERENCE_1, obj.REFERENCE_2, obj.REFERENCE_3, obj.REFERENCE_4, obj.CUSTOMER_NAME, obj.CUSTOMER_ADDR_1, obj.CUSTOMER_ADDR_2, obj.CUSTOMER_ADDR_3, obj.CUSTOMER_TEL_NO, obj.RETURN1, obj.RETURN2, obj.RETURN3, obj.AMOUNT_RECEIVED, obj.PRINT_SLIP);

                return obj;
            }
        }
    }