Esempio n. 1
0
        public dynamic DeleteFile(PersonalExtratimeActive data)
        {
            try
            {
                var model = entity.PersonalExtratimeActives.Where(p => p.Pid == data.Pid).FirstOrDefault();
                if (model.Status != 0)
                {
                    return(false);
                }
                string url = string.Empty;

                var listProof = model.Proof.Remove(model.Proof.Length - 1).Split(';');
                foreach (var item in listProof)
                {
                    if (item != data.Proof)
                    {
                        url = url + item + ";";
                    }
                }
                model.Proof = url;
                entity.SaveChanges();
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Esempio n. 2
0
 public dynamic Save(PersonalExtratimeActive data)
 {
     try
     {
         entity.PersonalExtratimeActives.Add(data);
         entity.SaveChanges();
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
Esempio n. 3
0
 public dynamic UpdateFile(PersonalExtratimeActive data)
 {
     try
     {
         var model = entity.PersonalExtratimeActives.Where(p => p.Pid == data.Pid).FirstOrDefault();
         if (model.Status != 0)
         {
             return(false);
         }
         model.Proof = model.Proof + data.Proof;
         //entity.PersonalExtratimeActives.Add(data);
         //entity.Entry(data).State= System.Data.Entity.EntityState.Modified;
         entity.SaveChanges();
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
Esempio n. 4
0
 public dynamic Update(PersonalExtratimeActive data)
 {
     try
     {
         var model = entity.PersonalExtratimeActives.Where(p => p.Pid == data.Pid).FirstOrDefault();
         if (model.Status != 0)
         {
             return(false);
         }
         model.KindActive = data.KindActive;
         model.Location   = data.Location;
         model.Time       = data.Time;
         model.Content    = data.Content;
         //entity.PersonalExtratimeActives.Add(data);
         //entity.Entry(data).State= System.Data.Entity.EntityState.Modified;
         entity.SaveChanges();
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }