Пример #1
0
        /// <summary>
        /// 获取到下拉框中客户和父客户的联系人
        /// </summary>
        private void GetParAndAccSelect(HttpContext context, long account_id)
        {
            StringBuilder conHtml = new StringBuilder();

            var account = new crm_account_dal().FindNoDeleteById(account_id);

            if (account != null)
            {
                var conList = new crm_contact_dal().GetContactByAccountId(account.id);
                if (conList != null && conList.Count > 0)
                {
                    foreach (var con in conList)
                    {
                        conHtml.Append($"<option value='{con.id}'>{con.name}</option>");
                    }
                }
                if (account.parent_id != null)
                {
                    var parConList = new crm_contact_dal().GetContactByAccountId((long)account.parent_id);
                    if (parConList != null && parConList.Count > 0)
                    {
                        conHtml.Append("<option value=''>-----</option>");
                        foreach (var con in conList)
                        {
                            conHtml.Append($"<option value='{con.id}'>{con.name}</option>");
                        }
                    }
                }
            }
            context.Response.Write(conHtml.ToString());
        }
Пример #2
0
        /// <summary>
        /// 获取到客户和父客户的联系人
        /// </summary>
        private void GetConAccAndPar(HttpContext context, long account_id)
        {
            StringBuilder conHtml = new StringBuilder();

            var account = new crm_account_dal().FindNoDeleteById(account_id);

            if (account != null)
            {
                var conList = new crm_contact_dal().GetContactByAccountId(account.id);
                if (conList != null && conList.Count > 0)
                {
                    foreach (var con in conList)
                    {
                        conHtml.Append("<tr><td><input type='checkbox' value='" + con.id + "' class='checkCon' /></td><td>" + con.name + "</td><td><a href='mailto:" + con.email + "'>" + con.email + "</a></td></tr>");
                    }
                }
                if (account.parent_id != null)
                {
                    var parConList = new crm_contact_dal().GetContactByAccountId((long)account.parent_id);
                    if (parConList != null && parConList.Count > 0)
                    {
                        conHtml.Append("<tr><td colspan='3'>父客户联系人</td></tr>");
                        foreach (var con in conList)
                        {
                            conHtml.Append("<tr><td><input type='checkbox' value='" + con.id + "' class='checkCon' /></td><td>" + con.name + "</td><td><a href='mailto:" + con.email + "'>" + con.email + "</a></td></tr>");
                        }
                    }
                }
            }
            context.Response.Write(conHtml.ToString());
        }
Пример #3
0
        /// <summary>
        /// 获取配置项相关详情数据
        /// </summary>
        private void GetInsProDetail(HttpContext context)
        {
            var insProId = context.Request.QueryString["insProId"];

            if (!string.IsNullOrEmpty(insProId))
            {
                var insPr = new crm_installed_product_dal().FindNoDeleteById(long.Parse(insProId));
                if (insPr != null)
                {
                    string name        = "";
                    string contactName = "";
                    string contactId   = "";
                    string insTime     = "";
                    string insUser     = "";
                    string insWarnTime = "";  // 保修期
                    string vendorId    = "";
                    string vendorName  = "";
                    string insService  = "";
                    int    relateNum   = 0;    // 相关配置项
                    var    thisPro     = new ivt_product_dal().FindNoDeleteById(insPr.product_id);
                    if (thisPro != null)
                    {
                        name = thisPro.name;
                    }
                    if (insPr.contact_id != null)
                    {
                        var contact = new crm_contact_dal().FindNoDeleteById((long)insPr.contact_id);
                        if (contact != null)
                        {
                            contactId   = contact.id.ToString();
                            contactName = contact.name;
                        }
                    }
                    if (insPr.installed_resource_id != null)
                    {
                        var insRes = new sys_resource_dal().FindNoDeleteById((long)insPr.installed_resource_id);
                        if (insRes != null)
                        {
                            insUser = insRes.name;
                        }
                    }
                    if (insPr.vendor_account_id != null)
                    {
                        var thisVnedor = new CompanyBLL().GetCompany((long)insPr.vendor_account_id);
                        if (thisVnedor != null)
                        {
                            vendorId   = thisVnedor.id.ToString();
                            vendorName = thisVnedor.name;
                        }
                    }
                    insTime = Tools.Date.DateHelper.ConvertStringToDateTime(insPr.create_time).ToString("yyyy-MM-dd");



                    context.Response.Write(new Tools.Serialize().SerializeJson(new { id = insPr.id, name = name, contactId = contactId, contactName = contactName, insTime = insTime, insUser = insUser, insWarnTime = insWarnTime, vendorId = vendorId, vendorName = vendorName, insService = insService, relateNum = relateNum }));
                }
            }
        }
Пример #4
0
        private void GetContactInfo(HttpContext context)
        {
            var contatc_id = context.Request.QueryString["contact_id"];

            if (!string.IsNullOrEmpty(contatc_id))
            {
                var thisContact = new crm_contact_dal().FindNoDeleteById(long.Parse(contatc_id));
                if (thisContact != null)
                {
                    context.Response.Write(new Tools.Serialize().SerializeJson(thisContact));
                }
            }
        }
