Example #1
0
 //更新用户学生情况
 public bool Update(AchivementApply apply)
 {
     try
     {
         if (apply != null)
         {
             AchivementApply newapply = dbcontext.AchivementApplyContext.Find(apply.AchivementApplyID);
             newapply.ApplyUnit       = apply.ApplyUnit;
             newapply.EconomicBenefit = apply.EconomicBenefit;
             newapply.EndTime         = apply.EndTime;
             newapply.EntryPerson     = apply.EntryPerson;
             newapply.SecrecyLevel    = apply.SecrecyLevel;
             newapply.StartTime       = apply.StartTime;
             newapply.Use             = apply.Use;
             newapply.EntryPerson     = apply.EntryPerson;
             newapply.AttachmentID    = apply.AttachmentID;
             newapply.AchievementID   = apply.AchievementID;
             newapply.Member          = apply.Member;
             dbcontext.SaveChanges();
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (System.Data.SqlClient.SqlException e)
     {
         throw e;
     }
 }
Example #2
0
 //删除
 public int Delete(int id)
 {
     try
     {
         AchivementApply AchivementApply = dbcontext.AchivementApplyContext.Where(u => u.AchivementApplyID == id).FirstOrDefault();//new Announcement { AnnouncementID = announcementID };
         int             attachID        = Convert.ToInt32(AchivementApply.AttachmentID);
         dbcontext.AchivementApplyContext.Attach(AchivementApply);
         dbcontext.AchivementApplyContext.Remove(AchivementApply);
         dbcontext.SaveChanges();
         return(attachID);
     }
     catch
     {
         throw;
     }
 }
Example #3
0
 //更新IsPass状态
 public void UpdateIsPass(int ID, bool isPass)
 {
     try
     {
         AchivementApply apply = dbcontext.AchivementApplyContext.Find(ID);
         if (apply == null)
         {
             return;
         }
         apply.IsPass = isPass;
         dbcontext.SaveChanges();
     }
     catch
     {
         throw;
     }
 }
Example #4
0
 //添加
 public bool Insert(AchivementApply apply)
 {
     try
     {
         if (apply != null)
         {
             dbcontext.AchivementApplyContext.Add(apply);
             dbcontext.SaveChanges();
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (System.Data.SqlClient.SqlException e)
     {
         throw e;
     }
 }