Ejemplo n.º 1
0
        public void SetCoinValue(int Denom, int val, int State, int Maxm, int StackVal, FCCSrv2.DenominationType Den)
        {
            this.Dispatcher.Invoke((Action)(() =>
            {
                if (StackVal == 4084)
                {
                    CoinBarabans[StackVal].DenomType = Den;
                    //CoinBarabans[StackVal].DenomValue = Denom;

                    CoinBarabans[StackVal].MoneyCount = Denom;
                    CoinBarabans[StackVal].MoneyValue = val;
                    CoinBarabans[StackVal].MaxMoneyCount = Maxm;
                    // CoinBarabans[StackVal].MoneyState = State;
                }
                else
                {
                    CoinBarabans[StackVal].DenomType = Den;
                    CoinBarabans[StackVal].DenomValue = Denom;
                    CoinBarabans[StackVal].MoneyValue = val * Denom;
                    CoinBarabans[StackVal].MaxMoneyCount = Maxm;
                    CoinBarabans[StackVal].MoneyState = State;
                }



                /*
                 * switch (Denom)
                 * {
                 * case 0:
                 *  BarCoinIzl.MoneyValue = val;
                 *  BarCoinIzl.MoneyState = State;
                 *  break;
                 * case 50:
                 *  BarCoin05.MoneyValue = val * 50;
                 *  BarCoin05.MoneyState = State;
                 *  break;
                 * case 100:
                 *  BarCoin1.MoneyValue = val * 100;
                 *  BarCoin1.MoneyState = State;
                 *  break;
                 * case 200:
                 *  BarCoin2.MoneyValue = val * 200;
                 *  BarCoin2.MoneyState = State;
                 *  break;
                 *
                 * case 500:
                 *  BarCoin5.MoneyValue = val * 500;
                 *  BarCoin5.MoneyState = State;
                 *  break;
                 * case 1000:
                 *  BarCoin10.MoneyValue = val * 1000;
                 *  BarCoin10.MoneyState = State;
                 *  break;
                 * default:
                 *  break;
                 * }
                 * */
            }));
        }
Ejemplo n.º 2
0
        private void UpdateInventory(FCCSrv2.CashUnitsType[] Cash, int ResultId, string ResSt)
        {
            // if (ResultId != FCCApi.FCC_SUCCESS)
            //{

            if (Cash != null)
            {
                int BillSumm            = 0;
                int BillCassetSumm      = 0;
                int BillCassetCountSumm = 0;
                int CoinSumm            = 0;

                int CoinCassetSumm      = 0;
                int CoinCassetCountSumm = 0;
                //Банкноты
                FCCSrv2.CashUnitsType MyCash = Cash.Where(a => a.devid == "1").FirstOrDefault();
                if (MyCash != null)
                {
                    foreach (FCCSrv2.CashUnitType Dt in MyCash.CashUnit.Where(a => a.unitno == "4043" || a.unitno == "4044" || a.unitno == "4045"))
                    {
                        FCCSrv2.DenominationType Den = Dt.Denomination[0];
                        Barabans.SetBillValue(int.Parse(Den.fv), int.Parse(Den.Piece), int.Parse(Den.Status), int.Parse(Dt.max), int.Parse(Dt.unitno), Den);
                        BillSumm += int.Parse(Den.fv) * int.Parse(Den.Piece);
                    }
                    FCCSrv2.CashUnitType DtCas = MyCash.CashUnit.Where(a => a.unitno == "4059").FirstOrDefault();

                    foreach (FCCSrv2.DenominationType Den in DtCas.Denomination)
                    {
                        BillCassetSumm      += int.Parse(Den.fv) * int.Parse(Den.Piece);
                        BillCassetCountSumm += int.Parse(Den.Piece);
                    }
                    Barabans.SetBillValue(BillCassetCountSumm, BillCassetSumm, 0, int.Parse(DtCas.max), int.Parse(DtCas.unitno), null);
                    BillSumm += BillCassetSumm;
                }

                CurrentCassetaSumm        = BillCassetSumm;
                FCCApi.CurrentCassetaSumm = BillCassetSumm;
                //Монеты
                MyCash = Cash.Where(a => a.devid == "2").FirstOrDefault();
                if (MyCash != null)
                {
                    foreach (FCCSrv2.CashUnitType Dt in MyCash.CashUnit.Where(a => int.Parse(a.unitno) > 4042 && int.Parse(a.unitno) < 4056))
                    {
                        FCCSrv2.DenominationType Den = Dt.Denomination[0];
                        Barabans.SetCoinValue(int.Parse(Den.fv), int.Parse(Den.Piece), int.Parse(Den.Status), int.Parse(Dt.max), int.Parse(Dt.unitno), Den);
                        CoinSumm += int.Parse(Den.fv) * int.Parse(Den.Piece);
                    }
                    FCCSrv2.CashUnitType DtCas = MyCash.CashUnit.Where(a => a.unitno == "4084").FirstOrDefault();

                    foreach (FCCSrv2.DenominationType Den in DtCas.Denomination)
                    {
                        CoinCassetSumm      += int.Parse(Den.fv) * int.Parse(Den.Piece);
                        CoinCassetCountSumm += int.Parse(Den.Piece);
                    }
                    Barabans.SetCoinValue(CoinCassetCountSumm, CoinCassetSumm, 0, int.Parse(DtCas.max), int.Parse(DtCas.unitno), null);
                    CoinSumm += CoinCassetSumm;
                }
                CurrentCoinCassetaSumm        = CoinCassetSumm;
                FCCApi.CurrentCoinCassetaSumm = CoinCassetSumm;
                SetSumm(BillSumm + CoinSumm);
            }
            else
            {
                GhangeConnectionState(ConnectonState_UpdateInventoryError, String.Format("Ошибка запроса состояния. Код ошибки  {0}. Сообщение {1} ", ResultId, ResSt), Colors.Red);
            }

            AllDoButtonsEnable();
            HideProcessMessage();


            /*
             * if (CurrentConnectonState == ConnectonState_CassetIneserted)
             * {
             *  if (CurrentCassetaSumm > 0)
             *  {
             *      MainClass2.NonEmptyCasset = true;
             *  }
             * }
             */
        }