Пример #5
0
        private void GetConName(HttpContext context, string ids)
        {
            StringBuilder con = new StringBuilder();

            if (!string.IsNullOrEmpty(ids))
            {
                var conList = new crm_contact_dal().GetContactByIds(ids);
                if (conList != null && conList.Count > 0)
                {
                    conList.ForEach(_ => con.Append($";{_.name}"));
                }
            }
            context.Response.Write(con.ToString());
        }
Пример #6
0
        public bool UpdateContacts(string updateIds, string phone, string fax, long user_id)
        {
            var user = UserInfoBLL.GetUserInfo(user_id);

            if (user == null)
            {
                return(false);
            }
            var con_list    = updateIds.Split(',');
            var contactList = _dal.GetContactByIds(updateIds);

            if (contactList != null && contactList.Count > 0)
            {
                foreach (var item in con_list)
                {
                    var contact = new crm_contact_dal().FindById(Convert.ToInt64(item));   // 获取到对应的联系人信息
                    if (contact != null)
                    {
                        contact.phone          = phone;
                        contact.fax            = fax;
                        contact.update_time    = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now);
                        contact.update_user_id = user.id;
                        new crm_contact_dal().Update(contact);                   // 修改联系人
                        new sys_oper_log_dal().Insert(new sys_oper_log()
                        {
                            user_cate           = "用户",
                            user_id             = user.id,
                            name                = user.name,
                            phone               = user.mobile == null ? "" : user.mobile,
                            oper_time           = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now),
                            oper_object_cate_id = (int)OPER_LOG_OBJ_CATE.CONTACTS,
                            oper_object_id      = contact.id,
                            oper_type_id        = (int)OPER_LOG_TYPE.UPDATE,
                            oper_description    = _dal.CompareValue(contactList.FirstOrDefault(_ => _.id == contact.id), contact),
                            remark              = "修改联系人电话或传真",
                        });    // 插入更改日志
                    }
                }
            }

            return(true);
        }
Пример #7
0
        /// <summary>
        /// 获取联系人的详情信息
        /// </summary>
        private void GetContactDetail(HttpContext context)
        {
            var contatc_id = context.Request.QueryString["contact_id"];

            if (!string.IsNullOrEmpty(contatc_id))
            {
                var thisContact = new crm_contact_dal().FindNoDeleteById(long.Parse(contatc_id));
                if (thisContact != null)
                {
                    int ticketNum  = 0; // 所有打开的工单的数量
                    int monthNum   = 0; // 近三十天工单的数量
                    var ticketList = new sdk_task_dal().GetTicketByContact(thisContact.id);
                    if (ticketList != null && ticketList.Count > 0)
                    {
                        ticketNum = ticketList.Count;
                    }
                    context.Response.Write(new Tools.Serialize().SerializeJson(new { id = thisContact.id, name = thisContact.name, phone = thisContact.phone, ticketNum = ticketNum, monthNum = monthNum, }));
                }
            }
        }
Пример #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                // 预付时间合同、预付费合同、事件合同的详情主界面

                var contract_id = Request.QueryString["contract_id"];
                if (!string.IsNullOrEmpty(contract_id))
                {
                    thisContract = new ctt_contract_dal().FindNoDeleteById(long.Parse(contract_id));
                }

                var thisId = Request.QueryString["id"];
                var srDal  = new sys_resource_dal();
                var ccDal  = new crm_contact_dal();
                if (!string.IsNullOrEmpty(thisId))
                {
                    thisRule = new ctt_contract_notify_rule_dal().FindNoDeleteById(long.Parse(thisId));
                    if (thisRule != null)
                    {
                        isAdd        = false;
                        thisContract = new ctt_contract_dal().FindNoDeleteById(thisRule.contract_id);
                        new ctt_contract_notify_rule_recipient_dal();
                        thisRuleResList  = srDal.GetConRuleList(thisRule.id);
                        otherRuleResList = srDal.GetNotInConRuleList(thisRule.id);

                        thisRuleConList  = ccDal.GetConRuleList(thisRule.id);
                        otherRuleConList = ccDal.GetNotInConRuleList(thisRule.id, thisContract.account_id);
                    }
                }
                else
                {
                    otherRuleResList = srDal.GetSourceList();
                    otherRuleConList = ccDal.GetContactByAccountId(thisContract.account_id);
                }

                if (thisContract == null)
                {
                    Response.Write("<script>window.close();</script>");
                    Response.End();
                }
                if (thisContract.type_id == (int)DicEnum.CONTRACT_TYPE.BLOCK_HOURS || thisContract.type_id == (int)DicEnum.CONTRACT_TYPE.RETAINER || thisContract.type_id == (int)DicEnum.CONTRACT_TYPE.PER_TICKET)
                {
                    // conTypeName
                    List <sys_notify_tmpl> thisTemp = null;
                    var sntDal = new sys_notify_tmpl_dal();
                    if (thisContract.type_id == (int)DicEnum.CONTRACT_TYPE.BLOCK_HOURS)
                    {
                        conTypeName = "预付时间";
                        thisTemp    = sntDal.GetTempByEvent(DicEnum.NOTIFY_EVENT.BLOCK_CONTRACT_RULE);
                    }
                    else if (thisContract.type_id == (int)DicEnum.CONTRACT_TYPE.RETAINER)
                    {
                        conTypeName = "预付费";
                        thisTemp    = sntDal.GetTempByEvent(DicEnum.NOTIFY_EVENT.RETAINER_CONTRACT_RULE);
                    }
                    else
                    {
                        conTypeName = "事件";
                        thisTemp    = sntDal.GetTempByEvent(DicEnum.NOTIFY_EVENT.PER_CONTRACT_RULE);
                    }
                    notify_tmpl_id.DataTextField  = "name";
                    notify_tmpl_id.DataValueField = "id";
                    notify_tmpl_id.DataSource     = thisTemp;
                    notify_tmpl_id.DataBind();
                    if (thisRule != null)
                    {
                        notify_tmpl_id.SelectedValue = thisRule.notify_tmpl_id.ToString();
                    }
                }
                else
                {
                    Response.Write("<script>alert('该合同类型暂不能添加通知规则');window.close();</script>");
                    Response.End();
                }
            }
            catch (Exception)
            {
                Response.End();
            }
        }
