public int AddPolicy(travel_policy TravelPolicy)
 {
     TravelPolicy.Payment_Status = false;
     _db.travel_policy.Add(TravelPolicy);
     _db.SaveChanges();
     return(TravelPolicy.ID);
 }
        public void AddOkSetup(Ok_SetupModel ok)
        {
            ok_setup ok2 = _db.ok_setup.Create();

            ok2 = Mapper.Map <Ok_SetupModel, ok_setup>(ok);
            _db.ok_setup.Add(ok2);
            _db.SaveChanges();
        }
        public void AddDiscount(DiscountModel discount)
        {
            discount_codes discount2 = _db.discount_codes.Create();

            discount2 = Mapper.Map <DiscountModel, discount_codes>(discount);
            _db.discount_codes.Add(discount2);
            _db.SaveChanges();
        }
        public int AddInsured(insured Insured)
        {
            var InsuredData = _db.insureds.Where(x => x.SSN == Insured.SSN).FirstOrDefault();

            if (InsuredData != null)
            {
                return(InsuredData.ID);
            }
            _db.insureds.Add(Insured);
            _db.SaveChanges();
            return(Insured.ID);
        }
示例#5
0
        public int UpdateUser(User editedUser)
        {
            aspnetuser editedUserDb = GetUserDataByUsername(editedUser.UserName);

            editedUserDb.UserName          = editedUser.UserName;
            editedUserDb.FirstName         = editedUser.FirstName;
            editedUserDb.LastName          = editedUser.LastName;
            editedUserDb.City              = editedUser.City;
            editedUserDb.Address           = editedUser.Address;
            editedUserDb.Municipality      = editedUser.Municipality;
            editedUserDb.MobilePhoneNumber = editedUser.MobilePhoneNumber;
            editedUserDb.Email             = editedUser.Email;
            editedUserDb.DateOfBirth       = editedUser.DateOfBirth;
            editedUserDb.EMBG              = editedUser.EMBG;
            editedUserDb.Gender            = editedUser.Gender;
            editedUserDb.PassportNumber    = editedUser.PassportNumber;
            editedUserDb.PostalCode        = editedUser.PostalCode;
            editedUserDb.PhoneNumber       = editedUser.PhoneNumber;
            var userRole = editedUserDb.aspnetroles.FirstOrDefault();

            if (userRole != null && userRole.Name != editedUser.Role)
            {
                aspnetrole previousUserRole = _db.aspnetroles.Where(x => x.Name == userRole.Name).FirstOrDefault();
                if (previousUserRole != null)
                {
                    editedUserDb.aspnetroles.Remove(previousUserRole);
                }
                AuthRepository _repo = new AuthRepository();
                try
                {
                    _repo.AddUserToRole(editedUserDb.Id, editedUser.Role);
                }
                catch (Exception ex)
                {
                }
            }

            int result = -1;

            try
            {
                result = _db.SaveChanges();
            }
            catch (Exception ex)
            {
            }

            return(result);
        }
        public notification AddNotification(string title, string content)
        {
            var notification = new notification
            {
                CreatedDate = DateTime.Now,
                Title       = title,
                Content     = content,
                URL         = "/Kanban/Index"
            };

            _db.notifications.Add(notification);
            _db.SaveChanges();

            return(notification);
        }
        private int SaveDBChanges()
        {
            int result = 0;

            try
            {
                result = _db.SaveChanges();
            }
            catch (Exception ex)
            {
                Debug.WriteLine($"Error saving request to db: {ex.ToString()}");
            }
            return(result);
        }
        public void getUnreadEmails()
        {
            InsuredTravelingEntity entities = new InsuredTravelingEntity();
            string n = "[notification]";

            using (ImapClient client = new ImapClient("imap.zoho.com", 993,
                                                      "*****@*****.**", "Enter4Sy", AuthMethod.Login, true))
            {
                IEnumerable <uint> uids = client.Search(SearchCondition.Unseen());

                foreach (uint uid in uids)
                {
                    MailMessage message = client.GetMessage(uid);
                    news_all    news    = entities.news_all.Create();;
                    news.Title            = message.Subject.Trim();
                    news.Content          = message.Body.Trim();
                    news.DataCreated      = (DateTime)message.Date();
                    news.InsuranceCompany = "Eurolink";
                    Random r = new Random();
                    //news.ID = r.Next(10000, 99999);
                    if (message.Subject.ToLower().StartsWith(n))
                    {
                        news.isNotification = true;
                    }
                    else
                    {
                        news.isNotification = false;
                    }

                    entities.news_all.Add(news);

                    client.MoveMessage(uid, "SeenNews");
                    client.DeleteMessage(uid, "Inbox");
                }

                client.Expunge("Inbox");
                client.Dispose();

                if (uids.Count() != 0)
                {
                    entities.SaveChanges();
                }
            }
        }
 public void Add(luggage_insurance LuggageInsurance)
 {
     _db.luggage_insurance.Add(LuggageInsurance);
     _db.SaveChanges();
 }
 public void AddBoard(string Name, string Description, string Color)
 {
     _db.kanbanboards.Add(new kanbanboard
     {
         Name        = Name,
         Description = Description,
         Color       = Color
     });
     _db.SaveChanges();
 }
 public void AddNews(news_all News)
 {
     _db.news_all.Add(News);
     _db.SaveChanges();
 }
示例#12
0
 public int Archive(first_notice_of_loss_archive archiveFnol)
 {
     _db.first_notice_of_loss_archive.Add(archiveFnol);
     _db.SaveChanges();
     return(archiveFnol.ID);
 }
示例#13
0
 public int Add(additional_info additionalInfo)
 {
     _db.additional_info.Add(additionalInfo);
     _db.SaveChanges();
     return(additionalInfo.ID);
 }
示例#14
0
 public int AddBank(bank bank)
 {
     _db.banks.Add(bank);
     _db.SaveChanges();
     return(bank.ID);
 }
示例#15
0
 public int Add(policy_insured policyInsured)
 {
     _db.policy_insured.Add(policyInsured);
     _db.SaveChanges();
     return(policyInsured.ID);
 }
 public int Add(first_notice_of_loss FirstNoticeOfLoss)
 {
     _db.first_notice_of_loss.Add(FirstNoticeOfLoss);
     _db.SaveChanges();
     return(FirstNoticeOfLoss.ID);
 }
示例#17
0
 public void Add(health_insurance HealthInsurance)
 {
     _db.health_insurance.Add(HealthInsurance);
     _db.SaveChanges();
 }
 public void AddTransaction(transaction Transaction)
 {
     _db.transactions.Add(Transaction);
     _db.SaveChanges();
 }
示例#19
0
 public int AddAdditionalChargesPolicy(policy_additional_charge policyAdditionalCharge)
 {
     _db.policy_additional_charge.Add(policyAdditionalCharge);
     _db.SaveChanges();
     return(policyAdditionalCharge.ID);
 }