Beispiel #1
0
        private void btnSaveCashier_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < ProgramConfig.MAX_CASHIER_COUNT; i++)
            {
                try
                {
                    DataGridViewCheckBoxCell selected = (DataGridViewCheckBoxCell)dgvCashier.Rows[i].Cells[clmnCashierSelect.Index];
                    if (selected.Value != null && (bool)selected.Value == true)
                    {
                        //NAME
                        String name = (String)dgvCashier.Rows[i].Cells[clmnCashierName.Index].Value;

                        //PASSWORD
                        string password = string.Empty;
                        if (!String.IsNullOrEmpty((string)dgvCashier.Rows[i].Cells[clmnCashierPassword.Index].Value))
                        {
                            password = Convert.ToInt32(dgvCashier.Rows[i].Cells[clmnCashierPassword.Index].Value).ToString();
                        }

                        CPResponse response = new CPResponse(bridge.Printer.SaveCashier(i, name, password));

                        if (response.ErrorCode == 0)
                        {
                            Cashier c = new Cashier();
                            c.Id = i + 1;
                            c.Name = response.GetNextParam();
                            bridge.Log(String.Format("{2}: {0} {3}:{1}",
                                c.Id,
                                c.Name,
                                FormMessage.CASHIER_ID,
                                FormMessage.CASHIER_NAME
                                ));
                        }
                    }
                }
                catch (System.Exception)
                {
                    bridge.Log(FormMessage.OPERATION_FAILS);
                }
            }
        }
Beispiel #2
0
        private void btnGetCashier_Click(object sender, EventArgs e)
        {
            dgvCashier.Rows.Clear();
            for (int i = 0; i < ProgramConfig.MAX_CASHIER_COUNT; i++)
            {
                try
                {
                    CPResponse response = new CPResponse(bridge.Printer.GetCashier(i));

                    if (response.ErrorCode == 0)
                    {
                        Cashier c = new Cashier();
                        c.Name = response.GetNextParam();
                        int index = dgvCashier.Rows.Add();
                        dgvCashier.Rows[index].Cells[clmnCashierIndex.Index].Value = i + 1;
                        dgvCashier.Rows[index].Cells[clmnCashierName.Index].Value = c.Name;
                        dgvCashier.Rows[index].Cells[clmnCashierPassword.Index].Value = c.Password;
                    }
                }
                catch (System.Exception)
                {
                    bridge.Log(FormMessage.OPERATION_FAILS);
                }
            }
        }