/// <summary> /// 根据商机获取相应项目的值 /// </summary> public void GetPorUdfByOpp(HttpContext context, long oppo_id) { var thisOpp = new crm_opportunity_dal().FindNoDeleteById(oppo_id); if (thisOpp != null) { var projectUdfList = new UserDefinedFieldsBLL().GetUdf(DicEnum.UDF_CATE.PROJECTS); var oppoUdfList = new UserDefinedFieldsBLL().GetUdf(DicEnum.UDF_CATE.OPPORTUNITY); var oppoValueList = new UserDefinedFieldsBLL().GetUdfValue(DicEnum.UDF_CATE.OPPORTUNITY, thisOpp.id, oppoUdfList); if (projectUdfList != null && projectUdfList.Count > 0) { StringBuilder udfHtml = new StringBuilder(); var sufDal = new sys_udf_field_dal(); foreach (var thisProUdf in projectUdfList) { var thisSysProFile = sufDal.FindNoDeleteById(thisProUdf.id); if (thisSysProFile != null && thisSysProFile.crm_to_project_udf_id != null) { var thisSysOppFile = sufDal.FindNoDeleteById((long)thisSysProFile.crm_to_project_udf_id); var oppoValue = oppoValueList.FirstOrDefault(_ => _.id == thisSysProFile.crm_to_project_udf_id); if (oppoValue != null && thisSysOppFile != null && !string.IsNullOrEmpty(oppoValue.value.ToString())) { udfHtml.Append($"<tr height='21'><td id ='txtBlack8'>{thisSysProFile.col_comment}</td><td> {thisSysOppFile.col_comment} </td><td>{oppoValue.value.ToString()}<input type='hidden' name='{thisProUdf.id.ToString()}' id='{thisProUdf.id.ToString()}' value='{oppoValue.value.ToString()}' /></ td></ tr>"); } } } context.Response.Write(udfHtml.ToString()); } } }
public void GetUdfByCate(HttpContext context) { var insProId = context.Request.QueryString["insProId"]; crm_installed_product insPro = null; List <DTO.UserDefinedFieldValue> iProduct_udfValueList = null; if (!string.IsNullOrEmpty(insProId)) { insPro = new DAL.crm_installed_product_dal().FindNoDeleteById(long.Parse(insProId)); var iProduct_udfList = new UserDefinedFieldsBLL().GetUdf(DTO.DicEnum.UDF_CATE.CONFIGURATION_ITEMS); iProduct_udfValueList = new UserDefinedFieldsBLL().GetUdfValue(DTO.DicEnum.UDF_CATE.CONFIGURATION_ITEMS, insPro.id, iProduct_udfList); } var cateId = context.Request.QueryString["cateId"]; string udfHtml = ""; if (!string.IsNullOrEmpty(cateId)) { var usdList = new DAL.sys_udf_field_dal().GetUdfByGroupId(long.Parse(cateId)); if (usdList != null && usdList.Count > 0) { var udfFileDto = new UserDefinedFieldsBLL().GetUdf((DTO.DicEnum.UDF_CATE.CONFIGURATION_ITEMS)); usdList.ForEach(_ => { DTO.UserDefinedFieldValue thisValue = null; if (iProduct_udfValueList != null && iProduct_udfValueList.Count > 0) { thisValue = iProduct_udfValueList.FirstOrDefault(ip => ip.id == _.id); } switch (_.data_type_id) { case (int)DTO.DicEnum.UDF_DATA_TYPE.SINGLE_TEXT: udfHtml += $"<tr><td class='ip_general_label_udf'><div class='clear'><label>{_.col_comment}</label><input type = 'text' name='{_.id}' class='sl_cdt' value='{(thisValue==null?"":thisValue.value)}' /></div></td></tr>"; break; case (int)DTO.DicEnum.UDF_DATA_TYPE.MUILTI_TEXT: udfHtml += $"<tr><td class='ip_general_label_udf'><div class='clear'><label>{_.col_comment}</label><textarea name='{_.id}' rows='2' cols='20'>{(thisValue == null ? "" : thisValue.value)}</textarea></div></td></tr>"; break; case (int)DTO.DicEnum.UDF_DATA_TYPE.DATETIME: udfHtml += $"<tr><td class='ip_general_label_udf'><div class='clear'><label>{_.col_comment}</label><input type = 'text' name='{_.id}' onclick='WdatePicker()' class='sl_cdt' value='{(thisValue == null ? "" : thisValue.value)}' /></div></td></tr>"; break; case (int)DTO.DicEnum.UDF_DATA_TYPE.NUMBER: udfHtml += $"<tr><td class='ip_general_label_udf'><div class='clear'><label>{_.col_comment}</label><input type = 'text' name='{_.id}' maxlength='11' onkeyup=\"value = value.replace(/[^\\d] / g, '') \" onbeforepaste=\"clipboardData.setData('text', clipboardData.getData('text').replace(/[^\\d] / g, ''))\" class='sl_cdt' value='{(thisValue == null ? "" : thisValue.value)}' /></div></td></tr>"; break; case (int)DTO.DicEnum.UDF_DATA_TYPE.LIST: var thisListHtml = ""; if (udfFileDto != null && udfFileDto.Count > 0) { var thisList = udfFileDto.FirstOrDefault(u => u.id == _.id); if (thisList != null && thisList.value_list != null && thisList.value_list.Count > 0) { if (_.is_required == 0) { thisListHtml += "<option value=''> </option>"; } thisList.value_list.ForEach(t => { if (thisValue != null && thisValue.value.ToString() == t.val) { thisListHtml += $"<option value='{t.val}' selected='selected'>{t.show}</option>"; } else { thisListHtml += $"<option value='{t.val}'>{t.show}</option>"; } }); } } udfHtml += $"<tr><td class='ip_general_label_udf'><div class='clear'><label>{_.col_comment}</label><select class='sl_cdt' name='{_.id}'>{thisListHtml}</select></div></td></tr>"; break; default: break; } }); } } context.Response.Write(udfHtml); }