/* * public string Action_Set_RemoveFromChatGroup(string dialogSymbol, string owner, AppLoader existedLoader) * { * Dictionary<string, string> activeParams = new Dictionary<string, string>(); * activeParams.Add("symbol", dialogSymbol); * DataTable dtMessageIndex = existedLoader.ExecuteSelectWithConditionsReturnDT(Global.GlobalDefines.DB_KEY_IKCODER_BASIC, Global.MapStoreProcedures.ikcoder_basic.spa_operation_messagesindex_students, activeParams); * Dictionary<string, string> existedIndexLst = new Dictionary<string, string>(); * foreach (DataRow dr in dtMessageIndex.Rows) * { * string existedUID = string.Empty; * string existedID = string.Empty; * Data_dbDataHelper.GetColumnData(dr, "uid", out existedUID); * * if (!existedIndexLst.Contains(existedUID)) * existedIndexLst.Add(existedUID); * } * if(existedIndexLst.Contains(owner)) * { * * } * } */ public string Action_Set_NewDialog(string token, List <string> lstOwners, AppLoader existedLoader) { string symbol_dialog = Guid.NewGuid().ToString(); Dictionary <string, string> activeParams = new Dictionary <string, string>(); activeParams.Add("symbol", symbol_dialog); DataTable dtMessageIndex = existedLoader.ExecuteSelectWithConditionsReturnDT(Global.GlobalDefines.DB_KEY_IKCODER_BASIC, Global.MapStoreProcedures.ikcoder_basic.spa_operation_messagesindex_students, activeParams); List <string> existedIndexLst = new List <string>(); foreach (DataRow dr in dtMessageIndex.Rows) { string existedUID = string.Empty; Data_dbDataHelper.GetColumnData(dr, "uid", out existedUID); if (!existedIndexLst.Contains(existedUID)) { existedIndexLst.Add(existedUID); } } foreach (string owner in lstOwners) { if (!existedIndexLst.Contains(owner)) { if (activeParams.ContainsKey("uid")) { activeParams.Remove("uid"); } activeParams.Add("uid", owner); existedLoader.ExecuteInsert(Global.GlobalDefines.DB_KEY_IKCODER_BASIC, Global.MapStoreProcedures.ikcoder_basic.spa_operation_messagesindex_students, activeParams); } } activeParams.Clear(); activeParams.Add("symbol", symbol_dialog); string newMsgContent = "<msg></msg>"; string base64Content = Util_Common.Encoder_Base64(newMsgContent); activeParams.Add("content", base64Content); existedLoader.ExecuteInsert(Global.GlobalDefines.DB_KEY_IKCODER_BASIC, Global.MapStoreProcedures.ikcoder_basic.spa_operation_messages_students, activeParams); StringBuilder strReturnDoc = new StringBuilder(); strReturnDoc.Append("<root type='passive'>"); strReturnDoc.Append("<action>" + Global.ActionsMap.Action_Get_DialogList + "</action>"); strReturnDoc.Append("</root>"); return(strReturnDoc.ToString()); }
public string Action_Set_NewFriend(string token, string suname, string msg, AppLoader existedLoader) { Global.ItemAccountStudents activeItem = Global.LoginServices.Pull(token); Dictionary <string, string> paramsMap_for_profle = new Dictionary <string, string>(); paramsMap_for_profle.Add("@puname", activeItem.name); DataTable dtData = existedLoader.ExecuteSelectWithConditionsReturnDT(Global.GlobalDefines.DB_KEY_IKCODER_BASIC, Global.MapStoreProcedures.ikcoder_basic.spa_operation_relations_students, paramsMap_for_profle); if (dtData != null && dtData.Rows.Count > 0) { DataRow[] rows = dtData.Select("suname='" + suname + "'"); if (rows.Length > 0) { return(MessageHelper.ExecuteSucessful()); } } paramsMap_for_profle.Add("@isacc", "0"); paramsMap_for_profle.Add("@suname", suname); paramsMap_for_profle.Add("@message", msg); if (existedLoader.ExecuteInsert(Global.GlobalDefines.DB_KEY_IKCODER_BASIC, Global.MapStoreProcedures.ikcoder_basic.spa_operation_relations_students, paramsMap_for_profle)) { if (_accountTokenMap.ContainsKey(suname)) { string owner_token = _accountTokenMap[suname]; WebSocket owner_socket = null; if (_sockets.ContainsKey(owner_token)) { owner_socket = _sockets[owner_token]; StringBuilder message = new StringBuilder(); message.Append("<root type='passive'>"); message.Append("<action>" + Global.ActionsMap.Action_Get_RelationsAcceptableList + "</action>"); message.Append("</root>"); SendStringAsync(owner_socket, BuildReturnDoc(message.ToString(), Global.ActionsMap.Action_Get_RelationsAcceptableList, true)); } } return(MessageHelper.ExecuteSucessful()); } else { return(MessageHelper.ExecuteFalse()); } }