protected void GetValue(object sender, EventArgs e) { PermissionIndex = 0; int CalendarId =Int32.Parse(dpOtherCalendar.SelectedValue); int PermissionUserID = Int32.Parse(Context.Session["UserID"].ToString()); if (PermissionUserID == 0) PermissionIndex = 3; //可创建事件 CalendarPermission _CalendarPermission = new CalendarPermission(); _CalendarPermission = DbHelper.GetInstance().GetCalendarPermissionEntityByID(CalendarId, PermissionUserID); if (_CalendarPermission != null) { string Permission = _CalendarPermission.CalendarPer; if (Permission == "无权限") PermissionIndex = 0; else if (Permission == "可读事件") PermissionIndex = 1; else if (Permission == "可删除修改事件") PermissionIndex = 2; else if (Permission == "可创建事件") PermissionIndex = 3; } string strScript = "<script type=\"text/javascript\" lanuage=\"javascript\"> \r\n" + "find('" + PermissionIndex + "'); \r\n" + "</script> \r\n"; System.Web.UI.ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "strScript", strScript, false); }
/// <summary> /// Update the navigation property calendarPermissions in users /// <param name="body"></param> /// <param name="requestConfiguration">Configuration for the request such as headers, query parameters, and middleware options.</param> /// </summary> public RequestInformation CreatePatchRequestInformation(CalendarPermission body, Action<CalendarPermissionItemRequestBuilderPatchRequestConfiguration> requestConfiguration = default) { _ = body ?? throw new ArgumentNullException(nameof(body)); var requestInfo = new RequestInformation { HttpMethod = Method.PATCH, UrlTemplate = UrlTemplate, PathParameters = PathParameters, }; requestInfo.SetContentFromParsable(RequestAdapter, "application/json", body); if (requestConfiguration != null) { var requestConfig = new CalendarPermissionItemRequestBuilderPatchRequestConfiguration(); requestConfiguration.Invoke(requestConfig); requestInfo.AddRequestOptions(requestConfig.Options); requestInfo.AddHeaders(requestConfig.Headers); } return requestInfo; }
private CalendarPermission GetCalendarPermissionFromIDataReader(DbDataReader dr) { CalendarPermission dt = new CalendarPermission(); if (dr.FieldCount > 0) { dt.CalendarID = Int32.Parse(dr["CalendarID"].ToString()); dt.CalendarPer = dr["CalendarPermission"].ToString(); dt.CalendarPermissionSerialID = Int32.Parse(dr["CalendarPermissionSerialID"].ToString()); dt.CalendarPermissionUserID = Int32.Parse(dr["CalendarPermissionUserID"].ToString()); return dt; } dr.Close(); return null; }
public string AddNewsCalenderPermission(CalendarPermission _CalendarEventPermission) { DbParameter[] pramsInsert = { MakeInParam("@CalendarID",(DbType)SqlDbType.Int,4,_CalendarEventPermission.CalendarID), MakeInParam("@CalendarPermission",(DbType)SqlDbType.VarChar,50,_CalendarEventPermission.CalendarPer), MakeInParam("@CalendarPermissionUserID",(DbType)SqlDbType.Int,4,_CalendarEventPermission.CalendarPermissionUserID), }; StringBuilder sb = new StringBuilder(); sb.Append("INSERT INTO [dbo].[CalendarPermission]"); sb.Append("([CalendarID]"); sb.Append(",[CalendarPermission]"); sb.Append(",[CalendarPermissionUserID]"); sb.Append(")"); sb.Append("VALUES"); sb.Append("(@CalendarID"); sb.Append(",@CalendarPermission"); sb.Append(",@CalendarPermissionUserID"); sb.Append(")"); sb.Append(" select @@identity;"); return ExecuteScalar(CommandType.Text, sb.ToString(), pramsInsert).ToString(); }
public string UpDateCalendarPermission(CalendarPermission _CalendarEventPermission) { DbParameter[] pramsUpDate = { MakeInParam("@CalendarID",(DbType)SqlDbType.Int,4,_CalendarEventPermission.CalendarID), MakeInParam("@CalendarPermission",(DbType)SqlDbType.VarChar,50,_CalendarEventPermission.CalendarPer), MakeInParam("@CalendarPermissionUserID",(DbType)SqlDbType.Int,4,_CalendarEventPermission.CalendarPermissionUserID), }; StringBuilder sb = new StringBuilder(); sb.Append("UpDate [dbo].[CalendarPermission]"); sb.Append(" set "); sb.Append(" [CalendarID]=@CalendarID,"); sb.Append(" [CalendarPermission]=@CalendarPermission,"); sb.Append(" [CalendarPermissionUserID]=@CalendarPermissionUserID"); sb.Append(" where [CalendarPermissionUserID]=@CalendarPermissionUserID and [CalendarID]=@CalendarID"); sb.Append(" select @@identity "); return ExecuteScalar(CommandType.Text, sb.ToString(), pramsUpDate).ToString(); }
protected void Share_Button(object sender, EventArgs e) { string szAllName; szAllName = txtSendTo.Text; int iCount = 0; string[] szOneAllName = szAllName.Split(';'); int CalendarID=0, PermissionUserID=0; foreach (string szOneName in szOneAllName) { if (szOneName != "") { string[] szName = szOneName.Split('('); CalendarPermission _CalendarPermission = new CalendarPermission(); foreach (string szUserName in szName) { iCount++; if (iCount == 1) { _CalendarPermission = new CalendarPermission(); UserListEntity _UserListEntity = new UserListEntity(); _UserListEntity = DbHelper.GetInstance().GetUserListEntityByUserID(szUserName); if (_UserListEntity != null) { _CalendarPermission.CalendarPermissionUserID = _UserListEntity.UserSerialID; //共享人员ID PermissionUserID = _UserListEntity.UserSerialID; } else _CalendarPermission.CalendarID = 0; _CalendarPermission.CalendarID = Int32.Parse(Context.Session["UserID"].ToString()); CalendarID = Int32.Parse(Context.Session["UserID"].ToString()); } else { string[] szPermission = szUserName.Split(')'); int iPerCount = 0; foreach (string szPermissionName in szPermission) { iPerCount++; if (iPerCount == 1) { _CalendarPermission.CalendarPer = szPermissionName; //权限 CalendarPermission _Calendar = DbHelper.GetInstance().GetCalendarPermissionEntityByID(CalendarID, PermissionUserID); if (_Calendar == null) { string szIndex = DbHelper.GetInstance().AddNewsCalenderPermission(_CalendarPermission); //添加 } else { string szIndex = DbHelper.GetInstance().UpDateCalendarPermission(_CalendarPermission); //更新 } } else iPerCount = 0; } iCount = 0; } } } } }