Пример #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                thisBookMark = new IndexBLL().GetSingBook(Request.RawUrl, LoginUserId);
                var soid = Request.QueryString["id"];
                if (AuthBLL.GetUserSaleorderAuth(LoginUserId, LoginUser.security_Level_id, Convert.ToInt64(soid)).CanEdit == false)
                {
                    Response.End();
                    return;
                }

                sale_order = new crm_sales_order_dal().GetSingleSalesOrderByWhere($" and id = {soid}");
                if (sale_order != null)
                {
                    sale_udfList      = new UserDefinedFieldsBLL().GetUdf(DicEnum.UDF_CATE.SALES);
                    sale_udfValueList = new UserDefinedFieldsBLL().GetUdfValue(DicEnum.UDF_CATE.SALES, sale_order.id, sale_udfList);
                    opportunity       = new crm_opportunity_dal().GetOpportunityById(sale_order.opportunity_id);
                    if (!IsPostBack)
                    {
                        var contactList = new crm_contact_dal().GetContactByAccountId(opportunity.account_id);


                        #region  拉赋值
                        status_id.DataTextField  = "show";
                        status_id.DataValueField = "val";
                        status_id.DataSource     = dic.FirstOrDefault(_ => _.Key == "sales_order_status").Value;
                        status_id.DataBind();
                        status_id.Items.Insert(0, new ListItem()
                        {
                            Value = "0", Text = "   ", Selected = true
                        });

                        owner_resource_id.DataTextField  = "show";
                        owner_resource_id.DataValueField = "val";
                        owner_resource_id.DataSource     = dic.FirstOrDefault(_ => _.Key == "sys_resource").Value;
                        owner_resource_id.DataBind();
                        owner_resource_id.Items.Insert(0, new ListItem()
                        {
                            Value = "0", Text = "   ", Selected = true
                        });

                        // bill_country_id
                        bill_country_id.DataTextField  = "show";
                        bill_country_id.DataValueField = "val";
                        bill_country_id.DataSource     = dic.FirstOrDefault(_ => _.Key == "country").Value;
                        bill_country_id.DataBind();
                        bill_country_id.Items.Insert(0, new ListItem()
                        {
                            Value = "0", Text = "   ", Selected = true
                        });
                        bill_country_id.SelectedValue = "1";

                        ship_country_id.DataTextField  = "show";
                        ship_country_id.DataValueField = "val";
                        ship_country_id.DataSource     = dic.FirstOrDefault(_ => _.Key == "country").Value;
                        ship_country_id.DataBind();
                        ship_country_id.Items.Insert(0, new ListItem()
                        {
                            Value = "0", Text = "   ", Selected = true
                        });
                        ship_country_id.SelectedValue = "1";
                        // contact_id
                        contact_id.DataTextField  = "name";
                        contact_id.DataValueField = "id";
                        contact_id.DataSource     = contactList.Where(_ => _.is_active == 1).ToList();
                        contact_id.DataBind();
                        contact_id.Items.Insert(0, new ListItem()
                        {
                            Value = "0", Text = "   ", Selected = true
                        });
                        if (sale_order.contact_id != null)
                        {
                            contact_id.SelectedValue = sale_order.contact_id.ToString();
                        }

                        #endregion
                        billTo_use_account_address.Checked = sale_order.bill_to_use_account_address == 1;
                        shipTo_use_account_address.Checked = sale_order.ship_to_use_account_address == 1;
                        shipTo_use_bill_to_address.Checked = sale_order.ship_to_use_bill_to_address == 1;

                        status_id.SelectedValue         = sale_order.status_id.ToString();
                        owner_resource_id.SelectedValue = sale_order.owner_resource_id.ToString();
                    }
                }
                else
                {
                    Response.End();
                }
            }
            catch (Exception)
            {
                Response.End();
            }
        }