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

            try
            {
                sb.Length = 0;
                sb.AppendFormat("UPDATE tFoodClass SET StdCode='{0}'", model.StdCode);
                sb.AppendFormat(",Name='{0}'", model.Name);
                sb.AppendFormat(",ShortCut='{0}'", model.ShortCut);
                sb.AppendFormat(",CheckLevel='{0}'", model.CheckLevel);
                sb.AppendFormat(",CheckItemCodes='{0}'", model.CheckItemCodes);
                sb.AppendFormat(",CheckItemValue='{0}'", model.CheckItemValue);
                sb.Append(",IsReadOnly=");
                sb.Append(model.IsReadOnly);
                sb.Append(",IsLock=");
                sb.Append(model.IsLock);
                sb.AppendFormat(",Remark='{0}'", model.Remark);
                sb.AppendFormat(",FoodProperty='{0}'", model.FoodProperty);
                sb.AppendFormat(" WHERE SysCode='{0}'", model.SysCode);
                DataBase.ExecuteCommand(sb.ToString(), out errMsg);
                sb.Length = 0;
                rtn       = 1;
            }
            catch (Exception e)
            {
                //Log.WriteLog("更新clsFoodClass",e);
                errMsg = e.Message;
            }

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

            try
            {
                sb.Length = 0;
                sb.Append("INSERT INTO TFOODCLASS");
                sb.Append("(SysCode,StdCode,Name,ShortCut,CheckLevel,CheckItemCodes");
                sb.Append(",CheckItemValue,IsReadOnly,IsLock,Remark,FoodProperty)");
                sb.Append("VALUES(");
                sb.AppendFormat("'{0}',", model.SysCode);
                sb.AppendFormat("'{0}',", model.StdCode);
                sb.AppendFormat("'{0}',", model.Name);
                sb.AppendFormat("'{0}',", model.ShortCut);
                sb.AppendFormat("'{0}',", model.CheckLevel);
                sb.AppendFormat("'{0}',", model.CheckItemCodes);
                sb.AppendFormat("'{0}',", model.CheckItemValue);
                sb.AppendFormat("{0},", model.IsReadOnly);
                sb.AppendFormat("{0},", model.IsLock);
                sb.AppendFormat("'{0}',", model.Remark);
                sb.AppendFormat("'{0}'", model.FoodProperty);
                sb.Append(")");
                DataBase.ExecuteCommand(sb.ToString(), out errMsg);
                sb.Length = 0;

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

            return(rtn);
        }