Exemplo n.º 1
0
        //资讯模块
        private void digg_article_add(HttpContext context)
        {
            string channel_type = DTRequest.GetFormString("channel_type");
            string digg_type    = DTRequest.GetFormString("digg_type");
            int    id           = DTRequest.GetFormInt("id");

            BLL.article bll = new BLL.article();
            if (!bll.Exists(id))
            {
                context.Response.Write("{msg:0, msgbox:\"信息不存在或已删除!\"}");
                return;
            }
            if (digg_type == "good")
            {
                bll.UpdateField(id, "digg_good=digg_good+1");
            }
            else
            {
                bll.UpdateField(id, "digg_act=digg_act+1");
            }
            Model.article model = bll.GetModel(id);
            context.Response.Write("{msg:1, digggood:" + model.digg_good + ", diggact:" + model.digg_act + ", msgbox:\"成功顶或踩了一下!\"}");
            Utils.WriteCookie(DTKeys.COOKIE_DIGG_KEY, channel_type + id.ToString(), id.ToString(), 8640);
            return;
        }
Exemplo n.º 2
0
        private void feedback_list(HttpContext context)
        {
            int    page      = DTRequest.GetFormInt("page", 1);
            int    pageSize  = DTRequest.GetFormInt("size", 10);
            string site_path = Utils.SafeXXS(DTRequest.GetQueryString("site").Trim());

            if (string.IsNullOrWhiteSpace(site_path))
            {
                context.Response.Write("{\"status\": 0, \"msg\": \"对不起,参数错误!\"}");
                return;
            }

            int       totalcount = 0;
            DataTable dt         = new BLL.plugin_feedback().GetList(pageSize, page, "is_lock=0 and site_path='" + site_path + "'", "add_time desc", out totalcount).Tables[0];

            dt.Columns.Remove("user_tel");
            dt.Columns.Remove("user_qq");
            dt.Columns.Remove("user_email");
            dt.Columns.Remove("row_number");
            dt.Columns.Remove("site_path");
            JsonHelper.WriteJson(context,
                                 new {
                status = 1,
                msg    = "获取留言列表成功!",
                total  = totalcount,
                list   = dt
            }
                                 );
        }
Exemplo n.º 3
0
        private void edit_dic_word(HttpContext context)
        {
            //检查权限
            if (!new BLL.manager_role().Exists(adminInfo.role_id, "lucene_pangu", DTEnums.ActionEnum.Edit.ToString()))
            {
                context.Response.Write("{\"status\": 0, \"msg\": \"您没有操作权限!\"}");
                return;
            }

            int    pos       = DTRequest.GetFormInt("p");
            int    frequency = DTRequest.GetFormInt("f");
            string key       = DTRequest.GetFormString("k");

            if (string.IsNullOrEmpty(key))
            {
                context.Response.Write("{\"status\":0 ,\"msg\":\"关键词不能为空!\"}");
                return;
            }
            PanguHelper dic = new PanguHelper();

            if (dic.UpdateWord(key, (double)frequency, pos))
            {
                dic.Save(DateTime.Now.ToString("yyMMddhh"));
                context.Response.Write("{\"status\":1 ,\"msg\":\"修改成功!\"}");
                return;
            }
            context.Response.Write("{\"status\":0 ,\"msg\":\"修改失败!\"}");
        }
Exemplo n.º 4
0
        private void digg_add(HttpContext context)
        {
            string channel_type = DTRequest.GetFormString("channel_type");
            int    id           = DTRequest.GetFormInt("id");

            if (!string.IsNullOrEmpty(channel_type) && id > 0)
            {
                string cookie = Utils.GetCookie(DTKeys.COOKIE_DIGG_KEY, channel_type + id.ToString());
                if (cookie == id.ToString())
                {
                    context.Response.Write("{msg:0, msgbox:\"您刚刚提交过,体息一会吧!\"}");
                    return;
                }
            }
            switch (channel_type)
            {
            case "article":
                digg_article_add(context);
                break;

            case "photo":
                digg_photo_add(context);
                break;

            case "download":
                digg_download_add(context);
                break;

            case "content":
                digg_content_add(context);
                break;
            }
        }
Exemplo n.º 5
0
        private void get_prop_page(HttpContext context)
        {
            try
            {
                StringBuilder strhtml  = new StringBuilder();
                int           category = DTRequest.GetFormInt("category", 0);
                int           page     = DTRequest.GetFormInt("page", 1);

                BLL.property       pro       = new BLL.property();
                BLL.property_value pro_value = new BLL.property_value();

                BLL.article_category catgory = new BLL.article_category();
                string    category_ids       = "";
                DataTable dt_pro             = null;
                if (category == 0)
                {
                    dt_pro = pro.GetList("").Tables[0];
                }
                else
                {
                    DataTable cat_dt = catgory.GetList(0, 2, category.ToString());//查找类别下的所有类别
                    if (cat_dt.Rows.Count > 0)
                    {
                        for (int i = 0; i < cat_dt.Rows.Count; i++)
                        {
                            category_ids += cat_dt.Rows[i][0].ToString() + ",";
                        }
                        category_ids = category_ids.Substring(0, category_ids.Length - 1);
                    }
                    dt_pro = pro.GetList("category_id in(" + category_ids + ")").Tables[0];
                }
                if (dt_pro.Rows.Count > 0)
                {
                    for (int i = 0; i < dt_pro.Rows.Count; i++)
                    {
                        strhtml.Append("<dl>");
                        strhtml.Append("<dt>" + dt_pro.Rows[i]["title"] + "</dt>");
                        DataTable dt_pro_value = pro_value.GetList("property_id='" + dt_pro.Rows[i][0] + "'").Tables[0];
                        if (dt_pro_value.Rows.Count > 0)
                        {
                            for (int j = 0; j < dt_pro_value.Rows.Count; j++)
                            {
                                strhtml.Append("<dd><a style=\"cursor:pointer;\" onclick='getpagedata(" + dt_pro_value.Rows[j][0] + "," + category + "," + page + ")'>" + dt_pro_value.Rows[j]["value"] + "</a><span></span></dd>");
                            }
                        }
                        strhtml.Append("</dl>");
                    }
                    context.Response.Write("{ \"info\":\"获取数据成功!\", \"status\":\"1\" ,\"html\":\"" + myJson.String2Json(strhtml.ToString()) + "\",\"pagelist\":\"\"}");
                    return;
                }
                context.Response.Write("{ \"info\":\"该类别暂未添加属性!\", \"status\":\"0\" }");
            }
            catch (Exception ex)
            {
                context.Response.Write("{ \"info\":\"该类别暂未添加属性!\", \"status\":\"0\" }");
                return;
            }
        }
