Beispiel #1
0
        private void btnStartFM_Click(object sender, EventArgs e)
        {
            try
            {
                InputBox ib = new InputBox(FormMessage.PLS_ENTER_FISCAL_ID + "(1-99999999) :", 8);
                if (ib.ShowDialog(this) == DialogResult.OK)
                {
                    // Fiscal number
                    int fiscalNumber = int.Parse(ib.input);
                    if (fiscalNumber == 0 || fiscalNumber > 99999999)
                    {
                        bridge.Log(FormMessage.INAPPROPRIATE_FISCAL_ID);
                    }

                    CPResponse response = new CPResponse(bridge.Printer.StartFM(fiscalNumber));
                    ParseResponse(response);
                }
            }
            catch (FormatException)
            {
                bridge.Log(FormMessage.INAPPROPRIATE_FISCAL_ID);
            }
            catch (System.Exception ex)
            {
                bridge.Log(FormMessage.OPERATION_FAILS + ": " + ex.Message);
            }
        }
Beispiel #2
0
 protected void handleCPResponse(CPResponse response)
 {
     if (response.wsEvents != null)
     {
         for (int i = 0; i < response.wsEvents.Count; i++)
         {
             clubPenguinClient.GameServer.SendWebServiceEvent(response.wsEvents[i]);
         }
     }
 }
Beispiel #3
0
 private void btnQueryStatus_Click(object sender, EventArgs e)
 {
     try
     {
         CPResponse response = new CPResponse(bridge.Printer.CheckPrinterStatus());
         ParseResponse(response);
     }
     catch (System.Exception ex)
     {
         bridge.Log(FormMessage.OPERATION_FAILS + ": " + ex.Message);
     }
 }
Beispiel #4
0
        private void btnSampleNF_Click(object sender, EventArgs e)
        {
            List <string> lines = new List <string>();

            for (int i = 0; i < 25; i++)
            {
                lines.Add(String.Format("{1} {0}", i, FormMessage.SAMPLE_LINE));
            }

            try
            {
                CPResponse response = new CPResponse(bridge.Printer.WriteNFLine(lines.ToArray()));
            }
            catch (System.Exception ex)
            {
                bridge.Log(FormMessage.OPERATION_FAILS + ": " + ex.Message);
            }
        }
Beispiel #5
0
 private void btnStartReceipt_Click(object sender, EventArgs e)
 {
     try
     {
         CPResponse response = new CPResponse(bridge.Printer.PrintDocumentHeader());
         if (response.ErrorCode == 0)
         {
             bridge.Log(FormMessage.DOCUMENT_ID.PadRight(12, ' ') + ":" + response.GetNextParam());
         }
     }
     catch (System.Exception ex)
     {
         bridge.Log(FormMessage.OPERATION_FAILS);
     }
 }
Beispiel #6
0
        private void btnStartInvoice_Click(object sender, EventArgs e)
        {
            try
            {
                // tckn vkn
                string tckn_vkn = txtTCKN_VKN.Text;

                // serial
                string docSerial = txtboxInvoiceSerialNo.Text;

                // issue date
                DateTime issueDate = dateTimePickerInvoiceIssueDate.Value;

                CPResponse response = new CPResponse(bridge.Printer.PrintDocumentHeader(cbxInvTypes.SelectedIndex+1, tckn_vkn, docSerial, issueDate));
                if (response.ErrorCode == 0)
                {
                    bridge.Log(FormMessage.DOCUMENT_ID + "  :" + response.GetNextParam());
                }
            }
            catch (System.Exception ex)
            {
                bridge.Log(FormMessage.OPERATION_FAILS);
            }
        }
Beispiel #7
0
        private void btnSaleDept_Click(object sender, EventArgs e)
        {
            int weighable = cbxDeptSaleWeighable.Checked ? 1 : 0;

            try
            {
                CPResponse response = new CPResponse(bridge.Printer.PrintDepartment((int)nmrDeptSaleId.Value,
                                                                                    nmrDeptSaleQtty.Value,
                                                                                    nmrDeptSalePrice.Value,
                                                                                    txtDeptSaleName.Text,
                                                                                    weighable));

                if (response.ErrorCode == 0)
                {
                    bridge.Log(String.Format(FormMessage.SUBTOTAL.PadRight(12, ' ') + ":{0}", response.GetNextParam()));
                }
            }
            catch
            {
                bridge.Log(FormMessage.OPERATION_FAILS);
            }
        }
Beispiel #8
0
 private void btnRefund_Click(object sender, EventArgs e)
 {
     try
     {
     #if !CPP
         CPResponse response = new CPResponse(bridge.Printer.RefundEFTPayment(int.Parse(txtAcquierIdRefund.Text)));
     #endif
     }
     catch(Exception ex)
     {
         bridge.Log(FormMessage.OPERATION_FAILS);
     }
 }
Beispiel #9
0
        private void btnRcptBarcode_Click(object sender, EventArgs e)
        {
            try
            {
                List<byte> bytes = new List<byte>();
                CPResponse response;

                //BARCODE
                string barcode = txtRcptBarcode.Text;

                if(comboBoxBarcodeTypes.SelectedIndex != 0)
                    response = new CPResponse(bridge.Printer.PrintReceiptBarcode(comboBoxBarcodeTypes.SelectedIndex, barcode));
                else
                    response = new CPResponse(bridge.Printer.PrintReceiptBarcode(barcode));
            }
            catch (System.Exception ex)
            {
                bridge.Log(FormMessage.OPERATION_FAILS);
            }
        }
Beispiel #10
0
        private void btnPaidDoc_Click(object sender, EventArgs e)
        {
            try
            {
                // tckn
                string tckn = txtboxAdvanceTCKN.Text;
                // name
                string name = txtboxAdvanceName.Text;
                // Amount
                decimal amount = nmrAdvanceAmount.Value;

                CPResponse response = new CPResponse(bridge.Printer.PrintAdvanceDocumentHeader(tckn, name, amount));
                if (response.ErrorCode == 0)
                {
                    bridge.Log(FormMessage.DOCUMENT_ID + "  :" + response.GetNextParam());
                }
            }
            catch (System.Exception ex)
            {
                bridge.Log(FormMessage.OPERATION_FAILS);
            }
        }
