Example #1
0
        /// <summary>
        /// 查询
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="model"></param>
        /// <returns></returns>
        public E_DrugLock GetInfoById(E_DrugLock model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select * from tb_DrugLock where id=@id");

            using (IDbConnection conn = new SqlConnection(PubConstant.GetConnectionString()))
            {
                model = conn.Query <E_DrugLock>(strSql.ToString(), model)?.FirstOrDefault();
            }
            return(model);
        }
Example #2
0
 /// <summary>
 /// 保存
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public bool DrugLockSave(E_DrugLock model)
 {
     model.updateDate = DateTime.Now;
     if (model != null && model.id > 0)
     {
         model.updateUser = CurrentUserInfo.PersonnelID;
         return(dDrugLock.Update(model));
     }
     model.createUser = CurrentUserInfo.PersonnelID;
     model.createDate = DateTime.Now;
     return(dDrugLock.Add(model));
 }
Example #3
0
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool Add(E_DrugLock model)
        {
            string sql = "INSERT INTO tb_DrugLock(temp2,pic,ischem,isdanger,locktypeid,lockName,mark,createUser,createDate,updateUser,updateDate,lockType,temp1) VALUES (@temp2,@pic,@ischem,@isdanger,@locktypeid,@lockName,@mark,@createUser,@createDate,@updateUser,@updateDate,@lockType,@temp1)";

            using (IDbConnection conn = new SqlConnection(PubConstant.GetConnectionString()))
            {
                int count = conn.Execute(sql, model);
                if (count > 0)//如果更新失败
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
Example #4
0
        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool Update(E_DrugLock model)
        {
            StringBuilder strSql = new StringBuilder();

            //  strSql.Append("update dp_food set areaid=@areaid, classinfoid=@classinfoid,foodname=@foodname,pid=@pid,pname=@pname,pic=@pic,updatetime=getdate()  where foodid=@foodid ");
            strSql.Append("update tb_DrugLock set " + Utils.SetUpdateSql(model, new string[] { "id" }) + " where id=@id ");

            using (IDbConnection conn = new SqlConnection(PubConstant.GetConnectionString()))
            {
                int count = conn.Execute(strSql.ToString(), model);
                if (count > 0)//如果更新失败
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }