Ejemplo n.º 1
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());
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // 不是微信内置浏览器
            if (!WXManage.IsWXBrowser(Request))
            {
                Response.Redirect("/RequireWX.aspx?url=" + Request.Url);
                return;
            }
            // 未登录,作为报名页面
            if (Session["phone"] == null || Session["iden"] == null)
            {
                signBtn1.InnerText = "立即报名";
                signBtn2.InnerText = "立即报名";
            }
            // 普通会员、管理员可查看
            if (Session["iden"] != null &&
                Session["iden"].ToString() != "1" &&
                Session["iden"].ToString() != "5")
            {
                Response.Redirect("/UserIndex.aspx");
                return;
            }
            // 没有参数
            if (!Request.QueryString.AllKeys.Contains("aid"))
            {
                Response.Redirect("/Activity.aspx");
                return;
            }
            // 活动ID
            string aid = Request.QueryString["aid"].ToString();
            // 获取活动
            var activity = DataBase.Activity.Get(new Objects.Activity()
            {
                id = aid
            });

            activity_name.InnerText = activity_name.InnerText.Replace("#title#", activity.title);
            end_time.InnerText      = end_time.InnerText.Replace("#end-time#", activity.timeEnd.ToString("yyyy-MM-dd HH:mm:ss"));
            js_content.InnerHtml    = js_content.InnerHtml.Replace("#content#", activity.content);
            Title = activity.brief;

            /*
             * appId: appId
             * timestamp: timestamp
             * nonceStr: nonceStr
             * signature: signature
             */
            var    timestamp = OSecurity.DateTimeToTimeStamp(DateTime.Now);
            String script    = "var appId = '" + WXManage.appID + "';";

            script += "var timestamp = '" + timestamp.ToString() + "';";
            script += "var nonceStr = 'chenyanhong';";
            script += "var signature = '" + WXManage.WXJSSign("chenyanhong", timestamp, Request.Url.ToString().Split('#')[0]) + "';";
            script += "var imgUrl = '" + WXManage.QRCode(Request.Url.ToString() + "&uid=" + Session["phone"]) + "';";
            if (Session["phone"] != null)
            {
                script += "var uid = '" + Session["phone"].ToString() + "';";
            }
            ScriptManager.RegisterClientScriptBlock(this, GetType(), "wxvar", script, true);
        }
Ejemplo n.º 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());
        }
        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");
        }
Ejemplo n.º 6
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;
            }
        }
Ejemplo n.º 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // 不是微信内置浏览器
            if (!WXManage.IsWXBrowser(Request))
            {
                Response.Redirect("/RequireWX.aspx?url=" + Request.Url);
                return;
            }
            if (Session["phone"] == null || Session["iden"].ToString() != "5")
            {
                Response.Redirect("/UserIndex.aspx");
                return;
            }

            string html =
                "<div class=\"weui-cell weui-cell_access\" onclick=\"location.href='/StaffYWYDetail.aspx?uid=#id#';\">" +
                "	<div class=\"weui-cell__bd\">#name#</div>"+
                "	<div class=\"weui-cell__ft\" style=\"font-size: 0\">"+
                "		<span style=\"vertical-align: middle; font-size: 17px;\">#phone#</span>"+
                "	</div>"+
                "</div>";

            var array = DataBase.User.Gets("2");

            list.InnerHtml = "";
            foreach (var item in array)
            {
                list.InnerHtml += html
                                  .Replace("#id#", item.id)
                                  .Replace("#name#", item.name)
                                  .Replace("#phone#", item.phone);
            }
        }
Ejemplo n.º 8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     // 不是微信内置浏览器
     if (!WXManage.IsWXBrowser(Request))
     {
         Response.Redirect("/RequireWX.aspx?url=" + Request.Url);
         return;
     }
 }
Ejemplo n.º 9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Request.QueryString.AllKeys.Contains("url"))
            {
                Response.Redirect("/UserLogin.aspx");
                return;
            }
            var url = Request.Url.ToString().Substring(Request.Url.ToString().IndexOf('=') + 1);

            qrcode.Src = WXManage.QRCode(url);
        }
