protected void ButtonOK_Click(Object sender, EventArgs e)
        {
            var aso = new Objects.ActivitySign()
            {
                id = Request.QueryString["sid"]
            };

            aso = DataBase.ActivitySign.Get(aso);

            var order = new Objects.Order()
            {
                name           = aso.name,
                phone          = aso.phone,
                createTime     = aso.signDate,
                location       = aso.location,
                locationDetail = aso.locationDetail,
                youHuiLaiYuan  = int.Parse(aso.activityID)
            };

            // 将报名转为订单
            if (!DataBase.Order.Add(order)) // 失败提示,成功不处理
            {
                ScriptManager.RegisterClientScriptBlock(this, GetType(), "error", "alert('派单失败,服务器错误');", true);
                return;
            }
            order = DataBase.Order.Get(order);
            // 删除活动报名
            if (!DataBase.ActivitySign.Delete(aso)) // 失败提示并删除订单
            {
                ScriptManager.RegisterClientScriptBlock(this, GetType(), "error", "alert('派单失败,服务器错误');", true);
                DataBase.Order.Delete(order);
                return;
            }
            order.commissioner = DataBase.User.GetByID(new Objects.User()
            {
                id = Request.Form["YWYSelect"]
            }).phone;
            // 将订单转给业务员
            if (!DataBase.Order.ToCommissioner(order)) // 失败提示并删除订单,成功给业务员发消息
            {
                ScriptManager.RegisterClientScriptBlock(this, GetType(), "error", "alert('派单失败,服务器错误');", true);
                DataBase.Order.Delete(order);
                return;
            }
            else
            {
                var com = new Objects.User()
                {
                    phone    = order.commissioner,
                    identity = "2"
                };
                com = DataBase.User.Get(com);
                var openID = DataBase.User.GetOpenID(com);
                if (openID != "")
                {
                    WXManage.SendMessage(openID, "有一个新的订单!");
                }
            }
            Response.Redirect("/ActivitySignView.aspx");
        }
Example #2
0
        protected void DeleteBtn_Click(Object sender, EventArgs e)
        {
            var usr = new Objects.User()
            {
                id = Request.QueryString["uid"]
            };

            if (!DataBase.User.Delete(usr))
            {
                ScriptManager.RegisterClientScriptBlock(this, GetType(), "error", "alert('删除失败,服务器错误')", true);
            }
            Response.Redirect("/StaffManageYWY.aspx");
        }
Example #3
0
        protected void btn_Click(object sender, EventArgs e)
        {
            string item =
                "<a class=\"weui-cell weui-cell_access\" href=\"/OrderDetailForSGD.aspx?oid=#id#\">" +
                "    <div class=\"weui-cell__bd\">" +
                "        <p>#content#</p>" +
                "   </div>" +
                "   <div class=\"weui-cell__ft\">#new#" +
                "    </div>" +
                "</a>";
            string newOrder = "<span class=\"weui-badge weui-badge_dot\" style=\"margin-left: 5px; margin-right: 5px; \"></span>";
            string aid      = Request.Form["statusSelect"];
            var    user     = new Objects.User()
            {
                phone    = Session["phone"].ToString(),
                identity = Session["iden"].ToString()
            };

            user = DataBase.User.Get(user);
            var team = DataBase.Team.Get(user);
            List <Objects.Order> list = new List <Objects.Order>();

            orderList.InnerHtml = "";
            if (aid == "-1")
            {
                list = DataBase.Order.Gets(team);
            }
            else
            {
                var listTmp = DataBase.Order.Gets(team);
                foreach (var order in listTmp)
                {
                    if (order.status == int.Parse(aid))
                    {
                        list.Add(order);
                    }
                }
            }
            foreach (var order in list)
            {
                orderList.InnerHtml += item
                                       .Replace("#id#", order.id)
                                       .Replace("#content#", order.name + " " + order.phone)
                                       .Replace("#new#", order.status == 8 ? newOrder : "");
            }
            if (list.Count == 0)
            {
                orderList.InnerHtml = "<p style=\"text-align:center\">找不到任何订单</p>";
            }
            statusSelect.Value = aid;
        }
Example #4
0
        protected void DialogOK_Click(Object sender, EventArgs e)
        {
            var usr = new Objects.User()
            {
                id     = Request.QueryString["uid"],
                name   = Request.Form["name"],
                phone  = Request.Form["tel"],
                IDCard = Request.Form["idCard"]
            };

            if (!DataBase.User.Modify(usr))
            {
                ScriptManager.RegisterClientScriptBlock(this, GetType(), "error", "alert('保存失败,服务器错误')", true);
            }
            Response.Redirect(Request.Url.ToString());
        }
Example #5
0
        protected void searchBtn_Click(Object sender, EventArgs e)
        {
            string item =
                "<a class=\"weui-cell weui-cell_access\" href=\"/OrderDetailForSGD.aspx?oid=#id#\">" +
                "    <div class=\"weui-cell__bd\">" +
                "        <p>#content#</p>" +
                "   </div>" +
                "   <div class=\"weui-cell__ft\">#new#" +
                "    </div>" +
                "</a>";
            string newOrder = "<span class=\"weui-badge weui-badge_dot\" style=\"margin-left: 5px; margin-right: 5px; \"></span>";
            string aid      = statusSelect.Value;
            string key      = searchInput.Value;
            var    user     = new Objects.User()
            {
                phone    = Session["phone"].ToString(),
                identity = Session["iden"].ToString()
            };
            var team = DataBase.Team.Get(user);
            var list = DataBase.Order.Search(key);

            orderList.InnerHtml = "";
            int validCount = 0;

            foreach (var order in list)
            {
                if (order.constructionTeam != team.id)
                {
                    continue;
                }
                validCount++;
                orderList.InnerHtml += item
                                       .Replace("#id#", order.id)
                                       .Replace("#content#", order.name + " " + order.phone)
                                       .Replace("#new#", order.status == 8 ? newOrder : "");
            }
            if (validCount == 0)
            {
                orderList.InnerHtml = "<p style=\"text-align:center\">找不到任何订单</p>";
            }
        }
Example #6
0
        protected void ButtonOK_Click(Object sender, EventArgs e)
        {
            var usr = new Objects.User()
            {
                id     = Request.QueryString["uid"],
                name   = Request.Form["name"],
                phone  = Request.Form["tel"],
                IDCard = Request.Form["idCard"]
            };

            try
            {
                if (!DataBase.User.Modify(usr))
                {
                    ScriptManager.RegisterClientScriptBlock(this, GetType(), "error", "alert('保存失败,服务器错误')", true);
                }
            }
            catch (MySql.Data.MySqlClient.MySqlException ex)
            {
                ScriptManager.RegisterClientScriptBlock(this, GetType(), "error", "alert('保存失败,需要先退出施工队')", true);
            }
            Response.Redirect(Request.Url.ToString());
        }