public bool HasPower(string JobId) { StringBuilder s = new StringBuilder(); BLL.UserBLL bll = new UserBLL(); if (bll.IsAdministrator()) { return(true); } else { string UserId = CkUserLv(); if (JobId.Trim() == "") { return(true); } s.Append(" select top 1 CreateUser from dbo.JobView where JobId='" + JobId + "' "); string CreateUser = DAL.DalComm.ExStr(s.ToString()); if (CreateUser == UserId) { return(true); } else { return(false); } } }
private void SaveJob() { BLL.UserBLL userbll = new BLL.UserBLL(); BLL.JobBLL bll = new BLL.JobBLL(); JobModel model = new JobModel(); model.JobId = ReStr("JobId", ""); if (userbll.HasPower(model.JobId)) { //如果没有权限发布 } else { ReTrue(); } if (model.JobId.Trim() != "") { //修改 model = bll.GetJobModel(model.JobId); if (model.CreateUser == Common.CookieSings.GetCurrentUserId()) { } else { if (!userbll.IsAdministrator()) { throw new Exception("您没有权限执行此操作!"); } } } else { model.RecommendLv = ReInt("RecommendLv", 0); } model.HumNum = ReInt("HumNum"); model.ContactEmail = ReStr("ContactEmail"); model.ContactName = ReStr("ContactName"); model.ContactPhone = ReStr("ContactPhone", ""); model.ContactQQ = ReStr("ContactQQ", ""); model.ContactTell = ReStr("ContactTell", ""); model.HumNum = ReInt("HumNum", 0); model.IsTop = ReBool("IsTop", false); model.JobMemo = ReStr("JobMemo"); model.JobPayId = ReInt("JobPayId"); model.JobtTitle = ReStr("JobtTitle"); model.JobTypeId = ReInt("JobTypeId"); model.MerchantId = ReDecimal("MerchantId", 0); model.SchoolExpId = ReInt("SchoolExpId"); model.Sex = ReStr("Sex"); model.WorkYearId = ReInt("WorkYearId"); model.JobLat = ReDecimal("JobLat", 0); model.JobLng = ReDecimal("JobLng", 0); model.TownId = ReDecimal("TownId"); bll.SaveJob(model); ReDict2.Add("JobId", model.JobId); ReTrue(); }
/// <summary> /// 保存一条分类信息 /// </summary> /// <param name="model"></param> public void SaveInformation(Model.InformationModel model) { DAL.InformationDAL dal = new DAL.InformationDAL(); if (model.InformationId <= 0) { //如果是新发布的话,那就用当前用户作为创建人. model.CreateUserId = Common.CookieSings.GetCurrentUserId(); model.CreateTime = DateTime.Now; dal.Add(model); } else { if (model.CreateUserId == Common.CookieSings.GetCurrentUserId()) { } else { BLL.UserBLL bll = new UserBLL(); if (!bll.IsAdministrator()) { throw new Exception("您不具备修改此条信息的权限!"); } } //如果是修改,无需修改创建人 model.CreateTime = DateTime.Now; dal.Update(model); } }
public bool HasTieZiPower(decimal TieZiId) { BLL.UserBLL ubll = new UserBLL(); if (ubll.IsAdministrator()) { return(true); } else { StringBuilder s = new StringBuilder(); string uid = ubll.CkUserLv();//如果被禁言则不能发表言论 if (TieZiId == 0) { return(true); } s.Append(" SELECT * FROM BBS.dbo.FormsVsUser WHERE UserId='" + uid + "' AND FormId= "); s.Append(" (SELECT TOP 1 FormId FROM BBS.dbo.TieZi WHERE TieZiId='" + TieZiId + "') "); DataSet ds = DAL.DalComm.BackData(s.ToString()); if (ds.Tables[0].Rows.Count > 0) { return(true); } else {//如果也不是版主 s.Clear(); s.Append("SELECT TOP 1 FormId FROM BBS.dbo.TieZi WHERE CreateUser='******'"); ds = DAL.DalComm.BackData(s.ToString()); if (ds.Tables[0].Rows.Count > 0) { //如果是我的帖子 return(true); } else { //如果不是管理员,不是版主, 也不是我的帖子, 那么就不行了 return(false); } } //是否版主 return(false); } }
/// <summary> /// 是否有权限修改这条新闻 /// </summary> /// <param name="MerId"></param> /// <returns></returns> public bool HasPower(decimal MerId) { BLL.UserBLL bll = new UserBLL(); if (bll.IsAdministrator()) { return(true); } string cuserId = bll.CurrentUserId(); int i = DAL.DalComm.ExInt(" select count(0) from dbo.UserMerRoleView where MerId='" + MerId + "' and UserId='" + cuserId + "' "); if (i > 0) { return(true); } else { return(false); } }