Ejemplo n.º 10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // 不是微信内置浏览器
            if (!WXManage.IsWXBrowser(Request))
            {
                Response.Redirect("/RequireWX.aspx?url=" + Request.Url);
                return;
            }
            if (Session["phone"] == null || Session["iden"].ToString() != "5")
            {
                Response.Redirect("/UserIndex.aspx");
                return;
            }
            if (Request.QueryString["uid"] == null)
            {
                Response.Redirect("/StaffManageSGRY.aspx");
                return;
            }

            var uid  = Request.QueryString["uid"];
            var user = DataBase.User.GetByID(new Objects.User()
            {
                id = uid
            });

            name.Value   = user.name;
            tel.Value    = user.phone;
            idCard.Value = user.IDCard;

            var teams = DataBase.Team.Gets();

            teamSelect.Items.Clear();
            teamSelect.Items.Add(new ListItem("请选择施工队", "0"));
            foreach (var team in teams)
            {
                teamSelect.Items.Add(new ListItem(team.teamName, team.id));
            }

            var signedTeam = DataBase.Team.Get(user);

            if (signedTeam == null)
            {
                team.Value = "未加入";
            }
            else
            {
                team.Value          = signedTeam.teamName;
                addToTeam.InnerText = "修改所在施工队";
                teamSelect.Items.Insert(1, new ListItem("从施工队中移除", "-1"));
            }
        }
Ejemplo n.º 11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // 不是微信内置浏览器
            if (!WXManage.IsWXBrowser(Request))
            {
                Response.Redirect("/RequireWX.aspx?url=" + Request.Url);
                return;
            }
            if (Session["phone"] == null || Session["iden"].ToString() != "5")
            {
                Response.Redirect("/UserIndex.aspx");
                return;
            }
            if (Request.QueryString["tid"] == null)
            {
                Response.Redirect("/StaffManageSGDW.aspx");
                return;
            }

            string listHTML =
                "<a class=\"weui-cell weui-cell_access\" href=\"/StaffSGRYDetail.aspx?uid=#id#\">" +
                "	<div class=\"weui-cell__bd\">"+
                "		<p>#name#</p>"+
                "	</div>"+
                "	<div class=\"weui-cell__ft\">"+
                "	</div>"+
                "</a>";

            if (Request.QueryString["tid"] == null)
            {
                Response.Clear();
                Response.Redirect("/StaffManageSGDW.aspx");
                return;
            }

            var tid  = Request.QueryString["tid"];
            var team = DataBase.Team.GetWithMembers(new Objects.Team()
            {
                id = tid
            });

            name.Value = team.teamName;
            foreach (var user in team.members)
            {
                members.InnerHtml += listHTML.Replace("#name#", user.name).Replace("#id#", user.id);
            }
            if (team.members.Count == 0)
            {
                members.InnerHtml = "<p style=\"text-align:center;\"><a href=\"/StaffManageSGRY.aspx\">该队伍没有成员,点击前往添加</a></p>";
            }
        }
Ejemplo n.º 12
0
 protected void Page_Load(object sender, EventArgs e)
 {
     // 不是微信内置浏览器
     if (!WXManage.IsWXBrowser(Request))
     {
         Response.Redirect("/RequireWX.aspx?url=" + Request.Url);
         return;
     }
     if (Session["phone"] == null || Session["iden"].ToString() != "5")
     {
         Response.Redirect("/UserIndex.aspx");
         return;
     }
 }
Ejemplo n.º 13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // 不是微信内置浏览器
            if (!WXManage.IsWXBrowser(Request))
            {
                Response.Redirect("/RequireWX.aspx?url=" + Request.Url);
                return;
            }

            if (IsPostBack)
            {
                // 手机
                var phone = Request.Form["tel"];
                // 短信验证码
                var code = Request.Form["code"];
                // 身份
                var iden = Int32.Parse(Request.Form["iden"]);

                // 格式检查
                if (!OSecurity.ValidPhone(phone) ||     // 手机号
                    !Regex.IsMatch(code, "^\\d{4}$") || // 验证码4位数字
                    iden < 1 || iden > 5                // 身份在[1,5]
                    )
                {
                    return;
                }
                // 验证码检查
                if (!AuthCode.CheckAuthCode(phone, code))
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "codeError", "alterError($('input[name=code]')[0]);", true);
                    return;
                }

                // 普通会员-业务员-施工队-管理员
                if (iden == 1 || iden == 2 || iden == 4 || iden == 5)
                {
                    if (DataBase.User.Exits(new Objects.User()
                    {
                        phone = phone,
                        identity = iden.ToString()
                    }))
                    {
                        Session["phone"] = phone;
                        Session["iden"]  = iden;
                        Response.Redirect("/UserIndex.aspx");
                    }
                }
            }
        }
