protected virtual string AddPerson(sysuser person)
 {
     lock (lockObj) {
         var persons = this.CurrentData;
         person.id = person.CreateID();
         persons.Add(person);
         this.Session["sysusers"] = persons;
         Global.SqlMapper.Create<sysuser>(person);
         return person.id;
     }
 }
Example #2
0
 /// <summary>
 /// 方法名称: Insert
 /// 内容摘要: 插入一条新纪录
 /// </summary>
 /// <returns>int</returns>
 public virtual object Insert(sysuser obj)
 {
     object result = null;
     try
     {
         result=_sysuserDao.Create<sysuser>(obj);
     }
     catch (Exception e)
     {
         throw e;
     }
     return result;
 }
Example #3
0
        /// <summary>
        /// 方法名称: Update
        /// 内容摘要: 更新一条新纪录
        /// </summary>
        /// <returns>int</returns>
        public virtual int Update(sysuser obj)
        {
            int result = 0;
            try
            {
                result = _sysuserDao.Update<sysuser>(obj);
            }
            catch (Exception e)
            {
                throw e;
            }

            return result;
        }
        protected virtual void UpdatePerson(sysuser person)
        {
            lock (lockObj) {
                var persons = this.CurrentData;
                sysuser updatingPerson = null;

                foreach (sysuser p in persons) {
                    if (p.id == person.id) {
                        updatingPerson = p;
                        break;
                    }
                }

                if (updatingPerson == null) {
                    throw new Exception("sysuser not found");
                }
                ConvertHelper.CopyTo(person, updatingPerson);
                Global.SqlMapper.Update<sysuser>(updatingPerson);
                this.Session["sysusers"] = persons;
            }
        }