public string Action_Get_DialogContent(string symbolMessage, AppLoader existedLoader) { Dictionary <string, string> activeParams = new Dictionary <string, string>(); activeParams.Add("symbol", symbolMessage); DataTable activeDataTable = existedLoader.ExecuteSelectWithConditionsReturnDT(Global.GlobalDefines.DB_KEY_IKCODER_BASIC, Global.MapStoreProcedures.ikcoder_basic.spa_operation_messages_students, activeParams); if (activeDataTable == null || activeDataTable.Rows.Count == 0) { StringBuilder strReturnDoc = new StringBuilder(); strReturnDoc.Append("<root type='passive'>"); strReturnDoc.Append("<action>" + Global.ActionsMap.Action_Get_RelationsList + "</action>"); strReturnDoc.Append("</root>"); return(strReturnDoc.ToString()); } else { StringBuilder resultStr = new StringBuilder(); string base64MsgContent = string.Empty; Data_dbDataHelper.GetArrByteColumnDataToString(activeDataTable.Rows[0], "content", out base64MsgContent); string MsgContent = Util_Common.Decoder_Base64(base64MsgContent); string dialogID = string.Empty; Data_dbDataHelper.GetArrByteColumnDataToString(activeDataTable.Rows[0], "id", out dialogID); resultStr.Append("<did>"); resultStr.Append(dialogID); resultStr.Append("</did>"); resultStr.Append(MsgContent); return(resultStr.ToString()); } }
public string Action_Set_SendMessage(string uid, string messageSymbol, string message, List <string> lstOwners, AppLoader existedLoader) { foreach (string owner in lstOwners) { if (_accountTokenMap.ContainsKey(owner)) { string owner_token = _accountTokenMap[owner]; WebSocket owner_socket = null; if (_sockets.ContainsKey(owner_token)) { owner_socket = _sockets[owner_token]; StringBuilder sent_message = new StringBuilder(); sent_message.Append("<root>"); sent_message.Append("<from>" + uid); sent_message.Append("</from>"); sent_message.Append("<group>"); sent_message.Append("</group>"); sent_message.Append("<action>"); sent_message.Append(Global.ActionsMap.Passive_Get_ReceivedMessage); sent_message.Append("</action>"); sent_message.Append("<msg>"); sent_message.Append(message); sent_message.Append("</msg>"); sent_message.Append("</root>"); SendStringAsync(owner_socket, message); } } } Dictionary <string, string> activeParams = new Dictionary <string, string>(); activeParams.Add("symbol", messageSymbol); DataTable activeDataTable = existedLoader.ExecuteSelectWithConditionsReturnDT(Global.GlobalDefines.DB_KEY_IKCODER_BASIC, Global.MapStoreProcedures.ikcoder_basic.spa_operation_messages_students, activeParams); if (activeDataTable == null) { return("<root type='error'><errmsg>lostdata</errmsg></root>"); } else { string base64MsgContent = string.Empty; string id = string.Empty; Data_dbDataHelper.GetArrByteColumnDataToString(activeDataTable.Rows[0], "content", out base64MsgContent); Data_dbDataHelper.GetColumnData(activeDataTable.Rows[0], "id", out id); string MsgContent = Util_Common.Decoder_Base64(base64MsgContent); XmlDocument contentDoc = new XmlDocument(); contentDoc.LoadXml(MsgContent); XmlNode newItem = Util_XmlOperHelper.CreateNode(contentDoc, "item", message); Util_XmlOperHelper.SetAttribute(newItem, "date", DateTime.Now.ToString("yyyy-MM-dd")); Util_XmlOperHelper.SetAttribute(newItem, "time", DateTime.Now.Hour + ":" + DateTime.Now.Minute + ":" + DateTime.Now.Second); Util_XmlOperHelper.SetAttribute(newItem, "dt", DateTime.Now.ToString()); contentDoc.SelectSingleNode("/msg").AppendChild(newItem); string MsgBase64Conetent = Util_Common.Encoder_Base64(contentDoc.OuterXml); activeParams.Clear(); activeParams.Add("id", id); activeParams.Add("content", MsgBase64Conetent); existedLoader.ExecuteUpdate(Global.GlobalDefines.DB_KEY_IKCODER_BASIC, Global.MapStoreProcedures.ikcoder_basic.spa_operation_messages_students, activeParams); return("<root><msg>sent</msg></root>"); } }
public ContentResult Action(string symbol) { Dictionary <string, string> paramsMap = new Dictionary <string, string>(); paramsMap.Add("symbol", symbol); DataTable dtData = _appLoader.ExecuteSelectWithConditionsReturnDT(Global.GlobalDefines.DB_KEY_IKCODER_APPMAIN, Global.MapStoreProcedures.ikcoder_appmain.spa_operation_store_demo_raw, paramsMap); if (dtData != null && dtData.Rows.Count > 0) { string content = string.Empty; Data_dbDataHelper.GetArrByteColumnDataToString(dtData.Rows[0], "content", out content); return(Content(content)); } else { return(Content(MessageHelper.ExecuteFalse())); } }