예제 #1
0
파일: AngelData.cs 프로젝트: kang740/-
        /// <summary>
        /// 修改多个对象的某个属性
        /// </summary>
        /// <param name="str_JsonIdList">["id1","id2"..."idn"]</param>
        /// <returns></returns>
        public bool setObjectsAttributById(string str_JsonIdList, string s_attr, string s_value)
        {
            bool          success = true;
            List <string> l_str_ids;

            l_str_ids = Angel_DataJson.json2ObjList <string>(str_JsonIdList);
            for (int i = 0; i < l_str_ids.Count; i++)
            {
                if (!setObjectAttributById(l_str_ids[i], s_attr, s_value))
                {
                    return(false);
                }
            }
            return(success);
        }
예제 #2
0
파일: AngelData.cs 프로젝트: kang740/-
        /// <summary>
        /// 删除多个对象
        /// </summary>
        /// <param name="str_JsonIdList">["id1","id2"..."idn"]</param>
        /// <returns>是否成功</returns>
        public bool DeleteObjectsById(string str_JsonIdList)
        {
            bool          success = true;
            List <string> l_str_ids;

            l_str_ids = Angel_DataJson.json2ObjList <string>(str_JsonIdList);
            for (int i = 0; i < l_str_ids.Count; i++)
            {
                this.SetCondition("id", l_str_ids[i]);
                if (!this.DeleteData())
                {
                    return(false);
                }
            }
            return(success);
        }
예제 #3
0
파일: AngelData.cs 프로젝트: kang740/-
        /// <summary>
        ///  得到对象列表
        /// </summary>
        /// <typeparam name="T"> 对象类</typeparam>
        /// <param name="str_Condition">条件</param>
        /// <returns>对象列表</returns>
        public List <T> getObjectListByCondition <T>(string str_Condition)
        {
            this.strDsJson = "";
            // 得到数据集
            DataSet ds = Item_db.GetDataSetByCondition(this.tablename, this.lst_colId, str_Condition);

            // 数据集转Json
            if (!(ds == null || ds.Tables.Count == 0))
            {
                strDsJson = Angel_DataJson.dataSet2Json(ds);
            }
            // 去掉Json串中的表名
            // string strMatch = @"^{.*?:";
            Regex rx = new Regex(@"^{.*?:", RegexOptions.IgnoreCase | RegexOptions.Multiline);

            if (rx.IsMatch(strDsJson))
            {
                strDsJson = rx.Replace(strDsJson, "");
            }

            return(Angel_DataJson.json2ObjList <T>(strDsJson));
        }