Exemple #1
0
        public int Update(ReviewRemarkInfo oParam)
        {
            string sql = @"UPDATE Review_Remark SET
                            ReviewSysNo=@ReviewSysNo, IsHelpful=@IsHelpful,
                            CreateUserTyp=@CreateUserType, CreateUserSysNo=@CreateUserSysNo,
                            CreateDate=@CreateDate
                            WHERE SysNo=@SysNo";
            SqlCommand cmd = new SqlCommand(sql);

            SqlParameter paramSysNo = new SqlParameter("@SysNo", SqlDbType.Int, 4);
            SqlParameter paramReviewSysNo = new SqlParameter("@ReviewSysNo", SqlDbType.Int, 4);
            SqlParameter paramIsHelpful = new SqlParameter("@IsHelpful", SqlDbType.Int, 4);
            SqlParameter paramCreateUserType = new SqlParameter("@CreateUserType", SqlDbType.Int, 4);
            SqlParameter paramCreateUserSysNo = new SqlParameter("@CreateUserSysNo", SqlDbType.Int, 4);
            SqlParameter paramCreateDate = new SqlParameter("@CreateDate", SqlDbType.DateTime);

            if (oParam.SysNo != AppConst.IntNull)
                paramSysNo.Value = oParam.SysNo;
            else
                paramSysNo.Value = System.DBNull.Value;
            if (oParam.ReviewSysNo != AppConst.IntNull)
                paramReviewSysNo.Value = oParam.ReviewSysNo;
            else
                paramReviewSysNo.Value = System.DBNull.Value;
            if (oParam.IsHelpful != AppConst.IntNull)
                paramIsHelpful.Value = oParam.IsHelpful;
            else
                paramIsHelpful.Value = System.DBNull.Value;
            if (oParam.CreateUserType != AppConst.IntNull)
                paramCreateUserType.Value = oParam.CreateUserType;
            else
                paramCreateUserType.Value = System.DBNull.Value;
            if (oParam.CreateUserSysNo != AppConst.IntNull)
                paramCreateUserSysNo.Value = oParam.CreateUserSysNo;
            else
                paramCreateUserSysNo.Value = System.DBNull.Value;
            if (oParam.CreateDate != AppConst.DateTimeNull)
                paramCreateDate.Value = oParam.CreateDate;
            else
                paramCreateDate.Value = System.DBNull.Value;

            cmd.Parameters.Add(paramSysNo);
            cmd.Parameters.Add(paramReviewSysNo);
            cmd.Parameters.Add(paramIsHelpful);
            cmd.Parameters.Add(paramCreateUserType);
            cmd.Parameters.Add(paramCreateUserSysNo);
            cmd.Parameters.Add(paramCreateDate);

            return SqlHelper.ExecuteNonQuery(cmd);
        }