Exemplo n.º 6
0
        private void save_Role(HttpContext context)
        {
            int mid = DTRequest.GetFormInt("mid");

            BLL.selfMessage   bll   = new BLL.selfMessage();
            Model.selfMessage model = bll.GetModel(mid);
            model.me_isRead = true;
            bll.Update(model);
            context.Response.End();
        }
Exemplo n.º 7
0
        private void confirm_Status(HttpContext context)
        {
            Model.manager adminModel = new ManagePage().GetAdminInfo();//获得当前登录管理员信息
            //string ids = DTRequest.GetFormString("ids");
            //string status = DTRequest.GetFormString("status");
            //string date = DTRequest.GetFormString("date");
            //int method = Utils.StrToInt(DTRequest.GetFormString("method"), 0);
            //string methodName = DTRequest.GetFormString("methodName");
            //BLL.unBusinessApply bll = new BLL.unBusinessApply();
            //string[] idlist = ids.Split(',');
            //int success = 0, error = 0;
            //StringBuilder sb = new StringBuilder();
            //string reason = "";
            //foreach (string id in idlist)
            //{
            //    reason = bll.confirmStatus(Convert.ToInt32(id), status, date, method, methodName, adminModel);
            //    if (string.IsNullOrEmpty(reason))
            //    {
            //        success++;
            //    }
            //    else
            //    {
            //        error++;
            //        sb.Append(reason + "<br/>");
            //    }
            //}
            //context.Response.Write("{ \"msg\":\"共选择" + idlist.Length + "条记录,成功" + success + "条,失败" + error + "条<br/>" + sb.ToString() + "\", \"status\":" + (error > 0 ? "1" : "0") + "  }");
            //context.Response.End();
            int    id         = DTRequest.GetFormInt("id");
            string status     = DTRequest.GetFormString("status");
            string date       = DTRequest.GetFormString("date");
            int    method     = Utils.StrToInt(DTRequest.GetFormString("method"), 0);
            string methodName = DTRequest.GetFormString("methodName");

            BLL.unBusinessApply bll = new BLL.unBusinessApply();
            string reason           = bll.confirmStatus(id, status, date, method, methodName, adminModel);

            if (string.IsNullOrEmpty(reason))
            {
                context.Response.Write("{ \"msg\":\"操作成功\", \"status\":0 }");
                context.Response.End();
            }
            else
            {
                context.Response.Write("{ \"msg\":\"" + reason + "\", \"status\":1 }");
                context.Response.End();
            }
        }
Exemplo n.º 8
0
        private void check_Status(HttpContext context)
        {
            Model.manager adminModel = new ManagePage().GetAdminInfo();//获得当前登录管理员信息
            //string ids = DTRequest.GetFormString("ids");
            //string ctype = DTRequest.GetFormString("ctype");
            //string cstatus = DTRequest.GetFormString("cstatus");
            //string remark = DTRequest.GetFormString("remark");
            //BLL.unBusinessApply bll = new BLL.unBusinessApply();
            //string[] idlist = ids.Split(',');
            //int success = 0, error = 0;
            //StringBuilder sb = new StringBuilder();
            //string reason = "";
            //foreach (string id in idlist)
            //{
            //    reason = bll.checkStatus(Convert.ToInt32(id), Utils.ObjToByte(ctype), Utils.ObjToByte(cstatus), remark, adminModel);
            //    if (string.IsNullOrEmpty(reason))
            //    {
            //        success++;
            //    }
            //    else
            //    {
            //        error++;
            //        sb.Append(reason + "<br/>");
            //    }
            //}
            //context.Response.Write("{ \"msg\":\"共选择" + idlist.Length + "条记录,成功" + success + "条,失败" + error + "条<br/>" + sb.ToString() + "\", \"status\":" + (error > 0 ? "1" : "0") + "  }");
            //context.Response.End();
            int    id         = DTRequest.GetFormInt("id");
            string ctype      = DTRequest.GetFormString("ctype");
            string cstatus    = DTRequest.GetFormString("cstatus");
            string checkMoney = DTRequest.GetFormString("checkMoney");
            string remark     = DTRequest.GetFormString("remark");

            BLL.unBusinessApply bll = new BLL.unBusinessApply();
            StringBuilder       sb  = new StringBuilder();
            string reason           = bll.checkStatus(id, Utils.ObjToByte(ctype), Utils.ObjToByte(cstatus), checkMoney, remark, adminModel);

            if (string.IsNullOrEmpty(reason))
            {
                context.Response.Write("{ \"msg\":\"操作成功\", \"status\":0 }");
                context.Response.End();
            }
            else
            {
                context.Response.Write("{ \"msg\":\"" + reason + "\", \"status\":1 }");
                context.Response.End();
            }
        }