Ejemplo n.º 14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // 不是微信内置浏览器
            if (!WXManage.IsWXBrowser(Request))
            {
                Response.Redirect("/RequireWX.aspx?url=" + Request.Url);
                return;
            }
            if (Session["phone"] == null)
            {
                Response.Redirect("/UserIndex.aspx");
                return;
            }

            if (IsPostBack)
            {
                var pass1 = Request.Form["password1"];
                var pass2 = Request.Form["password2"];
                if (pass1 == "" || pass2 == "")
                {
                    ScriptManager.RegisterClientScriptBlock(this, GetType(), "empty", "alert('密码不能为空!')", true);
                    return;
                }
                if (pass1 != pass2)
                {
                    ScriptManager.RegisterClientScriptBlock(this, GetType(), "equal", "alert('两次输入密码不一致!')", true);
                    return;
                }

                var user = DataBase.User.Get(new Objects.User()
                {
                    phone    = Session["phone"].ToString(),
                    identity = Session["iden"].ToString()
                });
                user.password = pass1;
                if (DataBase.User.ModifyPassword(user))
                {
                    Response.Redirect("/UserIndex.aspx");
                    return;
                }
                else
                {
                    ScriptManager.RegisterClientScriptBlock(this, GetType(), "error", "alert('系统错误')", true);
                    return;
                }
            }
        }
Ejemplo n.º 15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // 不是微信内置浏览器
            if (!WXManage.IsWXBrowser(Request))
            {
                Response.Redirect("/RequireWX.aspx?url=" + Request.Url);
                return;
            }
            if (Session["phone"] == null || Session["iden"].ToString() != "5")
            {
                Response.Redirect("/UserIndex.aspx");
                return;
            }
            if (Request.QueryString["rid"] == "")
            {
                Response.Clear();
                Response.Redirect("/RegisterAuth.aspx");
                return;
            }

            var rid   = Request.QueryString["rid"];
            var rauth = DataBase.UserUnAuth.Get(new Objects.User()
            {
                id = rid
            });

            inputName.Value  = rauth.name;
            inputPhone.Value = rauth.phone;
            var identity = "";

            switch (rauth.identity)
            {
            case "2":
                identity = "业务员";
                break;

            case "4":
                identity = "施工队";
                break;

            case "5":
                identity = "管理员";
                break;
            }
            inputIden.Value   = identity;
            inputIDCard.Value = rauth.IDCard;
        }
Ejemplo n.º 16
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());
        }
Ejemplo n.º 17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // 不是微信内置浏览器
            if (!WXManage.IsWXBrowser(Request))
            {
                Response.Redirect("/RequireWX.aspx?url=" + Request.Url);
                return;
            }
            if (Session["phone"] == null || Session["iden"].ToString() != "5")
            {
                Response.Redirect("/UserIndex.aspx");
                return;
            }
            if (Request.QueryString["uid"] == null)
            {
                Response.Redirect("/StaffManageYWY.aspx");
                return;
            }

            if (Request.QueryString["del"] == "true")
            {
                if (DataBase.User.Delete(new Objects.User()
                {
                    id = Request.QueryString["uid"]
                }
                                         ))
                {
                    Response.Redirect("/StaffManageYWY.aspx");
                    return;
                }
                else
                {
                    ScriptManager.RegisterClientScriptBlock(this, GetType(), "error", "alert('删除失败,服务器错误')", true);
                }
            }

            var uid  = Request.QueryString["uid"];
            var user = DataBase.User.GetByID(new Objects.User()
            {
                id = uid
            });

            name.Value   = user.name;
            tel.Value    = user.phone;
            idCard.Value = user.IDCard;
        }
