Esempio n. 1
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            SYCRM.Model.Product MF = new SYCRM.Model.Product();
            SYCRM.BLL.Product BF = new SYCRM.BLL.Product();

            {
                MF.Name = tbName.Text;
                MF.status = 1;
                BF.Add(MF);
                tbName.Text = "";
                Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "添加成功!", "<script>alert('添加成功!');window.location.href=window.location.href</script>");
            }
        }
Esempio n. 2
0
        protected void btnEdit_Click(object sender, EventArgs e)
        {
            SYCRM.Model.Product MF = new SYCRM.Model.Product();
            SYCRM.BLL.Product BF = new SYCRM.BLL.Product();

            {
                MF = BF.GetModel(new Guid(hfPid.Value.Trim()));
                MF.Name = tbEName.Text;
                BF.Update(MF);
                tbEName.Text = "";
                hfPid.Value = "";
                Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "修改成功!", "<script>alert('修改成功!');window.location.href=window.location.href</script>");
            }
        }
Esempio n. 3
0
        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();
        }
Esempio n. 4
0
 protected void BtnDelete_Click(object sender, EventArgs e)
 {
     CheckBox cb;
     SYCRM.BLL.Product BF = new SYCRM.BLL.Product();
     for (int i = 0; i < GridViewList.Rows.Count; i++)
     {
         cb = (CheckBox)GridViewList.Rows[i].FindControl("CBSelect");
         if (cb.Checked)
         {
             try
             {
                 SYCRM.Model.Product mf = BF.GetModel(new Guid(GridViewList.DataKeys[i].Value.ToString()));
                 mf.status = 2;
                 BF.Update(mf);
             }
             catch
             {
             }
         }
     }
     Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "产品成功删除!", "<script>alert('产品成功删除!');window.location.href=window.location.href</script>");
 }
Esempio n. 5
0
        protected void bindDetail(Guid cusId)
        {
            SYCRM.Model.Customer cus = new SYCRM.Model.Customer();
            SYCRM.BLL.Customer cusBll = new SYCRM.BLL.Customer();

            cus = cusBll.GetModel(cusId);
            tbName.Value = cus.Name;
            tbage.Value = cus.UserAge.ToString();
            if (cus.UserSex == 1)
            {
                sexman.Checked = true;
            }
            else
            {
                sexwoman.Checked = true;
            }
            tbbabayname.Value = cus.BabyName;
            if (cus.BabySex == 1)
            {
                sexboy.Checked = true;
            }
            else
            {
                sexgirl.Checked = true;
            }
            tbbrithday.Value = cus.BadyBirthday.ToString();
            tbtel.Value = cus.Phone;
            tbaddress.Value = cus.Address;
            tbdes.Value = cus.Des;
            ddlAgent.SelectedValue = cus.AgentId.ToString();
            areaId = cus.Area;
            hdAreaId.Value = areaId.ToString();

            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.CustomerProduct> listtempCP =
                   listAllCP.Where(Item => Item.CustomerId == cus.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)
                    {
                        ListItem li = dbProduct.Items.FindByValue(p.Id.ToString());
                        if (li != null)
                        {
                            li.Selected = true;
                        }
                    }

                }
                else
                {
                }
            }
        }
Esempio n. 6
0
        private void bindPage()
        {
            SYCRM.Model.Customer cus = new SYCRM.Model.Customer();
            SYCRM.BLL.Customer cusBll = new SYCRM.BLL.Customer();
            cus = cusBll.GetModel(cusId);
            lbName.Text = cus.Name;
            lbage.Text = cus.UserAge.ToString();
            if (cus.UserSex == 1)
            {
                lbsex.Text = "男";
            }
            else
            {
                lbsex.Text = "女";
            }
            if (cus.Area != null)
            {
                SYCRM.BLL.Area areaBll = new SYCRM.BLL.Area();
                SYCRM.Model.Area area = areaBll.GetModel(cus.Area);
                if (area != null)
                {
                    lbarea.Text = area.Name;
                }
            }

            SYCRM.Model.Agent a =  Session["User"] as SYCRM.Model.Agent;

            if (a.AreaId != null)
            {
                List<SYCRM.Model.Area> listA =  GetOwnArea(a.AreaId);
                if (listA == null)
                {
                    NoP();
                    return;
                }
                if (cus.Area == a.AreaId)
                {
                    hdP.Value = "2";
                }
                else if (listA.Where(Items => Items.Id == cus.Area).ToList().Count > 0)
                {
                    hdP.Value = "1";
                }
                else
                {
                    NoP();
                }

            }
            else
            {
                NoP();
                return;
            }

            lbbabayname.Text = cus.BabyName;
            lbbabysex.Text = cus.BabySexName;
            lbbrithday.Text = cus.BadyBirthday.ToString();
            lbtel.Text = cus.Phone.ToString();
            lbaddress.Text = cus.Address;

            if (cus.AgentId != null)
            {
                SYCRM.BLL.Agent agentBll = new SYCRM.BLL.Agent();

                SYCRM.Model.Agent agent = agentBll.GetModel(cus.AgentId);
                if (agent != null)
                {
                    lbagent.Text = agent.Name;
                }

            }

            lbdes.Text = cus.Des;
            lbAddTime.Text = cus.AddTime.Value.ToShortDateString().ToString();

            if (cus.AddUserId != null)
            {
                SYCRM.BLL.Agent agentBll = new SYCRM.BLL.Agent();

                SYCRM.Model.Agent agent = agentBll.GetModel(cus.AddUserId);
                if (agent != null)
                {
                    lbAaddUser.Text = agent.Name;
                }

            }

            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.CustomerProduct> listtempCP =
                   listAllCP.Where(Item => Item.CustomerId == cus.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)
                    {
                        cus.ProductName += p.Code.ToString()+"  "+p.Name +"   ";
                    }

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

            lbproduct.Text = cus.ProductName;
        }
Esempio n. 7
0
        private void BindData()
        {
            List<SYCRM.Model.Product> listMP = new List<SYCRM.Model.Product>();
            SYCRM.BLL.Product BP = new SYCRM.BLL.Product();

            string strWhere = " status=1 ";

            if (!tb_KeyWords.Text.Trim().Equals(""))
            {
                strWhere += " and [Name] like '%" + tb_KeyWords.Text.Trim() + "%'";
            }

            listMP = BP.GetModelList(strWhere);

            GridViewList.DataSource = listMP;
            GridViewList.DataBind();
        }
Esempio n. 8
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;
        }
Esempio n. 9
0
        void bindddl()
        {
            List<SYCRM.Model.Product> listAllP = new List<SYCRM.Model.Product>();
            SYCRM.BLL.Product bp = new SYCRM.BLL.Product();

            listAllP = bp.GetModelList(" status=1 order by  Name desc ");

            ddlUProduct.DataSource = listAllP;
            ddlUProduct.DataBind();
            ddlUProduct.Items.Insert(0, new ListItem("请选择","0"));
        }