Exemplo n.º 9
0
        private void set_lock(HttpContext context)
        {
            //检查用户是否登录
            DTcms.Model.users umodel = new DTcms.Web.UI.BasePage().GetUserInfo();
            if (umodel == null)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"请登录后再提交!\"}");
                return;
            }

            StringBuilder strTxt = new StringBuilder();

            BLL.forum_posts   bll   = new BLL.forum_posts();
            Model.forum_posts model = new Model.forum_posts();

            int    post_id  = DTRequest.GetFormInt("postid");
            string optip    = DTRequest.GetFormString("optip");
            string opremark = DTRequest.GetFormString("opremark");

            model = bll.GetModel(post_id);


            //检查是否是版主
            if (!IsModerator(model.board_id, umodel.id))
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,你无权进行此操作!\"}");
                return;
            }

            string strSet = "is_lock=0";

            if (model.is_lock == 0)
            {
                strSet = "is_lock=1";
            }

            bll.UpdateField(post_id, strSet);

            //发送短信息
            string postusername = new DTcms.BLL.users().GetModel(model.user_id).user_name;

            new DTcms.BLL.user_message().Add(1, string.Empty, postusername, "您发布的帖子被管理员进行操作", "您的帖子被管理员进行 " + optip + " 操作,原因:" + opremark);
            new DTcms.Web.UI.ManagePage().AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "锁定帖子:" + opremark); //记录日志

            context.Response.Write("{\"status\": 1, \"msg\": \"恭喜您,操作成功!\"}");
            return;
        }
Exemplo n.º 10
0
        private void change_OrderStatus(HttpContext context)
        {
            int     tag        = DTRequest.GetFormInt("tag", 0);
            string  oID        = DTRequest.GetFormString("oID");
            int     status     = DTRequest.GetFormInt("status", 0);
            int     flag       = DTRequest.GetFormInt("flag", 0);
            byte?   lockstatus = Utils.ObjToByte(DTRequest.GetFormString("lockstatus"));
            decimal cost       = DTRequest.GetFormDecimal("cost", 0);
            string  finRemark  = DTRequest.GetFormString("finRemark");

            if (tag == 0)
            {
                context.Response.Write("{ \"msg\":\"参数错误\", \"status\":\"1\" }");
                return;
            }
            BLL.Order     bll     = new BLL.Order();
            Model.manager manager = new ManagePage().GetAdminInfo();
            string        result  = string.Empty;

            if (tag == 1)
            {
                result = bll.updateDstatus(oID, (byte)status, manager);
            }
            else if (tag == 2)
            {
                result = bll.updateFlag(oID, (byte)flag, manager);
            }
            else if (tag == 3)
            {
                result = bll.updateLockStatus(oID, lockstatus, manager);
            }
            else if (tag == 4)
            {
                result = bll.updateCost(oID, cost, manager);
            }
            else
            {
                result = bll.updateFinRemark(oID, finRemark, manager);
            }
            if (string.IsNullOrEmpty(result))
            {
                context.Response.Write("{ \"msg\":\"" + oID + "\", \"status\":\"0\" }");
                return;
            }
            context.Response.Write("{ \"msg\":\"" + result + "\", \"status\":\"1\" }");
            return;
        }
Exemplo n.º 11
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public HttpResponseMessage userInfo()
        {
            int userId = DTRequest.GetFormInt("userId");

            BLL.users   bll   = new BLL.users();
            Model.users model = bll.GetModel(userId);
            if (model == null)
            {
                //context.Response.Write("{\"status\":0, \"msg\":\"用户不存在!\"}");
                //return;
                string ss = "{\"status\": 0, \"msg\": \"错误提示:站点传输参数不正确!\"}";
                return(new HttpResponseMessage {
                    Content = new StringContent(ss, System.Text.Encoding.UTF8, "application/json")
                });
            }
            string s = LitJson.JsonMapper.ToJson(model);
            //return new HttpResponseMessage { Content = new StringContent(s, System.Text.Encoding.UTF8, "application/json") };
            JObject obj = JsonConvert.DeserializeObject(s) as JObject;

            //移除无用字段
            obj.Remove("password");
            obj.Remove("password2");
            obj.Remove("amount");
            obj.Remove("point");
            obj.Remove("exp");
            obj.Remove("isweixin");
            obj.Remove("wid");
            obj.Remove("wxCard");
            obj.Remove("wxOpenId");
            obj.Remove("wxName");
            obj.Remove("xin");
            obj.Remove("yushu");
            obj.Remove("shangjilist");
            //添加需要的
            obj["status"]      = 1;
            obj["msg"]         = "获取信息成功!";
            obj["provinceStr"] = "";
            obj["cityStr"]     = "";
            obj["hangyeStr"]   = "";
            s = JsonConvert.SerializeObject(obj);
            return(new HttpResponseMessage {
                Content = new StringContent(s, System.Text.Encoding.UTF8, "application/json")
            });
            //return s;
        }
