예제 #1
0
        /// <summary>
        /// 插入信息(单表)
        /// </summary>
        /// <param name="">信息</param>
        /// <returns>插入行数</returns>
        public DataResult <int> Insert(ProductInfo model)
        {
            DataResult <int> result = new DataResult <int>();

            try
            {
                //基本信息
                model.PID        = Guid.NewGuid().ToString();
                model.CREATEUSER = this.LoginUser.UserID;
                model.CREATETIME = DateTime.Now;
                model.UPDATEUSER = model.CREATEUSER;
                model.UPDATETIME = model.CREATETIME;
                ProductInfoDAL cmdDAL = new ProductInfoDAL();
                if (ExistsCode(model))
                {
                    result.Msg    = "编号已存在";
                    result.Result = -1;
                    return(result);
                }
                if (ExistsName(model))
                {
                    result.Msg    = "名称已存在";
                    result.Result = -1;
                    return(result);
                }
                result.Result    = new ProductInfoDAL().Insert(model);
                result.IsSuccess = true;
                return(result);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }