protected void bindDDL()
        {
            SYCRM.BLL.Agent agentBll = new SYCRM.BLL.Agent();
            IList<SYCRM.Model.Agent> agentList = new List<SYCRM.Model.Agent>();
            agentList = agentBll.GetModelList(" 1=1 ");
            ddlAgent.DataSource = agentList;
            ddlAgent.DataTextField = "Name";
            ddlAgent.DataValueField = "Id";
            ddlAgent.DataBind();
            ListItem li = new ListItem("请选择", "0");
            ddlAgent.Items.Insert(0, li);

            SYCRM.BLL.Product ProductBll = new SYCRM.BLL.Product();
            IList<SYCRM.Model.Product> ProductList = new List<SYCRM.Model.Product>();
            ProductList = ProductBll.GetModelList(" status=1 order by code asc ");
            dbProduct.DataSource = ProductList;
            dbProduct.DataTextField = "CodeName";
            dbProduct.DataValueField = "Id";
            dbProduct.DataBind();
        }
Exemple #2
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            if (textmanagerID.Text.Trim() != "")
            {
                if (textpass.Text.Trim() != "")
                {
                    List<SYCRM.Model.Agent> listMA = new List<SYCRM.Model.Agent>();
                    SYCRM.BLL.Agent BA = new SYCRM.BLL.Agent();

                    string strWhere = " UserName='******' and  Password = '******'";

                    listMA = BA.GetModelList(strWhere);

                    if (listMA.Count == 1)
                    {
                        Session["User"] = listMA[0];
                        if (Request.QueryString["url"] != null)
                        {
                            Response.Redirect(Request.QueryString["url"].ToString());
                        }
                        Response.Redirect("~/struct/sms.aspx");
                    }
                    else
                    {
                        lbErr.Text = "用户名/密码错误";
                    }
                }
                else
                {
                    lbErr.Text = "密码不能为空";
                }
            }
            else
            {
                lbErr.Text = "用户名不能为空";
            }
        }
Exemple #3
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            SYCRM.Model.Agent manauser = Session["User"] as SYCRM.Model.Agent;

            SYCRM.Model.Agent user = new SYCRM.Model.Agent();

            List<SYCRM.Model.Agent> listuser = new List<SYCRM.Model.Agent>();

            SYCRM.BLL.Agent ba = new SYCRM.BLL.Agent();

            string strLayer = DDLLayer.SelectedValue;

            string[] layerarray = strLayer.Split('.');
            if (layerarray.Count() == 0)
            {
                labErr.Visible = true;
                labErr.Text = "账户数据错误!请联系系统管理员!";
                return;
            }
            user.AreaId = new Guid(layerarray[layerarray.Count() - 1]);

            user.Address = tbAddress.Text.Trim();

            user.Des = tb_ShowDes.Text.Trim();
            user.Email = tbMail.Text.Trim();
            user.IDCard = tbIDCard.Text.Trim();
            user.Phone = tbPhone.Text.Trim();

            user.UserType = int.Parse(ddlUserType.SelectedValue);

            if(manauser.AreaId==user.AreaId&&user.UserType.Value==1)
            {
                 labErr.Visible = true;
                labErr.Text = "账户数据错误!请联系系统管理员!";
                return;
            }

            user.Position = new Guid(ddlPost.SelectedValue);

            user.Sex = int.Parse(ddlSex.SelectedValue);

            user.status = 1;

            user.Password = tbPassword.Text;

            user.UserName = tbLoginName.Text.Trim();

            listuser = ba.GetModelList(" UserName ='******'");

            if (listuser.Count > 0)
            {
                labErr.Visible = true;
                labErr.Text = "已存在登录名,请修改!";
                return;
            }

            user.Name = tbName.Text.Trim();

            ba.Add(user);

            Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "添加成功!", "<script>alert('添加成功!');window.location.href=window.location.href</script>");
        }
Exemple #4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     SYCRM.BLL.Agent agent = new SYCRM.BLL.Agent();
     List<SYCRM.Model.Agent> listA =  agent.GetModelList("");
 }
