Пример #1
0
        //批量删除
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("user_point_log", DTEnums.ActionEnum.Delete.ToString()); //检查权限
            int sucCount   = 0;
            int errorCount = 0;

            BLL.user_point_log bll = new BLL.user_point_log();
            for (int i = 0; i < rptList.Items.Count; i++)
            {
                int      id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
                CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
                if (cb.Checked)
                {
                    if (bll.Delete(id))
                    {
                        sucCount += 1;
                    }
                    else
                    {
                        errorCount += 1;
                    }
                }
            }
            AddAdminLog(DTEnums.ActionEnum.Delete.ToString(), "删除积分日志成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志
            JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("point_log.aspx", "keywords={0}", this.keywords));
        }
Пример #2
0
 //批量删除
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     ChkAdminLevel("user_point_log", DTEnums.ActionEnum.Delete.ToString()); //检查权限
     int sucCount = 0;
     int errorCount = 0;
     BLL.user_point_log bll = new BLL.user_point_log();
     for (int i = 0; i < rptList.Items.Count; i++)
     {
         int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
         CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
         if (cb.Checked)
         {
             if (bll.Delete(id))
             {
                 sucCount += 1;
             }
             else
             {
                 errorCount += 1;
             }
         }
     }
     AddAdminLog(DTEnums.ActionEnum.Delete.ToString(), "删除积分日专成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志
     JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("point_log.aspx", "keywords={0}", this.keywords), "Success");
 }
Пример #3
0
        /// <summary>
        /// 获取退款状态
        /// </summary>
        /// <returns></returns>
        protected string GetrefundStatus(int id)
        {
            string title = "";

            Model.user_point_log model = new BLL.user_point_log().GetModel(id);
            if (model != null)
            {
                switch (model.order_status)
                {
                case 1:
                    title = "申请退款";
                    break;

                case 2:
                    title = "同意退款";
                    break;

                case 3:
                    title = "驳回退款";
                    break;

                default:
                    break;
                }
            }
            return(title);
        }
Пример #4
0
 /// <summary>
 /// 获取订单总金额
 /// </summary>
 /// <param name="total_amount"></param>
 protected void getTotalAmount()
 {
     refund_amount = 0M;
     if (this.keyDate == "")
     {
         BLL.user_point_log bll = new BLL.user_point_log();
         DataTable          dt  = bll.GetList(0, " pointtype=3", " add_time desc,id desc").Tables[0];
         foreach (DataRow row in dt.Rows)
         {
             if (int.Parse(row["order_status"].ToString()) == 2) //统计退款
             {
                 refund_amount += decimal.Parse(row["amount"].ToString());
             }
         }
     }
     else
     {
         BLL.user_point_log bll = new BLL.user_point_log();
         DataTable          dt  = bll.GetList(0, " pointtype=3 and datediff(dd,add_time,'" + this.keyDate + "')=0", " add_time desc,id desc").Tables[0];
         foreach (DataRow row in dt.Rows)
         {
             if (int.Parse(row["order_status"].ToString()) == 2)
             {
                 refund_amount += decimal.Parse(row["amount"].ToString());
             }
         }
     }
 }
Пример #5
0
        private void RptBind(string _strWhere, string _orderby)
        {
            this.page = MXRequest.GetQueryInt("page", 1);
            txtKeywords.Text = this.keywords;
            BLL.user_point_log bll = new BLL.user_point_log();
            this.rptList.DataSource = bll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount);
            this.rptList.DataBind();

            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("point_log.aspx", "keywords={0}&page={1}", this.keywords, "__id__");
            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
Пример #6
0
        private void RptBind(string _strWhere, string _orderby)
        {
            this.page        = DTRequest.GetQueryInt("page", 1);
            txtKeywords.Text = this.keywords;
            BLL.user_point_log bll = new BLL.user_point_log();
            this.rptList.DataSource = bll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount);
            this.rptList.DataBind();

            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("point_log.aspx", "keywords={0}&page={1}", this.keywords, "__id__");

            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
Пример #7
0
        private void RptBind(string _strWhere, string _orderby)
        {
            this.page      = Vincent._DTcms.DTRequest.GetQueryInt("page", 1);
            ipt_Time.Value = this.keyDate;

            BLL.user_point_log bll = new BLL.user_point_log();
            this.rptList.DataSource = bll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount);
            this.rptList.DataBind();

            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Vincent._DTcms.Utils.CombUrlTxt("refund.aspx", "keywords={0}&keyDate={1}&page={2}", this.keywords, this.keyDate, "__id__");

            PageContent.InnerHtml = Vincent._DTcms.Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 15);
        }
