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

            try
            {
                sb.Length = 0;
                sb.Append("UPDATE TSTANDARD SET ");
                sb.AppendFormat(" StdCode='{0}',", model.StdCode);
                sb.AppendFormat("StdDes='{0}',", model.StdDes);
                sb.AppendFormat("ShortCut='{0}',", model.ShortCut);
                sb.AppendFormat("StdInfo='{0}',", model.StdInfo);
                sb.AppendFormat("StdType='{0}',", model.StdType);
                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);
                DataBase.ExecuteCommand(sb.ToString(), out errMsg);
                sb.Length = 0;

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

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

            sb.Length = 0;
            try
            {
                sb.Append("INSERT INTO tStandard(SysCode,StdCode,StdDes,ShortCut,StdInfo,StdType,IsReadOnly,IsLock,Remark)VALUES(");
                sb.AppendFormat("'{0}','{1}','{2}','{3}','{4}','{5}',{6},{7},'{8}'", model.SysCode, model.StdCode, model.StdDes, model.ShortCut, model.StdInfo, model.StdType, model.IsReadOnly, model.IsLock, model.Remark);
                sb.Append(")");
                DataBase.ExecuteCommand(sb.ToString(), out errMsg);
                sb.Length = 0;
                rtn       = 1;
            }
            catch (Exception e)
            {
                //Log.WriteLog("添加clsStandard",e);
                errMsg = e.Message;
            }
            return(rtn);
        }
        /// <summary>
        /// 下载检测标准
        /// </summary>
        /// <param name="model"></param>
        /// <param name="errMsg"></param>
        /// <returns></returns>
        public int InsertOrUpdate(clsStandard model, out string errMsg)
        {
            errMsg = string.Empty;
            int rtn = 0;

            try
            {
                sb.Length = 0;
                DataTable dt = this.GetAsDataTable("SysCode Like '" + model.SysCode + "'", string.Empty, 9);
                if (dt != null && dt.Rows.Count > 0)
                {
                    sb.Length = 0;
                    sb.AppendFormat("Update tStandard Set StdCode='{0}',StdDes='{1}',ShortCut='{2}',StdInfo='{3}',StdType='{4}',",
                                    model.StdCode, model.StdDes, model.ShortCut, model.StdInfo, model.StdType);
                    sb.AppendFormat("IsReadOnly={0},IsLock={1},Remark='{2}',UDate='{3}' Where SysCode='{4}'",
                                    model.IsLock, model.IsReadOnly, model.Remark, model.UDate, model.SysCode);
                    DataBase.ExecuteCommand(sb.ToString(), out errMsg);
                }
                else
                {
                    sb.Length = 0;
                    sb.Append("Insert Into tStandard");
                    sb.Append(" (SysCode,StdCode,StdDes,ShortCut,StdInfo,StdType,IsLock,IsReadOnly,Remark,UDate) Values(");
                    sb.AppendFormat("'{0}','{1}','{2}','{3}','{4}',", model.SysCode, model.StdCode, model.StdDes, model.ShortCut, model.StdInfo);
                    sb.AppendFormat("'{0}',{1},{2},'{3}','{4}'", model.StdType, 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);
        }