Exemple #5
0
        void bindAllGV()
        {
            SYCRM.Model.Agent manauser = Session["User"] as SYCRM.Model.Agent;
            List<SYCRM.Model.Area> listMA = GetOwnArea(manauser.AreaId);
            string strWhere = " status=1 ";
            if (tbName.Text.Trim() != "")
            {
                strWhere += " and [Name] like '%" + tbName.Text.Trim() + "%' ";
            }

            if (ddlUserType.SelectedValue != "0")
            {
                if (ddlUserType.SelectedValue == "1")
                {
                    strWhere += " and UserType = 1 ";
                }
                if (ddlUserType.SelectedValue == "2")
                {
                    strWhere += " and UserType = 2 ";
                }
            }

            strWhere += " and Id <> '" + manauser.Id.ToString() + "'";

            strWhere += " and UserName <> 'admin' ";
            strWhere += "  order by AreaId, UserType, Sex, Name";

            List<SYCRM.Model.Agent> listMAG = new List<SYCRM.Model.Agent>();
            SYCRM.BLL.Agent BF = new SYCRM.BLL.Agent();

            listMAG = BF.GetModelList(strWhere);
            GridViewList.DataSource = handleAList(listMAG);
            GridViewList.DataBind();
        }
Exemple #6
0
        List<SYCRM.Model.Customer> HandleList(List<SYCRM.Model.Customer> list)
        {
            List<SYCRM.Model.CustomerProduct> listAllCP = new List<SYCRM.Model.CustomerProduct>();
            SYCRM.BLL.CustomerProduct bcp = new SYCRM.BLL.CustomerProduct();

            listAllCP = bcp.GetModelList("");

            List<SYCRM.Model.Product> listAllP = new List<SYCRM.Model.Product>();
            SYCRM.BLL.Product bp = new SYCRM.BLL.Product();

            listAllP = bp.GetModelList("");

            List<SYCRM.Model.Agent> listAllA = new List<SYCRM.Model.Agent>();
            SYCRM.BLL.Agent ba = new SYCRM.BLL.Agent();

            listAllA = ba.GetModelList("");

            List<SYCRM.Model.Area> listAllAA = new List<SYCRM.Model.Area>();
            SYCRM.BLL.Area baa = new SYCRM.BLL.Area();

            listAllAA = baa.GetModelList("");

            foreach (SYCRM.Model.Customer c in list)
            {
                #region 产品
                List<SYCRM.Model.CustomerProduct> listtempCP =
                    listAllCP.Where(Item => Item.CustomerId == c.Id && Item.Status==1).ToList();
                List<SYCRM.Model.Product> listtempP = new List<SYCRM.Model.Product>();
                if (listtempCP.Count > 0)
                {
                    listtempP = listAllP.Where(Item => listtempCP.Where(b => b.ProductId == Item.Id).Count() > 0
                            && Item.status == 1).ToList();

                    if (listtempP.Count > 0)
                    {
                        foreach(SYCRM.Model.Product p in listtempP)
                        {
                            c.ProductName += p.Name+ "   ";
                        }

                    }
                    else
                    {
                        c.ProductName = "无";
                    }

                }
                else
                {
                    c.ProductName = "无";
                }
                #endregion

                #region 区域
                List<SYCRM.Model.Area> listTempAA = new List<SYCRM.Model.Area>();

                listTempAA = listAllAA.Where(item => item.Id == c.Area).ToList();

                if (listTempAA.Count > 0)
                {
                    string strName = listTempAA[0].Name;
                    if (listTempAA[0].status == 2)
                    {
                        strName = listTempAA[0].Name + "(已删除)";
                    }
                    c.AreaName = strName;
                }
                else
                {
                    c.AreaName = "无";
                }
                #endregion

                #region 服务人员
                List<SYCRM.Model.Agent> listTempA = new List<SYCRM.Model.Agent>();

                listTempA = listAllA.Where(item => item.Id == c.AgentId).ToList();

                if (listTempA.Count > 0)
                {
                    string strName = listTempA[0].Name;
                    if (listTempA[0].status == 2)
                    {
                        strName = listTempA[0].Name + "(已删除)";
                    }
                    c.ChargeName = strName;
                }
                else
                {
                    c.ChargeName = "无";
                }
                #endregion
            }
            return list;
        }