Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string _action = MXRequest.GetQueryString("action");

            pid = MXRequest.GetQueryInt("pid");
            int id = 0;

            if (!string.IsNullOrEmpty(_action) && _action == MXEnums.ActionEnum.Edit.ToString())
            {
                this.action = MXEnums.ActionEnum.Edit.ToString();//修改类型
                if (!int.TryParse(Request.QueryString["id"] as string, out id))
                {
                    JscriptMsg("传输参数不正确!", "back", "Error");
                    return;
                }
                if (!datiBll.Exists(id))
                {
                    JscriptMsg("记录不存在或已被删除!", "back", "Error");
                    return;
                }
            }
            BLL.wx_dati_base   dtBll = new BLL.wx_dati_base();
            Model.wx_dati_base getdt = dtBll.GetModel(pid);
            txtscore.Text = getdt.dxscore.ToString();
            if (!Page.IsPostBack)
            {
                if (action == MXEnums.ActionEnum.Edit.ToString()) //修改
                {
                    ShowInfo(id);
                }
            }
        }
Beispiel #2
0
        public void userinfoAdd()
        {
            Dictionary <string, string> jsonDict = new Dictionary <string, string>();
            //取值
            int?   wid     = MyCommFun.RequestInt("wid", 0);
            int    aid     = MyCommFun.RequestInt("aid");
            string openid  = MyCommFun.RequestOpenid();
            string atitle  = MyCommFun.QueryString("atitle");
            string usersum = MyCommFun.QueryString("usersum");
            bool   ISnum   = true;

            if (wid == 0 || aid == 0 || openid == "" || usersum == "")
            {
                jsonDict.Add("re", "err");
                jsonDict.Add("content", "参数错误!");
                jsonDict.Add("isnum", "false");
                content.Response.Write(MyCommFun.getJsonStr(jsonDict));
                return;
            }
            BLL.wx_dati_user userBLL = new BLL.wx_dati_user();
            // Model.wx_dati_user usermodel = userBLL.GetModel(" openid='" + openid + "' ");
            int getcont = userBLL.GetRecordCount(" openid='" + openid + "' ");

            if (getcont == 3)
            {
                jsonDict.Add("re", "err");
                jsonDict.Add("content", "你已参加过了");
                jsonDict.Add("isnum", "false");
                content.Response.Write(MyCommFun.getJsonStr(jsonDict));
                return;
            }
            int sy = 2 - getcont;


            BLL.wx_dati_base   baseBLL   = new BLL.wx_dati_base();
            Model.wx_dati_base baseModel = baseBLL.GetModel(aid);
            int?jf     = 0;
            int jftype = baseModel.jftype;
            int jfval  = baseModel.jfval;

            if (jftype == 0)
            {
                jf = 0;
            }
            else if (jftype == 1)
            {
                jf = jfval;
            }
            else if (jftype == 2)
            {
                jf = int.Parse(usersum);
            }
            BLL.wx_dati_user   dxBLL   = new BLL.wx_dati_user();
            Model.wx_dati_user dxmodel = new Model.wx_dati_user();
            dxmodel.wid     = wid;
            dxmodel.openid  = openid;
            dxmodel.aid     = aid;
            dxmodel.atitle  = atitle;
            dxmodel.usersum = usersum;
            dxmodel.score   = jf;
            dxmodel.addtime = DateTime.Now;
            dxBLL.Add(dxmodel);
            //得分
            if (jf == 5)
            {
                jsonDict.Add("re", "OK");
                jsonDict.Add("cjscore", jf.ToString());
                jsonDict.Add("content", "你获得了一次红包机会!");
                jsonDict.Add("isnum", "false");
                content.Response.Write(MyCommFun.getJsonStr(jsonDict));
                return;
            }
            else
            {
                jsonDict.Add("re", "OK");
                jsonDict.Add("cjscore", jf.ToString());
                jsonDict.Add("content", "答卷提交成功!(" + sy + ")次机会");
                jsonDict.Add("isnum", "true");
                content.Response.Write(MyCommFun.getJsonStr(jsonDict));
                return;
            }
        }