Ejemplo n.º 3
0
        public void SetBillValue(int Denom, int val, int State, int Maxm, int StackVal, FCCSrv2.DenominationType Den)
        {
            this.Dispatcher.Invoke((Action)(() =>
            {
                if (StackVal == 4059)
                {
                    BillBarabans[StackVal].DenomType = Den;
                    //CoinBarabans[StackVal].DenomValue = Denom;

                    BillBarabans[StackVal].MoneyCount = Denom;
                    BillBarabans[StackVal].MoneyValue = val;
                    BillBarabans[StackVal].MaxMoneyCount = Maxm;
                    // CoinBarabans[StackVal].MoneyState = State;
                }
                else
                {
                    BillBarabans[StackVal].DenomType = Den;
                    BillBarabans[StackVal].DenomValue = Denom;
                    BillBarabans[StackVal].MoneyValue = val * Denom;
                    BillBarabans[StackVal].MaxMoneyCount = Maxm;
                    BillBarabans[StackVal].MoneyState = State;
                }



                /*
                 * switch (Denom)
                 * {
                 * case 0:
                 *  BarBillKass.MoneyCount = State;
                 *  BarBillKass.MoneyValue = Count;
                 *  //BarBillKass.MoneyState = State;
                 *  //BarBillKass.MoneyState = State;
                 *  break;
                 * case 5000:
                 *  BarBill50.DenomType = Den;
                 *  BarBill50.MoneyValue = 0;
                 *  BarBill50.MoneyValue = Count * 5000;
                 *  BarBill50.MoneyState = State;
                 *  break;
                 * case 10000:
                 *  BarBill100.DenomType = Den;
                 *  BarBill100.MoneyValue = Count * 10000;
                 *  BarBill100.MoneyState = State;
                 *  break;
                 * case 50000:
                 *  BarBill500.DenomType = Den;
                 *  BarBill500.MoneyValue = Count * 50000;
                 *  BarBill500.MoneyState = State;
                 *  break;
                 * default:
                 *  break;
                 *
                 *
                 *
                 *
                 *
                 *
                 *
                 * }
                 *  * */
            }));
        }
        private void CheckRecvComand(string returndata, long nEventRecvCount)
        {
            try
            {
                System.Xml.XmlDocument dom = new System.Xml.XmlDocument();
                dom.LoadXml(returndata);

                System.Xml.XmlNodeList nodelist1 = dom.SelectNodes("/BbxEventRequest/*");
                foreach (System.Xml.XmlNode node in nodelist1)
                {
                    String strName = node.Name;

                    //judge the kind of event



                    if (strName == "StatusChangeEvent")
                    {
                        //Get node object of each element
                        System.Xml.XmlNode nodeStatus = node.SelectSingleNode("./Status");
                        System.Xml.XmlNode nodeAmount = node.SelectSingleNode("./Amount");
                        System.Xml.XmlNode nodeError  = node.SelectSingleNode("./Error");
                        System.Xml.XmlNode nodeUser   = node.SelectSingleNode("./User");
                        System.Xml.XmlNode nodeSeqNo  = node.SelectSingleNode("./SeqNo");

                        Utils.ToLog(String.Format("Event Name: {0},  nodeStatus: {1}", strName, nodeStatus.InnerText));

                        String convUser = "";

                        convUser = nodeUser.InnerText;


                        if (Int32.Parse(nodeStatus.InnerText) == 21)
                        {
                            LastFixedDispense = int.Parse(nodeAmount.InnerText);
                        }


                        if (OnSetStatus != null)
                        {
                            int Summ = int.Parse(nodeAmount.InnerText);
                            if (Int32.Parse(nodeStatus.InnerText) == 7) //Это для сдачи
                            {
                                Summ = LastFixedDispense;
                            }
                            OnSetStatus(this, true, Int32.Parse(nodeStatus.InnerText), Summ, "");
                        }


                        //Check if the fcc is under change operation
                        if ((Int32.Parse(nodeStatus.InnerText) == CFCCApi.STATUS_CODE_DEPOSIT_WAIT) ||
                            (Int32.Parse(nodeStatus.InnerText) == CFCCApi.STATUS_CODE_DEPOSIT_COUNTING) ||
                            (Int32.Parse(nodeStatus.InnerText) == CFCCApi.STATUS_CODE_CALCREPLENISH))
                        {
                            //  pFrm.SetStatus(Int32.Parse(nodeStatus.InnerText),nodeStatus.InnerText);
                            //if doing change operation, then the amount should store deposit amount.
                            int dblCashin = int.Parse(nodeAmount.InnerText);

                            if (OnSetDeposit != null)
                            {
                                OnSetDeposit(this, dblCashin);
                            }
                        }
                        else if (Int32.Parse(nodeStatus.InnerText) == CFCCApi.STATUS_CODE_DISPENSE)
                        {
                            //If doing dispensing, then the amount should be dispense amount.
                            //The dispense amount is not result value, it just a parameter of dispense command.
                            //Actual dispensed amount will be reported after dispense command has been done.
                        }


                        // In the case of a StartReplenishmentFromCassette
                        // If status becomes an idol after lock normalcy, start a ReplenishmentFromCassette
                        //if (MainClass.repFC_state)
                        {
                            if (Int32.Parse(nodeStatus.InnerText) == CFCCApi.STATUS_CODE_IDLE)
                            {
                                if (OnStartReplenishmentFromCassette != null)
                                {
                                    OnStartReplenishmentFromCassette(this);
                                }
                            }
                        }

                        // pFrm.SetGuidance(pFrm.GetStatusString(Int32.Parse(nodeStatus.InnerText)));
                    }
                    else if (strName.Equals("GlyCashierEvent"))
                    {
                        string strOutput = "";

                        //Device Event
                        String sDevID = node.Attributes["devid"].InnerText;
                        String sUser  = node.Attributes["user"].InnerText;

                        System.Xml.XmlNode nEventTypeNode = node.FirstChild;
                        String             strEventName   = nEventTypeNode.Name;
                        Utils.ToLog(String.Format("Event Name: {0},  strEventName: {1}, sDevID: {2}", strName, nEventTypeNode.Name, sDevID));

                        int Summ = 0;
                        FCCSrv2.CashType[] CTT = new FCCSrv2.CashType[1];

                        if ((strEventName.Equals("eventReplenishCountChange")) || (strEventName.Equals("eventCassetteInventoryOnRemoval")))
                        {
                            FCCSrv2.CashType CT = new FCCSrv2.CashType();



                            System.Xml.XmlNode CashNode = nEventTypeNode;
                            if (strEventName.Equals("eventCassetteInventoryOnRemoval"))
                            {
                                CashNode = GetNideByName(nEventTypeNode, "Cash");
                            }
                            CT.Denomination = new FCCSrv2.DenominationType[CashNode.ChildNodes.Count];
                            CT.type         = "4";
                            int i = 0;



                            foreach (System.Xml.XmlNode n in CashNode.ChildNodes)
                            {
                                if (n.Name == "Denomination")
                                {
                                    FCCSrv2.DenominationType Den = new FCCSrv2.DenominationType();
                                    try
                                    {
                                        Den.cc    = n.Attributes["cc"].Value;
                                        Den.fv    = n.Attributes["fv"].Value;
                                        Den.devid = n.Attributes["devid"].Value;
                                        foreach (System.Xml.XmlNode nn in n.ChildNodes)
                                        {
                                            try
                                            {
                                                if (nn.Name.Equals("Piece"))
                                                {
                                                    Den.Piece = nn.InnerText;
                                                }
                                                else if (nn.Name.Equals("Status"))
                                                {
                                                    Den.Status = nn.InnerText;
                                                }
                                            }
                                            catch
                                            { }
                                        }
                                        CT.Denomination[i] = Den;
                                        CTT[0]             = CT;
                                        i++;

                                        Summ += int.Parse(Den.Piece) * int.Parse(Den.fv);
                                    }
                                    catch
                                    { }
                                }
                            }
                        }
                        if (OnSetStatus != null)
                        {
                            /*
                             * if (strEventName.Equals("eventWaitForRemoving"))
                             * {
                             * }
                             */
                            OnSetStatus(this, false, Summ, int.Parse(sDevID), strEventName);
                        }


                        if (strEventName.Equals("eventWaitForRemoving"))
                        {
                            //Wait removeing notes from RBW
                            System.Xml.XmlNode nDevicePositionID = nEventTypeNode.FirstChild;
                            string             strIDName         = GetDevicePositionIDString(nDevicePositionID.InnerText);
                            pFrm.SetStatus(Int32.Parse(sDevID), "WaitForRemoving " + strIDName);
                        }
                        else if (strEventName.Equals("eventRemoved"))
                        {
                            //Note was removed from RBW
                            System.Xml.XmlNode nDevicePositionID = nEventTypeNode.FirstChild;
                            string             strIDName         = GetDevicePositionIDString(nDevicePositionID.InnerText);
                            pFrm.SetStatus(Int32.Parse(sDevID), "Removed " + strIDName);
                        }
                        else if (strEventName.Equals("eventStatusChange"))
                        {
                            //Status Change
                            System.Xml.XmlNode nDeviceStatusID = nEventTypeNode.FirstChild;
                            string             strIDName       = GetDeviceStatusIDString(nDeviceStatusID.InnerText);

                            Utils.ToLog(String.Format("--------------eventStatusChange: StatusId{0},  str: {1}", nDeviceStatusID.InnerText, strIDName));

                            pFrm.SetStatus(Int32.Parse(sDevID), "StatusChange " + strIDName);
                        }
                        else if (strEventName.Equals("eventEmpty"))
                        {
                            //Empty
                            System.Xml.XmlNode nDevicePositionID = nEventTypeNode.FirstChild;
                            string             strIDName         = GetDevicePositionIDString(nDevicePositionID.InnerText);
                            pFrm.SetStatus(Int32.Parse(sDevID), "Empty " + strIDName);
                        }
                        else if (strEventName.Equals("eventLow"))
                        {
                            //Near Empty
                            System.Xml.XmlNode nDevicePositionID = nEventTypeNode.FirstChild;
                            string             strIDName         = GetDevicePositionIDString(nDevicePositionID.InnerText);
                            pFrm.SetStatus(Int32.Parse(sDevID), "Near Empty " + strIDName);
                        }
                        else if (strEventName.Equals("eventExist"))
                        {
                            //Exist
                            System.Xml.XmlNode nDevicePositionID = nEventTypeNode.FirstChild;
                            string             strIDName         = GetDevicePositionIDString(nDevicePositionID.InnerText);
                            pFrm.SetStatus(Int32.Parse(sDevID), "Exist " + strIDName);
                        }
                        else if (strEventName.Equals("eventHigh"))
                        {
                            //Near Full
                            System.Xml.XmlNode nDevicePositionID = nEventTypeNode.FirstChild;
                            string             strIDName         = GetDevicePositionIDString(nDevicePositionID.InnerText);
                            pFrm.SetStatus(Int32.Parse(sDevID), "High " + strIDName);
                        }
                        else if (strEventName.Equals("eventFull"))
                        {
                            //Full
                            System.Xml.XmlNode nDevicePositionID = nEventTypeNode.FirstChild;
                            string             strIDName         = GetDevicePositionIDString(nDevicePositionID.InnerText);
                            pFrm.SetStatus(Int32.Parse(sDevID), "Full " + strIDName);
                        }
                        else if (strEventName.Equals("eventMissing"))
                        {
                            //Missing unit.
                            System.Xml.XmlNode nDevicePositionID = nEventTypeNode.FirstChild;
                            string             strIDName         = GetDevicePositionIDString(nDevicePositionID.InnerText);
                            pFrm.SetStatus(Int32.Parse(sDevID), "Missing " + strIDName);
                        }
                        else if (strEventName.Equals("eventDepositCountChange"))
                        {
                            //Depositing
                        }
                        else if (strEventName.Equals("eventReplenishCountChange"))
                        {
                            /*
                             * FCCSrv2.CashType[] CTT = new FCCSrv2.CashType[1];
                             *
                             * FCCSrv2.CashType CT = new FCCSrv2.CashType();
                             *
                             * CT.Denomination = new FCCSrv2.DenominationType[nEventTypeNode.ChildNodes.Count];
                             * CT.type="4";
                             * int i= 0;
                             * int Summ = 0;
                             * foreach (System.Xml.XmlNode n in nEventTypeNode.ChildNodes)
                             * {
                             *  FCCSrv2.DenominationType Den = new FCCSrv2.DenominationType();
                             *  Den.cc = n.Attributes["cc"].Value;
                             *  Den.fv = n.Attributes["fv"].Value;
                             *  Den.devid = n.Attributes["devid"].Value;
                             *  foreach (System.Xml.XmlNode nn in n.ChildNodes)
                             *  {
                             *      if (nn.Name.Equals("Piece"))
                             *      {
                             *          Den.Piece = nn.InnerText;
                             *      } else if (nn.Name.Equals("Status"))
                             *      {
                             *          Den.Status = nn.InnerText;
                             *      }
                             *  }
                             *  CT.Denomination[i] = Den;
                             *  CTT[0] = CT;
                             *  i++;
                             *
                             *  Summ += int.Parse(Den.Piece) * int.Parse(Den.fv);
                             *
                             *
                             *
                             * }
                             */
                            Utils.ToMoneyCountLog(MoneyChangeCommands.Replenish, Summ);


                            if (OnReplenishCountChange != null)
                            {
                                OnReplenishCountChange(this, CTT);
                            }

                            //Replenishing
                        }
                        else if (strEventName.Equals("eventError"))
                        {
                            //Error occurred
                            System.Xml.XmlNode nErrorCode = nEventTypeNode.FirstChild;
                            pFrm.SetStatus(Int32.Parse(sDevID), "Error " + nErrorCode.InnerText);
                            System.Xml.XmlNode nURL    = nErrorCode.NextSibling;
                            String             errCode = Int32.Parse(nErrorCode.InnerText).ToString("X");
                            int i;
                            for (i = 1; i <= 4 - errCode.Length; i++)
                            {
                                errCode = "0" + errCode;
                            }

                            if (!String.IsNullOrEmpty(nURL.InnerText))
                            {
                                if (OnSendError != null)
                                {
                                    OnSendError(this, errCode, nURL.InnerText);
                                }
                                pFrm.ShowRecoveryScreen(errCode, nURL.InnerText);
                            }
                        }
                        else if (strEventName.Equals("eventCassetteInserted"))
                        {
                            //Inserted cassette
                            System.Xml.XmlNode nCassetteID = nEventTypeNode.FirstChild;
                            pFrm.SetStatus(Int32.Parse(sDevID), "CassetteInserted " + nCassetteID.InnerText);
                        }
                        else if (strEventName.Equals("eventPowerOffOnRequest"))
                        {
                            //Power off/on request
                        }
                        else if (strEventName.Equals("eventDownloadProgress"))
                        {
                            //Download progress
                        }
                        else if (strEventName.Equals("eventLogreadProgress"))
                        {
                            //Log Read progress
                        }
                        else if (strEventName == "eventRequireVerifyDenomination")
                        {
                            //RequireVerify
                            int i = 0;
                            System.Xml.XmlNode nCash = nEventTypeNode.FirstChild;
                            //Initialize
                            pFrm.SetWarningLabel(3, sDevID, "");
                            for (i = 0; i <= nCash.ChildNodes.Count - 1; i++)
                            {
                                System.Xml.XmlElement denomi = null;
                                string fv = null;

                                denomi = (System.Xml.XmlElement)nCash.ChildNodes.Item(i);
                                fv     = denomi.GetAttribute("fv");
                                pFrm.SetWarningLabel(1, sDevID, fv);
                            }
                        }
                        else if (strEventName == "eventRequireVerifyCollectionContainer")
                        {
                            //RequireVerify IF Cassette
                            pFrm.SetWarningLabel(2, sDevID, "");
                        }
                        else if (strEventName == "eventRequireVerifyMixStacker")
                        {
                            //RequireVerify MIX Stacker
                            pFrm.SetWarningLabel(5, sDevID, "");
                        }
                        else if (strEventName == "eventExactDenomination")
                        {
                            //Exact
                            pFrm.SetWarningLabel(3, sDevID, "");
                        }
                        else if (strEventName == "eventExactCollectionContainer")
                        {
                            //Exact IF Cassette
                            pFrm.SetWarningLabel(4, sDevID, "");
                        }
                        else if (strEventName == "eventExactMixStacker")
                        {
                            //Exact MIX Stacker
                            pFrm.SetWarningLabel(6, sDevID, "");
                        }
                        else if (strEventName.Equals("eventWaitForOpening"))
                        {
                            //Wait For Opening
                            System.Xml.XmlNode nDoorID   = nEventTypeNode.FirstChild;
                            string             strIDName = GetDoorIDString(nDoorID.InnerText);
                            pFrm.SetStatus(Int32.Parse(sDevID), "WaitForOpening " + strIDName);
                        }
                        else if (strEventName.Equals("eventOpened"))
                        {
                            //Opened
                            System.Xml.XmlNode nDoorID   = nEventTypeNode.FirstChild;
                            string             strIDName = GetDoorIDString(nDoorID.InnerText);
                            pFrm.SetStatus(Int32.Parse(sDevID), "Opened " + strIDName);
                        }
                        else if (strEventName.Equals("eventClosed"))
                        {
                            //Closed
                            System.Xml.XmlNode nDoorID   = nEventTypeNode.FirstChild;
                            string             strIDName = GetDoorIDString(nDoorID.InnerText);
                            pFrm.SetStatus(Int32.Parse(sDevID), "Closed " + strIDName);
                        }
                        else if (strEventName.Equals("eventLocked"))
                        {
                            //Locked
                            System.Xml.XmlNode nDoorID   = nEventTypeNode.FirstChild;
                            string             strIDName = GetDoorIDString(nDoorID.InnerText);
                            pFrm.SetStatus(Int32.Parse(sDevID), "Locked " + strIDName);
                        }
                        else if (strEventName.Equals("eventWaitForInsertion"))
                        {
                            //Wait For Insertion
                            System.Xml.XmlNode nDevicePositionID = nEventTypeNode.FirstChild;
                            string             strIDName         = GetDevicePositionIDString(nDevicePositionID.InnerText);
                            pFrm.SetStatus(Int32.Parse(sDevID), "WaitForInsertion " + strIDName);
                        }
                        else
                        {
                            //Unknown
                            strOutput  = "";
                            strOutput += strEventName + "\n";
                        }
                    }
                    else if (strName == "InventoryResponse")
                    {
                        // SetInventory
                        pFrm.SetEventInventory(node);
                    }
                    else
                    {
                        String strOutput = "";

                        strOutput  = "";
                        strOutput += ("(" + nEventRecvCount.ToString() + ")" + "\n");
                        strOutput += ("SOAP Completed." + "\n");

                        strOutput += (" res name  : " + strName + "\n");
                        strOutput += ("------------------------------" + "\n");
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message.ToString());
                appTrace.TraceEvent(System.Diagnostics.TraceEventType.Critical, 0, ex.Message.ToString());
            }
        }