Ejemplo n.º 18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // 不是微信内置浏览器
            if (!WXManage.IsWXBrowser(Request))
            {
                Response.Redirect("/RequireWX.aspx?url=" + Request.Url);
                return;
            }

            // 只有管理员能查看所有活动
            if (Session["phone"] == null || Session["iden"].ToString() != "5")
            {
                Response.Redirect("/UserIndex.aspx");
                return;
            }

            string activityHTML =
                "<a href=\"/ActivityEditor.aspx?aid=#id#\" class=\"weui-media-box weui-media-box_appmsg\">" +
                "    <div class=\"weui-media-box__hd\">" +
                "        <img class=\"weui-media-box__thumb\" src=\"#img#\" alt=\"\">" +
                "    </div>" +
                "    <div class=\"weui-media-box__bd\">" +
                "        <h4 class=\"weui-media-box__title\">#title#</h4>" +
                "        <p class=\"weui-media-box__desc\">#brief#</p>" +
                "    </div>" +
                "</a>";
            // 获取所有活动
            var activityList = DataBase.Activity.GetsAll();

            activities.InnerHtml = "";
            foreach (var activity in activityList)
            {
                if (activity.imgSrc == null || activity.imgSrc == "")
                {
                    activity.imgSrc = WXManage.QRCode(Request.Url.Host + "/ActivityDetail.aspx?aid=" + activity.id);
                }
                activities.InnerHtml += activityHTML
                                        .Replace("#id#", activity.id)
                                        .Replace("#img#", activity.imgSrc)
                                        .Replace("#title#", activity.title)
                                        .Replace("#brief#", activity.brief);
            }
        }
Ejemplo n.º 19
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // 不是微信内置浏览器
            if (!WXManage.IsWXBrowser(Request))
            {
                Response.Redirect("/RequireWX.aspx?url=" + Request.Url);
                return;
            }
            if (Session["phone"] == null || Session["iden"].ToString() != "5")
            {
                Response.Redirect("/UserIndex.aspx");
                return;
            }

            string html =
                "<div class=\"weui-cell weui-cell_access\" onclick=\"location.href='/StaffSGRYDetail.aspx?uid=#id#';\">" +
                "	<div class=\"weui-cell__bd\">#name#</div>"+
                "	<div class=\"weui-cell__ft\" style=\"font-size: 0\">"+
                "		<span style=\"vertical-align: middle; font-size: 17px;\">#phone#</span>#noteam#"+
                "	</div>"+
                "</div>";
            string noTeam     = "<span class=\"weui-badge weui-badge_dot\" style=\"margin-left: 5px; margin-right: 5px; \"></span>";
            var    noTeamList = DataBase.Team.UnRegisterToTeam();
            Dictionary <string, bool> unRegister = new Dictionary <string, bool>();

            foreach (var item in noTeamList)
            {
                unRegister[item.phone] = true;
            }

            var array = DataBase.User.Gets("4");

            list.InnerHtml = "";
            foreach (var item in array)
            {
                list.InnerHtml += html
                                  .Replace("#id#", item.id)
                                  .Replace("#name#", item.name)
                                  .Replace("#phone#", item.phone)
                                  .Replace("#noteam#", unRegister.ContainsKey(item.phone) ? noTeam : "");
            }
        }
Ejemplo n.º 20
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // 不是微信内置浏览器
            if (!WXManage.IsWXBrowser(Request))
            {
                Response.Redirect("/RequireWX.aspx?url=" + Request.Url);
                return;
            }
            if (Session["phone"] == null || Session["iden"].ToString() != "5")
            {
                Response.Redirect("/UserIndex.aspx");
                return;
            }

            string html =
                "<div class=\"weui-cell weui-cell_access\" onclick=\"location.href='/StaffSGDWDetail.aspx?tid=#id#';\">" +
                "	<div class=\"weui-cell__bd\">#name#</div>"+
                "	<div class=\"weui-cell__ft\" style=\"font-size: 0\">"+
                "		<span style=\"vertical-align: middle; font-size: 17px;\">#memberCount#人</span>"+
                "	</div>"+
                "</div>";

            var array   = DataBase.Team.GetsWithMembers();
            var allTeam = DataBase.Team.Gets();

            foreach (var team in allTeam)
            {
                if (!array.ContainsKey(team.id))
                {
                    array[team.id] = team;
                }
            }
            list.InnerHtml = "";
            foreach (var item in array)
            {
                list.InnerHtml += html
                                  .Replace("#id#", item.Key)
                                  .Replace("#name#", item.Value.teamName)
                                  .Replace("#memberCount#", item.Value.members.Count.ToString());
            }
        }
