Esempio n. 1
0
        public void Update(ImportantDeadline item)
        {
            using (APCRSHREntities context = new APCRSHREntities())
            {
                var importantDeadline = context.ImportantDeadlines.Where(i => i.DeadlineID.Equals(item.DeadlineID)).SingleOrDefault();
                if (importantDeadline != null)
                {
                    importantDeadline.Title        = item.Title;
                    importantDeadline.ShortContent = item.ShortContent;
                    importantDeadline.Contents     = item.Contents;
                    importantDeadline.ActionURL    = !string.IsNullOrEmpty(item.ActionURL) ? item.ActionURL : importantDeadline.ActionURL;
                    importantDeadline.StartDate    = item.StartDate;
                    importantDeadline.EndDate      = item.EndDate;
                    importantDeadline.Deadline     = item.Deadline;
                    importantDeadline.UpdatedDate  = DateTime.Now;
                    importantDeadline.Type         = item.Type;

                    context.SaveChanges();
                }
                else
                {
                    throw new Exception(string.Format("Important Deadline id {0} invalid", importantDeadline.DeadlineID));
                }
            }
        }
Esempio n. 2
0
        public void Update(Video item)
        {
            using (APCRSHREntities context = new APCRSHREntities())
            {
                var result = context.Videos.Where(n => n.VideoID.Equals(item.VideoID)).SingleOrDefault();
                if (result != null)
                {
                    result.Title = item.Title;
                    if (!string.IsNullOrEmpty(item.ActionURL))
                    {
                        result.ActionURL = item.ActionURL;
                    }

                    if (!string.IsNullOrEmpty(item.VideoURL))
                    {
                        result.VideoURL = item.VideoURL;
                    }
                    result.Contents     = item.Contents;
                    result.ShortContent = item.ShortContent;
                    result.UpdatedBy    = item.UpdatedBy;
                    result.UpdatedDate  = DateTime.Now;
                    result.Language     = item.Language;
                    context.SaveChanges();
                }
                else
                {
                    throw new Exception(string.Format("Video's id {0} invalid", item.VideoID));
                }
            }
        }
Esempio n. 3
0
 public void Update(Photo item)
 {
     using (APCRSHREntities context = new APCRSHREntities())
     {
         var result = context.Photos.Where(n => n.PhotoID.Equals(item.PhotoID)).SingleOrDefault();
         if (result != null)
         {
             result.Title = item.Title;
             if (!string.IsNullOrEmpty(item.ActionURL))
             {
                 result.ActionURL = item.ActionURL;
             }
             if (!string.IsNullOrEmpty(item.ImageURL))
             {
                 result.ImageURL = item.ImageURL;
             }
             result.Description = item.Description;
             result.AlbumID     = item.AlbumID;
             result.UpdatedBy   = item.UpdatedBy;
             result.UpdatedDate = DateTime.Now;
             context.SaveChanges();
         }
         else
         {
             throw new Exception(string.Format("Photo's id {0} invalid", item.PhotoID));
         }
     }
 }
Esempio n. 4
0
        public void Update(Menu item)
        {
            APCRSHREntities context = new APCRSHREntities();
            var             menu    = context.Menus.Where(a => a.MenuID.Equals(item.MenuID)).SingleOrDefault();

            if (menu != null)
            {
                menu.ActionURL = !string.IsNullOrEmpty(item.ActionURL) ? item.ActionURL : menu.ActionURL;
                menu.Language  = item.Language;
                menu.ParentID  = item.ParentID;
                menu.Title     = item.Title;
                menu.Type      = item.Type;
                if (!string.IsNullOrEmpty(item.URL))
                {
                    menu.URL = item.URL;
                }
                menu.DisplayOrder = item.DisplayOrder;

                context.SaveChanges();
            }
            else
            {
                throw new Exception(string.Format("Menu id {0} invalid", item.MenuID));
            }
        }
Esempio n. 5
0
        public void Update(User item)
        {
            using (APCRSHREntities context = new APCRSHREntities())
            {
                var user = context.Users.Where(u => u.UserID.Equals(item.UserID)).SingleOrDefault();
                if (user != null)
                {
                    user.Email       = item.Email;
                    user.DateOfBirth = item.DateOfBirth;
                    user.FullName    = item.FullName;
                    user.Locked      = item.Locked;
                    user.OtherEmail  = item.OtherEmail;
                    user.Password    = string.IsNullOrEmpty(item.Password) ? user.Password : Encryption.ComputeHash(item.Password, Algorithm.SHA384, null);
                    //user.UserName = item.UserName;
                    user.UpdatedDate                = DateTime.Now;
                    user.Sex                        = item.Sex;
                    user.PhoneNumber                = item.PhoneNumber;
                    user.Title                      = item.Title;
                    user.MealPreference             = item.MealPreference;
                    user.DisabilitySpecialTreatment = item.DisabilitySpecialTreatment;
                    user.Address                    = item.Address;
                    user.City                       = item.City;
                    user.Country                    = item.Country;
                    user.WorkAddress                = item.WorkAddress;
                    user.Organization               = item.Organization;
                    user.RegistrationStatus         = item.RegistrationStatus;

                    context.SaveChanges();
                }
                else
                {
                    throw new Exception(string.Format("User id {0} invalid", item.UserID));
                }
            }
        }
