Пример #1
0
        protected void AuthBtn_Click(object sender, EventArgs e)
        {
            string rid = Request.QueryString["rid"];

            if (DataBase.UserUnAuth.Auth(new Objects.User()
            {
                id = rid
            }))
            {
                // 发送新注册提示
                var admins = DataBase.User.Gets("5");
                foreach (var admin in admins)
                {
                    var openid = DataBase.User.GetOpenID(admin);
                    if (!string.IsNullOrEmpty(openid))
                    {
                        WXManage.SendMessage(openid, "新注册待审核!");
                    }
                }
                Response.Redirect("/UserRegisterAuth.aspx");
                return;
            }
            else
            {
                ScriptManager.RegisterClientScriptBlock(this, GetType(), "error", "alert('审核失败,服务器错误');", true);
                return;
            }
        }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var open_id = Request.QueryString["oid"];
            var content = Request.QueryString["cont"];

            WXManage.SendMessage(open_id, content);
        }
        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");
        }
Пример #4
0
        protected void ButtonOK_Click(Object sender, EventArgs e)
        {
            var order = new Objects.Order()
            {
                id = Request.QueryString["oid"]
            };

            order = DataBase.Order.GetByID(order);
            order.constructionTeam = Request.Form["SGDSelect"];
            // 派工
            if (!DataBase.Order.Dispatch(order))
            {
                ScriptManager.RegisterClientScriptBlock(this, GetType(), "error", "alert('派工失败,服务器错误');", true);
                return;
            }
            else
            {
                var team = DataBase.Team.GetWithMembers(new Objects.Team()
                {
                    id = order.constructionTeam
                });
                foreach (var member in team.members)
                {
                    var openID = DataBase.User.GetOpenID(member);
                    if (openID != "")
                    {
                        WXManage.SendMessage(openID, "有一个新的施工订单");
                    }
                }
                // 给施工队所有成员发送消息
            }
            Response.Redirect(Request.Url.ToString());
        }
Пример #5
0
        protected void cash_Click(object sender, EventArgs e)
        {
            var mmSum   = float.Parse(Request.Form["inputMMSum"]);
            var smSum   = float.Parse(Request.Form["inputSMSum"]);
            var workSum = float.Parse(Request.Form["inputWorkSum"]);

            if (!DataBase.Order.Cashed(new Objects.Order()
            {
                id = Request.QueryString["oid"],
                mmSum = mmSum,
                smSum = smSum,
                workSum = workSum
            }))
            {
                ScriptManager.RegisterClientScriptBlock(this, GetType(), "error", "alert('无法完成收款,系统错误')", true);
                return;
            }
            var admins = DataBase.User.Gets("5");

            foreach (var admin in admins)
            {
                var openID = DataBase.User.GetOpenID(admin);
                if (openID != "")
                {
                    WXManage.SendMessage(openID, "一个订单收款完成,前往派工:http://debug.ocrosoft.com/OrderDetail.aspx?oid=" + Request.QueryString["oid"]);
                }
            }
            Response.Redirect(Request.Url.ToString());
        }
Пример #6
0
        protected void refuse_Click(object sender, EventArgs e)
        {
            var reason = Request.Form["refuseReason"];
            var order  = new Objects.Order()
            {
                id = Request.QueryString["oid"]
            };

            order = DataBase.Order.GetByID(order);
            order.refuseReason = reason;

            if (!DataBase.Order.RefuseOrder(order))
            {
                ScriptManager.RegisterClientScriptBlock(this, GetType(), "error", "alert('无法完成退单,系统错误')", true);
                return;
            }
            // 给管理员发送消息
            var admins = DataBase.User.Gets("5");

            foreach (var admin in admins)
            {
                var openID = DataBase.User.GetOpenID(admin);
                if (!string.IsNullOrEmpty(openID))
                {
                    WXManage.SendMessage(openID, "一个订单被退单");
                }
            }
            // 已经派工也给施工队发送提醒
            if (order.status >= 8)
            {
                var team = new Objects.Team()
                {
                    id = order.constructionTeam
                };
                team = DataBase.Team.GetWithMembers(team);
                foreach (var member in team.members)
                {
                    var openID = DataBase.User.GetOpenID(member);
                    if (!string.IsNullOrEmpty(openID))
                    {
                        WXManage.SendMessage(openID, "一个订单被退单");
                    }
                }
            }
            Response.Redirect(Request.Url.ToString());
        }
Пример #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // 不是微信内置浏览器
            if (!WXManage.IsWXBrowser(Request))
            {
                Response.Redirect("/RequireWX.aspx?url=" + Request.Url);
                return;
            }
            if (Request.QueryString["aid"] == null)
            {
                Response.Redirect("/Activity.aspx");
                return;
            }

            if (IsPostBack)
            {
                string phone          = Request.Form["tel"];            // 手机
                string name           = Request.Form["name"];           // 姓名
                string code           = Request.Form["code"];           // 验证码
                string location       = Request.Form["location"];       // 地址
                string locationDetail = Request.Form["detailLocation"]; // 详细地址

                // 格式检查
                if (name == "" ||                       // 姓名不空
                    !OSecurity.ValidPhone(phone) ||     // 手机号
                    !Regex.IsMatch(code, "^\\d{4}$") || // 验证码4位数字
                    location == ""                      // 详细地址为空
                    )
                {
                    return;
                }
                // 验证码检查
                if (!AuthCode.CheckAuthCode(phone, code))
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "codeError", "alterError($('input[name=code]')[0]);", true);
                    return;
                }

                string activityID = Request.QueryString["aid"];
                string userID     = Request.QueryString["uid"]; // 即手机号
                if (activityID == "" || userID == "")
                {
                    return;
                }
                var activity = DataBase.Activity.Get(new Objects.Activity()
                {
                    id = activityID
                });
                if (activity == null)
                {
                    ScriptManager.RegisterClientScriptBlock(this, GetType(), "noaid", "alert('不存在此活动!');", true);
                    return;
                }
                if (activity.timeEnd <= DateTime.Now)
                {
                    ScriptManager.RegisterClientScriptBlock(this, GetType(), "ended", "alert('活动已结束!');", true);
                    return;
                }

                var user = DataBase.User.Get(new Objects.User()
                {
                    phone = userID, identity = "1"
                });
                if (user == null)
                {
                    ScriptManager.RegisterClientScriptBlock(this, GetType(), "nouid", "alert('不存在该推荐人!');", true);
                    return;
                }

                if (DataBase.ActivitySign.Add(new Objects.ActivitySign()
                {
                    name = name,
                    phone = phone,
                    location = location,
                    locationDetail = locationDetail,
                    activityID = activityID,
                    shareSource = userID
                }))
                {
                    // 发送新报名提示
                    var admins = DataBase.User.Gets("5");
                    foreach (var admin in admins)
                    {
                        var openid = DataBase.User.GetOpenID(admin);
                        if (!string.IsNullOrEmpty(openid))
                        {
                            WXManage.SendMessage(openid, "有一条新报名信息!");
                        }
                    }
                    Response.Redirect("/ActivitySignSuccess.aspx");
                    return;
                }
            }
        }