Beispiel #11
0
        public void AddReward(Reward reward, CPResponse responseBody)
        {
            ClubPenguin.Net.Offline.PlayerAssets value = offlineDatabase.Read <ClubPenguin.Net.Offline.PlayerAssets>();
            ProgressionService progressionService      = Service.Get <ProgressionService>();

            if (reward.TryGetValue <CoinReward>(out var rewardable))
            {
                value.Assets.coins += rewardable.Coins;
            }
            if (reward.TryGetValue <MascotXPReward>(out var rewardable2))
            {
                foreach (KeyValuePair <string, int> item in rewardable2.XP)
                {
                    if (value.Assets.mascotXP.ContainsKey(item.Key))
                    {
                        value.Assets.mascotXP[item.Key] = progressionService.addXp(item.Key, item.Value, value.Assets.mascotXP[item.Key]);
                    }
                    else
                    {
                        value.Assets.mascotXP[item.Key] = progressionService.addXp(item.Key, item.Value, 0L);
                    }
                }
                int level = progressionService.Level;
                int num   = 0;
                foreach (long value5 in value.Assets.mascotXP.Values)
                {
                    num += ProgressionService.GetMascotLevelFromXP(value5);
                }
                if (num > level)
                {
                    if (responseBody.wsEvents == null)
                    {
                        responseBody.wsEvents = new List <SignedResponse <WebServiceEvent> >();
                    }
                    responseBody.wsEvents.Add(new SignedResponse <WebServiceEvent>
                    {
                        Data = new WebServiceEvent
                        {
                            details = num,
                            type    = 3
                        }
                    });
                }
            }
            if (reward.TryGetValue <CollectibleReward>(out var rewardable3))
            {
                foreach (KeyValuePair <string, int> collectible in rewardable3.Collectibles)
                {
                    if (value.Assets.collectibleCurrencies.ContainsKey(collectible.Key))
                    {
                        value.Assets.collectibleCurrencies[collectible.Key] += collectible.Value;
                    }
                    else
                    {
                        value.Assets.collectibleCurrencies[collectible.Key] = collectible.Value;
                    }
                }
            }
            if (reward.TryGetValue <DecalReward>(out var rewardable4))
            {
                value.Assets.decals.AddRange(rewardable4.Decals);
            }
            if (reward.TryGetValue <FabricReward>(out var rewardable5))
            {
                value.Assets.fabrics.AddRange(rewardable5.Fabrics);
            }
            if (reward.TryGetValue <EmoteReward>(out var rewardable6))
            {
                value.Assets.emotePacks.AddRange(rewardable6.Emotes);
            }
            if (reward.TryGetValue <EquipmentTemplateReward>(out var rewardable7))
            {
                value.Assets.equipmentTemplates.AddRange(rewardable7.EquipmentTemplates);
            }
            if (reward.TryGetValue <EquipmentInstanceReward>(out var rewardable8))
            {
                System.Random             random = new System.Random();
                byte[]                    array  = new byte[8];
                CustomEquipmentCollection value2 = offlineDatabase.Read <CustomEquipmentCollection>();
                foreach (CustomEquipment equipmentInstance in rewardable8.EquipmentInstances)
                {
                    random.NextBytes(array);
                    value2.Equipment.Add(new CustomEquipment
                    {
                        dateTimeCreated = DateTime.UtcNow.GetTimeInMilliseconds(),
                        definitionId    = equipmentInstance.definitionId,
                        equipmentId     = BitConverter.ToInt64(array, 0),
                        parts           = equipmentInstance.parts
                    });
                }
                offlineDatabase.Write(value2);
            }
            if (reward.TryGetValue <LotReward>(out var rewardable9))
            {
                value.Assets.lots.AddRange(rewardable9.Lots);
            }
            if (reward.TryGetValue <DecorationInstanceReward>(out var rewardable10))
            {
                DecorationInventoryEntity value3 = offlineDatabase.Read <DecorationInventoryEntity>();
                foreach (KeyValuePair <int, int> decoration in rewardable10.Decorations)
                {
                    DecorationId decorationId = new DecorationId(decoration.Key, DecorationType.Decoration);
                    if (value3.Inventory.ContainsKey(decorationId))
                    {
                        value3.Inventory[decorationId] += decoration.Value;
                    }
                    else
                    {
                        value3.Inventory[decorationId] = decoration.Value;
                    }
                }
                offlineDatabase.Write(value3);
            }
            if (reward.TryGetValue <StructureInstanceReward>(out var rewardable11))
            {
                DecorationInventoryEntity value3 = offlineDatabase.Read <DecorationInventoryEntity>();
                foreach (KeyValuePair <int, int> decoration2 in rewardable11.Decorations)
                {
                    DecorationId decorationId = new DecorationId(decoration2.Key, DecorationType.Structure);
                    if (value3.Inventory.ContainsKey(decorationId))
                    {
                        value3.Inventory[decorationId] += decoration2.Value;
                    }
                    else
                    {
                        value3.Inventory[decorationId] = decoration2.Value;
                    }
                }
                offlineDatabase.Write(value3);
            }
            if (reward.TryGetValue <DecorationReward>(out var rewardable12))
            {
                value.Assets.decorations.AddRange(rewardable12.Decorations);
            }
            if (reward.TryGetValue <StructureReward>(out var rewardable13))
            {
                value.Assets.structures.AddRange(rewardable13.Structures);
            }
            if (reward.TryGetValue <MusicTrackReward>(out var rewardable14))
            {
                value.Assets.musicTracks.AddRange(rewardable14.MusicTracks);
            }
            if (reward.TryGetValue <LightingReward>(out var rewardable15))
            {
                value.Assets.lighting.AddRange(rewardable15.Lighting);
            }
            if (reward.TryGetValue <DurableReward>(out var rewardable16))
            {
                value.Assets.durables.AddRange(rewardable16.Durables);
            }
            if (reward.TryGetValue <IglooSlotsReward>(out var rewardable17))
            {
                value.IglooSlots += rewardable17.IglooSlots;
            }
            if (reward.TryGetValue <ConsumableReward>(out var rewardable18))
            {
                value.Assets.partySupplies.AddRange(rewardable18.Consumable);
            }
            if (reward.TryGetValue <TubeReward>(out var rewardable19))
            {
                value.Assets.tubes.AddRange(rewardable19.Tubes);
            }
            if (reward.TryGetValue <ConsumableInstanceReward>(out var rewardable20))
            {
                ClubPenguin.Net.Offline.ConsumableInventory value4 = offlineDatabase.Read <ClubPenguin.Net.Offline.ConsumableInventory>();
                foreach (KeyValuePair <string, int> consumable in rewardable20.Consumables)
                {
                    if (value4.Inventory.ContainsKey(consumable.Key))
                    {
                        value4.Inventory[consumable.Key].itemCount += consumable.Value;
                    }
                    else
                    {
                        value4.Inventory[consumable.Key] = new InventoryItemStock
                        {
                            itemCount = consumable.Value
                        };
                    }
                    value4.Inventory[consumable.Key].lastPurchaseTimestamp = DateTime.UtcNow.GetTimeInMilliseconds();
                }
                offlineDatabase.Write(value4);
            }
            offlineDatabase.Write(value);
        }