Exemplo n.º 12
0
        private void add_dic_word_all(HttpContext context)
        {
            //检查权限
            if (!new BLL.manager_role().Exists(adminInfo.role_id, "lucene_pangu", DTEnums.ActionEnum.Add.ToString()))
            {
                context.Response.Write("{\"status\": 0, \"msg\": \"您没有操作权限!\"}");
                return;
            }

            int    pos       = DTRequest.GetFormInt("p");
            int    frequency = DTRequest.GetFormInt("f");
            string key       = DTRequest.GetFormString("k");

            int sucCount   = 0;
            int errorCount = 0;

            if (string.IsNullOrEmpty(key))
            {
                context.Response.Write("{\"status\":0 ,\"msg\":\"关键词不能为空!\"}");
                return;
            }

            key = Regex.Replace(key, @"\W+", ",");
            string[]    valArr = key.Split(',');
            PanguHelper dic    = new PanguHelper();

            if (valArr.Length > 0)
            {
                foreach (string k in valArr)
                {
                    if (dic.InsertWord(k, (double)frequency, pos))
                    {
                        sucCount++;
                    }
                    else
                    {
                        errorCount++;
                    }
                }
                dic.Save(DateTime.Now.ToString("yyMMddhh"));
                context.Response.Write("{\"status\":1 ,\"msg\":\"" + string.Format("添加成功{0}条,失败{1}条!", sucCount, errorCount) + "\"}");
                return;
            }
            context.Response.Write("{\"status\":0 ,\"msg\":\"添加失败!\"}");
        }
Exemplo n.º 13
0
        private void reply(HttpContext context)
        {
            //检查用户是否登录
            DTcms.Model.users umodel = new DTcms.Web.UI.BasePage().GetUserInfo();
            if (umodel == null)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"请登录后再提交!\"}");
                return;
            }
            BLL.forum_posts   bll   = new BLL.forum_posts();
            Model.forum_posts model = new Model.forum_posts();

            string _title   = DTRequest.GetFormString("txtTitle");
            string _content = DTRequest.GetFormString("txtContent");
            int    board_id = DTRequest.GetFormInt("txtBoardID");
            int    post_id  = DTRequest.GetFormInt("txtPostID");


            int    _userid = umodel.id;
            string _userip = System.Web.HttpContext.Current.Request.UserHostAddress;

            model.class_layer    = 2;
            model.title          = Utils.DropHTML(_title);
            model.content        = _content;
            model.user_id        = _userid;
            model.user_ip        = _userip;
            model.board_id       = board_id;
            model.parent_post_id = post_id;
            model.post_type      = 2;//回帖


            Model.forum_posts pmodel = bll.GetModel(post_id);
            pmodel.reply_time    = DateTime.Now;
            pmodel.reply_user_id = _userid;
            pmodel.reply_count  += 1;

            if (bll.Add(model) > 0 && bll.Update(pmodel))
            {
                context.Response.Write("{\"status\": 1, \"msg\": \"恭喜您,回帖成功!\"}");
                return;
            }
            context.Response.Write("{\"status\": 0, \"msg\": \"对不起,保存过程中发生错误!\"}");
            return;
        }
Exemplo n.º 14
0
        private void getMoney_Log(HttpContext context)
        {
            int     ubaID = DTRequest.GetFormInt("ubaID");
            DataSet ds    = new BLL.unBusinessMoneyLog().GetList(0, "ubml_ubaid=" + ubaID + "", " ubml_type asc");
            string  str   = string.Empty;

            if (ds != null && ds.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    str += (Utils.ObjToByte(dr["ubml_type"]) == 1 ? "部门批复" : Utils.ObjToByte(dr["ubml_type"]) == 2 ? "财务批复" : "总经理批复") + ":" + dr["ubml_oldMoney"] + "->" + dr["ubml_newMoney"] + "," + dr["ubml_username"] + "(" + dr["ubml_realname"] + ")," + Utils.ObjectToDateTime(dr["ubml_date"]) + ";</br>";
                }
            }
            else
            {
                str = "无";
            }
            context.Response.Write(str);
            context.Response.End();
        }
Exemplo n.º 15
0
        private void delete_Unbusiness(HttpContext context)
        {
            Model.manager adminModel = new ManagePage().GetAdminInfo();//获得当前登录管理员信息
            int           id         = DTRequest.GetFormInt("id");

            BLL.unBusinessApply bll = new BLL.unBusinessApply();
            string result           = bll.Delete(id, adminModel);

            if (!string.IsNullOrEmpty(result))
            {
                context.Response.Write("{ \"msg\":\"" + result + "\", \"status\":1 }");
                context.Response.End();
            }
            //删除文件
            if (Directory.Exists(context.Server.MapPath("~/uploadPay/2/" + id + "/")))
            {
                Directory.Delete(context.Server.MapPath("~/uploadPay/2/" + id + "/"), true);
            }
            context.Response.Write("{ \"msg\":\"操作成功\", \"status\":0 }");
            context.Response.End();
        }