Esempio n. 6
0
        public void Update(MainScholarship item)
        {
            using (APCRSHREntities context = new APCRSHREntities())
            {
                var scholarship = context.MainScholarships.Where(a => a.ScholarshipID.Equals(item.ScholarshipID)).SingleOrDefault();
                if (scholarship != null)
                {
                    scholarship.HasSubmitted      = item.HasSubmitted;
                    scholarship.Organization      = item.Organization;
                    scholarship.Position          = item.Position;
                    scholarship.ReasonScholarship = item.ReasonScholarship;
                    scholarship.Responsibility    = item.Responsibility;
                    scholarship.UpdatedBy         = item.UpdatedBy;
                    scholarship.UpdatedDate       = DateTime.Now;
                    scholarship.DurationOfWork    = item.DurationOfWork;
                    scholarship.SubmissionTitles  = item.SubmissionTitles;
                    //scholarship.UserID = item.UserID;
                    scholarship.Status             = item.Status;
                    scholarship.ScholarshipPackage = item.ScholarshipPackage;

                    context.SaveChanges();
                }
                else
                {
                    throw new Exception(string.Format("Scholarship id {0} invalid", item.ScholarshipID));
                }
            }
        }
        public void Update(ConferenceDeclaration item)
        {
            using (APCRSHREntities context = new APCRSHREntities())
            {
                var result = context.ConferenceDeclarations.Where(n => n.ConferenceID.Equals(item.ConferenceID)).SingleOrDefault();
                if (result != null)
                {
                    result.Title = item.Title;
                    if (!string.IsNullOrEmpty(item.ActionURL))
                    {
                        result.ActionURL = item.ActionURL;
                    }

                    if (!string.IsNullOrEmpty(item.AttachmentURL))
                    {
                        result.AttachmentURL = item.AttachmentURL;
                    }
                    if (!string.IsNullOrEmpty(item.ImageURL))
                    {
                        result.ImageURL = item.ImageURL;
                    }
                    result.Contents     = item.Contents;
                    result.ShortContent = item.ShortContent;
                    result.UpdatedBy    = item.UpdatedBy;
                    result.UpdatedDate  = DateTime.Now;
                    context.SaveChanges();
                }
                else
                {
                    throw new Exception(string.Format("Conference's id {0} invalid", item.ConferenceID));
                }
            }
        }
Esempio n. 8
0
        public void Update(Article item)
        {
            using (APCRSHREntities context = new APCRSHREntities())
            {
                var article = context.Articles.Where(a => a.ArticleID.Equals(item.ArticleID)).SingleOrDefault();
                if (article != null)
                {
                    if (!string.IsNullOrEmpty(item.ActionURL))
                    {
                        article.ActionURL = item.ActionURL;
                    }
                    if (!string.IsNullOrEmpty(item.ImageURL))
                    {
                        article.ImageURL = item.ImageURL;
                    }
                    article.Contents     = item.Contents;
                    article.Language     = item.Language;
                    article.MenuID       = item.MenuID;
                    article.ShortContent = item.ShortContent;
                    article.Title        = item.Title;
                    article.UpdatedBy    = item.UpdatedBy;
                    article.UpdatedDate  = DateTime.Now;
                    article.HomeDisplay  = item.HomeDisplay;

                    context.SaveChanges();
                }
                else
                {
                    throw new Exception(string.Format("Article id {0} invalid", item.ArticleID));
                }
            }
        }
Esempio n. 9
0
        public void Update(News item)
        {
            using (APCRSHREntities context = new APCRSHREntities())
            {
                var news = context.News.Where(a => a.NewsID.Equals(item.NewsID)).SingleOrDefault();
                if (news != null)
                {
                    news.ActionURL   = !string.IsNullOrEmpty(item.ActionURL) ? item.ActionURL : news.ActionURL;
                    news.Contents    = item.Contents;
                    news.Language    = item.Language;
                    news.Title       = item.Title;
                    news.UpdatedBy   = item.UpdatedBy;
                    news.UpdatedDate = DateTime.Now;
                    if (!string.IsNullOrEmpty(item.ThumbnailURL))
                    {
                        news.ThumbnailURL = item.ThumbnailURL;
                    }
                    news.MenuID       = item.MenuID;
                    news.ShortContent = item.ShortContent;

                    context.SaveChanges();
                }
                else
                {
                    throw new Exception(string.Format("News id {0} invalid", item.NewsID));
                }
            }
        }
