/// <summary> /// 报价参数设置 /// </summary> /// <param name="quoteRef"></param> /// <param name="emailQuoteContact">是否通知报价联系人</param> /// <param name="emailAccountResource">是否通知客户经理</param> /// <param name="userId"></param> /// <returns></returns> public bool PreferencesQuote(crm_account_reference quoteRef, bool emailQuoteContact, bool emailAccountResource, long userId) { crm_account_reference_dal refDal = new crm_account_reference_dal(); var oldPref = refDal.GetAccountQuoteRef(quoteRef.account_id); crm_account_reference newPref; if (oldPref == null) { newPref = new crm_account_reference(); } else { newPref = refDal.GetAccountQuoteRef(quoteRef.account_id); } newPref.account_id = quoteRef.account_id; newPref.quote_tmpl_id = quoteRef.quote_tmpl_id; newPref.quote_email_message_tmpl_id = quoteRef.quote_email_message_tmpl_id; newPref.invoice_tmpl_id = null; newPref.invoice_email_message_tmpl_id = null; newPref.email_to_contacts = quoteRef.email_to_contacts; newPref.email_to_others = quoteRef.email_to_others; newPref.email_bcc_resources = quoteRef.email_bcc_resources; if (emailAccountResource) { var account = new CompanyBLL().GetCompany(newPref.account_id); if (account.resource_id != null) { newPref.email_bcc_account_manager = account.resource_id.ToString(); } } newPref.email_notes = quoteRef.email_notes; newPref.update_time = Tools.Date.DateHelper.ToUniversalTimeStamp(); newPref.update_user_id = userId; if (oldPref == null) { newPref.create_time = newPref.update_time; newPref.create_user_id = userId; newPref.id = refDal.GetNextIdCom(); refDal.Insert(newPref); OperLogBLL.OperLogAdd <crm_account_reference>(newPref, newPref.id, userId, OPER_LOG_OBJ_CATE.REFERENCE, "添加客户报价参数"); } else { refDal.Update(newPref); OperLogBLL.OperLogUpdate <crm_account_reference>(oldPref, newPref, newPref.id, userId, OPER_LOG_OBJ_CATE.REFERENCE, "修改客户报价参数"); } return(true); }
protected void Page_Load(object sender, EventArgs e) { try { var account_id = Request.QueryString["account_id"]; if (!string.IsNullOrEmpty(account_id)) { #region 拉框赋值 invoice_tmpl_id.DataValueField = "id"; invoice_tmpl_id.DataTextField = "name"; invoice_tmpl_id.DataSource = dic.FirstOrDefault(_ => _.Key == "invoice_tmpl").Value; invoice_tmpl_id.DataBind(); invoice_tmpl_id.Items.Insert(0, new ListItem() { Value = "0", Text = " ", Selected = true }); tax_region_id.DataValueField = "val"; tax_region_id.DataTextField = "show"; tax_region_id.DataSource = dic.FirstOrDefault(_ => _.Key == "taxRegion").Value; tax_region_id.DataBind(); tax_region_id.Items.Insert(0, new ListItem() { Value = "0", Text = " ", Selected = true }); // invoice_email_message_tmpl_id invoice_email_message_tmpl_id.DataValueField = "id"; invoice_email_message_tmpl_id.DataTextField = "name"; invoice_email_message_tmpl_id.DataSource = dic.FirstOrDefault(_ => _.Key == "email_temp").Value; invoice_email_message_tmpl_id.DataBind(); invoice_email_message_tmpl_id.Items.Insert(0, new ListItem() { Value = "0", Text = " ", Selected = true }); #endregion account = new CompanyBLL().GetCompany(long.Parse(account_id)); contractList = new crm_contact_dal().GetContactByAccountId(account.id); accRef = new crm_account_reference_dal().GetAccountInvoiceRef(account.id); if (accRef != null) { invoice_tmpl_id.SelectedValue = accRef.invoice_tmpl_id == null ? "0" : accRef.invoice_tmpl_id.ToString(); tax_region_id.SelectedValue = account.tax_region_id == null ? "0" : account.tax_region_id.ToString(); } if (!IsPostBack) { // no_contract_bill_to_parent nocontract_bill_to_parent.Checked = accRef != null && accRef.no_contract_bill_to_parent == 1; _ctl3_chkTaxExempt_ATCheckBox.Checked = account != null && account.is_tax_exempt == 1; if (accRef != null) { if (accRef.invoice_address_type_id == (int)DicEnum.INVOICE_ADDRESS_TYPE.USE_ACCOUNT_ADDRESS) { _ctl3_rdoAccount.Checked = true; } else if (accRef.invoice_address_type_id == (int)DicEnum.INVOICE_ADDRESS_TYPE.USE_PARENT_ACC_ADD) { _ctl3_UseParent.Checked = true; } else if (accRef.invoice_address_type_id == (int)DicEnum.INVOICE_ADDRESS_TYPE.USE_PARENT_INVOIVE_ADD) { _ctl3UseParInv.Checked = true; } else if (accRef.invoice_address_type_id == (int)DicEnum.INVOICE_ADDRESS_TYPE.USE_INSERT) { _ctl3_rdoAccountBillTo.Checked = true; } enable_email.Checked = accRef.enable_email_invoice == 1; } } if (account.parent_id != null) { parentAccount = new CompanyBLL().GetCompany((long)account.parent_id); } } else { Response.End(); } } catch (Exception) { Response.End(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { var id = Request.QueryString["account_id"]; if (string.IsNullOrEmpty(id)) { id = Request.QueryString["quote_id"]; if (string.IsNullOrEmpty(id)) { Response.Close(); return; } else { var quote = bll.GetQuote(long.Parse(id)); accountId = quote.account_id; } } else { accountId = long.Parse(id); } var dic = bll.GetField(); quote_email_message_tmpl_id.DataValueField = "id"; quote_email_message_tmpl_id.DataTextField = "name"; quote_email_message_tmpl_id.DataSource = dic.FirstOrDefault(_ => _.Key == "email_tmpl").Value; quote_email_message_tmpl_id.DataBind(); quote_tmpl_id.DataValueField = "id"; quote_tmpl_id.DataTextField = "name"; quote_tmpl_id.DataSource = dic.FirstOrDefault(_ => _.Key == "quote_tmpl").Value; quote_tmpl_id.DataBind(); accRef = bll.GetQuoteRef(accountId); if (accRef != null) { quote_tmpl_id.SelectedValue = accRef.quote_tmpl_id.ToString(); quote_email_message_tmpl_id.SelectedValue = accRef.quote_email_message_tmpl_id.ToString(); } } else { accountId = long.Parse(Request.Form["account_id"]); var thisRef = AssembleModel <crm_account_reference>(); bool emailQuoteContact = false; bool emailAccountResource = false; if (!string.IsNullOrEmpty(Request.Form["chooseQuoteContact"]) && Request.Form["chooseQuoteContact"].Equals("on")) { emailQuoteContact = true; } if (!string.IsNullOrEmpty(Request.Form["chooseManage"]) && Request.Form["chooseManage"].Equals("on")) { emailAccountResource = true; } if (bll.PreferencesQuote(thisRef, emailQuoteContact, emailAccountResource, GetLoginUserId())) { ClientScript.RegisterStartupScript(this.GetType(), "提示信息", "<script>alert('保存成功!');window.close(); </script>"); } } var account = new CompanyBLL().GetCompany(accountId); contactList = new ContactBLL().GetContactByCompany(account.id); resourceList = new UserResourceBLL().GetAllSysResource(); }