Exemplo n.º 16
0
        private void edit(HttpContext context)
        {
            //检查用户是否登录
            DTcms.Model.users umodel = new DTcms.Web.UI.BasePage().GetUserInfo();
            if (umodel == null)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"请登录后再提交!\"}");
                return;
            }
            BLL.forum_posts bll      = new BLL.forum_posts();
            string          _title   = DTRequest.GetFormString("txtTitle");
            string          _content = DTRequest.GetFormString("txtContent");
            int             post_id  = DTRequest.GetFormInt("txtPostID");

            if (post_id == 0)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"参数不正确!\"}");
                return;
            }
            Model.forum_posts model = bll.GetModel(post_id);

            //判断权限
            if (!IsModerator(model.board_id, umodel.id) && model.user_id != umodel.id)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,你无权编辑此帖!\"}");
                return;
            }

            model.title   = Utils.DropHTML(_title);
            model.content = _content;

            if (bll.Update(model))
            {
                context.Response.Write("{\"status\": 1, \"msg\": \"编辑帖子成功!\"}");
                return;
            }
            context.Response.Write("{\"status\": 0, \"msg\": \"对不起,保存过程中发生错误!\"}");
            return;
        }
Exemplo n.º 17
0
        private void del(HttpContext context)
        {
            //检查用户是否登录
            DTcms.Model.users umodel = new DTcms.Web.UI.BasePage().GetUserInfo();
            if (umodel == null)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"请登录后再提交!\"}");
                return;
            }

            BLL.forum_posts   bll   = new BLL.forum_posts();
            Model.forum_posts model = new Model.forum_posts();
            int    post_id          = DTRequest.GetFormInt("postid");
            string optip            = DTRequest.GetFormString("optip");
            string opremark         = DTRequest.GetFormString("opremark");

            model = bll.GetModel(post_id);

            //检查是否是版主
            if (!IsModerator(model.board_id, umodel.id))
            {
                context.Response.Write("{\"status\":0, \"msg\":\"当前用户无权执行此操作!\"}");
                return;
            }

            if (bll.Delete(post_id))
            {
                //发送短信息
                string postusername = new DTcms.BLL.users().GetModel(model.user_id).user_name;
                new DTcms.BLL.user_message().Add(1, string.Empty, postusername, "您发布的帖子被管理员进行操作", "您的帖子被管理员进行 " + optip + " 操作,原因:" + opremark);
                new DTcms.Web.UI.ManagePage().AddAdminLog(DTEnums.ActionEnum.Delete.ToString(), "删除帖子:" + opremark); //记录日志

                context.Response.Write("{\"status\": 1, \"msg\": \"恭喜您,删除帖子成功!\"}");
                return;
            }
            context.Response.Write("{\"status\": 0, \"msg\": \"对不起,保存过程中发生错误!\"}");
            return;
        }
Exemplo n.º 18
0
        void AddCat(string cart, string Key, string GoUrl)
        {
            //获取当前点击的商品信息
            int intPicCount = DTRequest.GetFormInt("text_box");
            IDictionary <string, string> dic = GetCart(cart);

            if (dic != null)
            {
                if (dic.ContainsKey(Key))
                {
                    if (cart == "dt_cookie_shopping_cart")
                    {
                        dic[Key] = (int.Parse(dic[Key]) + intPicCount).ToString();
                    }
                    AddCookies(cart, JsonMapper.ToJson(dic));
                }
                else
                {
                    if (!dic.ContainsKey(Key))
                    {
                        dic.Add(Key, intPicCount.ToString());
                        AddCookies(cart, JsonMapper.ToJson(dic));
                    }
                }
            }
            else
            {
                dic = new Dictionary <string, string>();
                //不存在的則新增
                if (!dic.ContainsKey(Key))
                {
                    dic.Add(Key, intPicCount.ToString());
                    AddCookies(cart, JsonMapper.ToJson(dic));
                }
            }
            this.Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('添加成功!');window.location.href='" + GoUrl + "'</script>");
        }
Exemplo n.º 19
0
        private void move(HttpContext context)
        {
            //检查用户是否登录
            DTcms.Model.users umodel = new DTcms.Web.UI.BasePage().GetUserInfo();
            if (umodel == null)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"请登录后再操作!\"}");
                return;
            }
            BLL.forum_posts   bll   = new BLL.forum_posts();
            Model.forum_posts model = new Model.forum_posts();

            BLL.forum_board   bbll   = new BLL.forum_board();
            Model.forum_board bmodel = new Model.forum_board();

            int    post_id    = DTRequest.GetFormInt("postid");
            int    to_boardid = DTRequest.GetFormInt("toboardid");
            string opremark   = DTRequest.GetString("opremark");

            if (post_id == 0)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"参数不正确!\"}");
                return;
            }

            model = bll.GetModel(post_id);
            if (model.parent_post_id != 0)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"非主题贴不可移动!\"}");
                return;
            }

            int postcount  = 0;
            int replycount = 0;
            int oldboardid = model.board_id;


            //检查是否是版主
            if (!IsModerator(model.board_id, umodel.id))
            {
                context.Response.Write("{\"status\":0, \"msg\":\"当前用户无权执行此操作!\"}");
                return;
            }

            DataTable dt = bll.GetList(0, "id=" + post_id + " or parent_post_id=" + post_id, "id desc").Tables[0];

            foreach (DataRow dr in dt.Rows)
            {
                if (int.Parse(dr["parent_post_id"].ToString()) == 0)
                {
                    postcount  += 1;
                    replycount += 1;
                }
                else
                {
                    replycount += 1;
                }
                bll.UpdateField(int.Parse(dr["id"].ToString()), "board_id=" + to_boardid);
            }

            bmodel = bbll.GetModel(oldboardid);
            bmodel.subject_count -= postcount;
            bmodel.post_count    -= replycount;
            bbll.Update(bmodel);

            bmodel = bbll.GetModel(to_boardid);
            bmodel.subject_count += postcount;
            bmodel.post_count    += replycount;
            bbll.Update(bmodel);

            new DTcms.Web.UI.ManagePage().AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "移动帖子:" + opremark); //记录日志

            context.Response.Write("{\"status\": 1, \"msg\": \"恭喜你,移动主题成功!\"}");
            return;
        }