Esempio n. 10
0
        public void Update(Admin item)
        {
            using (APCRSHREntities context = new APCRSHREntities())
            {
                var admin = context.Admins.Where(a => a.AdminID.Equals(item.AdminID)).SingleOrDefault();
                if (admin != null)
                {
                    admin.BirthDate = item.BirthDate;
                    admin.Email     = item.Email;
                    admin.FirstName = item.FirstName;
                    admin.LastName  = item.LastName;
                    admin.Locked    = item.Locked;
                    admin.Password  = string.IsNullOrEmpty(item.Password) ? admin.Password : Encryption.ComputeHash(item.Password, Algorithm.SHA384, null);
                    admin.Phone     = item.Phone;
                    admin.UserName  = item.UserName;
                    admin.Type      = item.Type;

                    context.SaveChanges();
                }
                else
                {
                    throw new Exception(string.Format("Admin id {0} invalid", item.AdminID));
                }
            }
        }
        public void Update(LogisticSchedule item)
        {
            using (APCRSHREntities context = new APCRSHREntities())
            {
                var logistic = context.LogisticSchedules.Where(a => a.LogisticID.Equals(item.LogisticID)).SingleOrDefault();
                if (logistic != null)
                {
                    logistic.ArrivalDate           = item.ArrivalDate;
                    logistic.ArrivalFlightNumber   = item.ArrivalFlightNumber;
                    logistic.ArrivalGate           = item.ArrivalGate;
                    logistic.DepartureDate         = item.DepartureDate;
                    logistic.DepartureFlightNumber = item.DepartureFlightNumber;
                    logistic.DepartureGate         = item.DepartureGate;
                    logistic.SpecialRequirement    = item.SpecialRequirement;
                    logistic.WhenNeedPick          = item.WhenNeedPick;
                    logistic.HotelName             = item.HotelName;
                    logistic.CheckinDate           = item.CheckinDate;
                    logistic.CheckoutDate          = item.CheckoutDate;
                    logistic.ConferenceRoles       = item.ConferenceRoles;
                    logistic.AirportService        = item.AirportService;
                    logistic.VisaProcess           = item.VisaProcess;

                    context.SaveChanges();
                }
                else
                {
                    throw new Exception(string.Format("Logistic id {0} invalid", item.LogisticID));
                }
            }
        }
        public void Update(MailingAddress item)
        {
            using (APCRSHREntities context = new APCRSHREntities())
            {
                var mailing = context.MailingAddresses.Where(a => a.MailingAddressID.Equals(item.MailingAddressID)).SingleOrDefault();
                if (mailing != null)
                {
                    mailing.UserID               = item.UserID;
                    mailing.UpdatedDate          = DateTime.Now;
                    mailing.ParticipantType      = item.ParticipantType;
                    mailing.ParticipateYouth     = item.ParticipateYouth;
                    mailing.OriginalNationality  = item.OriginalNationality;
                    mailing.CurrentNationality   = item.CurrentNationality;
                    mailing.PassportNumber       = item.PassportNumber;
                    mailing.TypeOfPassport       = item.TypeOfPassport;
                    mailing.Occupation           = item.Occupation;
                    mailing.DateOfPassportIssue  = item.DateOfPassportIssue;
                    mailing.DateOfPassportExpiry = item.DateOfPassportExpiry;
                    mailing.PassportPhoto1       = item.PassportPhoto1;
                    mailing.PassportPhoto2       = item.PassportPhoto2;
                    mailing.PassportPhoto3       = item.PassportPhoto3;
                    mailing.DetailOfEmbassy      = item.DetailOfEmbassy;
                    mailing.NeedVisaSupport      = item.NeedVisaSupport;
                    mailing.ActivationCode       = item.ActivationCode;
                    mailing.RegistrationNumber   = item.RegistrationNumber;

                    context.SaveChanges();
                }
                else
                {
                    throw new Exception(string.Format("Mailing id {0} invalid", item.MailingAddressID));
                }
            }
        }
