/// <summary> /// Imposta uno o più parametri per una conferenza. /// </summary> /// <param name="BasePath">Il percorso base</param> /// <param name="MainUserId">ID utente che può creare stanze</param> /// <param name="MainPwd">PWD (MD5) dell'user che può creare stanze</param> /// <param name="MasterKey">Chiave Master della stanza</param> /// <param name="Parameters">Lista chiave valore dei parametri</param> /// <returns></returns> /// <remarks> /// Viene controllata SOLAMENTE l'esistenza della chiave. /// I valori dei relativi formati NON vengono controllati! /// </remarks> public static List <string> SetParameters( String BasePath, String MainUserId, String MainPwd, String MasterKey, eWRoomParameters Parameters, int MaxUrlChars, Boolean IsForCreation, string Version ) { List <string> OutStrs = new List <string>(); String PrimaryUrl = BasePath + "manager.php?" + "method=SetParameters" + "&login="******"&password="******"&masterkey=" + MasterKey; int PrimaryUrlChars = PrimaryUrl.Length; String CurrentUrl = PrimaryUrl; bool IsFirst = true; foreach (string str in eWRoomParameterToUrls(Parameters, IsForCreation, Version)) { if (IsFirst) { CurrentUrl += str; IsFirst = false; } else { if (PrimaryUrlChars + str.Length <= MaxUrlChars) { CurrentUrl += str; } else { OutStrs.Add(CurrentUrl); CurrentUrl = PrimaryUrl + str; } } } OutStrs.Add(CurrentUrl); return(OutStrs); }
/// <summary> /// Modifica una stanza /// </summary> /// <param name="User">L'utente per cui creare la stanza</param> /// <returns>true = updated</returns> /// <remarks> /// SE viene impostata data di inizio e fine, viene ricalcolata la Duration /// SE viene impostata data di inizio e durata, ma non la data di fine, viene calcolata la data di fine /// </remarks> public override Boolean RoomUpdate(WbRoom Room) { if (Room == null) { throw new ArgumentNullException("Room", "Cannot be null."); } if (Room.Parameter.GetType() != typeof(eWRoomParameters)) { throw new ArgumentException("Room paramter must be eWRoomParameters", "Room.Parameter"); } eWRoomParameters param = new eWRoomParameters(); try { param = (eWRoomParameters)Room.Parameter; } catch { param = null; } if (param != null) { Room.Recording = param.recording; WbRoom OldRoom = DAL.RoomUpdate(Room); try { eWAPIConnector.SetParameters( this.eWSysParameter.BaseUrl, this.eWSysParameter.ProxyUrl, this.eWSysParameter.MainUserId, this.eWSysParameter.MainUserPwd, OldRoom.ExternalId, param, this.eWSysParameter.MaxUrlChars, false, this.eWSysParameter.Version); } catch (Exception ex) { OldRoom.Id = -2; } if (OldRoom.Id > 0) { return(true); } } return(false); }
public override void RoomRecordingUpdate() { IList <WbRoom> Rooms = DAL.RoomsGetAll(); foreach (WbRoom Room in Rooms) { eWRoomParameters Parameters = new eWRoomParameters(); try { Parameters = eWAPIConnector.GetRoomParameters( this.eWSysParameter.BaseUrl, this.eWSysParameter.ProxyUrl, this.eWSysParameter.MainUserId, this.eWSysParameter.MainUserPwd, Room.ExternalId); Room.Recording = Parameters.recording; DAL.RoomUpdate(Room); } catch { //Room.Deleted = BaseStatusDeleted.Automatic; // <-- CONTROLLARE RECUPERO DATI DAL DAL! } //if (Parameters == null) //{ // Room.Deleted = BaseStatusDeleted.Automatic; //} //if (Room.Deleted == BaseStatusDeleted.None) //{ // //} } }
/// <summary> /// Aggiorna i dati di una stanza /// </summary> /// <param name="RoomId">ID stanza</param> /// <param name="Data">Dati stanza (generici)</param> /// <param name="Parameters">Parametri stanza (dati avanzati, basati su integrazione)</param> /// <returns>La stanza con i dati aggiornati</returns> public override WbRoom RoomUpdateData( long RoomId, Domain.DTO.DTO_GenericRoomData Data, WbRoomParameter Parameters, bool HasIdInName) { //this.eWSysParameter. if (HasIdInName) { Data.Name = string.Format("({0}) {1}", RoomId.ToString(), Data.Name); } Data.HasIdInName = HasIdInName; String ExternalId = DAL.RoomGetExternaId(RoomId); WbRoom UpdatedRoom = new WbRoom(); if (Parameters == null) { WbRoom OldRoom = this.RoomGet(RoomId); if (OldRoom.Parameter != null) { Parameters = OldRoom.Parameter; } else { UpdatedRoom = DAL.RoomUpdate(RoomId, Data); return(UpdatedRoom); } } try { eWRoomParameters param = (eWRoomParameters)Parameters; Data.Recording = param.recording; UpdatedRoom = DAL.RoomUpdate(RoomId, Data); param.meetingtitle = Data.Name; param.description = Data.Description; param.meetingstart = Data.StartDate; if (Data.Duration > 0) { param.meetingduration = Data.Duration; } else { if (Data.StartDate != null && Data.EndDate != null) { TimeSpan TS = (Data.EndDate ?? DateTime.Now) - (Data.StartDate ?? DateTime.Now); try { param.meetingduration = Convert.ToInt32(TS.TotalMinutes); } catch { param.meetingduration = 0; } } } eWAPIConnector.SetParameters( this.eWSysParameter.BaseUrl, this.eWSysParameter.ProxyUrl, this.eWSysParameter.MainUserId, this.eWSysParameter.MainUserPwd, ExternalId, param, this.eWSysParameter.MaxUrlChars, false, this.eWSysParameter.Version); } catch (Exception ex) { UpdatedRoom.Parameter = null; } return(UpdatedRoom); }
/// <summary> /// Crea una stanza /// </summary> /// <returns>Id della nuova stanza</returns> public override Int64 RoomCreate(WbRoom Room, bool SysHasIdInName) { if (Room == null || Room.Parameter == null || Room.Parameter.GetType() != typeof(eWRoomParameters)) { throw new ArgumentException("Parameter must be eWRoomParameters!"); } eWRoomParameters Param = (eWRoomParameters)Room.Parameter; if (Room.StartDate == null) { Room.StartDate = DateTime.Now; } if (Room.Type == RoomType.VideoChat) { Room.SubCommunity = SubscriptionType.None; } else if (Room.Public) { Room.SubCommunity = SubscriptionType.Free; } else { Room.SubCommunity = SubscriptionType.Moderated; } if (Room.Type == RoomType.VideoChat) { Room.SubSystem = SubscriptionType.None; } else if (Room.Public) { Room.SubSystem = SubscriptionType.Free; } else { Room.SubSystem = SubscriptionType.Moderated; } if (Room.Type == RoomType.VideoChat) { Room.SubExternal = SubscriptionType.None; } else if (Room.Public) { Room.SubExternal = SubscriptionType.Moderated; } else { Room.SubExternal = SubscriptionType.None; } Room.ExternalId = eWAPIConnector.CreateMasterKey( this.eWSysParameter.BaseUrl, this.eWSysParameter.ProxyUrl, this.eWSysParameter.MainUserId, this.eWSysParameter.MainUserPwd, this.eWSysParameter.MainUserId, "Comol", Room.StartDate, Room.Name, Room.Duration); //Necessario! //Altrimenti il SET dei parametri "ARA" la data di partenza... Param.meetingstart = Room.StartDate; Param.meetingduration = Room.Duration; //allinea la descrizione "comol" con quella "eworks" Param.description = Room.Description; eWAPIConnector.SetParameters( this.eWSysParameter.BaseUrl, this.eWSysParameter.ProxyUrl, this.eWSysParameter.MainUserId, this.eWSysParameter.MainUserPwd, Room.ExternalId, Param, 1500, true, this.eWSysParameter.Version); Room.Recording = Param.recording; this.DAL.RoomCreate(Room); //Genero anche il codice stanza alla creazione. this.RoomCodeGenerate(Room.Id); if (SysHasIdInName) { RoomNameUpdateNameWithId(Room.Id); } return(Room.Id); }
/// <summary> /// Converte i parametri in ingresso per la modifica di una stanza in un elenco di stringhe di lunghezza consona /// </summary> /// <param name="Parameters">Parametri da impostare</param> /// <param name="IsForCreation"> /// True: la stringa è per la creazione /// False: la stringa è per la modifica /// </param> /// <returns></returns> private static List <string> eWRoomParameterToUrls(eWRoomParameters Parameters, Boolean IsForCreation, string version = "") { List <string> OutStrs = new List <string>(); String output = ""; if (!String.IsNullOrEmpty(Parameters.audiocodec)) { OutStrs.Add("&audiocodec=" + Parameters.audiocodec); } if (Parameters.bitrate != null && Parameters.bitrate.Count() > 0) { output = "&bitrate="; foreach (int br in Parameters.bitrate) { output += br.ToString() + "|"; } output.Remove(output.Length - 1, 1); if (!String.IsNullOrEmpty(output)) { OutStrs.Add(output); } } if (!String.IsNullOrEmpty(Parameters.description)) { OutStrs.Add("&description=" + Parameters.description); } OutStrs.Add("&language=" + Parameters.language.ToString()); OutStrs.Add("&meetingduration=" + Parameters.meetingduration.ToString()); output = "&meetinglog="; output += (Parameters.meetinglog) ? "1" : "0"; OutStrs.Add(output); // RIVEDERE FORMATO DATA!!! if (Parameters.meetingstart != null) { DateTime startTime = Parameters.meetingstart ?? DateTime.Now; OutStrs.Add("&meetingstart=" + startTime.ToString("yyyyMMddHHmmss")); //+ startTime.Year + "-" + startTime.Month + "-" + startTime.Day + " " + startTime.Hour + ":" + startTime.Minute + ":" +startTime.Second); } if (!String.IsNullOrEmpty(Parameters.meetingtitle)) { OutStrs.Add("&meetingtitle=" + Parameters.meetingtitle); } if (!String.IsNullOrEmpty(Parameters.meetingpassword)) { OutStrs.Add("&meetingpassword="******"7.0") { OutStrs.Add("&part_language=" + Parameters.part_language); if (!String.IsNullOrEmpty(Parameters.meetingpassword)) { OutStrs.Add("&meetingpassword="******"&part_properties=" + Parameters.part_properties); } if (!String.IsNullOrEmpty(Parameters.properties)) { OutStrs.Add("&properties=" + Parameters.properties); } output = "&recording="; output += (Parameters.recording) ? "1" : "0"; OutStrs.Add(output); OutStrs.Add("&sharingtype=" + Parameters.sharingtype.ToString()); OutStrs.Add("&timezone=" + Parameters.timezone.ToString()); output = "&usedatetime="; output += (Parameters.usedatetime) ? "1" : "0"; OutStrs.Add(output); if (Parameters.videoheight > 0 && Parameters.videowidth > 0) { OutStrs.Add("&videoheight=" + Parameters.videoheight.ToString()); OutStrs.Add("&videowidth=" + Parameters.videowidth.ToString()); } //Boh, cmq in SET funziona! output = "&framerate="; output += Parameters.framerate.ToString(); OutStrs.Add(output); //Aggiungere i parametri mancanti e non documentati? /*Nuovi (da 6.0)*/ //public string clientname { get; set; } //??? //public string email { get; set; } //??? //public int framerate { get; set; } //public bool vav { get; set; } //public bool svc { get; set; } //public int audiopayload { get; set; } //public string endsessionurl { get; set; } /*Solo in documentaizone, get*/ //public object collaborationtype { get; set; } //=-> SharingType? //Parametri che vengono impostati PER SICUREZZA in creazione, ma che poi non vengono modificati! if (IsForCreation) { output = "&forcehost=0"; //output += (Parameters.forcehost) ? "1" : "0"; OutStrs.Add(output); output = "&forcecontroller=0"; //output += (Parameters.forcecontroller) ? "1" : "0"; OutStrs.Add(output); //Configurare su Key output = "&controller=0"; //output += (Parameters.controller) ? "1" : "0"; OutStrs.Add(output); output = "&host=0"; //output += (Parameters.host) ? "1" : "0"; OutStrs.Add(output); output = "&needaccount=0"; //output += (Parameters.needaccount) ? "1" : "0"; OutStrs.Add(output); //SEGARE output = "&crypt=0"; //output += (Parameters.crypt) ? "1" : "0"; OutStrs.Add(output); output = "&dashboard=0"; //output += (Parameters.dashboard) ? "1" : "0"; OutStrs.Add(output); } //ELIMINATI: //if (!String.IsNullOrEmpty(Parameters.videocodec)) OutStrs.Add("&videocodec=" + Parameters.videocodec); //output = "&udpenabled="; //output += (Parameters.udpenabled) ? "1" : "0"; //OutStrs.Add(output); return(OutStrs); }