//插入新的咨询关联 public int InsertSWfsQuestAnswerRef(SWfsQuestAnswerRef QAR) { if (UpdateSWfsQuestAnswerOperateUserId(QAR.QuestAnswerId, PresentationHelper.GetPassport().UserName)) { return(DapperUtil.Insert <SWfsQuestAnswerRef>(QAR, false)); } return(-1); }
public ActionResult CreateQuestanswerRef(string questAnswerId, string productNos, string BtnSaveCB, string BtnSaveProduct) { string brandSelectedValue = Request.Params["brandSelectedValue"]; string categorySelectedValue = Request.Params["categorySelectedValue"]; SWfsQuestAnswerRef qar = new SWfsQuestAnswerRef(); qar.QuestAnswerId = Convert.ToInt32(questAnswerId); //关联商品 if (!string.IsNullOrEmpty(BtnSaveProduct)) { foreach (string item in productNos.Split(',')) { qar.ProductNo = item; qar.RefType = 1; if (CheckQuestanswerRef(item, "", "", questAnswerId)) { continue; } productCommentService.InsertSWfsQuestAnswerRef(qar); } } //关联分类和品牌 if (!string.IsNullOrEmpty(BtnSaveCB)) { if (!string.IsNullOrEmpty(categorySelectedValue) && !string.IsNullOrEmpty(brandSelectedValue)) { qar.RefType = 4; foreach (string itemc in categorySelectedValue.Split(',')) { qar.CategoryNo = itemc; foreach (string itemb in brandSelectedValue.Split(',')) { qar.BrandNo = itemb; if (CheckQuestanswerRef("", itemc, itemb, questAnswerId)) { continue; } productCommentService.InsertSWfsQuestAnswerRef(qar); } } } else if (!string.IsNullOrEmpty(categorySelectedValue)) { qar.RefType = 2; foreach (string itemc in categorySelectedValue.Split(',')) { qar.CategoryNo = itemc; if (CheckQuestanswerRef("", itemc, "", questAnswerId)) { continue; } productCommentService.InsertSWfsQuestAnswerRef(qar); } } else if (!string.IsNullOrEmpty(brandSelectedValue)) { qar.RefType = 3; foreach (string itemb in brandSelectedValue.Split(',')) { qar.BrandNo = itemb; //qar.RefType = 3; if (CheckQuestanswerRef("", "", itemb, questAnswerId)) { continue; } productCommentService.InsertSWfsQuestAnswerRef(qar); } } } return(Redirect("questanswermanager.html?pageindex=" + Request.QueryString["pageindex"] + "&productKeywords=" + Request.QueryString["productKeywords"] + "&questKeywords=" + Request.QueryString["questKeywords"] + "&answerKeywords=" + Request.QueryString["answerKeywords"] + CommonService.GetTimeStamp("&"))); }