Beispiel #12
0
        private void buttonStartCllctnDoc_Click(object sender, EventArgs e)
        {
            try
            {
                //invoice no
                string invoiceNo = textBoxCllctnSerial.Text;

                // amount
                decimal amount = numericUpDownCllctnAmount.Value;

                // subscriber no
                string subscriberNo = textBoxSubscriberNo.Text;

                // inst name
                string instutionName = textBoxInstutionName.Text;

                decimal comission = 0.0m;
                if (checkBoxComission.Checked)
                {
                    // comission amount
                    comission = numericUpDownComission.Value;
                }

                // Invoice Date
                DateTime invDate = dateTimePickerCllctionInvDate.Value;

                CPResponse response = new CPResponse(bridge.Printer.PrintCollectionDocumentHeader(invoiceNo, invDate, amount, subscriberNo, instutionName, comission));
                if (response.ErrorCode == 0)
                {
                    bridge.Log(FormMessage.DOCUMENT_ID + "  :" + response.GetNextParam());
                }
            }
            catch (System.Exception ex)
            {
                bridge.Log(FormMessage.OPERATION_FAILS);
            }
        }
Beispiel #13
0
        private void buttonGetEFTSlipCopy_Click(object sender, EventArgs e)
        {
            int acquierId = 0;
            int zNo = 0;
            int rNo = 0;
            int bNo = 0;
            int sNo = 0;

            CPResponse response = null;
            try
            {
                acquierId = int.Parse(textBoxSlpCpyAcquirId.Text);

                if (checkBoxSlpCpyZnoRcptNo.Checked)
                {
                    zNo = int.Parse(textBoxSlpCpyZNo.Text);
                    rNo = int.Parse(textBoxSlpCpyRcptNo.Text);
                }
                else
                {
                    bNo = int.Parse(textBoxSlpCpyBatchNo.Text);
                    sNo = int.Parse(textBoxSlpCpyStanNo.Text);
                }

                response = new CPResponse(bridge.Printer.GetEFTSlipCopy(acquierId, bNo, sNo, zNo, rNo));

            }
            catch (Exception ex)
            {
                bridge.Log(FormMessage.OPERATION_FAILS + " : " + ex.Message);
            }
        }
Beispiel #14
0
        private void btnxFer_Click(object sender, EventArgs e)
        {
            try
            {
                // SEND COMMAND
                CPResponse response = new CPResponse(bridge.Printer.TransferFile(txtFileName.Text));

                if (response.ErrorCode == 0)
                {
                    ParseServiceResponse(response);
                }
            }
            catch
            {

            }
        }
Beispiel #15
0
 private void btnVoidPayment_Click(object sender, EventArgs e)
 {
     CPResponse response = null;
     try
     {
         if (checkBoxVoidEft.Checked)
         {
     #if !CPP
             response = new CPResponse(bridge.Printer.VoidEFTPayment(int.Parse(txtAcquierId.Text), int.Parse(txtBatchNo.Text), int.Parse(txtStanNo.Text)));
     #endif
         }
         else
         {
             // SEND COMMAND
             response = new CPResponse(bridge.Printer.VoidPayment((int)nmrVoidPayIndex.Value - 1));
         }
     }
     catch (System.Exception ex)
     {
         bridge.Log(FormMessage.OPERATION_FAILS + ": " + ex.Message);
     }
 }
Beispiel #16
0
        private void btnVoidSale_Click(object sender, EventArgs e)
        {
            try
            {
                //PLU NO
                int pluNo = (int)nmrVoidPlu.Value;

                //VOID QUANTITY
                decimal quantity = nmrVoidQtty.Value;

                // SEND COMMAND
                CPResponse response = null;

                if (cbxVoidDept.Checked)
                {
                    if (String.IsNullOrEmpty(txtVoidDeptName.Text))
                    {
                        bridge.Log(FormMessage.FILL_DEPT_NAME);
                        return;
                    }
                    else
                        response = new CPResponse(bridge.Printer.VoidDepartment(pluNo, txtVoidDeptName.Text,quantity));
                }
                else
                {
                    response = new CPResponse(bridge.Printer.Void(pluNo, quantity));
                }

                if (response.ErrorCode == 0)
                {
                    bridge.Log(String.Format("{1}:{0}", response.GetNextParam(), FormMessage.SUBTOTAL.PadRight(12, ' ')));
                }
            }
            catch (System.Exception ex)
            {
                bridge.Log(FormMessage.OPERATION_FAILS);
            }
        }
