public void map(ProductRemarkInfo oParam, DataRow tempdr) { oParam.SysNo = Util.TrimIntNull(tempdr["SysNo"]); oParam.CustomerSysNo = Util.TrimIntNull(tempdr["CustomerSysNo"]); oParam.ProductSysNo = Util.TrimIntNull(tempdr["ProductSysNo"]); oParam.CreateTime = Util.TrimDateNull(tempdr["CreateTime"]); oParam.Title = Util.TrimNull(tempdr["Title"]); oParam.Remark = Util.TrimNull(tempdr["Remark"]);; oParam.Score = Util.TrimIntNull(tempdr["Score"]); oParam.Status = Util.TrimIntNull(tempdr["Status"]); oParam.OptIP = Util.TrimNull(tempdr["OptIP"]); }
public void Import() { if ( !AppConfig.IsImportable) throw new BizException("Is Importable is false"); /* do not use the following code after Data Pour in */ string sql = " select top 1 * from product_remark "; DataSet ds = SqlHelper.ExecuteDataSet(sql); if ( Util.HasMoreRow(ds) ) throw new BizException("the table product_remark is not empty"); TransactionOptions options = new TransactionOptions(); options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted; options.Timeout = TransactionManager.DefaultTimeout; using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options)) { string sql1 = @"select 1 as sysno, WebUserSysNo as CustomerSysNo, convert_1.newsysno as ProductSysNo, createtime, title, isnull(remark, '') as remark, score, status from ipp2003..product_remark as pr, ippconvert..productbasic convert_1 where pr.productsysno = convert_1.oldsysno"; DataSet ds1 = SqlHelper.ExecuteDataSet(sql1); foreach(DataRow dr1 in ds1.Tables[0].Rows) { ProductRemarkInfo oRemark = new ProductRemarkInfo(); map(oRemark,dr1); if ( oRemark.Remark == "") oRemark.Remark = "нч"; if ( oRemark.Title == "") oRemark.Title = "нч"; new ProductRemarkDac().Insert(oRemark); } scope.Complete(); } }
public void Insert(ProductRemarkInfo oParam) { new ProductRemarkDac().Insert(oParam); }
public int Insert(ProductRemarkInfo oParam) { string sql = @"INSERT INTO Product_Remark ( CustomerSysNo, ProductSysNo, CreateTime, Title, Remark, Score, Status,OptIP ) VALUES ( @CustomerSysNo, @ProductSysNo, @CreateTime, @Title, @Remark, @Score, @Status,@OptIP );set @SysNo = SCOPE_IDENTITY();"; SqlCommand cmd = new SqlCommand(sql); SqlParameter paramSysNo = new SqlParameter("@SysNo", SqlDbType.Int,4); SqlParameter paramCustomerSysNo = new SqlParameter("@CustomerSysNo", SqlDbType.Int,4); SqlParameter paramProductSysNo = new SqlParameter("@ProductSysNo", SqlDbType.Int,4); SqlParameter paramCreateTime = new SqlParameter("@CreateTime", SqlDbType.DateTime); SqlParameter paramTitle = new SqlParameter("@Title", SqlDbType.NVarChar,200); SqlParameter paramRemark = new SqlParameter("@Remark", SqlDbType.NText); SqlParameter paramScore = new SqlParameter("@Score", SqlDbType.Int,4); SqlParameter paramStatus = new SqlParameter("@Status", SqlDbType.Int,4); SqlParameter paramOptIP = new SqlParameter("@OptIP",SqlDbType.NVarChar,50); paramSysNo.Direction = ParameterDirection.Output; if ( oParam.CustomerSysNo != AppConst.IntNull) paramCustomerSysNo.Value = oParam.CustomerSysNo; else paramCustomerSysNo.Value = System.DBNull.Value; if ( oParam.ProductSysNo != AppConst.IntNull) paramProductSysNo.Value = oParam.ProductSysNo; else paramProductSysNo.Value = System.DBNull.Value; if ( oParam.CreateTime != AppConst.DateTimeNull) paramCreateTime.Value = oParam.CreateTime; else paramCreateTime.Value = System.DBNull.Value; if ( oParam.Title != AppConst.StringNull) paramTitle.Value = oParam.Title; else paramTitle.Value = System.DBNull.Value; if ( oParam.Remark != AppConst.StringNull) paramRemark.Value = oParam.Remark; else paramRemark.Value = System.DBNull.Value; if ( oParam.Score != AppConst.IntNull) paramScore.Value = oParam.Score; else paramScore.Value = System.DBNull.Value; if ( oParam.Status != AppConst.IntNull) paramStatus.Value = oParam.Status; else paramStatus.Value = System.DBNull.Value; if (oParam.OptIP != AppConst.StringNull) paramOptIP.Value = oParam.OptIP; else paramOptIP.Value = System.DBNull.Value; cmd.Parameters.Add(paramSysNo); cmd.Parameters.Add(paramCustomerSysNo); cmd.Parameters.Add(paramProductSysNo); cmd.Parameters.Add(paramCreateTime); cmd.Parameters.Add(paramTitle); cmd.Parameters.Add(paramRemark); cmd.Parameters.Add(paramScore); cmd.Parameters.Add(paramStatus); cmd.Parameters.Add(paramOptIP); return SqlHelper.ExecuteNonQuery(cmd, out oParam.SysNo); }