Ejemplo n.º 21
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // 不是微信内置浏览器
            if (!WXManage.IsWXBrowser(Request))
            {
                Response.Redirect("/RequireWX.aspx?url=" + Request.Url);
                return;
            }
            if (Session["phone"] == null || Session["iden"].ToString() != "5")
            {
                Response.Redirect("/UserIndex.aspx");
                return;
            }

            var list = DataBase.Team.UnRegisterToTeam();

            if (list.Count != 0)
            {
                newReg.Style["display"] = "block";
            }
        }
Ejemplo n.º 22
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // 不是微信内置浏览器
            if (!WXManage.IsWXBrowser(Request))
            {
                Response.Redirect("/RequireWX.aspx?url=" + Request.Url);
                return;
            }
            if (Session["phone"] == null)
            {
                Response.Redirect("/UserIndex.aspx");
                return;
            }

            var user = DataBase.User.Get(new Objects.User()
            {
                phone    = Session["phone"].ToString(),
                identity = Session["iden"].ToString()
            });

            inputName.Value  = user.name;
            inputPhone.Value = user.phone;
            if (user.identity == "1") // 普通会员
            {
                IDCardDiv.InnerHtml        = "";
                IDCardDiv.Style["display"] = "none";
            }
            else
            {
                inputIDCard.Value =
                    user.IDCard.Substring(0, 6) + new string('*', 8) + user.IDCard.Substring(14);
            }
            var openID = DataBase.User.GetOpenID(user);

            if (!string.IsNullOrEmpty(openID))
            {
                inputOpenID.Value = openID;
                save.InnerText    = "修改消息标识";
            }
        }
Ejemplo n.º 23
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // 不是微信内置浏览器
            if (!WXManage.IsWXBrowser(Request))
            {
                Response.Redirect("/RequireWX.aspx?url=" + Request.Url);
                return;
            }

            string activityHTML =
                "<a href=\"/ActivityDetail.aspx?aid=#id#\" class=\"weui-media-box weui-media-box_appmsg\">" +
                "    <div class=\"weui-media-box__hd\">" +
                "        <img class=\"weui-media-box__thumb\" src=\"#img#\" alt=\"\">" +
                "    </div>" +
                "    <div class=\"weui-media-box__bd\">" +
                "        <h4 class=\"weui-media-box__title\">#title#</h4>" +
                "        <p class=\"weui-media-box__desc\">#brief#</p>" +
                "    </div>" +
                "</a>";

            var activityList = DataBase.Activity.Gets();

            activities.InnerHtml = "";
            foreach (var activity in activityList)
            {
                if (activity.imgSrc == null || activity.imgSrc == "")
                {
                    activity.imgSrc = WXManage.QRCode(Request.Url.Host + "/ActivityDetail.aspx?aid=" + activity.id);
                }
                activities.InnerHtml += activityHTML
                                        .Replace("#id#", activity.id)
                                        .Replace("#img#", activity.imgSrc)
                                        .Replace("#title#", activity.title)
                                        .Replace("#brief#", activity.brief);
            }
            if (activityList.Count == 0)
            {
                activities.InnerHtml = "<p style=\"text-align:center;\">当前没有活动</p>";
            }
        }
Ejemplo n.º 24
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // 不是微信内置浏览器
            if (!WXManage.IsWXBrowser(Request))
            {
                Response.Redirect("/RequireWX.aspx?url=" + Request.Url);
                return;
            }
            if (Session["phone"] == null || Session["iden"].ToString() != "5")
            {
                Response.Redirect("/UserIndex.aspx");
                return;
            }

            // 获取所有活动,显示标题
            var activitys = DataBase.Activity.GetsAll();

            activitySelect.Items.Clear();
            activitySelect.Items.Add(new ListItem("所有活动", "0"));
            var firstActivityHasSign = "0";

            foreach (var activity in activitys)
            {
                var count = DataBase.ActivitySign.Gets(activity).Count;
                if (count != 0 && firstActivityHasSign == "0")
                {
                    firstActivityHasSign = activity.id;
                }
                // 报名数量不为0的显示数量
                activitySelect.Items.Add(new ListItem(activity.title + (count == 0 ? "" : ("(" + count + ")")), activity.id));
            }
            // 有新报名,则显示新报名信息
            if (firstActivityHasSign != "0" && !IsPostBack) // 回发时不处理
            {
                activitySelect.Value = firstActivityHasSign;
                ScriptManager.RegisterStartupScript(this, GetType(), "show", "$('#selectActivity').click();", true);
            }
        }
