コード例 #1
0
        /// <summary>
        /// 添加商品关联
        /// </summary>
        /// <param name="mappingModle"></param>
        /// <returns></returns>
        public static bool AddProductMapping(ProductMappingModel mappingModle)
        {
            bool result = false;

            try
            {
                SqlParameter[] paras = new SqlParameter[5];
                paras[0]           = new SqlParameter("@Product1SysNo", SqlDbType.Int, 4);
                paras[0].Value     = mappingModle.P1SysNo;
                paras[0].Direction = ParameterDirection.Input;
                paras[1]           = new SqlParameter("@Product2SysNo", SqlDbType.Int, 4);
                paras[1].Value     = mappingModle.P2SysNo;
                paras[1].Direction = ParameterDirection.Input;
                paras[2]           = new SqlParameter("@MappingType", SqlDbType.Int, 4);
                paras[2].Value     = (int)mappingModle.MappingType;
                paras[2].Direction = ParameterDirection.Input;
                paras[3]           = new SqlParameter("@MappingIndex", SqlDbType.VarChar, 8000);
                paras[3].Value     = mappingModle.MappingIndex;
                paras[3].Direction = ParameterDirection.Input;
                paras[4]           = new SqlParameter("@result", SqlDbType.Bit, 1);
                paras[4].Direction = ParameterDirection.Output;
                object outputValue;
                if (new SqlDBHelper().ExecuteStoredProcedure("AddProductMapping", paras, "@result", out outputValue) > 0)
                {
                    if ((bool)outputValue)
                    {
                        result = true;
                    }
                    else
                    {
                        result = false;
                    }
                }
                else
                {
                    result = false;
                }
            }
            catch
            {
                result = false;
            }

            return(result);
        }
コード例 #2
0
ファイル: ProductMappingModel.cs プロジェクト: ue96/ue96
        /// <summary>
        /// 添加商品关联
        /// </summary>
        /// <param name="mappingModle"></param>
        /// <returns></returns>
        public static bool AddProductMapping(ProductMappingModel mappingModle)
        {
            bool result = false;

            try
            {
                SqlParameter[] paras = new SqlParameter[5];
                paras[0] = new SqlParameter("@Product1SysNo", SqlDbType.Int, 4);
                paras[0].Value = mappingModle.P1SysNo;
                paras[0].Direction = ParameterDirection.Input;
                paras[1] = new SqlParameter("@Product2SysNo", SqlDbType.Int, 4);
                paras[1].Value = mappingModle.P2SysNo;
                paras[1].Direction = ParameterDirection.Input;
                paras[2] = new SqlParameter("@MappingType", SqlDbType.Int, 4);
                paras[2].Value = (int)mappingModle.MappingType;
                paras[2].Direction = ParameterDirection.Input;
                paras[3] = new SqlParameter("@MappingIndex", SqlDbType.VarChar, 8000);
                paras[3].Value = mappingModle.MappingIndex;
                paras[3].Direction = ParameterDirection.Input;
                paras[4] = new SqlParameter("@result", SqlDbType.Bit, 1);
                paras[4].Direction = ParameterDirection.Output;
                object outputValue;
                if (new SqlDBHelper().ExecuteStoredProcedure("AddProductMapping", paras, "@result", out outputValue) > 0)
                {
                    if ((bool)outputValue)
                    {
                        result = true;
                    }
                    else
                    {
                        result = false;
                    }
                }
                else
                {
                    result = false;
                }
            }
            catch
            {
                result = false;
            }

            return result;
        }