Пример #1
0
 public VIPPrasadam getTokenById(int TokenId)
 {
     using (var db = new eTempleDbDB())
     {
         return(db.FirstOrDefault <VIPPrasadam>("select v.*, s.Name as ServiceName from VIPPrasadam as v inner join Services as s on v.ServiceId = s.Id where v.Id = @0", TokenId));
     }
 }
 public VIPPrasadam getTokenById(int TokenId)
 {
     using (var db = new eTempleDbDB())
     {
         return db.FirstOrDefault<VIPPrasadam>("select v.*, s.Name as ServiceName from VIPPrasadam as v inner join Services as s on v.ServiceId = s.Id where v.Id = @0", TokenId);
     }
 }
Пример #3
0
 public Token getTokenById(long TokenId)
 {
     using (var db = new eTempleDbDB())
     {
         return(db.FirstOrDefault <Token>(@"select t.*, s.Name as ServiceName, s.Type as ServiceTypeID, s.Type as ServiceType, d.DevoteeName, d.Gothram, d.DoorNumber, d.AreaName, d.City, d.MandalName, d.StateName, p.Name as PrefixName
                                         from Tokens t 
                                         join Services s on (t.ServiceId = s.Id)
                                         left outer join Devotees d on (t.DevoteeId = d.Id)
                                         left outer join Prefixes p on (d.Prefix = p.Id)
                                         where t.Id = @0", TokenId));
     }
 }
Пример #4
0
 public Token GetTokenWithDevoteeDetails(long TokenId)
 {
     using (var db = new eTempleDbDB())
     {
         return(db.FirstOrDefault <Token>(@"select t.*, s.Name as ServiceName, s.Type as ServiceTypeID, s.Type as ServiceType, d.Prefix as PrefixId, d.EmailId as EmailId, d.DevoteeName, d.Gothram, d.DoorNumber, d.AreaName, d.City, d.MandalName, d.DistrictName, d.StateName, d.OtherDetails, d.PhoneNumber, d.AdditionalNames as AdditionalNames, d.AdditionalGothrams as AdditionalGothrams, p.Name as PrefixName, e.Loginid as Created_By, e.Name as Entered_By
                             from Tokens t 
                             join Services s on (t.ServiceId = s.Id)
                             left outer join Devotees d on (t.DevoteeId = d.Id)
                             left outer join Prefixes p on (d.Prefix = p.Id)
                             left outer join Employees e on (e.Id = t.CreatedBy)
                             where  t.Status=1 and t.Id = @0", TokenId));
     }
 }
Пример #5
0
        public List <Token> ProcessTokens(List <Token> tokens, List <Devotee> devotees)
        {
            var savedTokens = new List <Token>();

            using (var db = new eTempleDbDB())
            {
                int tokenCounter = 0;
                foreach (var t in tokens)
                {
                    for (int i = 0; i < t.Quantity; i++)
                    {
                        var newToken = new Token();
                        newToken.ServiceId = t.ServiceId;
                        newToken.Quantity  = 1; // we always create a new record for each ticket.
                        newToken.TotalCost = t.TotalCost / t.Quantity;
                        if (devotees.Count > tokenCounter)
                        {
                            var tokenDevotee = devotees[tokenCounter];
                            if (tokenDevotee.Id == 0)
                            {
                                // use the first devotee if other devotee details are not mentioned.
                                tokenDevotee = devotees.FirstOrDefault(d => d.Id != 0);
                            }
                            if (tokenDevotee != null)
                            {
                                newToken.DevoteeId = tokenDevotee.Id;
                            }
                        }

                        newToken.CreatedBy = t.CreatedBy;
                        newToken.CreatedOn = t.CreatedOn;

                        db.Save(newToken);

                        newToken = db.FirstOrDefault <Token>(@"select t.*, s.Name as ServiceName, s.Type as ServiceTypeID, s.Type as ServiceType, d.DevoteeName, d.Gothram, D.AdditionalNames, d.AdditionalGothrams, p.Name as PrefixName
                                            from Tokens t 
                                            join Services s on (t.ServiceId = s.Id)
                                            left outer join Devotees d on (t.DevoteeId = d.Id)
                                            left outer join Prefixes p on (d.Prefix = p.Id)
                                            where t.Id = @0", newToken.Id);

                        savedTokens.Add(newToken);

                        tokenCounter++;
                    }
                }
            }

            return(savedTokens);
        }
Пример #6
0
        public List<Token> ProcessTokens(List<Token> tokens, List<Devotee> devotees)
        {
            var savedTokens = new List<Token>();
            using (var db = new eTempleDbDB())
            {
                int tokenCounter = 0;
                foreach (var t in tokens)
                {
                    for (int i = 0; i < t.Quantity; i++)
                    {
                        var newToken = new Token();
                        newToken.ServiceId = t.ServiceId;
                        newToken.Quantity = 1; // we always create a new record for each ticket.
                        newToken.TotalCost = t.TotalCost / t.Quantity;
                        if (devotees.Count > tokenCounter)
                        {
                            var tokenDevotee = devotees[tokenCounter];
                            if (tokenDevotee.Id == 0)
                            {
                                // use the first devotee if other devotee details are not mentioned.
                                tokenDevotee = devotees.FirstOrDefault(d => d.Id != 0);
                            }
                            if (tokenDevotee != null)
                            {
                                newToken.DevoteeId = tokenDevotee.Id;
                            }
                        }

                        newToken.CreatedBy = t.CreatedBy;
                        newToken.CreatedOn = t.CreatedOn;

                        db.Save(newToken);

                        newToken = db.FirstOrDefault<Token>(@"select t.*, s.Name as ServiceName, s.Type as ServiceTypeID, s.Type as ServiceType, d.DevoteeName, d.Gothram, D.AdditionalNames, d.AdditionalGothrams, p.Name as PrefixName
                                            from Tokens t
                                            join Services s on (t.ServiceId = s.Id)
                                            left outer join Devotees d on (t.DevoteeId = d.Id)
                                            left outer join Prefixes p on (d.Prefix = p.Id)
                                            where t.Id = @0", newToken.Id);

                        savedTokens.Add(newToken);

                        tokenCounter++;
                    }
                }
            }

            return savedTokens;
        }
Пример #7
0
 public Token GetTokenWithDevoteeDetails(long TokenId)
 {
     using (var db = new eTempleDbDB())
     {
         return db.FirstOrDefault<Token>(@"select t.*, s.Name as ServiceName, s.Type as ServiceTypeID, s.Type as ServiceType, d.Prefix as PrefixId, d.EmailId as EmailId, d.DevoteeName, d.Gothram, d.DoorNumber, d.AreaName, d.City, d.MandalName, d.DistrictName, d.StateName, d.OtherDetails, d.PhoneNumber, d.AdditionalNames as AdditionalNames, d.AdditionalGothrams as AdditionalGothrams, p.Name as PrefixName, e.Loginid as Created_By, e.Name as Entered_By
                             from Tokens t
                             join Services s on (t.ServiceId = s.Id)
                             left outer join Devotees d on (t.DevoteeId = d.Id)
                             left outer join Prefixes p on (d.Prefix = p.Id)
                             left outer join Employees e on (e.Id = t.CreatedBy)
                             where  t.Status=1 and t.Id = @0", TokenId);
     }
 }
Пример #8
0
 public Token getTokenById(long TokenId)
 {
     using (var db = new eTempleDbDB())
     {
         return db.FirstOrDefault<Token>(@"select t.*, s.Name as ServiceName, s.Type as ServiceTypeID, s.Type as ServiceType, d.DevoteeName, d.Gothram, d.DoorNumber, d.AreaName, d.City, d.MandalName, d.StateName, p.Name as PrefixName
                                         from Tokens t
                                         join Services s on (t.ServiceId = s.Id)
                                         left outer join Devotees d on (t.DevoteeId = d.Id)
                                         left outer join Prefixes p on (d.Prefix = p.Id)
                                         where t.Id = @0", TokenId);
     }
 }