Exemplo n.º 1
0
 public void Add(M_ViewLog model)
 {
     SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@UserId", model.UserId), new SqlParameter("@UserName", model.UserName), new SqlParameter("@ModelType", model.ModelType), new SqlParameter("@InfoId", model.InfoId), new SqlParameter("@AddTime", model.AddTime) };
     SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringKy, CommandType.StoredProcedure, "Up_ViewLog_Add", commandParameters);
 }
Exemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Cache.SetNoStore();
        if (!string.IsNullOrEmpty(Request.Form["tablename"]) && !string.IsNullOrEmpty(Request.Form["paramstr"]) && !string.IsNullOrEmpty(Request.Form["id"]) & !string.IsNullOrEmpty(Request.Form["pageindex"]) && !string.IsNullOrEmpty(Request.Form["pagecount"]))
        {
            try
            {
                TableName = Request.Form["tablename"];
                ParamStr = Request.Form["paramstr"];
                InfoId = int.Parse(Request.Form["id"]);
                PageIndex = int.Parse(Request.Form["pageindex"]);
                PageCount = int.Parse(Request.Form["pagecount"]);
            }
            catch { }
        }
        if (ParamStr.Length == 0 || InfoId == 0)
        {
            return;
        }
        DataRow dr = CreateBll.GetInfoById(TableName, InfoId);
        if (!UserBll.IsLogin())
        {
            HiddenContent = CreateBll.Info_Ajax(ParamStr, dr, PageIndex, PageCount,0);
            Response.Write(HiddenContent);
            return;
        }

        int pointCount = int.Parse(dr["pointcount"].ToString());
        M_User userLoginModel = UserBll.GetCookie();
        M_User userModel = UserBll.GetUser(userLoginModel.UserID);
        int userId = userModel.UserID;
        string userName = userModel.LogName;
        string userGroupId = userModel.GroupID.ToString();
        decimal goldNum = userModel.YellowBoy;
        DateTime userExpirtTime = userModel.ExpireTime;
        userLoginModel = null;
        M_UserGroup userGroupModel = UserGroupBll.GetModel(userModel.GroupID);
        string powerStr = userGroupModel.ColumnPower;
        int payType = (int)dr["chargetype"];
        string title = (string)dr["title"];
        int reduceType = int.Parse(UserGroupBll.Power_UserGroup("ChargingType", 0, powerStr));//重复计费方式
        int dayViewCount = int.Parse(UserGroupBll.Power_UserGroup("SmashMoney", 0, powerStr));//有效期每天最大浏览次数
        int chargeHourCount = (int)dr["chargehourcount"];
        int chargViewCount = (int)dr["chargeviewcount"];
        int modelId = (int)dr["modelid"];
        string msg = string.Empty;
        bool isPay = false;//是否付费

        isPay = userLogBll.CheckIsPay(payType, modelId, InfoId, userId, chargeHourCount, chargViewCount);

        if (!isPay)
        {

            HiddenContent = CreateBll.Info_Ajax(ParamStr, dr, PageIndex, PageCount, 1);
            Response.Write(HiddenContent);
            return;
        }
        else
        {
            HiddenContent = CreateBll.Info_Ajax(ParamStr, dr, PageIndex, PageCount, 2);
            if (PageIndex == 1)
            {
                M_ViewLog viewLogModel = new M_ViewLog();
                viewLogModel.UserId = userModel.UserID;
                viewLogModel.UserName = userModel.LogName;
                viewLogModel.ModelType = modelId;
                viewLogModel.InfoId = InfoId;
                viewLogModel.AddTime = DateTime.Now;
                viewLogBll.Add(viewLogModel);
            }
            Response.Write(HiddenContent);
            return;

        }
    }
