Esempio n. 1
0
        public hr_specializations GetSpec(int id)
        {
            var res = new hr_specializations();

            res = db.hr_specializations.FirstOrDefault(x => x.id == id);
            return(res);
        }
Esempio n. 2
0
 public int SaveSpec(hr_specializations item)
 {
     try
     {
         if (item.id == 0)
         {
             db.hr_specializations.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);
 }
Esempio n. 3
0
        internal hr_specializations GetSpec(int id)
        {
            var res = new hr_specializations();

            res = db.GetSpec(id);
            return(res);
        }
Esempio n. 4
0
        public ActionResult Spec_save()
        {
            var parameters = AjaxModel.GetAjaxParameters(HttpContext);
            var mng        = new HRManager();

            try
            {
                var fields  = (parameters["fields"] as ArrayList).ToArray().ToList().Select(x => x as Dictionary <string, object>).ToList();
                var newSpec = new hr_specializations
                {
                    id   = (AjaxModel.GetValueFromSaveField("id", fields) == "") ? 0 : int.Parse(AjaxModel.GetValueFromSaveField("id", fields)),
                    name = AjaxModel.GetValueFromSaveField("name", fields),
                    code = AjaxModel.GetValueFromSaveField("code", fields)
                };
                mng.SaveSpec(newSpec);
                return(Json(new
                {
                    result = newSpec.id > 0,
                    id = newSpec.id,
                    msg = (newSpec.id > 0) ? "Операция успешна" : "Ошибка"
                }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                RDL.Debug.LogError(ex);
                return(Json(new
                {
                    result = false,
                    id = 0,
                    msg = "Ошибка"
                }, JsonRequestBehavior.AllowGet));
            }
        }
Esempio n. 5
0
 internal void SaveSpec(hr_specializations item)
 {
     try
     {
         db.SaveSpec(item);
     }
     catch (Exception ex)
     {
         RDL.Debug.LogError(ex);
     }
 }