示例#1
0
 public int SaveHuman(hr_humans item)
 {
     try
     {
         if (item.id == 0)
         {
             db.hr_humans.Add(item);
             db.SaveChanges();
         }
         else
         {
             try
             {
                 db.Entry(item).State = EntityState.Modified;
                 db.SaveChanges();
             }
             catch (OptimisticConcurrencyException ex)
             {
                 RDL.Debug.LogError(ex);
             }
         }
     }
     catch (Exception ex)
     {
         RDL.Debug.LogError(ex);
     }
     return(item.id);
 }
示例#2
0
        public hr_humans GetHuman(int id)
        {
            var res = new hr_humans();

            res = db.hr_humans.FirstOrDefault(x => x.id == id);
            return(res);
        }
示例#3
0
        internal hr_humans GetHuman(int id)
        {
            var res = new hr_humans();

            res = db.GetHuman(id);
            return(res);
        }
示例#4
0
 internal void SaveHuman(hr_humans item)
 {
     try
     {
         db.SaveHuman(item);
     }
     catch (Exception ex)
     {
         RDL.Debug.LogError(ex);
     }
 }
示例#5
0
        public ActionResult CreateHuman(string fio, string note, int sourceID, int statusID)
        {
            var mng = new HRManager();

            int?sourceID_ = null;

            if (sourceID != 0)
            {
                sourceID_ = sourceID;
            }

            int?statusID_ = null;

            if (statusID != 0)
            {
                statusID_ = statusID;
            }

            var item = new hr_humans
            {
                id         = 0,
                fio        = fio,
                city       = null,
                note       = note,
                sourceID   = sourceID_,
                statusID   = statusID_,
                addedBy    = null,
                created    = DateTime.Now,
                subchannel = null,
                username   = null,
                needActive = null,
                sourceGuid = null,
                pay        = null,
                hourRate   = null
            };

            mng.SaveHuman(item);

            return(Json(new
            {
                result = item.id > 0,
                id = item.id
            }));
        }