private void InitCharge(int generalId, bool enableCharge) { ContentPermissionInfo contentPermissionInfoById = PermissionContent.GetContentPermissionInfoById(generalId); if (!contentPermissionInfoById.IsNull) { this.RadlInfoPurview.SelectedValue = contentPermissionInfoById.PermissionType.ToString(); if (!string.IsNullOrEmpty(contentPermissionInfoById.ArrGroupId)) { string[] strArray = contentPermissionInfoById.ArrGroupId.Split(new char[] { ',' }); for (int i = 0; i < strArray.Length; i++) { this.EChklUserGroupList.Items.FindByValue(strArray[i]).Selected = true; } } } if (enableCharge) { ContentChargeInfo contentChargeInfoById = EasyOne.Contents.ContentCharge.GetContentChargeInfoById(generalId); if (!contentChargeInfoById.IsNull) { this.TxtInfoPoint.Text = contentChargeInfoById.InfoPoint.ToString(); this.ShowChargeType.ChargeType = contentChargeInfoById.ChargeType; this.ShowChargeType.PitchTime = contentChargeInfoById.PitchTime; this.ShowChargeType.ReadTimes = contentChargeInfoById.ReadTimes; this.TxtDividePercent.Text = contentChargeInfoById.DividePercent.ToString(); } } }
private int AddPermissionAndCharge(DataTable dataTable, bool enableCharge) { int generalId = GetGeneralId(dataTable); ContentPermissionInfo contentPermissionInfo = new ContentPermissionInfo(); contentPermissionInfo.GeneralId = generalId; contentPermissionInfo.PermissionType = DataConverter.CLng(this.RadlInfoPurview.SelectedValue); contentPermissionInfo.ArrGroupId = this.EChklUserGroupList.SelectList(); int num2 = DataConverter.CLng(this.TxtInfoPoint.Text); PermissionContent.Delete(generalId); if (PermissionContent.Add(contentPermissionInfo)) { EasyOne.Contents.ContentCharge.Delete(generalId); if (enableCharge && (num2 > 0)) { ContentChargeInfo contentChargeInfo = new ContentChargeInfo(); contentChargeInfo.GeneralId = generalId; contentChargeInfo.InfoPoint = num2; contentChargeInfo.ChargeType = this.ShowChargeType.ChargeType; contentChargeInfo.PitchTime = this.ShowChargeType.PitchTime; contentChargeInfo.ReadTimes = this.ShowChargeType.ReadTimes; contentChargeInfo.DividePercent = DataConverter.CLng(this.TxtDividePercent.Text); EasyOne.Contents.ContentCharge.Add(contentChargeInfo); } } return(num2); }
public bool Update(ContentChargeInfo contentChargeInfo) { Parameters parms = new Parameters(); GetParameter(contentChargeInfo, parms); return(DBHelper.ExecuteSql("UPDATE PE_ContentCharge SET GeneralId = @GeneralId, ChargeType = @ChargeType, InfoPoint = @InfoPoint, PitchTime = @PitchTime, ReadTimes = @ReadTimes, DividePercent = @DividePercent WHERE GeneralId = @GeneralId", parms)); }
private void AddCharge(DataTable dataTable) { int generalId = DataConverter.CLng(dataTable.Select("FieldName = 'generalId'")[0]["FieldValue"].ToString()); NodeInfo cacheNodeById = EasyOne.Contents.Nodes.GetCacheNodeById(DataConverter.CLng(dataTable.Select("FieldName = 'nodeId'")[0]["FieldValue"].ToString())); ContentPermissionInfo contentPermissionInfo = new ContentPermissionInfo(); contentPermissionInfo.GeneralId = generalId; contentPermissionInfo.PermissionType = 0; PermissionContent.Delete(generalId); if (PermissionContent.Add(contentPermissionInfo)) { ContentCharge.Delete(generalId); if (cacheNodeById.Settings.DefaultItemPoint > 0) { ContentChargeInfo contentChargeInfo = new ContentChargeInfo(); contentChargeInfo.GeneralId = generalId; contentChargeInfo.InfoPoint = cacheNodeById.Settings.DefaultItemPoint; contentChargeInfo.ChargeType = cacheNodeById.Settings.DefaultItemChargeType; contentChargeInfo.PitchTime = cacheNodeById.Settings.DefaultItemPitchTime; contentChargeInfo.ReadTimes = cacheNodeById.Settings.DefaultItemReadTimes; contentChargeInfo.DividePercent = cacheNodeById.Settings.DefaultItemDividePercent; ContentCharge.Add(contentChargeInfo); } } }
public bool Add(ContentChargeInfo contentChargeInfo) { Parameters parms = new Parameters(); GetParameter(contentChargeInfo, parms); string strSql = "INSERT INTO PE_ContentCharge(GeneralId, ChargeType, InfoPoint, PitchTime, ReadTimes, DividePercent) VALUES (@GeneralId, @ChargeType, @InfoPoint, @PitchTime, @ReadTimes, @DividePercent)"; return(DBHelper.ExecuteSql(strSql, parms)); }
private static void GetParameter(ContentChargeInfo contentChargeInfo, Parameters parms) { parms.AddInParameter("@GeneralId", DbType.Int32, contentChargeInfo.GeneralId); parms.AddInParameter("@ChargeType", DbType.Int32, contentChargeInfo.ChargeType); parms.AddInParameter("@InfoPoint", DbType.Int32, contentChargeInfo.InfoPoint); parms.AddInParameter("@PitchTime", DbType.Int32, contentChargeInfo.PitchTime); parms.AddInParameter("@ReadTimes", DbType.Int32, contentChargeInfo.ReadTimes); parms.AddInParameter("@DividePercent", DbType.Int32, contentChargeInfo.DividePercent); }
private static ContentChargeInfo ContentChargeFromDataReader(NullableDataReader dr) { ContentChargeInfo info = new ContentChargeInfo(); info.GeneralId = dr.GetInt32("GeneralId"); info.ChargeType = dr.GetInt32("ChargeType"); info.InfoPoint = dr.GetInt32("InfoPoint"); info.PitchTime = dr.GetInt32("PitchTime"); info.ReadTimes = dr.GetInt32("ReadTimes"); info.DividePercent = dr.GetInt32("DividePercent"); return(info); }
public static bool BatchUpdate(ContentChargeInfo contentChargeInfo, string itemId, Dictionary <string, bool> checkItem, int batchType) { if (!DataValidator.IsValidId(itemId)) { return(false); } if (!checkItem.ContainsValue(true)) { return(false); } StringBuilder sb = new StringBuilder(); int generalId = 0; if (batchType == 1) { foreach (CommonModelInfo info in ContentManage.GetCommonModelInfoList(itemId)) { if (!dal.Exists(info.GeneralId)) { contentChargeInfo.GeneralId = info.GeneralId; dal.Add(contentChargeInfo); } else { StringHelper.AppendString(sb, info.GeneralId.ToString()); } } } else { foreach (string str in itemId.Split(new char[] { ',' })) { generalId = DataConverter.CLng(str); if (generalId != 0) { if (!dal.Exists(generalId)) { contentChargeInfo.GeneralId = generalId; dal.Add(contentChargeInfo); } else { StringHelper.AppendString(sb, str); } } } } if (sb.Length > 0) { return(dal.BatchUpdate(contentChargeInfo, sb.ToString(), checkItem)); } return(true); }
private void UpdateCharge(int batchType, StringBuilder itemId) { ContentChargeInfo contentChargeInfo = new ContentChargeInfo(); contentChargeInfo.InfoPoint = DataConverter.CLng(this.TxtInfoPoint.Text); contentChargeInfo.ChargeType = this.ShowChargeType.ChargeType; contentChargeInfo.PitchTime = this.ShowChargeType.PitchTime; contentChargeInfo.ReadTimes = this.ShowChargeType.ReadTimes; contentChargeInfo.DividePercent = DataConverter.CLng(this.TxtDividePercent.Text); if (!EasyOne.Contents.ContentCharge.BatchUpdate(contentChargeInfo, itemId.ToString(), this.GetCheckItem(), batchType)) { AdminPage.WriteErrMsg("批量设置内容收费失败!"); } }
public ChargeManage() { int generalId = DataConverter.CLng(HttpContext.Current.Request["id"]); this.m_UserInfo = PEContext.Current.User.UserInfo; this.m_CommonModelInfo = ContentManage.GetCommonModelInfoById(generalId); this.m_ModelInfo = ModelManager.GetModelInfoById(this.m_CommonModelInfo.ModelId); this.m_NodeInfo = Nodes.GetCacheNodeById(this.m_CommonModelInfo.NodeId); this.m_contentChargeInfo = ContentCharge.GetContentChargeInfoById(this.m_CommonModelInfo.GeneralId); this.m_UserTrueIP = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (string.IsNullOrEmpty(this.m_UserTrueIP)) { this.m_UserTrueIP = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"]; } this.m_UserTrueIP = DataSecurity.FilterBadChar(this.m_UserTrueIP); this.m_Pay = HttpContext.Current.Request["Pay"]; this.m_errMsg_NoLogin = this.m_errMsg_NoLogin.Replace("{$InstallDir}", SiteConfig.SiteInfo.VirtualPath); this.m_errMsg_NoLogin = this.m_errMsg_NoLogin.Replace("{$ItemName}", this.m_ModelInfo.ItemName); this.m_errMsg_NoLogin = this.m_errMsg_NoLogin.Replace("{$ReturnUrl}", DataSecurity.HtmlEncode(HttpContext.Current.Request.RawUrl).Replace("&", "%26")); this.m_errMsg_OutTime = this.m_errMsg_OutTime.Replace("{$ItemName}", this.m_ModelInfo.ItemName); this.m_errMsg_NeedPoint = this.m_errMsg_NeedPoint.Replace("{$ItemName}", this.m_ModelInfo.ItemName); this.m_errMsg_NeedPoint = this.m_errMsg_NeedPoint.Replace("{$InfoPoint}", this.m_contentChargeInfo.InfoPoint.ToString()); this.m_errMsg_NeedPoint = this.m_errMsg_NeedPoint.Replace("{$NeedPoint}", this.m_contentChargeInfo.InfoPoint.ToString()); this.m_errMsg_NeedPoint = this.m_errMsg_NeedPoint.Replace("{$NowPoint}", this.m_UserInfo.UserPoint.ToString()); this.m_errMsg_NeedPoint = this.m_errMsg_NeedPoint.Replace("{$PointName}", SiteConfig.UserConfig.PointName); this.m_errMsg_NeedPoint = this.m_errMsg_NeedPoint.Replace("{$PointUnit}", SiteConfig.UserConfig.PointUnit); this.m_errMsg_UsePoint = this.m_errMsg_UsePoint.Replace("{$ItemName}", this.m_ModelInfo.ItemName); this.m_errMsg_UsePoint = this.m_errMsg_UsePoint.Replace("{$InfoPoint}", this.m_contentChargeInfo.InfoPoint.ToString()); this.m_errMsg_UsePoint = this.m_errMsg_UsePoint.Replace("{$NowPoint}", this.m_UserInfo.UserPoint.ToString()); this.m_errMsg_UsePoint = this.m_errMsg_UsePoint.Replace("{$FinalPoint}", (this.m_UserInfo.UserPoint - this.m_contentChargeInfo.InfoPoint).ToString()); if (HttpContext.Current.Request.RawUrl.Contains("?")) { this.m_errMsg_UsePoint = this.m_errMsg_UsePoint.Replace("{$url}", HttpContext.Current.Request.RawUrl + "&Pay=yes"); } else { this.m_errMsg_UsePoint = this.m_errMsg_UsePoint.Replace("{$url}", HttpContext.Current.Request.RawUrl + "?Pay=yes"); } this.m_errMsg_UsePoint = this.m_errMsg_UsePoint.Replace("{$InstallDir}", SiteConfig.SiteInfo.VirtualPath); this.m_errMsg_UsePoint = this.m_errMsg_UsePoint.Replace("{$PointName}", SiteConfig.UserConfig.PointName); this.m_errMsg_UsePoint = this.m_errMsg_UsePoint.Replace("{$PointUnit}", SiteConfig.UserConfig.PointUnit); }
public bool BatchUpdate(ContentChargeInfo contentChargeInfo, string itemId, Dictionary <string, bool> checkItem) { StringBuilder builder = new StringBuilder(); Parameters cmdParams = new Parameters(); builder.Append("UPDATE PE_ContentCharge SET "); if (checkItem["InfoPoint"]) { builder.Append("InfoPoint = @InfoPoint,"); cmdParams.AddInParameter("@InfoPoint", DbType.Int32, contentChargeInfo.InfoPoint); } if (checkItem["ChargeType"]) { builder.Append("ChargeType = @ChargeType,"); cmdParams.AddInParameter("@ChargeType", DbType.Int32, contentChargeInfo.ChargeType); builder.Append("PitchTime = @PitchTime,"); cmdParams.AddInParameter("@PitchTime", DbType.Int32, contentChargeInfo.PitchTime); builder.Append("ReadTimes = @ReadTimes,"); cmdParams.AddInParameter("@ReadTimes", DbType.Int32, contentChargeInfo.ReadTimes); } if (checkItem["DividePercent"]) { builder.Append("DividePercent = @DividePercent,"); cmdParams.AddInParameter("@DividePercent", DbType.Int32, contentChargeInfo.DividePercent); } if (builder.Length <= 0x1c) { return(true); } builder.Remove(builder.Length - 1, 1); builder.Append(" WHERE "); builder.Append(" GeneralID IN ( "); builder.Append(DBHelper.ToValidId(itemId)); builder.Append(" )"); return(DBHelper.ExecuteSql(builder.ToString(), cmdParams)); }
public static bool Add(ContentChargeInfo contentChargeInfo) { return(dal.Add(contentChargeInfo)); }
public static bool Update(ContentChargeInfo contentChargeInfo) { return(dal.Update(contentChargeInfo)); }