Esempio n. 1
0
 private void map(OnlineListProductInfo oParam, DataRow tempdr)
 {
     oParam.SysNo = Util.TrimIntNull(tempdr["SysNo"]);
     oParam.OnlineAreaType = Util.TrimIntNull(tempdr["OnlineAreaType"]);
     oParam.OnlineRecommendType = Util.TrimIntNull(tempdr["OnlineRecommendType"]);
     oParam.CategorySysNo = Util.TrimIntNull(tempdr["CategorySysNo"]);
     oParam.ProductSysNo = Util.TrimIntNull(tempdr["ProductSysNo"]);
     oParam.CreateUserSysNo = Util.TrimIntNull(tempdr["CreateUserSysNo"]);
     oParam.CreateTime = Util.TrimDateNull(tempdr["CreateTime"]);
     oParam.ListOrder = Util.TrimIntNull(tempdr["ListOrder"]);
 }
Esempio n. 2
0
 public int Update(OnlineListProductInfo oParam)
 {
     return new OnlineListProductDac().Update(oParam);
 }
Esempio n. 3
0
 public OnlineListProductInfo LoadOnlineListProduct(int OnlineAreaType, int OnlineRecommendType, int CategorySysNo, int ProductSysNo)
 {
     string sql = "select * from onlinelistproduct(nolock) where onlineareatype=" + OnlineAreaType + " and onlinerecommendtype=" + OnlineRecommendType + " and categorysysno=" + CategorySysNo + " and productsysno=" + ProductSysNo;
     DataSet ds = SqlHelper.ExecuteDataSet(sql);
     if (Util.HasMoreRow(ds))
     {
         OnlineListProductInfo oInfo = new OnlineListProductInfo();
         map(oInfo, ds.Tables[0].Rows[0]);
         return oInfo;
     }
     else
     {
         return null;
     }
 }
Esempio n. 4
0
 public int Insert(OnlineListProductInfo oParam)
 {
     if (LoadOnlineListProduct(oParam.OnlineAreaType, oParam.OnlineRecommendType, oParam.CategorySysNo, oParam.ProductSysNo) != null)
     {
         throw new BizException("duplicated!");
     }
     return new OnlineListProductDac().Insert(oParam);
 }
Esempio n. 5
0
        public int Update(OnlineListProductInfo oParam)
        {
            string sql = @"UPDATE OnlineListProduct SET
                            OnlineAreaType=@OnlineAreaType, OnlineRecommendType=@OnlineRecommendType,
                            CategorySysNo=@CategorySysNo, ProductSysNo=@ProductSysNo,
                            CreateUserSysNo=@CreateUserSysNo, CreateTime=@CreateTime,
                            ListOrder=@ListOrder
                            WHERE SysNo=@SysNo";
            SqlCommand cmd = new SqlCommand(sql);

            SqlParameter paramSysNo = new SqlParameter("@SysNo", SqlDbType.Int, 4);
            SqlParameter paramOnlineAreaType = new SqlParameter("@OnlineAreaType", SqlDbType.Int, 4);
            SqlParameter paramOnlineRecommendType = new SqlParameter("@OnlineRecommendType", SqlDbType.Int, 4);
            SqlParameter paramCategorySysNo = new SqlParameter("@CategorySysNo", SqlDbType.Int, 4);
            SqlParameter paramProductSysNo = new SqlParameter("@ProductSysNo", SqlDbType.Int, 4);
            SqlParameter paramCreateUserSysNo = new SqlParameter("@CreateUserSysNo", SqlDbType.Int, 4);
            SqlParameter paramCreateTime = new SqlParameter("@CreateTime", SqlDbType.DateTime);
            SqlParameter paramListOrder = new SqlParameter("@ListOrder", SqlDbType.Int, 4);

            if (oParam.SysNo != AppConst.IntNull)
                paramSysNo.Value = oParam.SysNo;
            else
                paramSysNo.Value = System.DBNull.Value;
            if (oParam.OnlineAreaType != AppConst.IntNull)
                paramOnlineAreaType.Value = oParam.OnlineAreaType;
            else
                paramOnlineAreaType.Value = System.DBNull.Value;
            if (oParam.OnlineRecommendType != AppConst.IntNull)
                paramOnlineRecommendType.Value = oParam.OnlineRecommendType;
            else
                paramOnlineRecommendType.Value = System.DBNull.Value;
            if (oParam.CategorySysNo != AppConst.IntNull)
                paramCategorySysNo.Value = oParam.CategorySysNo;
            else
                paramCategorySysNo.Value = System.DBNull.Value;
            if (oParam.ProductSysNo != AppConst.IntNull)
                paramProductSysNo.Value = oParam.ProductSysNo;
            else
                paramProductSysNo.Value = System.DBNull.Value;
            if (oParam.CreateUserSysNo != AppConst.IntNull)
                paramCreateUserSysNo.Value = oParam.CreateUserSysNo;
            else
                paramCreateUserSysNo.Value = System.DBNull.Value;
            if (oParam.CreateTime != AppConst.DateTimeNull)
                paramCreateTime.Value = oParam.CreateTime;
            else
                paramCreateTime.Value = System.DBNull.Value;
            if (oParam.ListOrder != AppConst.IntNull)
                paramListOrder.Value = oParam.ListOrder;
            else
                paramListOrder.Value = System.DBNull.Value;

            cmd.Parameters.Add(paramSysNo);
            cmd.Parameters.Add(paramOnlineAreaType);
            cmd.Parameters.Add(paramOnlineRecommendType);
            cmd.Parameters.Add(paramCategorySysNo);
            cmd.Parameters.Add(paramProductSysNo);
            cmd.Parameters.Add(paramCreateUserSysNo);
            cmd.Parameters.Add(paramCreateTime);
            cmd.Parameters.Add(paramListOrder);

            return SqlHelper.ExecuteNonQuery(cmd);
        }