Exemplo n.º 20
0
        private void get_productdate_page(HttpContext context)
        {
            try
            {
                int    category = DTRequest.GetFormInt("category", 0);
                string keyword  = DTRequest.GetFormString("keyword");
                int    propty   = DTRequest.GetFormInt("propty", 0);
                int    page     = DTRequest.GetFormInt("page", 1);
                int    pagesize = DTRequest.GetFormInt("pagesize", 8);

                string      _orderby     = "sort_id asc,add_time desc";
                int         _recordCount = 0;
                string      pagelist     = "";
                BLL.article bll          = new BLL.article();

                string sqlwhere = "";

                if (keyword != "" && keyword.Length > 0 && DTcms.Common.Utils.IsSafeSqlString(keyword))
                {
                    sqlwhere = " id in (select good_id from td_property_good where property_value_id in ( select id from td_property_value where value like '%" + keyword + "%')) or id in (select good_id from td_tag_good where tag_id in( select id from td_tag where title like '%" + keyword + "%')) or id in (select good_id from td_alias_good where alias_id in( select id from td_alias where title like '%" + keyword + "%'))or title like '%" + keyword + "%'";
                    if (propty > 0)//属性筛选
                    {
                        sqlwhere += " and id in (select distinct good_id from dbo.td_property_good where property_value_id in(" + propty + "))";
                    }
                }
                else
                {
                    if (propty > 0)//属性筛选
                    {
                        sqlwhere = "id in (select distinct good_id from dbo.td_property_good where property_value_id in(" + propty + "))";
                        if (keyword != "" && keyword.Length > 0 && DTcms.Common.Utils.IsSafeSqlString(keyword))
                        {
                            sqlwhere += " and id in select good_id from td_property_good where property_value_id in ( select id from td_property_value where value like '%" + keyword + "%'))orid in (select good_id from td_tag_good where tag_id in( select id from td_tag where title like '%" + keyword + "%'))or id in (select good_id from td_alias_good where alias_id in( select id from td_alias where title like '%" + keyword + "%'))or title like '%" + keyword + "%'";
                        }
                    }
                }

                //DataSet ds = bll.get_article_list(,pagesize, page, "*", _where + "and attr1='1' and id in", _orderby, out _recordCount);
                DataSet   ds        = bll.GetList("goods", category, pagesize, page, sqlwhere, _orderby, out _recordCount);
                DataTable dt        = ds.Tables[0];
                BasePage  _basepage = new BasePage();
                if (keyword.Length <= 0)
                {
                    pagelist = _basepage.get_page_links(pagesize, page, _recordCount, "javascript:getpagedata(''," + propty + "," + category + ",__id__);");
                }
                else
                {
                    pagelist = _basepage.get_page_links(pagesize, page, _recordCount, "javascript:getpagedata(" + keyword + "," + propty + "," + category + ",__id__);");
                }

                StringBuilder strhtml = new StringBuilder();

                foreach (DataRow dr in dt.Rows)
                {
                    strhtml.Append("<li>");

                    strhtml.Append("<div class=\"Procurement_list_li_top\">");
                    strhtml.Append("<input type=\"checkbox\" class=\"select_buy\" name=\"computer\" /></div>");

                    strhtml.Append("<div class=\"img_describe\">");
                    strhtml.Append("<a href=\"/good_show.aspx?id=" + dr["id"].ToString() + "\"><img  src=\"" + dr["img_url"].ToString() + "\" width=\"235\" height=\"229\" />");
                    strhtml.Append("" + dr["title"] + "&nbsp;" + get_category_title(int.Parse(dr["category_id"].ToString()), "") + "&nbsp;红色 </a> </div>");

                    strhtml.Append("<span><strong>¥" + dr["sell_price"] + "</strong></span>");
                    strhtml.Append("<div class=\"Procurement_list_li_bottom\">");
                    strhtml.Append("<img class=\"reduce_btn\" src=\"../../../../templates/ql/images/reduce.jpg\" width=\"14\" height=\"14\" />");
                    strhtml.Append("<input type=\"text\" id=\"inputCount\" value=\"1\" name=\"\" />");
                    strhtml.Append("<img class=\"add_btn\" src=\"../../../../templates/ql/images/add.jpg\" width=\"14\" height=\"14\" /><a href=\"/good_show.aspx?id=" + dr["id"].ToString() + "\" class=\"enter_shoppingcar\">进购物车</a>");
                    strhtml.Append("<a href=\"javascript:;\" onclick=\"Submit4('" + dr["id"].ToString() + "')\">收藏</a></div>");


                    strhtml.Append("</li>");
                }
                context.Response.Write("{ \"info\":\"获取数据成功!\", \"status\":\"1\" ,\"html\":\"" + myJson.String2Json(strhtml.ToString()) + "\",\"pagelist\":\"" + myJson.String2Json(pagelist) + "\"}");
                return;
            }
            catch (Exception ex)
            {
                context.Response.Write("{ \"info\":\"获取数据失败!\", \"status\":\"0\" }");
                return;
            }
        }
