public void ProcessRequest(HttpContext context) { var templateBll = new FormTemplateBLL(); if ("post".Equals(context.Request.HttpMethod.ToLower())) { using (var reader = new StreamReader(context.Request.InputStream)) { string templateJson = HttpUtility.UrlDecode(reader.ReadToEnd()); if (!string.IsNullOrEmpty(templateJson)) { var templateMode = templateJson.ToModeBase <FormTemplateModel>(); if (templateMode == null) { return; } templateMode = templateBll.AddOrUpdateFormTemplateModel(templateMode); } } } else { var formTemplateId = context.Request["formTemplateId"].ToInt64(); var templateMode = templateBll.GetFormTemplate(formTemplateId); var result = templateMode.ToJason(); } }
public static string ShowAllTemplates() { var templateBll = new FormTemplateBLL(); var templateModes = templateBll.GetFormTemplates(); string result = templateModes.ToJason(); return(result); }
//get all templates public void ProcessRequest(HttpContext context) { var templateBll = new FormTemplateBLL(); if ("get".Equals(context.Request.HttpMethod.ToLower())) { var templateModes = templateBll.GetFormTemplates(); string result = templateModes.ToJason(); } }
public static ArrayList ShowInstance(string instanceId, string templateId) { var values = new ArrayList(); if (!string.IsNullOrEmpty(instanceId)) { var instanceBll = new FormInstanceBLL(); var instanceMode = instanceBll.GetFormInstance(instanceId.ToInt64()); values.Add(instanceMode.FormTemplateModel.ToJason()); values.Add(instanceMode.FormData); } else { var instanceBll = new FormTemplateBLL(); var instanceMode = instanceBll.GetFormTemplate(templateId.ToInt64()); values.Add(instanceMode.ToJason()); } return(values); }
/// <summary> /// 根据商机模板填充商机内容 /// </summary> /// <param name="context"></param> /// <param name="formTemp_id"></param> public void GetFormTemplate(HttpContext context, long formTemp_id) { var formTemplate = new FormTemplateBLL().GetOpportunityTmpl((int)formTemp_id); if (formTemplate != null) { var json = new Tools.Serialize().SerializeJson(formTemplate); if (formTemplate.account_id != null) { var companyName = new CompanyBLL().GetCompany((long)formTemplate.account_id); if (companyName != null) { json = json.Substring(0, json.Length - 1); json += ",\"ParentComoanyName\":\"" + companyName.name + "\"}"; } } context.Response.Write(json); } }
protected void Page_Load(object sender, EventArgs e) { try { thisBookMark = new IndexBLL().GetSingBook(Request.RawUrl, LoginUserId); callBackFiled = Request.QueryString["callBackFiled"]; var opportunity_id = Request.QueryString["opportunity_id"]; if (!string.IsNullOrEmpty(opportunity_id)) { if (AuthBLL.GetUserOppAuth(LoginUserId, LoginUser.security_Level_id, Convert.ToInt64(opportunity_id)).CanEdit == false) { Response.End(); return; } opportunity = new crm_opportunity_dal().GetOpportunityById(Convert.ToInt64(opportunity_id)); } dic = new OpportunityBLL().GetField(); #region 配置下拉框的数据源 // 商机负责人 resource_id.DataTextField = "show"; resource_id.DataValueField = "val"; resource_id.DataSource = dic.FirstOrDefault(_ => _.Key == "sys_resource").Value; resource_id.DataBind(); resource_id.Items.Insert(0, new ListItem() { Value = "0", Text = " ", Selected = true }); // 当前阶段 stage_id.DataTextField = "show"; stage_id.DataValueField = "val"; stage_id.DataSource = dic.FirstOrDefault(_ => _.Key == "opportunity_stage").Value; stage_id.DataBind(); stage_id.Items.Insert(0, new ListItem() { Value = "0", Text = " ", Selected = true }); stage_id.SelectedValue = ((int)OPPORTUNITY_STAGE.NEW_CLUE).ToString(); // 感兴趣等级 interest_degree_id.DataTextField = "show"; interest_degree_id.DataValueField = "val"; interest_degree_id.DataSource = dic.FirstOrDefault(_ => _.Key == "opportunity_interest_degree").Value; interest_degree_id.DataBind(); interest_degree_id.Items.Insert(0, new ListItem() { Value = "0", Text = " ", Selected = true }); // 商机来源 source_id.DataTextField = "show"; source_id.DataValueField = "val"; source_id.DataSource = dic.FirstOrDefault(_ => _.Key == "opportunity_source").Value; source_id.DataBind(); source_id.Items.Insert(0, new ListItem() { Value = "0", Text = " ", Selected = true }); // 状态 status_id.DataTextField = "show"; status_id.DataValueField = "val"; status_id.DataSource = dic.FirstOrDefault(_ => _.Key == "oppportunity_status").Value; status_id.DataBind(); status_id.SelectedValue = ((int)OPPORTUNITY_STATUS.ACTIVE).ToString(); //status_id.Items.Insert(0, new ListItem() { Value = "0", Text = " ", Selected = true }); // 主要竞争对手 competitor_id.DataTextField = "show"; competitor_id.DataValueField = "val"; competitor_id.DataSource = dic.FirstOrDefault(_ => _.Key == "competition").Value; competitor_id.DataBind(); competitor_id.Items.Insert(0, new ListItem() { Value = "0", Text = " ", Selected = true }); // 赢单原因 win_reason_type_id.DataTextField = "show"; win_reason_type_id.DataValueField = "val"; win_reason_type_id.DataSource = dic.FirstOrDefault(_ => _.Key == "oppportunity_win_reason_type").Value; win_reason_type_id.DataBind(); win_reason_type_id.Items.Insert(0, new ListItem() { Value = "0", Text = " ", Selected = true }); // 丢单原因 loss_reason_type_id.DataTextField = "show"; loss_reason_type_id.DataValueField = "val"; loss_reason_type_id.DataSource = dic.FirstOrDefault(_ => _.Key == "oppportunity_loss_reason_type").Value; loss_reason_type_id.DataBind(); loss_reason_type_id.Items.Insert(0, new ListItem() { Value = "0", Text = " ", Selected = true }); // 通知模板 --todo 需要过滤商机创建或编辑相关的通知模板 //notify_tmpl_id.DataTextField = "show"; //notify_tmpl_id.DataValueField = "val"; //notify_tmpl_id.DataSource = dic.FirstOrDefault(_ => _.Key == "notify_tmpl").Value; //notify_tmpl_id.DataBind(); //notify_tmpl_id.Items.Insert(0, new ListItem() { Value = "0", Text = " ", Selected = true }); var formTemplateList = new FormTemplateBLL().GetTemplateOpportunityByUser(GetLoginUserId()); formTemplate.DataTextField = "speed_code"; formTemplate.DataValueField = "id"; formTemplate.DataSource = formTemplateList; formTemplate.DataBind(); formTemplate.Items.Insert(0, new ListItem() { Value = "0", Text = " ", Selected = true }); #endregion opportunity_udfList = new UserDefinedFieldsBLL().GetUdf(DicEnum.UDF_CATE.OPPORTUNITY); if (opportunity != null) { isAdd = false; //company_udfList = new UserDefinedFieldsBLL().GetUdf(DicEnum.UDF_CATE.COMPANY); } if (!isAdd) { opportunity_udfValueList = new UserDefinedFieldsBLL().GetUdfValue(DicEnum.UDF_CATE.OPPORTUNITY, opportunity.id, opportunity_udfList); if (!IsPostBack) { resource_id.SelectedValue = opportunity.resource_id.ToString(); stage_id.SelectedValue = opportunity.stage_id == null ? "0" : opportunity.stage_id.ToString(); interest_degree_id.SelectedValue = opportunity.interest_degree_id == null ? "0" : opportunity.interest_degree_id.ToString(); source_id.SelectedValue = opportunity.source_id == null ? "0" : opportunity.source_id.ToString(); status_id.SelectedValue = opportunity.status_id == null ? "0" : opportunity.status_id.ToString(); competitor_id.SelectedValue = opportunity.competitor_id == null ? "0" : opportunity.competitor_id.ToString(); win_reason_type_id.SelectedValue = opportunity.win_reason_type_id == null ? "0" : opportunity.win_reason_type_id.ToString(); loss_reason_type_id.SelectedValue = opportunity.loss_reason_type_id == null ? "0" : opportunity.loss_reason_type_id.ToString(); is_use_quote.Checked = opportunity.use_quote == 1; } } else { // 联系人查看的时候穿过来客户ID,和联系人ID,联系人不能更改,只有更改客户才可以更改联系人 var contact_id = Request.QueryString["oppo_contact_id"]; if (!string.IsNullOrEmpty(contact_id)) { contact = new ContactBLL().GetContact(Convert.ToInt64(contact_id)); } var account_id = Request.QueryString["oppo_account_id"]; if (!string.IsNullOrEmpty(account_id)) { account = new CompanyBLL().GetCompany(Convert.ToInt64(account_id)); } } } catch (Exception msg) { Response.End(); } }