コード例 #1
0
        /// <summary>
        /// 插入一条明细记录
        /// </summary>
        /// <param name="OprObject"></param>
        /// <returns></returns>
        public int Insert(clsCheckType model, out string errMsg)
        {
            errMsg = string.Empty;
            int rtn = 0;

            try
            {
                sb.Length = 0;
                sb.Append("INSERT INTO TCHECKTYPE(NAME,ISREADONLY,ISLOCK,REMARK) VALUES(");
                sb.AppendFormat("'{0}',", model.Name);
                sb.AppendFormat("{0},", model.IsReadOnly);
                sb.AppendFormat("{0},", model.IsLock);
                sb.AppendFormat("'{0}'", model.Remark);
                sb.Append(")");
                DataBase.ExecuteCommand(sb.ToString(), out errMsg);
                sb.Length = 0;
                rtn       = 1;
            }
            catch (Exception e)
            {
                //Log.WriteLog("添加clsCheckType",e);
                errMsg = e.Message;
            }

            return(rtn);
        }
コード例 #2
0
        /// <summary>
        /// 部分修改保存
        /// </summary>
        /// <param name="model">对象clsCheckType的一个实例参数</param>
        /// <returns></returns>
        public int UpdatePart(clsCheckType model, string sName, out string errMsg)
        {
            errMsg = string.Empty;
            int rtn = 0;

            try
            {
                sb.Length = 0;
                sb.Append("UPDATE TCHECKTYPE SET ");
                sb.AppendFormat("Name='{0}',", model.Name);
                sb.AppendFormat("IsReadOnly={0},", model.IsReadOnly);
                sb.AppendFormat("IsLock={0},", model.IsLock);
                sb.AppendFormat("Remark='{0}'", model.Remark);
                sb.AppendFormat(" WHERE Name='{0}'", sName);
                DataBase.ExecuteCommand(sb.ToString(), out errMsg);
                sb.Length = 0;

                //更新相关表
                //updateSql="update tCheckItem set "
                //    + "CheckType='" + OprObject.Name + "'"
                //    + " where CheckType='" + sName + "' ";
                //DataBase.ExecuteCommand(updateSql,out sErrMsg);

                //updateSql="update tresult set "
                //    + "CheckType='" + OprObject.Name + "'"
                //    + " where CheckType='" + sName + "' ";
                //DataBase.ExecuteCommand(updateSql,out sErrMsg);

                rtn = 1;
            }
            catch (Exception e)
            {
                //Log.WriteLog("更新clsCheckType",e);
                errMsg = e.Message;
            }

            return(rtn);
        }