Exemplo n.º 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        DownLoadBll.ClearDownCount();
        if (!string.IsNullOrEmpty(Request.QueryString["SId"]))
        {
            try
            {
                SId = int.Parse(Request.QueryString["SId"]);
            }
            catch { }
        }
        if (!string.IsNullOrEmpty(Request.QueryString["AId"]))
        {
            try
            {
                AId = int.Parse(Request.QueryString["AId"]);
            }
            catch { }
        }

        DataRow adr = DownAddressBll.GetAddressPath(AId,SId);
        if (adr == null)
        {
            Function.ShowMsg(0,"<li>访问的内容不存在或已经被删除</li>");
        }
        int Id = (int)adr["downloaddataid"];
        DataRow dr = CreateBll.GetInfoById("kydownloaddata", Id);
        if (dr == null)
        {
            Function.ShowMsg(0,"<li>访问的内容不存在或已经被删除</li>");
            return;
        }
        bool server_isOpened = adr["isopened"].ToString() == string.Empty ||(bool)adr["isopened"]?true:false;
        if (!server_isOpened)
        {
            Function.ShowMsg(0,"<li>所属服务器已经被管理员禁用</li>");
            return;
        }
        InfoModel = InfoModelBll.GetModel(3);
        if (InfoModel == null)
        {
            Function.ShowMsg(0,"<li>所属内容模型不存在或已经被删除</li>");
            return;
        }

        CheckUrl();
        int chId = (int)dr["chid"];
        int colId = (int)dr["colid"];
        string title = (string)dr["title"];
        int pointCount = (int)dr["pointcount"];
        int payType = (int)dr["chargetype"];
        int isOpened = (int)dr["isopened"];
        string groupIdStr = (string)dr["groupidstr"];
        bool colIsOpened = (bool)dr["colisopened"];
        int chargeHourCount = (int)dr["chargehourcount"];
        int chargViewCount = (int)dr["chargeviewcount"];
        if (pointCount > 0 || isOpened == 0 || (isOpened == 2 && !colIsOpened))
        {
            M_User userLoginModel = UserBll.GetCookie();
            M_User userModel = UserBll.GetUser(userLoginModel.UserID);
            int userId = userModel.UserID;
            string userName = userModel.LogName;
            string userGroupId = userModel.GroupID.ToString();
            decimal goldNum = userModel.YellowBoy;
            DateTime userExpirtTime = userModel.ExpireTime;
            userLoginModel = null;
            M_UserGroup userGroupModel = UserGroupBll.GetModel(userModel.GroupID);
            string powerStr = userGroupModel.ColumnPower;
            #region 继承栏目认证
            if (isOpened == 2 && !colIsOpened)
            {
                bool isAccess = UserGroupBll.Power_ColumnPower(chId, colId, powerStr, 1);
                if (!isAccess)
                {
                    Function.ShowMsg(0,"<li>您所在的用户组无法访问该内容,请联系系统管理员</li>");
                }
            }
            #endregion

            #region 内容认证
            if (isOpened == 0 && groupIdStr.IndexOf("|" + userGroupId + "|") == -1)
            {
                Function.ShowMsg(0,"<li>您所在的用户组无法访问该内容,请联系系统管理员</li>");
            }
            #endregion

            #region 收费
            if (pointCount > 0)
            {
                int reduceType = int.Parse(UserGroupBll.Power_UserGroup("ChargingType", 0, powerStr));//重复计费方式
                int dayViewCount = int.Parse(UserGroupBll.Power_UserGroup("SmashMoney", 0, powerStr));//有效期每天最大浏览次数
                string msg = string.Empty;
                bool isPay = false;//是否付费
                isPay = userLogBll.CheckIsPay(payType, ModelId, Id, userId, chargeHourCount, chargViewCount);
                if (!isPay)
                {
                    bool flag = userLogBll.CheckReducePointCondition(reduceType, userId, goldNum, pointCount, userExpirtTime, dayViewCount, ref msg);
                    if (!flag)//不满足扣费条件
                    {
                        Function.ShowMsg(0,"<li>" + msg + "</li>");
                    }
                    else
                    {
                        //flag = userLogBll.ReducePoint(reduceType,pointCount,ModelId,Id,title,userId,userExpirtTime);
                        flag = userLogBll.ReducePoint(reduceType, pointCount, ModelId, Id, title, userId, userExpirtTime, userName, dayViewCount);
                        if (!flag)
                        {
                            Function.ShowMsg(0,"<li>扣费失败</li>");
                        }
                    }
                }
                M_ViewLog viewLogModel = new M_ViewLog();
                viewLogModel.UserId = userModel.UserID;
                viewLogModel.UserName = userModel.LogName;
                viewLogModel.ModelType = 1;
                viewLogModel.InfoId = Id;
                viewLogModel.AddTime = DateTime.Now;
                viewLogBll.Add(viewLogModel);
            }
            #endregion
            DownLoadBll.SetDownCount(Id);
            Response.Redirect(GetUrl(adr));
        }
        else
        {
            DownLoadBll.SetDownCount(Id);
            Response.Redirect(GetUrl(adr));
        }
    }
Exemplo n.º 4
0
 public void Add(M_ViewLog model)
 {
     this.dal.Add(model);
 }