public static PriceSellerEntity getById(int psId) { DataRow dr = DbHelper.ExecuteDataRow("p_PriceSeller_getById", psId); PriceSellerEntity ps = new PriceSellerEntity(); if (dr != null) { ps.PsId = psId; ps.CustomerId = Convert.ToInt32(dr["customerId"]); ps.InputDt = Convert.ToDateTime(dr["inputDt"]); ps.IsUse = Convert.ToBoolean(dr["isUse"]); ps.ProductId = Convert.ToInt32(dr["ProductId"]); ps.SellerId = Convert.ToInt32(dr["SellerId"]); ps.SellerPrice = Convert.ToDecimal(dr["SellerPrice"]); ps.Unit = dr["Unit"].ToString(); } return ps; }
/// <summary> /// code:1表示超过报价时间;2表示发生错误,无法提交;3表示提交报价成功. /// </summary> /// <param name="request"></param> /// <param name="response"></param> private void sellerSubmitPrice(HttpRequest request, HttpResponse response) { string REQUEST_ERROR = "{\"code\":\"2\"}"; string OUT_OF_LIMITED_TIME = "{\"code\":\"1\"}"; string CURRENT_IS_NOTSUPPLY = "{\"code\":\"4\"}"; if (!string.IsNullOrEmpty(request.QueryString["w"])) // f表示前台供应商提交;a表示后台操作人员提交; { if (!string.IsNullOrEmpty(request.QueryString["tArray"])) { try { int companyId = 0; if (request.QueryString["w"] == "a") { int.TryParse(request.QueryString["companyId"], out companyId); } else if (request.QueryString["w"] == "f") { companyId = logic.customer.companyId; } int productId = 0; List<BusinessNaturePrice> businessNaturePriceList = JsonConvert.DeserializeObject<List<BusinessNaturePrice>>(request.QueryString["tArray"]); if (businessNaturePriceList.Count > 0) { #region 报价时间判断 if (request.QueryString["w"] == "f" && logic.customer.userId != 0) { DateTime updatePriceDt = Convert.ToDateTime(DateTime.Now.ToShortDateString() + " " + logic.webset.list().UpdatePriceDt); if (DateTime.Now >= updatePriceDt) { response.Output.Write(OUT_OF_LIMITED_TIME); return; } } #endregion #region 提交报价操作 foreach (BusinessNaturePrice item in businessNaturePriceList) { bool isSupply = logic.sellerRange.IsSupply(companyId, item.ProductId, item.BusinessNature); if (!isSupply) { PriceSellerEntity ps = new PriceSellerEntity(); ps.ProductId = item.ProductId; productId = item.ProductId; ps.SellerPrice = item.Price; ps.Unit = item.Unit; if (request.QueryString["w"] == "f") //前台供应商报价 { ps.SellerId = companyId; ps.CustomerId = logic.customer.userId; ps.Source = "1"; ps.AdminId = 0; ps.ContactMan = ""; ps.Reason = ""; } else if (request.QueryString["w"] == "a") // 后台操作人员报价 { ps.SellerId = companyId; ps.CustomerId = 0; ps.Source = "2"; ps.AdminId = logic.sysAdmin.AdminID; ps.ContactMan = request.QueryString["contactMan"]; ps.Reason = request.QueryString["reason"]; } ps.BusinessNature = item.BusinessNature; logic.priceSeller.updatePriceV2(ps); } else { response.Output.Write(CURRENT_IS_NOTSUPPLY); return; } } #endregion #region 更新价格数据 DataTable dt = logic.price.listWithBusinessNatures(productId, companyId); using (JsonTextWriter jsonWriter = new JsonTextWriter(response.Output)) { jsonWriter.WriteStartObject(); jsonWriter.WritePropertyName("code"); jsonWriter.WriteValue("3"); jsonWriter.WritePropertyName("productId"); jsonWriter.WriteValue(productId); jsonWriter.WritePropertyName("priceArray"); jsonWriter.WriteStartArray(); foreach (DataRow row in dt.Rows) { jsonWriter.WriteStartObject(); jsonWriter.WritePropertyName("businessNatureName"); jsonWriter.WriteValue(row["businessNatureName"]); jsonWriter.WritePropertyName("sellerPrice"); jsonWriter.WriteValue(string.Format("{0:F2}", row["sellerPrice"])); jsonWriter.WritePropertyName("businessNature"); jsonWriter.WriteValue(row["businessNature"]); jsonWriter.WritePropertyName("unit"); jsonWriter.WriteValue(row["unit"]); jsonWriter.WriteEndObject(); } jsonWriter.WriteEndArray(); jsonWriter.WriteEndObject(); } #endregion } else { response.Output.Write(REQUEST_ERROR); } } catch { response.Output.Write(REQUEST_ERROR); } } else { response.Output.Write(REQUEST_ERROR); } } else { response.Output.Write(REQUEST_ERROR); } }
public static void updatePriceV2(PriceSellerEntity ps) { PriceSeller.updatePriceV2(ps); }
public static void updatePriceV2(PriceSellerEntity ps) { DbHelper.ExecuteNonQuery("p_PriceSeller_updatePriceV2", ps.SellerId, ps.CustomerId, ps.ProductId, ps.SellerPrice, ps.Unit, ps.AdminId, ps.Source, ps.ContactMan, ps.Reason,ps.BusinessNature); }