Esempio n. 6
0
        public int Insert(OnlineListProductInfo oParam)
        {
            string sql = @"INSERT INTO OnlineListProduct
                            (
                            OnlineAreaType, OnlineRecommendType, CategorySysNo, ProductSysNo,
                            CreateUserSysNo, CreateTime, ListOrder
                            )
                            VALUES (
                            @OnlineAreaType, @OnlineRecommendType, @CategorySysNo, @ProductSysNo,
                            @CreateUserSysNo, @CreateTime, @ListOrder
                            );set @SysNo = SCOPE_IDENTITY();";
            SqlCommand cmd = new SqlCommand(sql);

            SqlParameter paramSysNo = new SqlParameter("@SysNo", SqlDbType.Int, 4);
            SqlParameter paramOnlineAreaType = new SqlParameter("@OnlineAreaType", SqlDbType.Int, 4);
            SqlParameter paramOnlineRecommendType = new SqlParameter("@OnlineRecommendType", SqlDbType.Int, 4);
            SqlParameter paramCategorySysNo = new SqlParameter("@CategorySysNo", SqlDbType.Int, 4);
            SqlParameter paramProductSysNo = new SqlParameter("@ProductSysNo", SqlDbType.Int, 4);
            SqlParameter paramCreateUserSysNo = new SqlParameter("@CreateUserSysNo", SqlDbType.Int, 4);
            SqlParameter paramCreateTime = new SqlParameter("@CreateTime", SqlDbType.DateTime);
            SqlParameter paramListOrder = new SqlParameter("@ListOrder", SqlDbType.Int, 4);
            paramSysNo.Direction = ParameterDirection.Output;
            if (oParam.OnlineAreaType != AppConst.IntNull)
                paramOnlineAreaType.Value = oParam.OnlineAreaType;
            else
                paramOnlineAreaType.Value = System.DBNull.Value;
            if (oParam.OnlineRecommendType != AppConst.IntNull)
                paramOnlineRecommendType.Value = oParam.OnlineRecommendType;
            else
                paramOnlineRecommendType.Value = System.DBNull.Value;
            if (oParam.CategorySysNo != AppConst.IntNull)
                paramCategorySysNo.Value = oParam.CategorySysNo;
            else
                paramCategorySysNo.Value = System.DBNull.Value;
            if (oParam.ProductSysNo != AppConst.IntNull)
                paramProductSysNo.Value = oParam.ProductSysNo;
            else
                paramProductSysNo.Value = System.DBNull.Value;
            if (oParam.CreateUserSysNo != AppConst.IntNull)
                paramCreateUserSysNo.Value = oParam.CreateUserSysNo;
            else
                paramCreateUserSysNo.Value = System.DBNull.Value;
            if (oParam.CreateTime != AppConst.DateTimeNull)
                paramCreateTime.Value = oParam.CreateTime;
            else
                paramCreateTime.Value = System.DBNull.Value;
            if (oParam.ListOrder != AppConst.IntNull)
                paramListOrder.Value = oParam.ListOrder;
            else
                paramListOrder.Value = System.DBNull.Value;

            cmd.Parameters.Add(paramSysNo);
            cmd.Parameters.Add(paramOnlineAreaType);
            cmd.Parameters.Add(paramOnlineRecommendType);
            cmd.Parameters.Add(paramCategorySysNo);
            cmd.Parameters.Add(paramProductSysNo);
            cmd.Parameters.Add(paramCreateUserSysNo);
            cmd.Parameters.Add(paramCreateTime);
            cmd.Parameters.Add(paramListOrder);

            return SqlHelper.ExecuteNonQuery(cmd, out oParam.SysNo);
        }