Beispiel #1
0
        public bool changeClientInfo(int companyCode)
        {
            try
            {
                if (Card.cashierCheck(loginInfo, ip))
                {
                    CardInfo cardInfo = new CardInfo(cardInfoString, loginInfo, ip);
                    if (Card.licenseCheckResponse(cardInfo, companyCode))
                    {
                        var matches = Regex.Matches(cardInfo.inputInfo, @"([0-9])+");

                        string  cardId = matches[1].ToString();
                        SqlConn conn   = new SqlConn();
                        Card    card   = conn.select("cards", "card_id='" + cardId + "'");
                        updateContacts(card, email, telephone, conn);
                        if (numberOfClients != 0)
                        {
                            conn.delete("client_info", "card_id='" + cardId + "'");
                            updateParentNameCard(card, parentName, conn);

                            foreach (var client in clients)
                            {
                                Client.addClient(client);
                            }
                            return(true);
                        }
                        else
                        {
                            conn.delete("client_info", "card_id='" + cardId + "'");
                            updateParentNameCard(card, parentName, conn);
                            Client.addClient(new Client {
                                cardId = cardId, childrenName = "", childrenDate = "", parentName = parentName, adultCard = 1
                            });
                            return(true);
                        }
                    }
                }
                return(false);
            }
            catch
            {
                return(false);
            }
        }
Beispiel #2
0
        public bool addClientInfo(int companyCode)
        {
            try
            {
                if (Card.cashierCheck(loginInfo, ip))
                {
                    CardInfo cardInfo = new CardInfo(cardInfoString, loginInfo, ip);
                    if (Card.licenseCheckResponse(cardInfo, companyCode))
                    {
                        var matches = Regex.Matches(cardInfo.inputInfo, @"([0-9])+");

                        string  cardId = matches[1].ToString();
                        SqlConn conn   = new SqlConn();
                        Card    card   = conn.select("cards", "card_id='" + cardId + "'");
                        if (numberOfClients != 0)
                        {
                            conn.delete("client_info", "card_id='" + cardId + "'");

                            foreach (var client in clients)
                            {
                                client.cardId = cardId;
                                Client.addClient(client);
                            }
                            return(true);
                        }
                        else
                        {
                            conn.delete("client_info", "card_id='" + cardId + "'");
                            Client.addClient(new Client {
                                cardId = cardId, childrenName = "", childrenDate = "", parentName = parentName, adultCard = 1
                            });
                            return(true);
                        }
                    }
                }
                return(false);
            }
            catch (Exception exc)
            {
                Console.WriteLine(exc.ToString());
                logger.Info(exc.ToString());
                return(false);
            }
        }