Esempio n. 1
0
        public AjaxMessage UpdateSaleType(string SaleTypeId, string SaleTypeName)
        {
            AjaxMessage ajax = new AjaxMessage();

            ajax.IsSuccess = false;
            ajax.Message   = "";
            try
            {
                if (!string.IsNullOrEmpty(SaleTypeId))
                {
                    int TypeId = SaleTypeId.ToInt32();
                    //根据Id查询
                    Expression <Func <FD_SaleType, bool> > whereLambda = c => c.SaleTypeID == TypeId;
                    FD_SaleType m_saleType = _SaleTypeService.GetModel(whereLambda);
                    m_saleType.SaleTypeName = SaleTypeName;

                    //执行修改
                    int result = _SaleTypeService.Update(m_saleType);
                    if (result > 0)
                    {
                        ajax.Message   = "修改成功";
                        ajax.IsSuccess = true;
                    }
                }
            }
            catch (Exception e)
            {
                ajax.Message = e.Message;
            }
            return(ajax);
        }
Esempio n. 2
0
        public AjaxMessage CreateSaleType(string typeName)
        {
            AjaxMessage ajax = new AjaxMessage();

            ajax.IsSuccess = false;
            ajax.Message   = "";
            try
            {
                if (!string.IsNullOrEmpty(typeName))
                {
                    int         EmployeeId = LoginInfo.UserInfo.EmployeeId;
                    FD_SaleType saleType   = new FD_SaleType()
                    {
                        SaleTypeName   = typeName,
                        CreateEmployee = LoginInfo.UserInfo.EmployeeId,
                        CreateDate     = DateTime.Now,
                        Status         = 1
                    };

                    var result = _SaleTypeService.Add(saleType);
                    if (result != null)
                    {
                        ajax.Message   = "添加成功";
                        ajax.IsSuccess = true;
                    }
                }
            }
            catch (Exception e)
            {
                ajax.Message = e.Message;
            }
            return(ajax);
        }
Esempio n. 3
0
        /// <summary>
        /// 根据渠道类型Id获取名称
        /// </summary>
        /// <param name="Source"></param>
        /// <returns></returns>
        public string GetSaleTypeName(object Source)
        {
            string saleType = string.Empty;

            if (Source != null)
            {
                int         SaleTypeId = Source.ToString().ToInt32();
                FD_SaleType m_saleType = _saleTypeService.GetById(SaleTypeId);
                if (m_saleType != null)
                {
                    saleType = m_saleType.SaleTypeName;
                }
            }
            return(saleType);
        }