Ejemplo n.º 25
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // 不是微信内置浏览器
            if (!WXManage.IsWXBrowser(Request))
            {
                Response.Redirect("/RequireWX.aspx?url=" + Request.Url);
                return;
            }
            if (Session["phone"] == null || Session["iden"].ToString() != "4")
            {
                Response.Redirect("/UserIndex.aspx");
                return;
            }

            var statusList = new DataBase.Status().Gets();

            statusSelect.Items.Clear();
            statusSelect.Items.Add(new ListItem("所有订单", "-1"));
            foreach (var status in statusList)
            {
                statusSelect.Items.Add(new ListItem(status.view, status.id));
            }
        }
Ejemplo n.º 26
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // 不是微信内置浏览器
            if (!WXManage.IsWXBrowser(Request))
            {
                Response.Redirect("/RequireWX.aspx?url=" + Request.Url);
                return;
            }
            if (Session["phone"] == null || Session["iden"].ToString() != "5")
            {
                Response.Redirect("/UserIndex.aspx");
                return;
            }
            if (Request.QueryString["aid"] == null)
            {
                Response.Redirect("/Activity.aspx");
                return;
            }

            // 保存
            if (IsPostBack)
            {
                var      id               = Request.QueryString["aid"];
                DateTime timeStart        = DateTime.Parse(Request.Form["timeStart"]);
                DateTime timeEnd          = DateTime.Parse(Request.Form["timeEnd"]);
                var      title            = Request.Form["title"];
                var      content          = Request.Unvalidated["htmlInput"];
                int      template         = int.Parse(Request.Form["templateSelect"]);
                var      brief            = Request.Form["brief"];
                bool     valid            = checkValid.Checked;
                var      imgSrc           = "";
                var      templateAddition = Request.Form["templateAdditionInput"];

                if (title == "" ||
                    content == "" ||
                    brief == "" ||
                    templateAddition == "" ||
                    Request.Files.Count > 1)
                {
                    return;
                }

                if (Request.Files.Count == 1)
                {
                    var    imgName = Request.Files[0].FileName;
                    string path    = "/WXShare/uploads/" + DateTime.Now.ToString("yyyyMMdd");
                    if (!Directory.Exists("/WXShare/uploads"))
                    {
                        Directory.CreateDirectory("/WXShare/uploads");
                    }
                    if (!Directory.Exists(path))
                    {
                        Directory.CreateDirectory(path);
                    }
                    path += "/" + OSecurity.DateTimeToTimeStamp(DateTime.Now) +
                            "." + imgName.Substring(imgName.LastIndexOf('.') + 1);
                    Request.Files[0].SaveAs(path);
                    imgSrc = path.Substring(8);
                }

                Objects.Activity modActivity = new Objects.Activity()
                {
                    id               = id,
                    timeStart        = timeStart,
                    timeEnd          = timeEnd,
                    title            = title,
                    content          = content,
                    template         = template,
                    brief            = brief,
                    valid            = valid,
                    imgSrc           = imgSrc,
                    templateAddition = templateAddition
                };
                if (!DataBase.Activity.Modify(modActivity))
                {
                    ScriptManager.RegisterClientScriptBlock(this, GetType(), "saveFailed", "alert('保存失败');", true);
                    return;
                }
                Response.Redirect(Request.Url.ToString());
            }

            // 显示
            var activityID = Request.QueryString["aid"];
            var activity   = DataBase.Activity.Get(new Objects.Activity()
            {
                id = activityID
            });

            timeStart.Value    = activity.timeStart.ToString("yyyy-MM-ddTHH:mm:ss");
            timeEnd.Value      = activity.timeEnd.ToString("yyyy-MM-ddTHH:mm:ss");
            title.Value        = activity.title;
            textarea.InnerHtml = activity.content;

            var templates = DataBase.Template.Gets();

            templateSelect.Items.Clear();
            foreach (var template in templates)
            {
                templateSelect.Items.Add(new ListItem(template.name, template.id));
                if (template.id == activity.id)
                {
                    templateSelect.SelectedIndex = templateSelect.Items.Count - 1;
                }
            }
            templateAdditionInput.Value = activity.templateAddition;

            brief.Value        = activity.brief;
            checkValid.Checked = activity.valid;
            if (activity.imgSrc != "")
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "showImgSrc", "showImgSrc('//" + Request.Url.Host + "" + activity.imgSrc + "');", true);
            }
        }
