Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            User user = (User)Session["user"];

            userName   = user.UserName;
            regionName = user.ReginId.RegionName;
            string op = Request["op"];

            if (op == "paging")
            {
                getData();
            }
            if (op == "exportAll")
            {
                //export();
                exportAll();
            }
            if (op == "exportDe")
            {
                //exportDe();
                exportDetail();
            }
            else
            {
                permission();
                //获取供应商
                dsSupplier = bookBll.selectSupplier();
                //获取组织
                dsRegion = regionBll.select();
                //获取客户
                dsCustom = customBll.select();
            }
            if (op == "logout")
            {
                //删除身份凭证
                FormsAuthentication.SignOut();
                //设置Cookie的值为空
                Response.Cookies[FormsAuthentication.FormsCookieName].Value = null;
                //设置Cookie的过期时间为上个月今天
                Response.Cookies[FormsAuthentication.FormsCookieName].Expires = DateTime.Now.AddMonths(-1);
            }
            if (op == "print")
            {
                Response.Write(print());
                Response.End();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 获取基础数据及查询方法
        /// </summary>
        public string getData()
        {
            User   user     = (User)Session["user"];
            int    regionId = user.ReginId.RegionId;
            string roleName = user.RoleId.RoleName;
            //获取分页数据
            int currentPage = Convert.ToInt32(Request["page"]);

            if (currentPage == 0)
            {
                currentPage = 1;
            }
            string search = Request["search"];

            if (search == "" || search == null)
            {
                if (roleName == "超级管理员")
                {
                    search = "deleteState=0";
                }
                else
                {
                    search = "deleteState=0 and regionId=" + regionId;
                }
            }
            else
            {
                if (roleName == "超级管理员")
                {
                    search = String.Format(" saleTaskId {0} or userName {0} or customerName {0} and deleteState=0 ", "like '%" + search + "%'");
                }
                else
                {
                    search = String.Format(" saleTaskId {0} or userName {0} or customerName {0} and deleteState=0 and regionId=" + regionId, "like '%" + search + "%'");
                }
            }

            TableBuilder tb = new TableBuilder();

            tb.StrTable      = "V_SaleTask";
            tb.OrderBy       = "startTime desc";
            tb.StrColumnlist = "saleTaskId,defaultDiscount,defaultCopy,priceLimit,numberLimit,totalPriceLimit,startTime,finishTime,userId,userName,customerName,regionId";
            tb.IntPageSize   = pageSize;
            tb.IntPageNum    = currentPage;
            tb.StrWhere      = search;
            //获取展示的客户数据
            ds = saleBll.selectBypage(tb, out totalCount, out intPageCount);
            //获取客户下拉数据
            customerds = custBll.select();
            //生成table
            StringBuilder strb = new StringBuilder();

            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                string time = ds.Tables[0].Rows[i]["finishTime"].ToString();
                if (time == "" || time == null)
                {
                    time = "销售任务采集中";
                }
                strb.Append("<tr><td>" + ds.Tables[0].Rows[i]["saleTaskId"].ToString() + "</td>");
                strb.Append("<td><nobr>" + ds.Tables[0].Rows[i]["customerName"].ToString() + "</nobr></td>");
                strb.Append("<td>" + ds.Tables[0].Rows[i]["userName"].ToString() + "</td>");
                string defaultDiscount = ds.Tables[0].Rows[i]["defaultDiscount"].ToString();
                if (defaultDiscount == "-1")
                {
                    defaultDiscount = "";
                }
                strb.Append("<td>" + defaultDiscount + "</td>");
                strb.Append("<td>" + ds.Tables[0].Rows[i]["numberLimit"].ToString() + "</td>");
                strb.Append("<td>" + ds.Tables[0].Rows[i]["defaultCopy"].ToString() + "</td>");
                strb.Append("<td>" + (ds.Tables[0].Rows[i]["priceLimit"].ToString() + ".00") + "</td>");
                strb.Append("<td><nobr>" + ds.Tables[0].Rows[i]["startTime"].ToString() + "</nobr></td>");
                strb.Append("<td><nobr>" + time + "</nobr></td>");
                strb.Append("<td style='width:100px;'>" + "<button class='btn btn-success btn-sm btn_sale'>销售</button>");
                strb.Append("<button class='btn btn-success btn-sm btn_back'>销退</button></td>");
                strb.Append("<td><button class='btn btn-success btn-sm btn_search'>查看</button> <button class='btn btn-sm btn-success edited' value='" + ds.Tables[0].Rows[i]["totalPriceLimit"].ToString() + "' >编辑</button>");
                strb.Append("<button class='btn btn-danger btn-sm btn_del'><i class='fa fa-trash'></i></button>" + "</td></tr>");
            }
            strb.Append("<input type='hidden' value='" + intPageCount + "' id='intPageCount' />");
            string op = Request["op"];

            if (op == "paging")
            {
                Response.Write(strb.ToString());
                Response.End();
            }
            return(strb.ToString());
        }