Esempio n. 4
0
        public AjaxMessage DeleteSaleType(string SaleTypeId)
        {
            AjaxMessage ajax = new AjaxMessage();

            ajax.IsSuccess = false;
            ajax.Message   = "";
            try
            {
                if (!string.IsNullOrEmpty(SaleTypeId))
                {
                    int TypeId = SaleTypeId.ToInt32();
                    //根据Id查询
                    object[] key = new object[1] {
                        SaleTypeId.ToInt32()
                    };
                    FD_SaleType m_saleType = _SaleTypeService.Find(key);
                    //执行功能 禁用状态→启用
                    if (m_saleType.Status == 0)
                    {
                        m_saleType.Status = (byte)SysStatus.Enable;
                        ajax.Message      = "启用成功";
                    }
                    else
                    {
                        m_saleType.Status = (byte)SysStatus.Disable;
                        ajax.Message      = "禁用成功";
                    }

                    int result = _SaleTypeService.Update(m_saleType);

                    if (result > 0)
                    {
                        ajax.IsSuccess = true;
                    }
                }
            }
            catch (Exception e)
            {
                ajax.Message = e.Message;
            }
            return(ajax);
        }
        /// <summary>
        /// 数据绑定
        /// </summary>
        public void BinderData()
        {
            if (Request["CustomerId"] != null)
            {
                Guid        customerId = new Guid(Request["CustomerId"].ToString());
                FL_Customer m_customer = _customerService.GetById(customerId);
                if (m_customer != null)
                {
                    //主要联系人
                    if (m_customer.ContactMan == m_customer.Groom)
                    {
                        rdoContactMan.SelectedValue = "0";
                    }
                    else if (m_customer.ContactMan == m_customer.Bride)
                    {
                        rdoContactMan.SelectedValue = "1";
                    }
                    else
                    {
                        rdoContactMan.SelectedValue = "2";
                    }

                    txtBride.Value              = m_customer.Bride;
                    txtGroom.Value              = m_customer.Groom;
                    txtOperator.Value           = m_customer.Operator;
                    txtBridePhone.Value         = m_customer.BridePhone;
                    txtGroomPhone.Value         = m_customer.GroomPhone;
                    txtOperatorPhone.Value      = m_customer.OperatorPhone;
                    ddlHotel.SelectedValue      = m_customer.Hotel.ToString();
                    txtPartyDate.Value          = m_customer.PartyDate.ToString().ToDateTime().ToString("yyyy-MM-dd");
                    txtDeskCount.Value          = m_customer.DeskCount.ToString();
                    txtBudget.Value             = m_customer.Budget.ToString();
                    rdoVip.SelectedValue        = m_customer.IsVip.ToString();
                    rdoBanqueType.SelectedValue = m_customer.BanqueType.ToString();
                    txtState.Value              = GetCustomerState(m_customer.State);
                    switch (m_customer.IsFinish)
                    {
                    case 0:
                        txtIsFinish.Value = "未完成";
                        break;

                    case 1:
                        txtIsFinish.Value = "已完成";
                        break;

                    case 2:
                        txtIsFinish.Value = "已完结";
                        break;
                    }
                    if (m_customer.EvalState == 0)
                    {
                        txtEvalState.Value = "未评价(" + txtIsFinish.Value + ")";
                    }
                    else
                    {
                        txtEvalState.Value = "已评价(" + txtIsFinish.Value + ")";
                    }
                }

                //渠道类型
                FD_SaleType m_saleType = _saleTypeService.GetById(m_customer.SaleType);
                ddlSaleType.SelectedValue = m_customer.SaleType.ToString();


                //渠道名称条件
                List <Expression <Func <FD_SaleSource, bool> > > parmList = new List <Expression <Func <FD_SaleSource, bool> > >();
                parmList.Add(c => c.SaleTypeId == m_saleType.SaleTypeID);
                ddlSaleSource.DataSource = _saleSourceService.GetListBy(parmList);
                ddlSaleSource.DataBind();

                //渠道名称
                FD_SaleSource m_saleSource = _saleSourceService.GetById(m_customer.Channel);;
                ddlSaleSource.SelectedValue = m_customer.Channel.ToString();
                txtReCommand.Value          = m_saleSource.CommoandName;

                txtCreateEmployee.Value = GetEmployeeNames(m_customer.CreateEmployee);
                txtCreateDate.Value     = m_customer.CreateDate.ToString();


                SS_Report m_report = _reportService.GetByCustomerId(customerId);
                txtInviteEmployee.Value = GetEmployeeNames(m_report.InviteEmployee);
                txtOrderEmployees.Value = GetEmployeeNames(m_report.OrderEmployee);
                txtQuotedEmployee.Value = GetEmployeeNames(m_report.QuotedEmployee);

                txtDescription.Text = m_customer.Description;


                //邀约沟通记录
                var dataList = _inviteService.GetDataListByCustomerId(customerId);

                if (dataList.Count > 0)         //有沟通记录
                {
                    tr_noInvite.Visible         = false;
                    repInviteContent.DataSource = dataList;
                    repInviteContent.DataBind();
                }
                else
                {
                    tr_noInvite.Visible = true;
                }


                //跟单沟通记录
                var orderList = _orderService.GetDataListByCustomerId(customerId);

                if (orderList.Count > 0)         //有沟通记录
                {
                    tr_noOrder.Visible         = false;
                    repOrderContent.DataSource = orderList;
                    repOrderContent.DataBind();
                }
                else
                {
                    tr_noOrder.Visible = true;
                }
            }
        }