Beispiel #1
0
        public static IEnumerable <CardsBonusAccountsTrans> GetTransactions(Set10ExchangeLoyClient client, DateTime bDate, DateTime eDate, NpgsqlConnection dbCon = null)
        {
            var dbConnection = GetConnection(dbCon);
            var result       = dbConnection.Query <CardsBonusAccountsTrans>(BaseScriptsPG.GetTransactionsScript, new { client.BonusAccountId, bDate, eDate });

            return(result);
        }
Beispiel #2
0
        private void SaveKit(IEnumerable <string> cards)
        {
            var client     = new ClientKit();
            var clientInfo = new Set10ExchangeLoyClient(Guid.NewGuid(), null, DbPg.GetHibernateSequenceNextVal(), null, null, null, null, null, 0, 3, 10, DateTime.Now, string.Empty);
            var cardsList  = new ObservableCollection <Set10ExchangeLoyCard>();

            foreach (var card in cards)
            {
                cardsList.Add(new Set10ExchangeLoyCard(clientInfo.Uid, clientInfo.Set10Guid, DbPg.GetHibernateSequenceNextVal(), card, clientInfo.BonusAccountId));
            }
            client.Client = clientInfo;
            client.Cards  = cardsList;

            try
            {
                client.Save();
                if (IsPrintLabel)
                {
                    Printer.Print(client.Cards[0]?.CardHexNumber, client.Cards[1]?.CardHexNumber, client.Client.Set10Guid.ToString());
                }
                IsScansCount++;
                EventMsg = $"Комплект с номером {client.Client.Set10Guid} создан";
            }
            catch (Exception ex)
            {
                EventMsg = ex.Message;
            }
        }
Beispiel #3
0
        public static ClientKit GetClientFullInfo(Set10ExchangeLoyClient client, SqlConnection dbConnection = null)
        {
            var clientFull = new ClientKit();

            clientFull.Client = client;
            clientFull.Cards  = new ObservableCollection <Set10ExchangeLoyCard>(DbMs.GetCardsByClientUid(client.Uid, dbConnection));
            return(clientFull);
        }
        private void Client(Set10ExchangeLoyClient client, bool isExistClient, IDbTransaction transaction, NpgsqlConnection dbConnection)
        {
            var cli = new CardClients
            {
                Id                   = client.Set10Guid.Value,
                Auto                 = false,
                Birthdate            = client.BirthDate,
                Childrenage          = string.Empty,
                Appartment           = string.Empty,
                Building             = string.Empty,
                City                 = string.Empty,
                District             = string.Empty,
                Districtarea         = string.Empty,
                House                = string.Empty,
                Other                = string.Empty,
                Region               = string.Empty,
                Street               = string.Empty,
                Zip                  = string.Empty,
                Deleted              = false,
                Email                = client.EMail,
                Firstname            = client.FirstName,
                Guid                 = client.Set10Guid,
                Iscompleted          = true,
                Lastchangedate       = DateTime.Now,
                Lastname             = client.LastName,
                Marital              = false,
                Middlename           = client.MiddleName,
                Mobileoperator       = string.Empty,
                Mobilephone          = client.MobilePhone,
                Delivery             = string.Empty,
                Deliverydate         = null,
                Passnumber           = string.Empty,
                Passserie            = string.Empty,
                Phone                = string.Empty,
                Bymail               = false,
                Bysms                = false,
                Byphone              = false,
                Byemail              = false,
                Sendcatalog          = false,
                Sex                  = 0,
                Shopnumber           = string.Empty,
                Creationdate         = DateTime.Now,
                Bonusbalance         = 0,
                Clienttype           = 0,
                ReceiptFeedbackMeans = 0,
                SmartphoneType       = null,
                WantsECard           = false
            };

            if (isExistClient)
            {
                DbPg.UpdateClient(cli, dbConnection, transaction);
            }
            else
            {
                DbPg.InsertClient(cli, dbConnection, transaction);
            }
        }
Beispiel #5
0
        public static void SaveClientInfo(Set10ExchangeLoyClient client)
        {
            using (var dbConnection = new SqlConnection(ConnectionSettings.ConMsStr))
            {
                dbConnection.Open();
                using (var tran = dbConnection.BeginTransaction())
                {
                    if (client.IsNew)
                    {
                        dbConnection.Execute(BaseScriptsMs.InsertClientSript,
                                             new
                        {
                            client.Uid,
                            client.Set10Guid,
                            client.BonusAccountId,
                            client.LastName,
                            client.FirstName,
                            client.MiddleName,
                            client.BirthDate,
                            client.MobilePhone,
                            client.SexId,
                            client.CategoryId,
                            client.ChangeTypeId,
                            client.Ldm
                        });
                    }
                    else if (!client.IsNew)
                    {
                        dbConnection.Execute(BaseScriptsMs.UpdateClientSript,
                                             new
                        {
                            client.Uid,
                            client.LastName,
                            client.FirstName,
                            client.MiddleName,
                            client.BirthDate,
                            client.MobilePhone,
                            client.SexId,
                            client.CategoryId
                        });
                    }

                    try
                    {
                        tran.Commit();
                    }
                    catch (Exception e)
                    {
                        tran.Rollback();

                        throw new Exception("SaveClientInfo error!", e);
                    }
                }
            }
        }
        private void Cards(Set10ExchangeLoyClient client, List <CardsCompositions> cardComposition, IDbTransaction transaction, NpgsqlConnection dbConnection)
        {
            foreach (var card in cardComposition)
            {
                var set10Card = new CardCards(card.MasterCard.Set10Guid.Value, DateTime.Now.Date, 0, null, DateTime.Now.Date, false, DateTime.Parse("01-01-2021"), card.MasterCard.Set10Guid.Value, card.MasterCard.CardNumber, (card.MasterCard.IsBlocked == false ? 0 : 2), string.Empty, 2059, client.Set10Guid, null, null, null, String.Empty);
                if (card.CardById == null && card.CardByNumCard != null)
                {
                    DbPg.DeleteCardByNumCard(set10Card, dbConnection, transaction);
                }
                if (card.CardById == null)
                {
                    DbPg.InsertCard(set10Card, card.MasterCard.BonusAccountId, dbConnection, transaction);
                }
                else
                {
                    DbPg.UpdateCard(set10Card, dbConnection, transaction);
                }

                if (card.CardById?.Clientid == null)
                {
                    DbPg.UpdateCardClientIdIEmpty(set10Card, dbConnection, transaction);
                }
            }
        }
Beispiel #7
0
        public static IEnumerable <Set10ExchangeLoyAmmounts> GetBonus(Set10ExchangeLoyClient client, NpgsqlConnection dbCon = null)
        {
            var dbConnection = GetConnection(dbCon);

            return(dbConnection.Query <Set10ExchangeLoyAmmounts>(BaseScriptsPG.BonusByGuidScript, new { client.Set10Guid }));
        }
Beispiel #8
0
 public SelectedClientInfoEventArgs(Set10ExchangeLoyClient clientInfo)
 {
     Client = clientInfo;
 }
        //private bool CheckIdentityCard(CardsCompositions cardCompot)
        //{
        //    if (cardCompot.CardById.)
        //    return false;
        //}

        private void BonusAccounts(Set10ExchangeLoyClient client, IDbTransaction transaction, NpgsqlConnection dbConnection)
        {
            DbPg.InsertBonusAccount(client.BonusAccountId, client.BonusAccountId, dbConnection, transaction);
        }