Exemplo n.º 21
0
        private void user_credit_convert(HttpContext context)
        {
            //检查系统是否启用兑换金币功能
            if (DTcms.Web.Plugin.Forum.Global.RateExchange == 0)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,网站未开启兑换金币功能!\"}");
                return;
            }

            if (modelUser == null)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,用户尚未登录或已超时!\"}");
                return;
            }
            int credit = DTRequest.GetFormInt("txtCredit");

            string password = DTRequest.GetFormString("txtPassword");

            if (modelUser.Credit < DTcms.Web.Plugin.Forum.Global.RateExchange)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,您论坛金币不足!\"}");
                return;
            }

            if (modelUser.Credit < DTcms.Web.Plugin.Forum.Global.RateExchange)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,最小兑换金币为" + DTcms.Web.Plugin.Forum.Global.RateExchange + "币!\"}");
                return;
            }

            if (credit > modelUser.Credit)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,您输入的兑换的额度大于账户上的论坛余额!\"}");
                return;
            }
            if (password == "")
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,请输入您账户的密码!\"}");
                return;
            }

            DTcms.Model.users model = new DTcms.BLL.users().GetModel(modelUser.UserId);

            //验证密码
            if (DESEncrypt.Encrypt(password, model.salt) != model.password)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,您输入的密码不正确!\"}");
                return;
            }

            BLL.Forum_UserExtended bllUser = new BLL.Forum_UserExtended();
            bllUser.UpdateField(modelUser.UserId, " Credit=Credit-" + credit + " ");


            //计算兑换后的积分值
            int convertPoint = (int)(Convert.ToDecimal(credit) / DTcms.Web.Plugin.Forum.Global.RateExchange);

            //增加积分
            int pointNewId = new DTcms.BLL.user_point_log().Add(model.id, model.user_name, convertPoint, "用户兑换论坛金币", true);

            //重新计算组
            HttpContext.Current.Session["SESSION_USER_EXTENDED"] = bllUser.SetGroupId(modelUser);

            context.Response.Write("{\"status\":1, \"msg\":\"恭喜您,积分兑换成功!\"}");
            return;
        }
Exemplo n.º 22
0
        private void save_Order(HttpContext context)
        {
            string oID           = DTRequest.GetFormString("orderID");
            int    cid           = DTRequest.GetFormInt("hCusId", 0);
            int    coid          = DTRequest.GetFormInt("ddlcontact", 0);
            string contractPrice = DTRequest.GetFormString("ddlcontractPrice");
            string sdate         = DTRequest.GetFormString("txtsDate");
            string edate         = DTRequest.GetFormString("txteDate");
            string address       = DTRequest.GetFormString("txtAddress");
            string content       = DTRequest.GetFormString("txtContent");
            string contract      = DTRequest.GetFormString("txtContract");
            string remark        = DTRequest.GetFormString("txtRemark");
            string place         = DTRequest.GetFormString("hide_place");
            int    fstatus       = DTRequest.GetFormInt("ddlfStatus", 0);
            string employee0     = DTRequest.GetFormString("hide_employee0");
            string employee1     = DTRequest.GetFormString("hide_employee1");
            string employee2     = DTRequest.GetFormString("hide_employee2");
            string employee3     = DTRequest.GetFormString("hide_employee3");
            string employee4     = DTRequest.GetFormString("hide_employee4");
            string pushStatus    = DTRequest.GetFormString("ddlpushStatus");

            Model.Order order = new Model.Order();
            order.o_id              = oID;
            order.o_cid             = cid;
            order.o_coid            = coid;
            order.o_content         = content;
            order.o_address         = address;
            order.o_contractPrice   = contractPrice;
            order.o_contractContent = contract;
            order.o_sdate           = ConvertHelper.toDate(sdate);
            order.o_edate           = ConvertHelper.toDate(edate);
            order.o_place           = place;
            order.o_status          = (byte)fstatus;
            order.o_isPush          = pushStatus == "True" ? true : false;
            order.o_remarks         = remark;
            string[] list = new string[] { }, pli = new string[] { };
            #region  单人
            if (!string.IsNullOrEmpty(employee0))
            {
                pli = employee0.Split('|');
                order.personlist.Add(new Model.OrderPerson()
                {
                    op_type = 1, op_name = pli[0], op_number = pli[1], op_area = pli[2], op_addTime = DateTime.Now
                });
            }
            #endregion
            #region 业务报账员
            if (!string.IsNullOrEmpty(employee1))
            {
                pli = new string[] { };
                pli = employee1.Split('|');
                order.personlist.Add(new Model.OrderPerson()
                {
                    op_type = 2, op_name = pli[0], op_number = pli[1], op_area = pli[2], op_addTime = DateTime.Now
                });
            }
            #endregion
            #region 业务策划人员
            if (!string.IsNullOrEmpty(employee2))
            {
                pli  = new string[] { };
                list = employee2.Split(',');
                foreach (string item in list)
                {
                    pli = item.Split('|');
                    order.personlist.Add(new Model.OrderPerson()
                    {
                        op_type = 3, op_name = pli[0], op_number = pli[1], op_area = pli[2], op_dstatus = Utils.ObjToByte(pli[3]), op_addTime = DateTime.Now
                    });
                }
            }
            #endregion
            #region 业务执行人员
            if (!string.IsNullOrEmpty(employee3))
            {
                list = new string[] { };
                pli  = new string[] { };
                list = employee3.Split(',');
                foreach (string item in list)
                {
                    pli = item.Split('|');
                    order.personlist.Add(new Model.OrderPerson()
                    {
                        op_type = 4, op_name = pli[0], op_number = pli[1], op_area = pli[2], op_addTime = DateTime.Now
                    });
                }
            }
            #endregion
            #region 业务设计人员
            if (!string.IsNullOrEmpty(employee4))
            {
                pli  = new string[] { };
                list = employee4.Split(',');
                foreach (string item in list)
                {
                    pli = item.Split('|');
                    order.personlist.Add(new Model.OrderPerson()
                    {
                        op_type = 5, op_name = pli[0], op_number = pli[1], op_area = pli[2], op_dstatus = Utils.ObjToByte(pli[3]), op_addTime = DateTime.Now
                    });
                }
            }
            #endregion
            string           oid     = string.Empty;
            string           result  = string.Empty;
            BLL.manager_role bll     = new BLL.manager_role();
            Model.manager    manager = new ManagePage().GetAdminInfo();
            if (string.IsNullOrEmpty(oID))
            {
                if (!bll.Exists(manager.role_id, "sys_order_add", "Add"))
                {
                    context.Response.Write("{ \"msg\":\"您没有管理该页面的权限,请勿非法进入!\", \"status\":\"1\" }");
                    return;
                }
                result = new BLL.Order().AddOrder(order, manager, out oid);
            }
            else
            {
                if (!bll.Exists(manager.role_id, "sys_order_add", "Edit"))
                {
                    context.Response.Write("{ \"msg\":\"您没有管理该页面的权限,请勿非法进入!\", \"status\":\"1\" }");
                    return;
                }
                oid    = oID;
                result = new BLL.Order().UpdateOrder(order, manager);
            }
            if (string.IsNullOrEmpty(result))
            {
                context.Response.Write("{ \"msg\":\"" + oid + "\", \"status\":\"0\" }");
                return;
            }
            context.Response.Write("{ \"msg\":\"" + result + "\", \"status\":\"1\" }");
            return;
        }