Beispiel #17
0
        private void btnAdjust_Click(object sender, EventArgs e)
        {
            try
            {
                int percantege = 0;
                decimal amount = 0;
                AdjustmentType adjType;

                bool IsFee = false;
                if (rbtnFee.Checked)
                {
                    IsFee = true;
                }

                if (cbxPerc.Checked)
                {
                    //Percantage
                    percantege = (int)nmrAdjAmount.Value;

                    adjType = IsFee ? AdjustmentType.PercentFee : AdjustmentType.PercentDiscount;
                }
                else
                {
                    //AMOUNT
                    amount = nmrAdjAmount.Value;

                    adjType = IsFee ? AdjustmentType.Fee : AdjustmentType.Discount;
                }

                // SEND COMMAND
                CPResponse response = new CPResponse(bridge.Printer.PrintAdjustment((int)adjType, amount, percantege));

                if (response.ErrorCode == 0)
                {
                    bridge.Log(String.Format(FormMessage.SUBTOTAL.PadRight(12, ' ') + ":{0:#0.00}", response.GetNextParam()));
                }
            }
            catch (System.Exception ex)
            {
                bridge.Log(FormMessage.OPERATION_FAILS);
            }
        }
Beispiel #18
0
        private void btnBankList_Click(object sender, EventArgs e)
        {
            CPResponse response = null;
            try
            {
            #if !CPP
                response = new CPResponse(bridge.Printer.GetBankListOnEFT());
            #endif

                if (response.ErrorCode == 0)
                {
                    int counter = 1;
                    bridge.Log(String.Format("** BANK INFO LIST **"));
                    while (response.CurrentParamIndex < response.ParamList.Count)
                    {
                        String bankInfo = response.GetNextParam();
                        string acquirID = bankInfo.Substring(0, 4);
                        string bankName = bankInfo.Substring(4);

                        bridge.Log(String.Format("BANK {0}", counter++));
                        bridge.Log(String.Format("ACQUIER ID : {0}", acquirID));
                        bridge.Log(String.Format("BANK NAME  : {0}", bankName));
                        bridge.Log(String.Format(""));
                    }
                }
            }
            catch (Exception ex)
            {
                bridge.Log(FormMessage.OPERATION_FAILS + ": " + ex.Message);
            }
        }
Beispiel #19
0
        private void btnCardQuery_Click(object sender, EventArgs e)
        {
            CPResponse response = null;
            try
            {
                // SEND COMMAND
            #if CPP

            #else
                response = new CPResponse(bridge.Printer.GetEFTCardInfo(nmrPaymentAmount.Value));
            #endif

                if (response.ErrorCode == 0)
                {
                    bridge.Log(String.Format(FormMessage.CC_ID.PadRight(12, ' ') + ":{0}", response.GetNextParam()));
                    bridge.Log(String.Format(FormMessage.CC_NAME.PadRight(12, ' ') + ":{0}", response.GetNextParam()));
                    bridge.Log(String.Format(FormMessage.DISCOUNT_ACTIVE.PadRight(12, ' ') + ":{0}", response.GetNextParam()));

                    string cardNum = response.GetNextParam();
                    bridge.Log(String.Format(FormMessage.CARD_NUMBER.PadRight(12, ' ') + ":{0}", cardNum));
                    bridge.Log(String.Format("Holder Name".PadRight(12, ' ') + ":{0}", response.GetNextParam()));

                    txtCardNumber.Text = cardNum.Substring(0, 6);
                }

            }
            catch (System.Exception ex)
            {
                bridge.Log(FormMessage.OPERATION_FAILS);
            }
        }
Beispiel #20
0
        private void btnPayment_Click(object sender, EventArgs e)
        {
            try
            {
                int index = -1;
                CPResponse response = null;

                //PAYMENT TYPE
                int paymentType = cbxPaymentType.SelectedIndex;

                //IF PAYMENT IS FOREIGN CURRENCY OR CREDIT
                if (cbxPaymentType.Text == FormMessage.CURRENCY || cbxPaymentType.Text == FormMessage.CREDIT)
                {
                    //Index
                    index = cbxSubPayments.SelectedIndex;
                }

                //PAYMENT AMOUNT
                decimal amount = nmrPaymentAmount.Value;

                // SEND COMMAND
                response = new CPResponse(bridge.Printer.PrintPayment(paymentType, index, amount));

                if (response.ErrorCode == 0)
                {
                    bridge.Log(String.Format(FormMessage.SUBTOTAL.PadRight(12, ' ') + ":{0}", response.GetNextParam()));

                    bridge.Log(String.Format(FormMessage.PAID_TOTAL.PadRight(12, ' ') + ":{0}", response.GetNextParam()));

                }

            }
            catch (System.Exception ex)
            {
                bridge.Log(FormMessage.OPERATION_FAILS);
            }
        }
Beispiel #21
0
        private int LoadCreditData()
        {
            int successCount = 0;

            for (int i = 0; i < ProgramConfig.MAX_CREDIT_COUNT; i++)
            {
                try
                {
                    CPResponse response = new CPResponse(bridge.Printer.GetCreditInfo(i));

                    if (response.ErrorCode == 0)
                    {
                        String name = response.GetNextParam();
                        MainForm.SetCredit(i, name);
                        successCount++;
                    }
                }
                catch (TimeoutException)
                {
                    bridge.Log(FormMessage.TIMEOUT_ERROR);
                }
                catch
                {
                    bridge.Log(FormMessage.OPERATION_FAILS);
                }
            }
            return successCount;
        }
