private static CasePlanAggregate BuildCasePlan(tCase tCase, tDefinitions definitions, CaseFileAggregate caseFile) { var planModel = tCase.casePlanModel; var roles = new List <CasePlanRole>(); var files = new List <CasePlanFileItem>(); if (tCase.caseRoles != null && tCase.caseRoles.role != null) { foreach (var role in tCase.caseRoles.role) { roles.Add(new CasePlanRole { Id = role.id, Name = role.name }); } } if (tCase.caseFileModel != null && tCase.caseFileModel.caseFileItem != null) { foreach (var caseFileItem in tCase.caseFileModel.caseFileItem) { var caseFileItemDef = definitions.caseFileItemDefinition.First(c => c.id == caseFileItem.definitionRef.ToString()); files.Add(new CasePlanFileItem { DefinitionType = caseFileItemDef.definitionType, Id = caseFileItem.id, Name = caseFileItem.name }); } } return(CasePlanAggregate.New(planModel.id, planModel.name, planModel.name, caseFile.AggregateId, caseFile.Version, Serialize(planModel), roles, files)); }
public string SendMailToSales(string heading, string content) { string h = heading; string c = content; var customer = GetUserName(); if (h != null && c != null) { tCase a = new tCase(); a.fheading = h; a.fcontent = c; a.fCustomerID = customer.fCustomerID; db.tCases.Add(a); db.SaveChanges(); return "<span style=\"font-weight: bold\">--------訊息已發送成功,請耐心等待業務員的回覆,謝謝!!-------- </span>"; } else { return "<span style=\"font-weight: bold\">--------請檢查輸入是否正確,謝謝!!-------- </span>"; } }