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

            sb.Length = 0;
            try
            {
                sb.Append("UPDATE TCHECKITEM SET ");
                sb.AppendFormat("StdCode='{0}',", model.StdCode);
                sb.AppendFormat("ItemDes='{0}',", model.ItemDes);
                sb.AppendFormat("CheckType='{0}',", model.CheckType);
                sb.AppendFormat("StandardCode='{0}',", model.StandardCode);
                sb.AppendFormat("StandardValue='{0}',", model.StandardValue);
                sb.AppendFormat("Unit='{0}',", model.Unit);
                sb.AppendFormat("DemarcateInfo='{0}',", model.DemarcateInfo);
                sb.AppendFormat("TestValue='{0}',", model.TestValue);
                sb.AppendFormat("OperateHelp='{0}',", model.OperateHelp);
                sb.AppendFormat("CheckLevel='{0}',", model.CheckLevel);
                sb.AppendFormat("IsReadOnly={0},", model.IsReadOnly);
                sb.AppendFormat("IsLock={0},", model.IsLock);
                sb.AppendFormat("Remark='{0}'", model.Remark);
                sb.AppendFormat(" WHERE SysCode='{0}',", model.SysCode);
                //+ "StdCode='" + model.StdCode + "',"
                //+ "ItemDes='" + model.ItemDes + "',"
                //+ "CheckType='" + model.CheckType + "',"
                //+ "StandardCode='" + model.StandardCode + "',"
                //+ "StandardValue='" + model.StandardValue + "',"
                //+ "Unit='" + model.Unit + "',"
                //+ "DemarcateInfo='" + model.DemarcateInfo + "',"
                //+ "TestValue='" + model.TestValue + "',"
                //+ "OperateHelp='" + model.OperateHelp + "',"
                //+ "CheckLevel='" + model.CheckLevel + "',"
                //+ "IsReadOnly=" + model.IsReadOnly + ","
                //+ "IsLock=" + model.IsLock + ","
                //+ "Remark='" + model.Remark + "'"
                //+ " where SysCode='" + model.SysCode + "' ";
                DataBase.ExecuteCommand(sb.ToString(), out errMsg);
                sb.Length = 0;

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

            return(rtn);
        }
        /// <summary>
        /// 插入一条明细记录
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int Insert(clsCheckItem model, out string sErrMsg)
        {
            sErrMsg = string.Empty;
            int rtn = 0;

            sb.Length = 0;
            try
            {
                sb.Append("INSERT INTO tCheckItem");
                sb.Append("(SysCode,StdCode,ItemDes,CheckType,StandardCode,StandardValue,Unit,");
                sb.Append("DemarcateInfo,TestValue,OperateHelp,CheckLevel,IsReadOnly,IsLock,Remark)");
                sb.Append(" VALUES(");
                sb.AppendFormat("'{0}',", model.SysCode);
                sb.AppendFormat("'{0}',", model.StdCode);
                sb.AppendFormat("'{0}',", model.ItemDes);
                sb.AppendFormat("'{0}',", model.CheckType);
                sb.AppendFormat("'{0}',", model.StandardCode);
                sb.AppendFormat("'{0}',", model.StandardValue);
                sb.AppendFormat("'{0}',", model.Unit);
                sb.AppendFormat("'{0}',", model.DemarcateInfo);
                sb.AppendFormat("'{0}',", model.TestValue);
                sb.AppendFormat("'{0}',", model.OperateHelp);
                sb.AppendFormat("'{0}',", model.CheckLevel);
                sb.AppendFormat("{0},", model.IsReadOnly);
                sb.AppendFormat("{0},", model.IsLock);
                sb.AppendFormat("'{0}'", model.Remark);
                sb.Append(")");
                DataBase.ExecuteCommand(sb.ToString(), out sErrMsg);
                sb.Length = 0;

                rtn = 1;
            }
            catch (Exception e)
            {
                //Log.WriteLog("添加clsCheckItem",e);
                sErrMsg = e.Message;
            }

            return(rtn);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 下载|更新 检测项目
        /// </summary>
        /// <param name="model">clsCheckItem</param>
        /// <param name="errMsg"></param>
        /// <returns></returns>
        public int InsertOrUpdate(clsCheckItem model, out string errMsg)
        {
            errMsg = string.Empty;
            int rtn = 0;

            try
            {
                sb.Length = 0;
                DataTable dt = this.GetAsDataTable("SysCode Like '" + model.SysCode + "'", string.Empty, 8);
                if (dt != null && dt.Rows.Count > 0)
                {
                    sb.Length = 0;
                    sb.AppendFormat("Update tCheckItem Set StdCode='{0}',ItemDes='{1}',CheckType='{2}',StandardCode='{3}',StandardValue='{4}',",
                                    model.StdCode, model.ItemDes, model.CheckType, model.StandardCode, model.StandardValue);
                    sb.AppendFormat("Unit='{0}',DemarcateInfo='{1}',TestValue='{2}',OperateHelp='{3}',CheckLevel='{4}',",
                                    model.Unit, model.DemarcateInfo, model.TestValue, model.OperateHelp, model.CheckLevel);
                    sb.AppendFormat("IsReadOnly={0},IsLock={1},Remark='{2}',UDate='{3}' Where SysCode='{4}'",
                                    model.IsReadOnly, model.IsLock, model.Remark, model.UDate, model.SysCode);
                    DataBase.ExecuteCommand(sb.ToString(), out errMsg);
                }
                else
                {
                    sb.Length = 0;
                    sb.Append("Insert Into tCheckItem");
                    sb.Append(" (SysCode,StdCode,ItemDes,CheckType,StandardCode,StandardValue,Unit,DemarcateInfo,TestValue,OperateHelp,CheckLevel,IsLock,IsReadOnly,Remark,UDate) Values(");
                    sb.AppendFormat("'{0}','{1}','{2}','{3}','{4}',", model.SysCode, model.StdCode, model.ItemDes, model.CheckType, model.StandardCode);
                    sb.AppendFormat("'{0}','{1}','{2}','{3}','{4}',", model.StandardValue, model.Unit, model.DemarcateInfo, model.TestValue, model.OperateHelp);
                    sb.AppendFormat("'{0}',{1},{2},'{3}','{4}'", model.CheckLevel, model.IsLock, model.IsReadOnly, model.Remark, model.UDate);
                    sb.Append(")");
                    DataBase.ExecuteCommand(sb.ToString(), out errMsg);
                }
                sb.Length = 0;
                rtn       = 1;
            }
            catch (Exception e)
            {
                errMsg = e.Message;
            }
            return(rtn);
        }