Пример #1
0
        public int Update(ReviewComplainInfo oParam)
        {
            string sql = @"UPDATE Review_Complain SET
                            ReviewSysNo=@ReviewSysNo, ComplainContent=@ComplainContent,
                            CreateUserType=@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 paramComplainContent = new SqlParameter("@ComplainContent", SqlDbType.NVarChar, 1000);
            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.ComplainContent != AppConst.StringNull)
                paramComplainContent.Value = oParam.ComplainContent;
            else
                paramComplainContent.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(paramComplainContent);
            cmd.Parameters.Add(paramCreateUserType);
            cmd.Parameters.Add(paramCreateUserSysNo);
            cmd.Parameters.Add(paramCreateDate);

            return SqlHelper.ExecuteNonQuery(cmd);
        }
Пример #2
0
        public int Insert(ReviewComplainInfo oParam)
        {
            string sql = @"INSERT INTO Review_Complain
                            (
                            ReviewSysNo, ComplainContent, CreateUserType, CreateUserSysNo,
                            CreateDate
                            )
                            VALUES (
                            @ReviewSysNo, @ComplainContent, @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 paramComplainContent = new SqlParameter("@ComplainContent", SqlDbType.NVarChar, 1000);
            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.ComplainContent != AppConst.StringNull)
                paramComplainContent.Value = oParam.ComplainContent;
            else
                paramComplainContent.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(paramComplainContent);
            cmd.Parameters.Add(paramCreateUserType);
            cmd.Parameters.Add(paramCreateUserSysNo);
            cmd.Parameters.Add(paramCreateDate);

            return SqlHelper.ExecuteNonQuery(cmd, out oParam.SysNo);
        }
Пример #3
0
        public void AddNewReviewComplain(ReviewComplainInfo 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_complain 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 = InsertReviewComplain(oParam);
                if (iInsert == 0)
                    throw new BizException("�ύʧ��");

                sql = "update review_master set totalcomplaincount=totalcomplaincount+1 where sysno=" + oParam.ReviewSysNo;
                SqlHelper.ExecuteNonQuery(sql);

                scope.Complete();
            }
        }
Пример #4
0
 private void map(ReviewComplainInfo oParam, DataRow tempdr)
 {
     oParam.SysNo = Util.TrimIntNull(tempdr["SysNo"]);
     oParam.ReviewSysNo = Util.TrimIntNull(tempdr["ReviewSysNo"]);
     oParam.ComplainContent = Util.TrimNull(tempdr["ComplainContent"]);
     oParam.CreateUserType = Util.TrimIntNull(tempdr["CreateUserType"]);
     oParam.CreateUserSysNo = Util.TrimIntNull(tempdr["CreateUserSysNo"]);
     oParam.CreateDate = Util.TrimDateNull(tempdr["CreateDate"]);
 }
Пример #5
0
 public int UpdateReviewComplain(ReviewComplainInfo oParam)
 {
     return new ReviewComplainDac().Update(oParam);
 }
Пример #6
0
 public int InsertReviewComplain(ReviewComplainInfo oParam)
 {
     return new ReviewComplainDac().Insert(oParam);
 }