public string SaveDetailGroup(string value) { QuestionnaireDetailManager qdm = new QuestionnaireDetailManager(); List <QuestionnaireDetailData> qds = new List <QuestionnaireDetailData>(); string[] values = value.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); foreach (var val in values) { var qd = new QuestionnaireDetailData(); qd = Element.ToElement(qd, val); qds.Add(qd); } if (qds.Count > 0) { //先刪除 qdm.DeleteByGroupId(qds[0].GroupId.ToString()); //新增 foreach (var qd in qds) { qdm.Insert(qd); } } return("Y"); }
public string SaveDetail(string detailPK, string masterPK, string type, string groupId, string topic, string desc, string answerType, string answerDef, string nextAnswer, string needed, string sort) { QuestionnaireDetailManager qdm = new QuestionnaireDetailManager(); int dPK, mPK, gId, s; int.TryParse(detailPK, out dPK); int.TryParse(masterPK, out mPK); int.TryParse(groupId, out gId); int.TryParse(sort, out s); if (detailPK == "0") { detailPK = qdm.Insert(new QuestionnaireDetailData { MasterId = mPK, Type = type, GroupId = gId, Topic = topic, Description = desc, AnswerType = answerType, AnswerDefine = answerDef, NextAnswer = nextAnswer, Needed = needed == "Y", Sort = s }); } else { qdm.Update(new QuestionnaireDetailData { Id = dPK, MasterId = mPK, Type = type, GroupId = gId, Topic = topic, Description = desc, AnswerType = answerType, AnswerDefine = answerDef, NextAnswer = nextAnswer, Needed = needed == "Y", Sort = s }); } return(detailPK); }