Ejemplo n.º 27
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;
                }
            }
        }
Ejemplo n.º 28
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // 不是微信内置浏览器
            if (!WXManage.IsWXBrowser(Request))
            {
                Response.Redirect("/RequireWX.aspx?url=" + Request.Url);
                return;
            }
            if (Session["phone"] == null || Session["iden"].ToString() != "4")
            {
                Response.Redirect("/UserIndex.aspx");
                return;
            }
            if (Request.QueryString["oid"] == null)
            {
                Response.Clear();
                Response.Redirect("/OrdersForSGD.aspx");
                return;
            }

            // 获取订单信息
            var oid   = Request.QueryString["oid"];
            var order = DataBase.Order.GetByID(new Objects.Order()
            {
                id = oid
            });

            inputName.Value           = order.name;
            inputPhone.Value          = order.phone;
            inputLocation.Value       = order.location;
            inputLocationDetail.Value = order.locationDetail;
            inputStatus.Value         = new DataBase.Status()
                                        .Get(
                new Objects.Status()
            {
                id = order.status.ToString()
            }
                )
                                        .view;
            // 获取活动优惠
            var activity = DataBase.Activity.Get(new Objects.Activity()
            {
                id = order.youHuiLaiYuan.ToString()
            });

            if (activity.template == 1)
            {
                var addition = activity.templateAddition.Split(',');
                inputYouHui.Value = "满" + addition[0] + "减" + addition[1];
            }
            else if (activity.template == 2)
            {
                var addition = activity.templateAddition.Split(',');
                inputYouHui.Value = "满" + addition[0] + "赠送" + addition[1];
            }

            // 涂刷类型、涂刷需求
            inputBrushType.Value = new DataBase.BrushType().Get(new Objects.BrushType()
            {
                id = order.brushType.ToString()
            }).view;
            inputBrushDemand.Value = "";
            foreach (var dem in order.brushDemand.Split(','))
            {
                inputBrushDemand.Value += new DataBase.BrushDemand().Get(new Objects.BrushDemand()
                {
                    id = dem
                }).view + ",";
            }
            inputBrushDemand.Value = inputBrushDemand.Value.Substring(0, inputBrushDemand.Value.Length - 1);
            // 房屋用途、房屋类型、房屋结构、面积等
            inputHousePurpose.Value = new DataBase.HousePurpose().Get(new Objects.HousePurpose()
            {
                id = order.housePurpose.ToString()
            }).view;
            inputHouseType.Value = new DataBase.HouseType().Get(new Objects.HouseType()
            {
                id = order.houseType.ToString()
            }).view;
            inputHouseStructure.Value = new DataBase.HouseStructure().Get(new Objects.HouseStructure()
            {
                id = order.houseStructure.ToString()
            }).view;
            inputMianJiSubmitted.Value   = order.mianJi.ToString();
            inputNeiQiangSubmitted.Value = order.neiQiang.ToString();
            inputYiShuQiSubmitted.Value  = order.yiShuQi.ToString();
            inputWaiQiangSubmitted.Value = order.waiQiang.ToString();
            inputYangTaiSubmitted.Value  = order.yangTai.ToString();
            inputMuQiSubmitted.Value     = order.muQi.ToString();
            inputTieYiSubmitted.Value    = order.tieYi.ToString();
            // 计划施工时间,计划完工时间,计划工期
            inputWorkOrderDateSubmitted.Value         = order.workOrderDate.ToString("yyyy-MM-dd");
            inputWorkCompleteOrderDateSubmitted.Value = order.workCompleteOrderDate.ToString("yyyy-MM-dd");
            inputContractNumberSubmitted.Value        = order.contractNumber;
            // 各种金额
            var sum = order.smSum + order.mmSum + order.workSum;

            if (activity.template == 1)
            {
                if (sum >= int.Parse(activity.templateAddition.Split(',')[0]))
                {
                    sum -= int.Parse(activity.templateAddition.Split(',')[1]);
                }
            }
            cashRec.Value               = sum.ToString("0.0");
            inputMMSumSubmitted.Value   = order.mmSum.ToString("0.0");
            inputSMSumSubmitted.Value   = order.smSum.ToString("0.0");
            inputWorkSumSubmitted.Value = order.workSum.ToString("0.0");

            if (order.status >= 9)
            {
                inputWorkDate.Value          = order.workDate.ToString("yyyy-MM-dd");
                workDateDiv.Style["display"] = "";
            }
            if (order.status > 9)
            {
                inputWorkCompleteDate.Value          = order.workCompleteDate.ToString("yyyy-MM-dd");
                workCompleteDateDiv.Style["display"] = "";
            }

            // 调整按钮
            if (order.status != 8)
            {
                statusBtn_8.InnerHtml        = "";
                statusBtn_8.Style["display"] = "none";
            }
            if (order.status != 9)
            {
                statusBtn_9.InnerHtml        = "";
                statusBtn_9.Style["display"] = "none";
            }
            // 停工继续按钮
            if (DataBase.Order.HasPaused(order))
            {
                inputStatus.Value = "临时停工";
                // 隐藏完工按钮
                statusBtn_9.InnerHtml        = "";
                statusBtn_9.Style["display"] = "none";
                // 显示重新开工按钮
                statusBtn_8_5.Style["display"] = "";
            }
        }