Пример #8
0
 public void ProcessRequest(HttpContext context)
 {
     string sitepath = DTRequest.GetQueryString("site");
     int id = DTRequest.GetQueryInt("id");
     if (string.IsNullOrEmpty(sitepath))
     {
         context.Response.Write("出错了,站点传输参数不正确!");
         return;
     }
     //获得下载ID
     if (id < 1)
     {
         context.Response.Redirect(new Web.UI.BasePage().getlink(sitepath,
             new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("出错了,文件参数传值不正确!"))));
         return;
     }
     //检查下载记录是否存在
     BLL.article_attach bll = new BLL.article_attach();
     if (!bll.Exists(id))
     {
         context.Response.Redirect(new Web.UI.BasePage().getlink(sitepath,
             new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("出错了,您要下载的文件不存在或已经被删除!"))));
         return;
     }
     Model.article_attach model = bll.GetModel(id);
     //检查积分是否足够
     if (model.point > 0)
     {
         //检查用户是否登录
         Model.users userModel = new Web.UI.BasePage().GetUserInfo();
         if (userModel == null)
         {
             //自动跳转URL
             HttpContext.Current.Response.Redirect(new Web.UI.BasePage().getlink(sitepath, new Web.UI.BasePage().linkurl("login")));
         }
         //如果该用户未曾下载过该附件
         if (!bll.ExistsLog(model.id, userModel.id))
         {
             //检查积分
             if (model.point > userModel.point)
             {
                 context.Response.Redirect(new Web.UI.BasePage().getlink(sitepath,
                     new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,您的积分不足支付本次下载!"))));
                 return;
             }
             //扣取积分
             int result = new BLL.user_point_log().Add(userModel.id, userModel.user_name, model.point * -1, "下载附件:“" + model.file_name + "”,扣减积分", false);
             //添加下载记录
             if (result > 0)
             {
                 bll.AddLog(userModel.id, userModel.user_name, model.id, model.file_name);
             }
         }
     }
     //下载次数+1
     bll.UpdateField(id, "down_num=down_num+1");
     //检查文件本地还是远程
     if (model.file_path.ToLower().StartsWith("http://"))
     {
         context.Response.Redirect(model.file_path);
         return;
     }
     else
     {
         //取得文件物理路径
         string fullFileName = Utils.GetMapPath(model.file_path);
         if (!File.Exists(fullFileName))
         {
             context.Response.Redirect(new Web.UI.BasePage().getlink(sitepath,
                 new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("出错了,您要下载的文件不存在或已经被删除!"))));
             return;
         }
         FileInfo file = new FileInfo(fullFileName);//路径
         context.Response.ContentEncoding = System.Text.Encoding.GetEncoding("UTF-8"); //解决中文乱码
         context.Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(model.file_name)); //解决中文文件名乱码
         context.Response.AddHeader("Content-length", file.Length.ToString());
         context.Response.ContentType = "application/pdf";
         context.Response.WriteFile(file.FullName);
         context.Response.End();
     }
 }
Пример #9
0
        private void user_point_convert(HttpContext context)
        {
            //检查系统是否启用兑换积分功能
            if (userConfig.pointcashrate == 0)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,网站未开启兑换积分功能!\"}");
                return;
            }
            //检查用户是否登录
            Model.users model = new BasePage().GetUserInfo();
            if (model == null)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,用户尚未登录或已超时!\"}");
                return;
            }
            int amout = DTRequest.GetFormInt("txtAmount");
            string password = DTRequest.GetFormString("txtPassword");
            if (model.amount < 1)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,您账户上的余额不足!\"}");
                return;
            }
            if (amout < 1)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,最小兑换金额为1元!\"}");
                return;
            }
            if (amout > model.amount)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,您兑换的金额大于账户余额!\"}");
                return;
            }
            if (password == "")
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,请输入您账户的密码!\"}");
                return;
            }
            //验证密码
            if (DESEncrypt.Encrypt(password, model.salt) != model.password)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,您输入的密码不正确!\"}");
                return;
            }
            //计算兑换后的积分值
            int convertPoint = (int)(Convert.ToDecimal(amout) * userConfig.pointcashrate);
            //扣除金额
            int amountNewId = new BLL.user_amount_log().Add(model.id, model.user_name, amout * -1, "用户兑换积分");
            //增加积分
            if (amountNewId < 1)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"转换过程中发生错误,请重新提交!\"}");
                return;
            }
            int pointNewId = new BLL.user_point_log().Add(model.id, model.user_name, convertPoint, "用户兑换积分", true);
            if (pointNewId < 1)
            {
                //返还金额
                new BLL.user_amount_log().Add(model.id, model.user_name, amout, "用户兑换积分失败,返还金额");
                context.Response.Write("{\"status\":0, \"msg\":\"转换过程中发生错误,请重新提交!\"}");
                return;
            }

            context.Response.Write("{\"status\":1, \"msg\":\"恭喜您,积分兑换成功!\"}");
            return;
        }