Beispiel #22
0
        private void btnRcptInfo_Click(object sender, EventArgs e)
        {
            CPResponse response = null;
            try
            {
            #if !CPP
                response = new CPResponse(bridge.Printer.GetSalesInfo());
            #endif

                if (response.ErrorCode == 0)
                {
                    bridge.Log(String.Format("DOC NO    : {0}", response.GetNextParam()));
                    bridge.Log(String.Format("Z NO      : {0}", response.GetNextParam()));
                    bridge.Log(String.Format("DOC TYPE  : {0}", response.GetNextParam()));
                    bridge.Log(String.Format("DATE      : {0}", response.GetNextParam()));
                    bridge.Log(String.Format("TIME      : {0}", response.GetNextParam()));
                    bridge.Log(String.Format("SUB TOTAL : {0}", response.GetNextParam()));

                    try
                    {
                        int payCount = Convert.ToInt32(response.GetNextParam());
                        bridge.Log(String.Format("PAYMENT COUNT : {0}", payCount));
                        for (int i = 0; i < payCount; i++)
                        {
                            bridge.Log(String.Format("PAY TYPE   : {0}", response.GetNextParam()));
                            bridge.Log(String.Format("PAY INDEX  : {0}", response.GetNextParam()));
                            bridge.Log(String.Format("PAY AMOUNT : {0}", response.GetNextParam()));
                            bridge.Log(String.Format("PAY DETAIL : {0}", response.GetNextParam()));
                        }
                    }
                    catch
                    {

                    }
                }
            }
            catch (Exception ex)
            {
                bridge.Log(FormMessage.OPERATION_FAILS + ": " + ex.Message);
            }
        }
Beispiel #23
0
        private int LoadCurrency()
        {
            int successCount = 0;

            for (int i = 0; i < ProgramConfig.MAX_FCURRENCY_COUNT; i++)
            {
                try
                {
                    CPResponse response = new CPResponse(bridge.Printer.GetCurrencyInfo(i));

                    if (response.ErrorCode == 0)
                    {
                        FCurrency curr = new FCurrency();
                        curr.ID = i;
                        curr.Name = response.GetNextParam();
                        curr.Rate = decimal.Parse(response.GetNextParam());
                        MainForm.SetCurrency(curr.ID, curr);
                    }
                }
                catch
                {
                }
            }
            return successCount;
        }
Beispiel #24
0
        private void btnRemark_Click(object sender, EventArgs e)
        {
            try
            {
                List<byte> bytes = new List<byte>();

                string[] remarkLines = txtRemarkLine.Lines;

                if (remarkLines.Length > 0)
                {
                    for (int i = 0; i < remarkLines.Length; i++)
                    {
                        remarkLines[i] = remarkLines[i].PadRight(ProgramConfig.LOGO_LINE_LENGTH - 3, ' ');
                    }

                    // SEND COMMAND
                    CPResponse response = new CPResponse(bridge.Printer.PrintRemarkLine(remarkLines));
                }
            }
            catch (System.Exception ex)
            {
                bridge.Log(FormMessage.OPERATION_FAILS);
            }
        }
Beispiel #25
0
        private void timer_Tick(object sender, EventArgs e, bool isDeptSale)
        {
            if (String.IsNullOrEmpty(jsonStr))
            {
                string jsonFileName = System.Configuration.ConfigurationManager.AppSettings["JSONDocName"];
                if (!File.Exists(jsonFileName))
                {
                    bridge.Log(FormMessage.JSON_FILE_NOT_EXISTS);
                    return;
                }

                jsonStr = File.ReadAllText(jsonFileName);
            }

            try
            {
                bridge.Log(String.Format("AUTO PRINT DOC COUNTER: {0}", docCounter));
                CPResponse response = new CPResponse(bridge.Printer.PrintDocumentHeader());
                if (response.ErrorCode == 0)
                    if (isDeptSale)
                        response = new CPResponse(bridge.Printer.PrintJSONDocumentDeptOnly(jsonStr));
                    else
                        response = new CPResponse(bridge.Printer.PrintJSONDocument(jsonStr));
                else
                {
                    if (isDeptSale)
                        buttonAutoPrintDEPT.Text = "AUTO PRINT    JSON DEPT";
                    else
                        buttonAutoPrintPLU.Text = "AUTO PRINT    JSON PLU";
                }
                System.Threading.Thread.Sleep(500);

                if (docCounter % GetZRepAt == 0)
                {
                    bridge.Log(String.Format("AUTO PRINT: Z PRINTING... AT {0}", docCounter));
                    response = new CPResponse(bridge.Printer.PrintZReport());
                }

                docCounter++;
            }
            catch (Exception ex)
            {
                bridge.Log(FormMessage.OPERATION_FAILS + ": " + ex.Message);
                if (isDeptSale)
                    buttonAutoPrintDEPT.Text = "AUTO PRINT    JSON DEPT";
                else
                    buttonAutoPrintPLU.Text = "AUTO PRINT    JSON PLU";
            }
        }
Beispiel #26
0
        private void btnSaleSample_Click(object sender, EventArgs e)
        {
            int pluNo = (int)nmrPlu.Value;
            Decimal quantity = nmrQuantity.Value;
            Decimal price = Decimal.MinusOne;
            int weighable = -1;

            if (checkBoxForPrice.Checked)
                price = nmrPrice.Value;

            if (checkBoxWeighable.Checked)
                weighable = 1;

            try
            {
                CPResponse response = null;
                if (cbxSaveAndSale.Checked)
                {
                    response = new CPResponse(bridge.Printer.PrintItem(pluNo, quantity, price, FixTurkishUpperCase(txtName.Text), txtBarcode.Text, (int)nmrDept.Value, weighable));
                }
                else
                {
                    response = new CPResponse(bridge.Printer.PrintItem(pluNo, quantity, price, null, null, -1, -1));
                }

                if (response.ErrorCode == 0)
                {
                    bridge.Log(String.Format(FormMessage.SUBTOTAL.PadRight(12, ' ') + ":{0}", response.GetNextParam()));
                }
            }
            catch
            {
                bridge.Log(FormMessage.OPERATION_FAILS);
            }
        }
Beispiel #27
0
        private void btnCloseReceipt_Click(object sender, EventArgs e)
        {
            try
            {
                CPResponse response = new CPResponse(bridge.Printer.CloseReceipt(chbSlipCopy.Checked));

                if (response.ErrorCode == 0)
                {
                    bridge.Log(FormMessage.DOCUMENT_ID.PadRight(12, ' ') + ":" + response.GetNextParam());
                }
            }
            catch
            {
                bridge.Log(FormMessage.OPERATION_FAILS);
            }
        }
