private void map(PaipaiResponseInfo oParam, DataRow tempdr) { oParam.SysNo = Util.TrimIntNull(tempdr["SysNo"]); oParam.ProductSysNo = Util.TrimIntNull(tempdr["ProductSysNo"]); oParam.PaipaiItemID = Util.TrimNull(tempdr["PaipaiItemID"]); oParam.CreateTime = Util.TrimDateNull(tempdr["CreateTime"]); }
public string ResponseFromPaiPai(string response, int productsysno) { XmlDocument xml = new XmlDocument(); xml.Load(new System.IO.MemoryStream(System.Text.Encoding.GetEncoding("GB2312").GetBytes(response))); XmlNodeList xmlnode = xml.SelectSingleNode("response").ChildNodes; string result = ""; string itemid = ""; int retcode = -1; string errinfo = ""; foreach (XmlNode xNo in xmlnode) { if (xNo.Name == "body" || xNo.Name == "head") { foreach (XmlNode xNoChild in xNo.ChildNodes) { XmlElement xe = (XmlElement)xNoChild; { if (xe.Name == "itemid") { itemid = xe.InnerText; PaipaiResponseInfo oPaipaiResponse = new PaipaiResponseInfo(); oPaipaiResponse.ProductSysNo = productsysno; oPaipaiResponse.PaipaiItemID = itemid; oPaipaiResponse.CreateTime = DateTime.Now; PaipaiManager.GetInstance().Insert(oPaipaiResponse); } else if (xe.Name == "retcode") { retcode = Int32.Parse(xe.InnerText); } else if (xe.Name == "errinfo") { errinfo = xe.InnerText; } } } } } if (retcode == 0) { result = "拍拍网上架/更新成功!"; } else { result = "拍拍网更新出错" + errinfo; } return(result); }
public int Insert(PaipaiResponseInfo oParam) { string sql = @"INSERT INTO Paipai_Response ( ProductSysNo, PaipaiItemID, CreateTime ) VALUES ( @ProductSysNo, @PaipaiItemID, @CreateTime );set @SysNo = SCOPE_IDENTITY();"; SqlCommand cmd = new SqlCommand(sql); SqlParameter paramSysNo = new SqlParameter("@SysNo", SqlDbType.Int, 4); SqlParameter paramProductSysNo = new SqlParameter("@ProductSysNo", SqlDbType.Int, 4); SqlParameter paramPaipaiItemID = new SqlParameter("@PaipaiItemID", SqlDbType.NVarChar, 50); SqlParameter paramCreateTime = new SqlParameter("@CreateTime", SqlDbType.DateTime); paramSysNo.Direction = ParameterDirection.Output; if (oParam.ProductSysNo != AppConst.IntNull) { paramProductSysNo.Value = oParam.ProductSysNo; } else { paramProductSysNo.Value = System.DBNull.Value; } if (oParam.PaipaiItemID != AppConst.StringNull) { paramPaipaiItemID.Value = oParam.PaipaiItemID; } else { paramPaipaiItemID.Value = System.DBNull.Value; } if (oParam.CreateTime != AppConst.DateTimeNull) { paramCreateTime.Value = oParam.CreateTime; } else { paramCreateTime.Value = System.DBNull.Value; } cmd.Parameters.Add(paramSysNo); cmd.Parameters.Add(paramProductSysNo); cmd.Parameters.Add(paramPaipaiItemID); cmd.Parameters.Add(paramCreateTime); return(SqlHelper.ExecuteNonQuery(cmd, out oParam.SysNo)); }
public void Insert(PaipaiResponseInfo oPaipaiResponseInfo) { new PaipaiResposeDac().Insert(oPaipaiResponseInfo); }