Пример #10
0
        Model.sysconfig sysConfig = new BLL.sysconfig().loadConfig(); //系统配置
        public void ProcessRequest(HttpContext context)
        {
            string sitepath = DTRequest.GetQueryString("site");
            int    id       = DTRequest.GetQueryInt("id");

            if (string.IsNullOrEmpty(sitepath))
            {
                context.Response.Write("出错了,站点传输参数不正确!");
                return;
            }
            //获得下载ID
            if (id == 0)
            {
                context.Response.Redirect(new Web.UI.BasePage().getlink(sitepath,
                                                                        new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("出错了,文件参数传值不正确!"))));
                return;
            }
            //检查下载记录是否存在
            BLL.article_attach bll = new BLL.article_attach();
            if (!bll.Exists(id))
            {
                context.Response.Redirect(new Web.UI.BasePage().getlink(sitepath,
                                                                        new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("出错了,您要下载的文件不存在或已经被删除!"))));
                return;
            }
            Model.article_attach model = bll.GetModel(id);
            //检查积分是否足够
            if (model.point > 0)
            {
                //检查用户是否登录
                Model.users userModel = new Web.UI.BasePage().GetUserInfo();
                if (userModel == null)
                {
                    //自动跳转URL
                    HttpContext.Current.Response.Redirect(new Web.UI.BasePage().getlink(sitepath, new Web.UI.BasePage().linkurl("login")));
                }
                //如果该用户未曾下载过该附件
                if (!bll.ExistsLog(model.id, userModel.id))
                {
                    //检查积分
                    if (model.point > userModel.point)
                    {
                        context.Response.Redirect(new Web.UI.BasePage().getlink(sitepath,
                                                                                new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,您的积分不足支付本次下载!"))));
                        return;
                    }
                    //扣取积分
                    int result = new BLL.user_point_log().Add(userModel.id, userModel.user_name, model.point * -1, "下载附件:“" + model.file_name + "”,扣减积分", false);
                    //添加下载记录
                    if (result > 0)
                    {
                        bll.AddLog(userModel.id, userModel.user_name, model.id, model.file_name);
                    }
                }
            }
            //下载次数+1
            bll.UpdateField(id, "down_num=down_num+1");
            //检查文件本地还是远程
            if (model.file_path.ToLower().StartsWith("http://") || model.file_path.ToLower().StartsWith("https://"))
            {
                var request = System.Net.HttpWebRequest.Create(model.file_path) as System.Net.HttpWebRequest;
                using (var response = request.GetResponse() as System.Net.HttpWebResponse)
                {
                    if (response.StatusCode != System.Net.HttpStatusCode.OK)
                    {
                        context.Response.Redirect(new Web.UI.BasePage().getlink(sitepath,
                                                                                new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("出错了,您要下载的文件不存在或已经被删除!"))));
                        return;
                    }
                    byte[] byteData = FileHelper.ConvertStreamToByteBuffer(response.GetResponseStream());
                    context.Response.ContentEncoding = System.Text.Encoding.GetEncoding("UTF-8");                                        //解决中文乱码
                    context.Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(model.file_name)); //解决中文文件名乱码
                    context.Response.AddHeader("Content-length", byteData.Length.ToString());
                    context.Response.ContentType = "application/octet-stream";
                    context.Response.BinaryWrite(byteData);
                    context.Response.Flush();
                    context.Response.End();
                }
                return;
            }
            else
            {
                //取得文件物理路径
                string fullFileName = Utils.GetMapPath(model.file_path);
                if (!File.Exists(fullFileName))
                {
                    context.Response.Redirect(new Web.UI.BasePage().getlink(sitepath,
                                                                            new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("出错了,您要下载的文件不存在或已经被删除!"))));
                    return;
                }
                FileInfo file = new FileInfo(fullFileName);                                                                          //路径
                context.Response.ContentEncoding = System.Text.Encoding.GetEncoding("UTF-8");                                        //解决中文乱码
                context.Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(model.file_name)); //解决中文文件名乱码
                context.Response.AddHeader("Content-length", file.Length.ToString());
                context.Response.ContentType = "application/octet-stream";
                context.Response.WriteFile(file.FullName);
                context.Response.End();
            }
        }