Esempio n. 13
0
        public void Update(Slider item)
        {
            using (APCRSHREntities context = new APCRSHREntities())
            {
                var slider = context.Sliders.Where(i => i.SliderID.Equals(item.SliderID)).SingleOrDefault();
                if (slider != null)
                {
                    slider.Title = item.Title;
                    slider.URL   = item.URL;
                    if (!string.IsNullOrEmpty(item.URL))
                    {
                        slider.URL = item.URL;
                    }
                    if (!string.IsNullOrEmpty(item.ImageURL))
                    {
                        slider.ImageURL = item.ImageURL;
                    }
                    slider.UpdatedBy   = item.UpdatedBy;
                    slider.UpdatedDate = DateTime.Now;
                    slider.Language    = item.Language;

                    context.SaveChanges();
                }
                else
                {
                    throw new Exception(string.Format("Slider id {0} invalid", slider.SliderID));
                }
            }
        }
Esempio n. 14
0
        public object Insert(Menu item)
        {
            APCRSHREntities context = new APCRSHREntities();

            context.Menus.Add(item);
            context.SaveChanges();
            return(item.MenuID);
        }
 public object Insert(Experience item)
 {
     using (APCRSHREntities context = new APCRSHREntities())
     {
         context.Experiences.Add(item);
         context.SaveChanges();
         return(item.WorkingID);
     }
 }
Esempio n. 16
0
 public object Insert(Role item)
 {
     using (APCRSHREntities context = new APCRSHREntities())
     {
         context.Roles.Add(item);
         context.SaveChanges();
         return(item.RoleID);
     }
 }
Esempio n. 17
0
 public object Insert(News item)
 {
     using (APCRSHREntities context = new APCRSHREntities())
     {
         context.News.Add(item);
         context.SaveChanges();
         return(item.NewsID);
     }
 }
Esempio n. 18
0
 public object Insert(LeaderShip item)
 {
     using (APCRSHREntities context = new APCRSHREntities())
     {
         context.LeaderShips.Add(item);
         context.SaveChanges();
         return(item.LeaderShipID);
     }
 }
 public object Insert(UserSubmission item)
 {
     using (APCRSHREntities context = new APCRSHREntities())
     {
         context.UserSubmissions.Add(item);
         context.SaveChanges();
         return(item.SubmitID);
     }
 }
Esempio n. 20
0
 public object Insert(Album item)
 {
     using (APCRSHREntities context = new APCRSHREntities())
     {
         context.Albums.Add(item);
         context.SaveChanges();
         return(item.AlbumID);
     }
 }
 public object Insert(ConferenceDeclaration item)
 {
     using (APCRSHREntities context = new APCRSHREntities())
     {
         context.ConferenceDeclarations.Add(item);
         context.SaveChanges();
         return(item.ConferenceID);
     }
 }
Esempio n. 22
0
 public object Insert(Training item)
 {
     using (APCRSHREntities context = new APCRSHREntities())
     {
         context.Trainings.Add(item);
         context.SaveChanges();
         return(item.TrainingID);
     }
 }
Esempio n. 23
0
 public object Insert(Presentation item)
 {
     using (APCRSHREntities context = new APCRSHREntities())
     {
         context.Presentations.Add(item);
         context.SaveChanges();
         return(item.PresentationID);
     }
 }
Esempio n. 24
0
 public object Insert(TransactionHistory item)
 {
     using (APCRSHREntities context = new APCRSHREntities())
     {
         context.TransactionHistories.Add(item);
         context.SaveChanges();
         return(item.Id);
     }
 }
Esempio n. 25
0
 public object Insert(MainScholarship item)
 {
     using (APCRSHREntities context = new APCRSHREntities())
     {
         context.MainScholarships.Add(item);
         context.SaveChanges();
         return(item.ScholarshipID);
     }
 }
Esempio n. 26
0
 public object Insert(Upload item)
 {
     using (APCRSHREntities context = new APCRSHREntities())
     {
         context.Uploads.Add(item);
         context.SaveChanges();
         return(item.UploadID);
     }
 }
Esempio n. 27
0
 public object Insert(Photo item)
 {
     using (APCRSHREntities context = new APCRSHREntities())
     {
         context.Photos.Add(item);
         context.SaveChanges();
         return(item.PhotoID);
     }
 }
Esempio n. 28
0
 public object Insert(ImportantDeadline item)
 {
     using (APCRSHREntities context = new APCRSHREntities())
     {
         context.ImportantDeadlines.Add(item);
         context.SaveChanges();
         return(item.DeadlineID);
     }
 }
 public object Insert(LogisticSchedule item)
 {
     using (APCRSHREntities context = new APCRSHREntities())
     {
         context.LogisticSchedules.Add(item);
         context.SaveChanges();
         return(item.LogisticID);
     }
 }
 public object Insert(MailingAddress item)
 {
     using (APCRSHREntities context = new APCRSHREntities())
     {
         context.MailingAddresses.Add(item);
         context.SaveChanges();
         return(item.MailingAddressID);
     }
 }