Beispiel #28
0
 private void btnStartParkDoc_Click(object sender, EventArgs e)
 {
     DateTime entranceDT = new DateTime(dtParkDate.Value.Year,
                                         dtParkDate.Value.Month,
                                         dtParkDate.Value.Day,
                                         dtParkTime.Value.Hour,
                                         dtParkTime.Value.Minute,
                                         dtParkTime.Value.Second);
     try
     {
         CPResponse response = new CPResponse(bridge.Printer.PrintParkDocument(txtPlate.Text, entranceDT));
         if (response.ErrorCode == 0)
         {
             bridge.Log(FormMessage.DOCUMENT_ID + "  :" + response.GetNextParam());
         }
     }
     catch (System.Exception ex)
     {
         bridge.Log(FormMessage.OPERATION_FAILS);
     }
 }
Beispiel #29
0
        private void btnCorrect_Click(object sender, EventArgs e)
        {
            try
            {
                CPResponse response = new CPResponse(bridge.Printer.Correct());

                if (response.ErrorCode == 0)
                {
                    bridge.Log(String.Format("{1}:{0:#0.00}", response.GetNextParam(), FormMessage.SUBTOTAL.PadRight(12, ' ')));
                }
            }
            catch (System.Exception ex)
            {
                bridge.Log(FormMessage.OPERATION_FAILS);
            }
        }
Beispiel #30
0
        private void btnSubtotal_Click(object sender, EventArgs e)
        {
            try
            {
                CPResponse response = new CPResponse(bridge.Printer.PrintSubtotal(false));

                if (response.ErrorCode == 0)
                {
                    bridge.Log(String.Format(FormMessage.SUBTOTAL.PadRight(12, ' ') + ":{0}", response.GetNextParam()));

                    bridge.Log(String.Format(FormMessage.PAID_TOTAL.PadRight(12, ' ') + ":{0}", response.GetNextParam()));
                }
            }
            catch (System.Exception ex)
            {
                bridge.Log(FormMessage.OPERATION_FAILS);
            }
        }
Beispiel #31
0
        private void btnEFTAuthorization_Click(object sender, EventArgs e)
        {
            try
            {
                // SEND COMMAND
                CPResponse response = new CPResponse(bridge.Printer.GetEFTAuthorisation(nmrEFTAmount.Value, (int)nmrInstallment.Value, txtCardNumber.Text));

                if (response.ErrorCode == 0)
                {
                    string totalAmount      = response.GetNextParam();
                    string provisionCode    = response.GetNextParam();
                    string paidAmount       = response.GetNextParam();
                    string installmentCount = response.GetNextParam();
                    string acquirerId       = response.GetNextParam();
                    string bin              = response.GetNextParam();
                    string issuerId         = response.GetNextParam();

                    bridge.Log(String.Format("İşlem Tutarı   :{0}", nmrEFTAmount.Value.ToString()));
                    bridge.Log(String.Format("Ödeme Toplamı  :{0}", paidAmount));
                    bridge.Log(String.Format("Belge Tutarı   :{0}", totalAmount));
                    bridge.Log(String.Format("Taksit sayısı  :{0}", installmentCount));
                    bridge.Log(String.Format("Provizyon kodu :{0}", provisionCode));
                    bridge.Log(String.Format("ACQUIRER ID    :{0}", acquirerId));
                    bridge.Log(String.Format("BIN            :{0}", bin));
                    bridge.Log(String.Format("ISSUERER ID    :{0}", issuerId));

                }

            }
            catch (System.Exception ex)
            {
                bridge.Log(FormMessage.OPERATION_FAILS);
            }
        }
Beispiel #32
0
        private void btnVoidReceipt_Click(object sender, EventArgs e)
        {
            try
            {
                CPResponse response = new CPResponse(bridge.Printer.VoidReceipt());

                if (response.ErrorCode == 0)
                {
                    bridge.Log(FormMessage.VOIDED_DOC_ID.PadRight(12, ' ') + ":" + response.GetNextParam());
                }
            }
            catch (System.Exception ex)
            {
                bridge.Log(FormMessage.OPERATION_FAILS + ": " + ex.Message);
            }
        }
Beispiel #33
0
        private void btnJsonOnlyDept_Click(object sender, EventArgs e)
        {
            string jsonFileName = System.Configuration.ConfigurationManager.AppSettings["JSONDocName"];
            string jsonStr = "";
            if (!File.Exists(jsonFileName))
            {
                bridge.Log(FormMessage.JSON_FILE_NOT_EXISTS);
                return;
            }

            try
            {
                jsonStr = File.ReadAllText(jsonFileName);

                CPResponse response = new CPResponse(bridge.Printer.PrintJSONDocumentDeptOnly(jsonStr));
            }
            catch (Exception ex)
            {
                bridge.Log(FormMessage.OPERATION_FAILS + " : " + ex.Message);
            }
        }
