Exemplo n.º 1
0
 public long Add(ClientEditData client, long userId, long transitId)
 {
     return(_executor.Query <long>("[dbo].[Client_Add]",
                                   new
     {
         client.BIC,
         client.Bank,
         client.Contacts,
         client.Emails,
         client.INN,
         client.KPP,
         client.KS,
         client.LegalAddress,
         client.LegalEntity,
         client.MailingAddress,
         client.Nic,
         client.OGRN,
         client.Phone,
         client.RS,
         UserId = userId,
         TransitId = transitId,
         client.ContractDate,
         client.ContractNumber,
         client.DefaultSenderId,
         client.FactureCost,
         client.FactureCostEx,
         client.TransitCost,
         client.PickupCost,
         client.InsuranceRate,
         client.TariffPerKg,
         client.ScotchCostEdited,
         client.Comments
     }));
 }
Exemplo n.º 2
0
        public long Add(string name, string login, string password, string email, string language)
        {
            var salt         = _converter.GenerateSalt();
            var passwordHash = _converter.GetPasswordHash(password, salt);

            return(_executor.Query <long>("[dbo].[Forwarder_Add]", new
            {
                login,
                PasswordHash = passwordHash,
                PasswordSalt = salt,
                language,
                name,
                email
            }));
        }
Exemplo n.º 3
0
        public long Add(StateEditData data)
        {
            using (var scope = new TransactionScope())
            {
                var id = _executor.Query <long>("[dbo].[State_Add]",
                                                new
                {
                    data.Name,
                    data.Position,
                    IsSystem = false,
                });

                _executor.Execute("[dbo].[StateLocalization_Merge]",
                                  new
                {
                    Name = data.LocalizedName,
                    TwoLetterISOLanguageName = data.Language,
                    StateId = id
                });

                scope.Complete();

                return(id);
            }
        }
Exemplo n.º 4
0
        public Setting AddOrReplace(Setting setting)
        {
            try
            {
                var rowVersion = _executor.Query <byte[]>("[dbo].[Setting_Merge]", setting);

                return(new Setting
                {
                    Data = setting.Data,
                    RowVersion = rowVersion,
                    Type = setting.Type
                });
            }
            catch (DublicateException e)
            {
                throw new UpdateConflictException("Failed to merge setting " + setting.Type, e);
            }
        }
Exemplo n.º 5
0
 public EventData GetNext(EventType type, int partitionId)
 {
     return(_executor.Query <EventData>(
                "[dbo].[Event_GetNext]",
                new
     {
         EventTypeId = type,
         partitionId
     }));
 }
Exemplo n.º 6
0
        public long Add(TransitData transit)
        {
            if (transit.Id > 0)
            {
                throw new InvalidDataException("Id should be undefined");
            }

            return(_executor.Query <long>("[dbo].[Transit_Add]", new
            {
                transit.Address,
                transit.Phone,
                transit.CarrierId,
                transit.CityId,
                transit.DeliveryType,
                transit.MethodOfTransit,
                transit.RecipientName,
                transit.WarehouseWorkingTime
            }));
        }
Exemplo n.º 7
0
        public long Add(string name, string email, string phone, string contact, string address,
                        string login, string password, string language)
        {
            var salt         = _converter.GenerateSalt();
            var passwordHash = _converter.GetPasswordHash(password, salt);

            return(_executor.Query <long>("[dbo].[Carrier_Add]", new
            {
                login,
                PasswordHash = passwordHash,
                PasswordSalt = salt,
                language,
                name,
                email,
                phone,
                contact,
                address
            }));
        }
Exemplo n.º 8
0
        public long Add(ApplicationEditData application)
        {
            var entity = new DbContext.Application();

            Map(application, entity);

            entity.StateId = _defaultStateId;
            entity.StateChangeTimestamp = DateTimeProvider.Now;
            entity.DisplayNumber        = _executor.Query <int>("[dbo].[GetNextDisplayNumber]");
            entity.CreationTimestamp    = DateTimeProvider.Now;

            _context.Applications.InsertOnSubmit(entity);

            _context.SaveChanges();

            return(entity.Id);
        }
Exemplo n.º 9
0
 public long Add(string englishName, string russianName, int position)
 {
     return(_executor.Query <long>("[dbo].[Country_Add]", new { englishName, russianName, position }));
 }
Exemplo n.º 10
0
 public long?GetByUserId(long userId)
 {
     return(_executor.Query <long?>("[dbo].[Sender_GetByUser]", new { userId }));
 }
Exemplo n.º 11
0
 public BillData Get(long applicationId)
 {
     return(_executor.Query <BillData>("[dbo].[Bill_GetByApplicationId]", new { applicationId }));
 }
Exemplo n.º 12
0
 public decimal GetBalance(long clientId)
 {
     return(_executor.Query <decimal>("[dbo].[Client_GetBalance]", new { clientId }));
 }
Exemplo n.º 13
0
 public CalculationData GetByApplication(long applicationId)
 {
     return(_executor.Query <CalculationData>("[dbo].[Calculation_GetByApplication]", new { applicationId }));
 }
Exemplo n.º 14
0
 public UserData Get(long userId)
 {
     return(_executor.Query <UserData>("[dbo].[User_Get]", new { userId }));
 }
Exemplo n.º 15
0
 public EmailMessageData GetNext(EmailMessageState state, int partitionId)
 {
     return(_executor.Query <EmailMessageData>("[dbo].[EmailMessage_GetNext]", new { state, partitionId }));
 }
Exemplo n.º 16
0
 public FileHolder GetClientContract(long clientId)
 {
     return(_executor.Query <FileHolder>("[dbo].[ClientContract_Get]", new { clientId }));
 }
Exemplo n.º 17
0
 public FileHolder Get(long id)
 {
     return(_executor.Query <FileHolder>("[dbo].[AwbFile_Get]", new { id }));
 }
Exemplo n.º 18
0
 public EventTemplateData GetByEventType(EventType eventType)
 {
     return(_executor.Query <EventTemplateData>("[dbo].[EmailTemplate_GetByEvent]",
                                                new { EventTypeId = (int)eventType }));
 }