Exemple #2
0
        public int Insert(ReviewRemarkInfo oParam)
        {
            string sql = @"INSERT INTO Review_Remark
                            (
                            ReviewSysNo, IsHelpful, CreateUserType, CreateUserSysNo,
                            CreateDate
                            )
                            VALUES (
                            @ReviewSysNo, @IsHelpful, @CreateUserType, @CreateUserSysNo,
                            @CreateDate
                            );set @SysNo = SCOPE_IDENTITY();";
            SqlCommand cmd = new SqlCommand(sql);

            SqlParameter paramSysNo = new SqlParameter("@SysNo", SqlDbType.Int, 4);
            SqlParameter paramReviewSysNo = new SqlParameter("@ReviewSysNo", SqlDbType.Int, 4);
            SqlParameter paramIsHelpful = new SqlParameter("@IsHelpful", SqlDbType.Int, 4);
            SqlParameter paramCreateUserType = new SqlParameter("@CreateUserType", SqlDbType.Int, 4);
            SqlParameter paramCreateUserSysNo = new SqlParameter("@CreateUserSysNo", SqlDbType.Int, 4);
            SqlParameter paramCreateDate = new SqlParameter("@CreateDate", SqlDbType.DateTime);
            paramSysNo.Direction = ParameterDirection.Output;
            if (oParam.ReviewSysNo != AppConst.IntNull)
                paramReviewSysNo.Value = oParam.ReviewSysNo;
            else
                paramReviewSysNo.Value = System.DBNull.Value;
            if (oParam.IsHelpful != AppConst.IntNull)
                paramIsHelpful.Value = oParam.IsHelpful;
            else
                paramIsHelpful.Value = System.DBNull.Value;
            if (oParam.CreateUserType != AppConst.IntNull)
                paramCreateUserType.Value = oParam.CreateUserType;
            else
                paramCreateUserType.Value = System.DBNull.Value;
            if (oParam.CreateUserSysNo != AppConst.IntNull)
                paramCreateUserSysNo.Value = oParam.CreateUserSysNo;
            else
                paramCreateUserSysNo.Value = System.DBNull.Value;
            if (oParam.CreateDate != AppConst.DateTimeNull)
                paramCreateDate.Value = oParam.CreateDate;
            else
                paramCreateDate.Value = System.DBNull.Value;

            cmd.Parameters.Add(paramSysNo);
            cmd.Parameters.Add(paramReviewSysNo);
            cmd.Parameters.Add(paramIsHelpful);
            cmd.Parameters.Add(paramCreateUserType);
            cmd.Parameters.Add(paramCreateUserSysNo);
            cmd.Parameters.Add(paramCreateDate);

            return SqlHelper.ExecuteNonQuery(cmd, out oParam.SysNo);
        }
Exemple #3
0
        public void AddNewReviewRemark(ReviewRemarkInfo oParam)
        {
            TransactionOptions options = new TransactionOptions();
            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout = TransactionManager.DefaultTimeout;

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {
                string sql = @"select * from review_remark where reviewSysNo=" + oParam.ReviewSysNo + " and createUserType=" + oParam.CreateUserType + " and createUserSysNo=" + oParam.CreateUserSysNo;
                DataSet ds = SqlHelper.ExecuteDataSet(sql);
                if (Util.HasMoreRow(ds))
                    throw new BizException("�����ظ��ύ");

                int iInsert = InsertReviewRemark(oParam);
                if (iInsert == 0)
                    throw new BizException("�ύʧ��");

                if (oParam.IsHelpful == (int)AppEnum.YNStatus.Yes)
                {
                    sql = "update review_master set totalremarkcount=totalremarkcount+1,totalhelpfulremarkcount=totalhelpfulremarkcount+1 where sysno=" + oParam.ReviewSysNo;
                }
                else
                {
                    sql = "update review_master set totalremarkcount=totalremarkcount+1 where sysno=" + oParam.ReviewSysNo;
                }
                SqlHelper.ExecuteNonQuery(sql);

                scope.Complete();
            }
        }
Exemple #4
0
 private void map(ReviewRemarkInfo oParam, DataRow tempdr)
 {
     oParam.SysNo = Util.TrimIntNull(tempdr["SysNo"]);
     oParam.ReviewSysNo = Util.TrimIntNull(tempdr["ReviewSysNo"]);
     oParam.IsHelpful = Util.TrimIntNull(tempdr["IsHelpful"]);
     oParam.CreateUserType = Util.TrimIntNull(tempdr["CreateUserType"]);
     oParam.CreateUserSysNo = Util.TrimIntNull(tempdr["CreateUserSysNo"]);
     oParam.CreateDate = Util.TrimDateNull(tempdr["CreateDate"]);
 }
Exemple #5
0
 public int UpdateReviewRemark(ReviewRemarkInfo oParam)
 {
     return new ReviewRemarkDac().Update(oParam);
 }
Exemple #6
0
 public int InsertReviewRemark(ReviewRemarkInfo oParam)
 {
     return new ReviewRemarkDac().Insert(oParam);
 }