Ejemplo n.º 29
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // 不是微信内置浏览器
            if (!WXManage.IsWXBrowser(Request))
            {
                Response.Redirect("/RequireWX.aspx?url=" + Request.Url);
                return;
            }

            if (IsPostBack)
            {
                // 姓名
                var name = Request.Form["name"];
                // 手机
                var phone = Request.Form["tel"];
                // 短信验证码
                var code = Request.Form["code"];
                // 身份
                var iden = Request.Form["iden"];

                // 格式检查
                if (name == "" ||                                  // 姓名不空
                    !OSecurity.ValidPhone(phone) ||                // 手机号
                    !Regex.IsMatch(code, "^\\d{4}$") ||            // 验证码4位数字
                    Int32.Parse(iden) < 1 || Int32.Parse(iden) > 5 // 身份在[1,5]
                    )
                {
                    return;
                }
                // 验证码检查
                if (!AuthCode.CheckAuthCode(phone, code))
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "codeError", "alterError($('input[name=code]')[0]);", true);
                    return;
                }

                // 身份证(业务员-施工队-管理员)
                String IDCardYWY = null;
                // 身份证(经销商)
                String IDCardJXS;
                // 区县(经销商)
                String location;
                // 详细地址
                String detailLocation;

                if (iden == "2" || iden == "4" || iden == "5")
                {
                    IDCardYWY = Request.Form["idcard_ywy"];
                    // 身份证检查
                    if (!OSecurity.ValidIDCard(IDCardYWY))
                    {
                        return;
                    }
                }

                if ((iden == "1" || iden == "2" || iden == "4" || iden == "5") &&
                    DataBase.User.Add(new Objects.User()
                {
                    phone = phone,
                    name = name,
                    identity = iden,
                    IDCard = IDCardYWY
                }))
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "success", "success(" + iden + ", '注册成功', true);", true);
                }
                // 经销商
                else if (iden == "3")
                {
                    IDCardJXS      = Request.Form["idcard_jxs"];
                    location       = Request.Form["location"];
                    detailLocation = Request.Form["detailLocation"];

                    // 不实现
                }
                else
                {
                    return;
                }
            }
        }
Ejemplo n.º 30
0
 public override string ToXML()
 {
     CreateTime = OSecurity.DateTimeToTimeStamp(DateTime.Now);
     return(WXManage.ToXML(this));
 }