Beispiel #1
0
        public ActionResult Index()
        {
            var item = from o in entities.V_HR_TipsPeople
                       where o.Valid == true
                       select o;
            V_HR_TipsPeople tp = new V_HR_TipsPeople();

            if (item.Any())
            {
                tp = item.First();
            }
            return(View(tp));
        }
Beispiel #2
0
        public ActionResult EditPeople(V_HR_TipsPeople tp)
        {
            DirectResult r    = new DirectResult();
            var          last = from o in entities.V_HR_TipsPeople
                                where o.ID == tp.ID
                                select o;

            if (last.Any())
            {
                T_HR_TipsPeople lasttp = entities.T_HR_TipsPeople.Find(tp.ID);
                lasttp.Valid = false;
            }

            T_HR_TipsPeople newtp = new T_HR_TipsPeople();

            newtp.ID          = Tool.ProduceSed64();
            newtp.StaffID     = tp.StaffID;
            newtp.Valid       = true;
            newtp.Remark      = tp.Remark;
            newtp.CreaterName = new LoginUser().EmployeeId;
            newtp.CreateTime  = DateTime.Now;

            entities.T_HR_TipsPeople.Add(newtp);

            try
            {
                entities.SaveChanges();
                r.Success = true;
                X.Msg.Alert("提示", "保存成功!").Show();
            }
            catch (Exception e)
            {
                X.Msg.Alert("警告", "数据保存失败!<br /> note:" + e.Message).Show();
                r.Success = false;
            }
            return(r);
        }