Exemplo n.º 23
0
        protected void reg()
        {
            type = DTRequest.GetFormInt("ctl00$ContentPlaceHolder1$type");
            bool result = true;

            Model.users model = new Model.users();
            BLL.users   bll   = new BLL.users();

            //model.is_lock = int.Parse(rblIsLock.SelectedValue);
            model.user_name = DTRequest.GetFormString("ctl00$ContentPlaceHolder1$txtusername");
            model.password  = DESEncrypt.Encrypt(DTRequest.GetFormString("ctl00$ContentPlaceHolder1$txtpassword"));
            model.email     = DTRequest.GetFormString("ctl00$ContentPlaceHolder1$txtemall");
            model.nick_name = DTRequest.GetFormString("ctl00$ContentPlaceHolder1$txtName");
            //if (fileUpImage.HasFile)
            //{
            //    string extendName = fileUpImage.FileName.Substring(fileUpImage.FileName.LastIndexOf('.'));
            //    string filename = DateTime.Now.ToString("yyyyMMddhhmmss") + extendName;
            //    if (!System.IO.Directory.Exists(Server.MapPath("upload/user/")))
            //    {
            //        System.IO.Directory.CreateDirectory(Server.MapPath("upload/user/"));
            //    }

            //    fileUpImage.SaveAs(Server.MapPath("upload/user/" + filename));
            //    model.avatar = filename;
            //}
            //model.sex = rblSex.SelectedValue;
            //DateTime _birthday;
            //if (DateTime.TryParse(txtBirthday.Text.Trim(), out _birthday))
            //{
            //    model.birthday = _birthday;
            //}
            model.mobile = DTRequest.GetFormString("ctl00$ContentPlaceHolder1$txtphone");
            //model.qq = "";
            model.address = DTRequest.GetFormString("ctl00$ContentPlaceHolder1$txtAddress");
            model.amount  = 0;
            model.point   = 0;
            switch (type)
            {
            case 1:
                model.amount = 0;
                break;

            case 2:
                model.amount = 100;
                break;

            case 3:
                model.amount = 200;
                break;

            case 4:
                model.amount = 300;
                break;
            }

            model.exp      = 0;
            model.reg_time = DateTime.Now;
            model.reg_ip   = DTRequest.GetIP();

            //if (ddlGroup.SelectedValue == "0")
            //{
            //    model.group_id = 1;
            //}
            //else
            //{
            model.group_id = Utils.StringToNum(DTRequest.GetFormString("ctl00$ContentPlaceHolder1$ddlGroup"));
            model.dianming = DTRequest.GetFormString("ctl00$ContentPlaceHolder1$txtIntroduce");
            //model.dianmiaoshu = dianmiaoshu.Value;
            //model.congye = congye.Value;
            model.gongsi   = DTRequest.GetFormString("ctl00$ContentPlaceHolder1$gongsi");
            model.fuwuquyu = DTRequest.GetFormString("ctl00$ContentPlaceHolder1$CompanyName");
            //model.fuwuquyu = fuwuquyu.Value;
            //model.shuxishequ = shuxishequ.Value;
            //model.fuwutechang = fuwutechang.Value;
            //model.jingli = jingli.Value;
            //model.zhengshu = zhengshu.Value;
            model.note    = DTRequest.GetFormString("ctl00$ContentPlaceHolder1$note");
            model.is_lock = 1;
            //}
            int bk = bll.Add(model);

            if (bk < 1)
            {
                this.Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('網路異常,請重試')</script>");
            }
            else
            {
                setEmail();
                Utils.WriteCookie("LoginUserID", bk.ToString());
                //ToFirstPay(bk);
                //this.Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('註冊成功,請登入');window.location.href='login.aspx'</script>");
            }
        }