public override void Numeric(char c) { password.Append(c.ToString()); if (password.Length == 1) { DisplayAdapter.Cashier.Show("{0}{1}", PosMessage.ENTER_PASSWORD, "*"); DisplayAdapter.Cashier.Append("*"); } else if (password.Length == 6) { ICashier cashier = cr.DataConnector.FindCashierByPassword(password.ToString()); if (cashier != null && cashier.AuthorizationLevel == AuthorizationLevel.Z) { cr.State = States.Login.Instance(); } else { DisplayAdapter.Cashier.Append("*"); password = new StringBuilder(); DisplayAdapter.Cashier.Show("{0}{1}\n{2}", PosMessage.INVALID_PASSWORD, "*", PosMessage.PROMPT_RETRY); } } else { DisplayAdapter.Cashier.Append("*"); } return; }
public void CreateCashier(string name, decimal salery, string telephone) { ICashier c = dbf.CreateCashier(name, salery, telephone); cashierCollection.Add((Cashier)c); actualCashier = c; }
public static IState GetCashierValue(ICashier cashier) { values[parameterCount] = cashier; parameterCount++; return(GetParameters()); }
public override ICashier ChooseCashier(ISet <ICashier> cashiers) { if (cashiers == null || cashiers.Count == 0) { return(null); } ICashier selectedCashier = null; int minLineLength = int.MaxValue; foreach (var cashier in cashiers) { int cashierLineLength = cashier.CalculateQueueLength(ArrivalTime); if (cashierLineLength < minLineLength) { minLineLength = cashierLineLength; selectedCashier = cashier; } else if (cashierLineLength == minLineLength) { if (selectedCashier != null && selectedCashier.Id > cashier.Id) { selectedCashier = cashier; } } } Debug.Assert(selectedCashier != null, "no cashier selected by A"); return(selectedCashier); }
/// <summary> Владелец ларька с шаурмой </summary> public ShaurmaTruckOwner(ICleaner cleaner, ICooker cooker, IDriver driver, ICashier cashier) { _cleaner = cleaner; _cooker = cooker; _driver = driver; _cashier = cashier; }
public AnalyticsController( ICashier cashier, IAbstractFactory abstractFactory) { _cashier = cashier; _abstractFactory = abstractFactory; }
public static void SignInCashier(ICashier cashier) { try { manager = cr.Printer.SignInCashier(managerId, password.ToString()); } catch (CashierAlreadyAssignedException caae) { cr.Log.Error("CashierAlreadyAssignedException occured. {0}", caae.Message); if (!cashier.Id.Equals(caae.CashierId)) { cr.Printer.SignOutCashier(); SignInCashier(cashier); } } catch (CmdSequenceException cse) { if (cse.LastCommand == 37) { cr.Printer.AdjustPrinter(new Invoice()); cr.Printer.Void(); cr.Printer.AdjustPrinter(new Receipt()); } } }
/// <summary> /// Adds the given element to the collection /// </summary> /// <param name="item">The item to add</param> public override void Add(IModelElement item) { if ((this._parent.Cashier == null)) { ICashier cashierCasted = item.As <ICashier>(); if ((cashierCasted != null)) { this._parent.Cashier = cashierCasted; return; } } if ((this._parent.PointOfSale == null)) { IPointOfSale pointOfSaleCasted = item.As <IPointOfSale>(); if ((pointOfSaleCasted != null)) { this._parent.PointOfSale = pointOfSaleCasted; return; } } IReceipt receiptsCasted = item.As <IReceipt>(); if ((receiptsCasted != null)) { this._parent.Receipts.Add(receiptsCasted); } ITransaction transactionsCasted = item.As <ITransaction>(); if ((transactionsCasted != null)) { this._parent.Transactions.Add(transactionsCasted); } }
public IPrinterResponse SignInCashier(ICashier ch) { string id = ch.Id; if (File.Exists(cashierLog)) { id = IOUtil.ReadAllText(cashierLog).Trim(); cashier = DataConnector.FindCashierById(id); if (id == ch.Id) { cashier = ch; return(toResponse); } else if (id != "") { throw new CashierAlreadyAssignedException("already assigned", id); } } StartCurrentLog(2000); IOUtil.WriteAllText(cashierLog, ch.Id); guiDocument.AddLines(Logo); guiDocument.AddLines(Formatter.FormatReceiptHeader("FÝÞ", currentDocumentId)); guiDocument.AddLines(Formatter.FormatInfo(String.Format("KASÝYER : {0} {1}", ch.Id, ch.Name).PadRight(40))); guiDocument.AddLines(Formatter.FormatInfo("GÝRÝÞ".PadRight(40))); guiDocument.AddLine(""); guiDocument.AddLines(Formatter.FormatEnd()); cashier = ch; return(toResponse); }
void Login_OnLogin(ICashier sender) { if (CashRegister.Document != null && CashRegister.Document.Items.Count > 0) { display.ChangeDocumentStatus(CashRegister.Document, DisplayDocumentStatus.OnChange); } }
public TestGreenCycle() { //Arrange ICashRegister cashRegister = new CashRegister(); _cashier = new Cashier(cashRegister); }
public void DeleteCashier(ICashier c) { // Kald til DB... dbf.DeleteCashier(c); // Opdater model cashierCollection.Remove((Cashier) c); }
public void DeleteCashier(ICashier c) { // Kald til DB... dbf.DeleteCashier(c); // Opdater model cashierCollection.Remove((Cashier)c); }
internal void OnCashierLogout(ICashier cashier) { String logText = String.Format("1,{0},15,LOT, {1},{2:HH:mm:ss}", sequenceNumber++.ToString().PadLeft(5, '0'), cashier.Id, DateTime.Now); SaveLog(logText.PadRight(40)); currentCashier = null; }
internal void OnCashierLogin(ICashier cashier, int zReportNo) { String logText = String.Format("1,{0},14,LIN, {1},{2:HH:mm:ss}", sequenceNumber++.ToString().PadLeft(5, '0'), cashier.Id, DateTime.Now); SaveLog(logText.PadRight(40)); currentCashier = cashier; lastZNo = zReportNo; }
void SecurityConnector_CashierCaptured(object sender, EventArgs e) { ICashier cashier = sender as ICashier; if (cashier == cr.CurrentCashier) { return; } DisplayAdapter.Cashier.Show(String.Format("İKİNCİ KASİYER\n{0}", cashier.Name)); Instance(); }
private void dataGridCashier_SelectionChanged(object sender, SelectionChangedEventArgs e) { ICashier c = (ICashier)dataGridCashier.CurrentItem; if (c != null) { controller.actualCashier = c; textBoxName.Text = c.Name; textBoxSalery.Text = c.Salery.ToString(); textBoxTelephone.Text = c.Telephone; } }
public override IState ConfirmSalesPerson(ICashier salesPerson) { if (salesPerson == null) { return(States.Start.Instance()); } Confirm confirm = new Confirm(String.Format("{0}{1}", PosMessage.CLERK_FOR_ITEM, salesPerson.Name.TrimEnd()), new StateInstance <Hashtable>(SaveSalesPerson), new StateInstance(States.EnterPassword.Instance)); confirm.Data.Add("SalesPerson", salesPerson); return(States.ConfirmCashier.Instance(confirm)); }
internal static IState PrintRegisterReportSummary(ICashier cashier, DateTime startZDate, DateTime endZDate, bool hardcopy) { if (cr.Printer is IPeriodicCashierReport) { cr.State = States.WaitingState.Instance(); DisplayAdapter.Cashier.Show(PosMessage.WRITING_PROGRAM_REPORT); IPrinterResponse response = ((IPeriodicCashierReport)cr.Printer).PrintRegisterReportSummary(cashier, startZDate, endZDate, hardcopy); if (!response.HasError || !hardcopy) { cr.DataConnector.SaveReport("ORAPORU", response.Detail); } } return(States.Start.Instance()); }
public ICashier CheckAutoLogin() { // System.Threading.Thread.Sleep(500); if (File.Exists(IOUtil.ProgramDirectory + "autologin.dat")) { String id = IOUtil.ReadAllText(IOUtil.ProgramDirectory + "autologin.dat"); currentCashier = DataConnector.FindCashierById(id); if (currentCashier != null) { return(currentCashier); } } return(null); }
private static IState PrintZReport() { DisplayAdapter.Cashier.Show(PosMessage.WRITING_Z_REPORT); BackgroundWorker.IsfterZreport = true; IPrinterResponse response = cr.Printer.PrintZReport(); if (!response.HasError) { cr.DataConnector.SaveReport("ZRAPORU", response.Detail); } manager = null; return(Instance()); }
private static ICashier CheckCashier(String password) { ICashier cashier = null; try { cashier = cr.SecurityConnector.LoginCashier(String.Format("{0:D6}", password)); } catch (Exception ex) { cr.State = States.AlertCashier.Instance(new Error(ex)); } if (cashier == null) { return(cashier); } if (cashier.AuthorizationLevel == AuthorizationLevel.Seller) { cr.State = States.AlertCashier.Instance( new Error( new Exception( String.Format("{0}\n{1}", cashier.Name.Trim(), PosMessage.NO_ACCESS_RIGHT)) ) ); return(null); } cr.CurrentCashier = cashier; Confirm err = new Confirm(String.Format("{0}\n{1}\t{2}", cr.CurrentCashier.Name, PosMessage.ACCESS_LEVEL, cr.CurrentCashier.AuthorizationLevel), new StateInstance(LoginCashier), new StateInstance(EscapeCashier)); cr.State = States.ConfirmCashier.Instance(err); // Set cashier name to ECR on current manager try { cr.Printer.SaveCashier(int.Parse(manager.Id), cashier.Name); } catch { } return(cashier); }
public void UpdateCashier(int cashier_id, string name, decimal salery, string telephone) { Cashier theCashier; // Opdater model theCashier = cashierCollection.First(c => c.Cashier_id == cashier_id); theCashier.Name = name; theCashier.Salery = salery; theCashier.Telephone = telephone; actualCashier = theCashier; // Opdatere DB dbf.UpdateCashier(cashier_id, name, salery, telephone); }
/// <summary> /// /// </summary> /// <param name="c"></param> public override void Numeric(char c) { password.Append(c.ToString()); if (password.Length == 6) { salesPerson = cr.DataConnector.FindCashierByPassword(password.ToString()); DisplayAdapter.Cashier.Show(PosMessage.CLERK + " ({0})\n{1}", subtotal ? PosMessage.TOTAL : PosMessage.PRODUCT, (salesPerson != null) ? salesPerson.Name : PosMessage.INVALID_PASSWORD); password = new StringBuilder(); return; } DisplayAdapter.Cashier.Show(PosMessage.CLERK + " ({0})\n{1}", subtotal ? PosMessage.TOTAL : PosMessage.PRODUCT, password.ToString()); }
public IPrinterResponse SignOutCashier() { StartCurrentLog(3000); guiDocument.AddLines(Logo); guiDocument.AddLines(Formatter.FormatReceiptHeader("FÝÞ", currentDocumentId)); if (cashier != null) { guiDocument.AddLines(Formatter.FormatInfo(String.Format("KASÝYER : {0} {1}", cashier.Id, cashier.Name).PadRight(40))); } guiDocument.AddLines(Formatter.FormatInfo("ÇIKIÞ".PadRight(40))); guiDocument.AddLine(""); guiDocument.AddLines(Formatter.FormatEnd()); cashier = null; IOUtil.WriteAllText(cashierLog, ""); return(toResponse); }
public void DeleteCashier(ICashier c) { // Her skal jeres trylleri være der sletter i DB'EN SqlCommand cmd = new SqlCommand("DeleteCashier", dbconn); cmd.CommandType = CommandType.StoredProcedure; // VIGTIG!!!! SqlParameter parameter; // Slet post med id c.Cashier_id parameter = new SqlParameter("@cashier_id", SqlDbType.Int); parameter.Value = c.Cashier_id; cmd.Parameters.Add(parameter); cmd.ExecuteNonQuery(); }
public ItogOrderController( IDayResult dayResult, IOrderServicesCarWashServices orderServices, IOrderCarWashWorkersServices orderCarWashWorkers, ICarWashWorkersServices carWashWorkers, ICashier cashier, IBrigadeForTodayServices brigadeForToday, IEmployeeRateModules employeeRate, IEmployeesFacade employeesFacade) { _dayResult = dayResult; _orderServices = orderServices; _orderCarWashWorker = orderCarWashWorkers; _carWashWorkers = carWashWorkers; _cashier = cashier; _brigadeForToday = brigadeForToday; _employeeRate = employeeRate; _employeesFacade = employeesFacade; }
internal static List <string> FormatRegisterDocument(int registerDocTypes, decimal amount) { currentLines = new List <string>(); List <string> lines = new List <string>(); //--------------------- FormatLine(new Location(productNameLocation.X, currentLines.Count + 1), "".PadRight(FiscalPrinter.CHAR_PER_LINE, '-')); String label = ""; if (registerDocTypes == 101) { label = PosMessage.RECEIVE_CASH; } else { label = PosMessage.ENTER_CASH; } FormatLine(new Location(productNameLocation.X, currentLines.Count + 1), label); FormatLine(new Location(productAmountLocation.X - maxAmountWidth, currentLines.Count), String.Format("{0," + maxAmountWidth + "}", "*" + new Number(amount).ToString("C"))); //--------------------- FormatLine(new Location(productNameLocation.X, currentLines.Count + 1), "".PadRight(FiscalPrinter.CHAR_PER_LINE, '-')); FormatLine(new Location(productNameLocation.X, currentLines.Count + 1), String.Empty); String cashierInfo = String.Empty; ICashier cashier = FiscalPrinter.Cashier; if (CurrentSettings.GetProgramOption(Setting.ShowCashierNameOnReceipt) == PosConfiguration.ON) { cashierInfo = cashier.Name.TrimEnd(); } cashierInfo = String.Format("{0} : {1} {2}", PosMessage.CASHIER, cashier.Id, cashierInfo); FormatLine(new Location(productNameLocation.X, currentLines.Count + 1), cashierInfo); lines.AddRange(currentLines); lines.AddRange(FormatEnd()); return(lines); }
static void CheckAutoLogin(ICashier cashier) { if (cr.CurrentCashier == null) { try { CheckCashier((cashier.Password)); if (cr.DataConnector.CurrentSettings.GetProgramOption(Setting.AutoLogin) == 1) { cr.CurrentCashier = cashier; state = LoginCashier(); } } catch (Exception ex) { cr.Log.Error("Kasiyer giriþi yapýlmadý."); cr.Log.Error(ex); } } }
private static IState AccecptCashier(String password) { ICashier cashier = null; try { cashier = cr.SecurityConnector.LoginCashier(String.Format("{0:D6}", password)); if (cashier == null) { Confirm err = new Confirm(PosMessage.INVALID_CASHIER, EnterCashier); cr.State = States.AlertCashier.Instance(err); } else { // For set authorized cashier name before operation try { cr.Printer.SaveCashier(int.Parse(cr.CurrentManager.Id), cashier.Name); } catch { } cr.State = CheckCashierAuthorization(cashier); } } catch (CashierAutorizeException cae) { cr.Log.Error(cae); cr.State = States.AlertCashier.Instance(new Confirm(PosMessage.INVALID_CASHIER, EnterCashier)); } catch (Exception ex) { cr.Log.Error(ex); cr.State = States.AlertCashier.Instance(new Error(ex, EnterCashier)); } return(cr.State); }
public bool DeleteCashier(ICashier ch) { bool retVal = true; if (cashiersById.ContainsKey(ch.Id) && cashiersByPassword.ContainsKey(ch.Password)) { cashiersById.Remove(ch.Id); cashiersByPassword.Remove(ch.Password); string strId = String.Format(" {0:D4}", ch.Id); retVal = updateLine(strId, true); } else { retVal = false; } return(retVal); }
public void FixtureSetUp() { _cashier = new Cashier(new Checkout(_prices, _discounters)); }
public int Compare(ICashier x, ICashier y) { return x.Id.CompareTo(y.Id); }
//sorts by queue/cashier id public int CompareTo(ICashier other) { return Compare(this, other); }
public void CreateCashier(string name, decimal salery, string telephone) { ICashier c = dbf.CreateCashier( name, salery, telephone); cashierCollection.Add((Cashier) c); actualCashier = c; }