Beispiel #34
0
        private void SendCommand(CPResponse response)
        {
            try
            {
                if (response.ErrorCode == 0 && response.ParamList != null)
                {
                    string paramVal = "";

                    if (lastCmd != FiscalCmd.DRAWER_INFO)
                    {
                        paramVal = response.GetNextParam();
                        if (!String.IsNullOrEmpty(paramVal))
                        {
                            bridge.Log(FormMessage.DOCUMENT_ID.PadLeft(12, ' ') + ": " + paramVal);
                        }
                        paramVal = response.GetNextParam();
                        if (!String.IsNullOrEmpty(paramVal))
                        {
                            bridge.Log(FormMessage.Z_ID.PadLeft(12, ' ') + ": " + paramVal);
                        }
                        paramVal = response.GetNextParam();
                        if (!String.IsNullOrEmpty(paramVal))
                        {
                            bridge.Log(FormMessage.EJ_ID.PadLeft(12, ' ') + ": " + paramVal);
                        }
                        paramVal = response.GetNextParam();
                        if (!String.IsNullOrEmpty(paramVal))
                        {
                            bridge.Log(FormMessage.DOCUMENT_TYPE.PadLeft(12, ' ') + ": " + paramVal);
                        }
                        paramVal = response.GetNextParam();
                        if (!String.IsNullOrEmpty(paramVal))
                        {
                            bridge.Log(String.Format(FormMessage.DATE.PadLeft(12, ' ') + ": {0}", paramVal));
                        }

                        paramVal = response.GetNextParam();
                        if (!String.IsNullOrEmpty(paramVal))
                        {
                            bridge.Log(String.Format(FormMessage.TIME.PadLeft(12, ' ') + ": {0}", paramVal));
                        }
                    }
                    // TOPLAM BİLGİLERİ
                    paramVal = response.GetNextParam();
                    if (!String.IsNullOrEmpty(paramVal))
                    {
                        bridge.Log("--- " + FormMessage.TOTAL_INFO + " ---");
                        bridge.Log(String.Format(FormMessage.TOTAL_RECEIPT_COUNT + ": {0}", paramVal));
                    }
                    paramVal = response.GetNextParam();
                    if (!String.IsNullOrEmpty(paramVal))
                    {
                        bridge.Log(String.Format(FormMessage.TOTAL_AMOUNT + ": {0}", paramVal));
                    }

                    // SATIŞ BİLGİLERİ
                    paramVal = response.GetNextParam();
                    if (!String.IsNullOrEmpty(paramVal))
                    {
                        bridge.Log("--- " + FormMessage.SALE_INFO + " ---");
                        bridge.Log(String.Format(FormMessage.TOTAL_SALE_RECEIPT_COUNT + ": {0}", paramVal));
                    }
                    paramVal = response.GetNextParam();
                    if (!String.IsNullOrEmpty(paramVal))
                    {
                        bridge.Log(String.Format(FormMessage.TOTAL_SALE_AMOUNT + ": {0}", paramVal));
                    }

                    // İPTAL BİLGİLERİ
                    paramVal = response.GetNextParam();
                    if (!String.IsNullOrEmpty(paramVal))
                    {
                        bridge.Log("--- " + FormMessage.VOID_INFO + " ---");
                        bridge.Log(String.Format(FormMessage.TOTAL_VOID_RECEIPT_COUNT + ": {0}", paramVal));
                    }
                    paramVal = response.GetNextParam();
                    if (!String.IsNullOrEmpty(paramVal))
                    {
                        bridge.Log(String.Format(FormMessage.TOTAL_VOID_AMOUNT + ": {0}", paramVal));
                    }

                    // İNDİRİM BİLGİLERİ
                    paramVal = response.GetNextParam();
                    if (!String.IsNullOrEmpty(paramVal))
                    {
                        bridge.Log("--- " + FormMessage.ADJUSTMENT_INFO + " ---");
                        bridge.Log(String.Format(FormMessage.TOTAL_ADJUSTED_AMOUNT + ": {0}", paramVal));
                    }

                    // ÖDEME BİLGİLERİ
                    bridge.Log("--- " + FormMessage.PAYMENT_INFO + " ---");
                    int i = 0;
                    while (response.CurrentParamIndex < response.ParamList.Count)
                    {
                        i++;
                        bridge.Log("** " + FormMessage.PAYMENT + " " + i + " **");
                        paramVal = response.GetNextParam();
                        if (!String.IsNullOrEmpty(paramVal))
                        {
                            int paymentType = int.Parse(paramVal);
                            bridge.Log(String.Format(FormMessage.PAYMENT_TYPE.PadLeft(15, ' ') + ": {0}", Common.Payments[paymentType]));
                        }
                        paramVal = response.GetNextParam();
                        if (!String.IsNullOrEmpty(paramVal))
                        {
                            bridge.Log(String.Format(FormMessage.PAYMENT_INDEX.PadLeft(15, ' ') + ": {0}", paramVal));
                        }
                        paramVal = response.GetNextParam();
                        if (!String.IsNullOrEmpty(paramVal))
                        {
                            bridge.Log(String.Format(FormMessage.PAYMENT_AMOUNT.PadLeft(15, ' ') + ": {0}", paramVal));
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                bridge.Log(FormMessage.OPERATION_FAILS);
            }
        }
Beispiel #35
0
 private void btnOpenDrawer_Click(object sender, EventArgs e)
 {
     try
     {
         // SEND COMMAND
         CPResponse response = new CPResponse(bridge.Printer.OpenDrawer());
     }
     catch (System.Exception ex)
     {
         bridge.Log(FormMessage.OPERATION_FAILS);
     }
 }
Beispiel #36
0
        private void SendCommand(CPResponse response)
        {
            try
            {
                if (response.ErrorCode == 0 && response.ParamList != null)
                {
                    string paramVal = "";

                    if (lastCmd != FiscalCmd.DRAWER_INFO)
                    {
                        paramVal = response.GetNextParam();
                        if (!String.IsNullOrEmpty(paramVal))
                        {
                            bridge.Log(FormMessage.DOCUMENT_ID.PadLeft(12, ' ') + ": " + paramVal);
                        }
                        paramVal = response.GetNextParam();
                        if (!String.IsNullOrEmpty(paramVal))
                        {
                            bridge.Log(FormMessage.Z_ID.PadLeft(12, ' ') + ": " + paramVal);
                        }
                        paramVal = response.GetNextParam();
                        if (!String.IsNullOrEmpty(paramVal))
                        {
                            bridge.Log(FormMessage.EJ_ID.PadLeft(12, ' ') + ": " + paramVal);
                        }
                        paramVal = response.GetNextParam();
                        if (!String.IsNullOrEmpty(paramVal))
                        {
                            bridge.Log(FormMessage.DOCUMENT_TYPE.PadLeft(12, ' ') + ": " + paramVal);
                        }
                        paramVal = response.GetNextParam();
                        if (!String.IsNullOrEmpty(paramVal))
                        {
                            bridge.Log(String.Format(FormMessage.DATE.PadLeft(12, ' ') + ": {0}", paramVal));
                        }

                        paramVal = response.GetNextParam();
                        if (!String.IsNullOrEmpty(paramVal))
                        {
                            bridge.Log(String.Format(FormMessage.TIME.PadLeft(12, ' ') + ": {0}", paramVal));
                        }
                    }
                    // TOPLAM BİLGİLERİ
                    paramVal = response.GetNextParam();
                    if (!String.IsNullOrEmpty(paramVal))
                    {
                        bridge.Log("--- "+FormMessage.TOTAL_INFO+" ---");
                        bridge.Log(String.Format(FormMessage.TOTAL_RECEIPT_COUNT + ": {0}", paramVal));
                    }
                    paramVal = response.GetNextParam();
                    if (!String.IsNullOrEmpty(paramVal))
                    {
                        bridge.Log(String.Format(FormMessage.TOTAL_AMOUNT + ": {0}", paramVal));
                    }

                    // SATIŞ BİLGİLERİ
                    paramVal = response.GetNextParam();
                    if (!String.IsNullOrEmpty(paramVal))
                    {
                        bridge.Log("--- "+FormMessage.SALE_INFO+" ---");
                        bridge.Log(String.Format(FormMessage.TOTAL_SALE_RECEIPT_COUNT + ": {0}", paramVal));
                    }
                    paramVal = response.GetNextParam();
                    if (!String.IsNullOrEmpty(paramVal))
                    {
                        bridge.Log(String.Format(FormMessage.TOTAL_SALE_AMOUNT + ": {0}", paramVal));
                    }

                    // İPTAL BİLGİLERİ
                    paramVal = response.GetNextParam();
                    if (!String.IsNullOrEmpty(paramVal))
                    {
                        bridge.Log("--- "+FormMessage.VOID_INFO+" ---");
                        bridge.Log(String.Format(FormMessage.TOTAL_VOID_RECEIPT_COUNT + ": {0}", paramVal));
                    }
                    paramVal = response.GetNextParam();
                    if (!String.IsNullOrEmpty(paramVal))
                    {
                        bridge.Log(String.Format(FormMessage.TOTAL_VOID_AMOUNT + ": {0}", paramVal));
                    }

                    // İNDİRİM BİLGİLERİ
                    paramVal = response.GetNextParam();
                    if (!String.IsNullOrEmpty(paramVal))
                    {
                        bridge.Log("--- "+FormMessage.ADJUSTMENT_INFO+" ---");
                        bridge.Log(String.Format(FormMessage.TOTAL_ADJUSTED_AMOUNT + ": {0}", paramVal));
                    }

                    // ÖDEME BİLGİLERİ
                    bridge.Log("--- "+FormMessage.PAYMENT_INFO+" ---");
                    int i = 0;
                    while (response.CurrentParamIndex < response.ParamList.Count)
                    {
                        i++;
                        bridge.Log("** " + FormMessage.PAYMENT + " " + i + " **");
                        paramVal = response.GetNextParam();
                        if (!String.IsNullOrEmpty(paramVal))
                        {
                            int paymentType = int.Parse(paramVal);
                            bridge.Log(String.Format(FormMessage.PAYMENT_TYPE.PadLeft(15, ' ') + ": {0}", Common.Payments[paymentType]));
                        }
                        paramVal = response.GetNextParam();
                        if (!String.IsNullOrEmpty(paramVal))
                        {
                            bridge.Log(String.Format(FormMessage.PAYMENT_INDEX.PadLeft(15, ' ') + ": {0}", paramVal));
                        }
                        paramVal = response.GetNextParam();
                        if (!String.IsNullOrEmpty(paramVal))
                        {
                            bridge.Log(String.Format(FormMessage.PAYMENT_AMOUNT.PadLeft(15, ' ') + ": {0}", paramVal));
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                bridge.Log(FormMessage.OPERATION_FAILS);
            }
        }
Beispiel #37
0
        private void ParseResponse(CPResponse response)
        {
            try
            {
                if (response.ErrorCode == 0)
                {
                    string retVal = response.GetNextParam();
                    if (!String.IsNullOrEmpty(retVal))
                    {
                        bridge.Log(String.Format(FormMessage.DATE.PadRight(12, ' ') + ":{0}", retVal));
                    }

                    retVal = response.GetNextParam();
                    if (!String.IsNullOrEmpty(retVal))
                    {
                        bridge.Log(String.Format(FormMessage.TIME.PadRight(12, ' ') + ":{0}", retVal));
                    }
                    retVal = response.GetNextParam();
                    if (!String.IsNullOrEmpty(retVal))
                    {
                        bridge.Log(String.Format("NOTE".PadRight(12, ' ') + ":{0}", retVal));
                    }
                    retVal = response.GetNextParam();
                    if (!String.IsNullOrEmpty(retVal))
                    {
                        bridge.Log(String.Format(FormMessage.AMOUNT.PadRight(12, ' ') + ":{0}", retVal));
                    }
                    retVal = response.GetNextParam();
                    if (!String.IsNullOrEmpty(retVal))
                    {
                        bridge.Log(FormMessage.DOCUMENT_ID.PadRight(12, ' ') + ":" + retVal);
                    }

                    retVal = response.GetNextParam();
                    if (!String.IsNullOrEmpty(retVal))
                    {
                    }

                    retVal = response.GetNextParam();
                    if (!String.IsNullOrEmpty(retVal))
                    {
                        String authNote = "";
                        try
                        {
                            switch (int.Parse(retVal))
                            {
                            case 0:
                                authNote = FormMessage.SALE;
                                break;

                            case 1:
                                authNote = "PROGRAM";
                                break;

                            case 2:
                                authNote = FormMessage.SALE + " & Z";
                                break;

                            case 3:
                                authNote = FormMessage.ALL;
                                break;

                            default:
                                authNote = "";
                                break;
                            }

                            bridge.Log(FormMessage.AUTHORIZATION.PadRight(12, ' ') + ":" + authNote);
                        }
                        catch { }
                    }
                }
            }
            catch (Exception ex)
            {
                bridge.Log(FormMessage.OPERATION_FAILS + ": " + ex.Message);
            }
        }