public ContentResult actionResult(string withpath = "1") { try { string token = _appLoader.get_ClientToken(Request, "student_token"); Global.ItemAccountStudents activeItem = Global.LoginServices.Pull(token); Dictionary <string, string> paramsMap_for_profle = new Dictionary <string, string>(); paramsMap_for_profle.Add("@uid", activeItem.name); DataTable dt = _appLoader.ExecuteSelectWithConditionsReturnDT(Global.GlobalDefines.DB_KEY_IKCODER_BASIC, Global.MapStoreProcedures.ikcoder_basic.spa_operation_profile_students, paramsMap_for_profle); if (dt != null && dt.Rows.Count > 0) { string header = string.Empty; Data_dbDataHelper.GetColumnData(dt.Rows[0], "header", out header); if (withpath == "1") { string filePath = iKCoderComps.FileStore.GetImageStore(activeItem.id); return(Content(MessageHelper.ExecuteSucessful("800", filePath + "\\" + header))); } else { return(Content(MessageHelper.ExecuteSucessful("800", header))); } } else { return(Content(MessageHelper.ExecuteFalse())); } } catch (Basic_Exceptions err) { return(Content(MessageHelper.ExecuteFalse())); } }
public ContentResult actionResult() { try { string token = _appLoader.get_ClientToken(Request, "student_token"); Global.ItemAccountStudents activeItem = Global.LoginServices.Pull(token); Dictionary <string, string> paramsMap_for_profle = new Dictionary <string, string>(); paramsMap_for_profle.Add("@uid", activeItem.name); DataTable dtData = _appLoader.ExecuteSelectWithConditionsReturnDT(Global.GlobalDefines.DB_KEY_IKCODER_BASIC, Global.MapStoreProcedures.ikcoder_basic.spa_operation_profile_students, paramsMap_for_profle); if (dtData != null && dtData.Rows.Count > 0) { string nickName = string.Empty; string birthday = string.Empty; string country = string.Empty; string state = string.Empty; string city = string.Empty; string realname = string.Empty; Dictionary <string, string> resturnMap = new Dictionary <string, string>(); Data_dbDataHelper.GetColumnData(dtData.Rows[0], "nickname", out nickName); Data_dbDataHelper.GetColumnData(dtData.Rows[0], "birthday", out birthday); Data_dbDataHelper.GetColumnData(dtData.Rows[0], "country", out country); Data_dbDataHelper.GetColumnData(dtData.Rows[0], "state", out state); Data_dbDataHelper.GetColumnData(dtData.Rows[0], "city", out city); Data_dbDataHelper.GetColumnData(dtData.Rows[0], "realname", out realname); if (!string.IsNullOrEmpty(nickName)) { resturnMap.Add("nickname", nickName); } if (!string.IsNullOrEmpty(birthday)) { resturnMap.Add("birthday", birthday); } if (!string.IsNullOrEmpty(country)) { resturnMap.Add("country", country); } if (!string.IsNullOrEmpty(state)) { resturnMap.Add("state", state); } if (!string.IsNullOrEmpty(city)) { resturnMap.Add("city", city); } if (!string.IsNullOrEmpty(realname)) { resturnMap.Add("realname", city); } return(Content(MessageHelper.ExecuteSucessfulDoc(resturnMap))); } else { return(Content(MessageHelper.ExecuteFalse())); } } catch (Basic_Exceptions err) { return(Content(MessageHelper.ExecuteFalse())); } }
public ContentResult Action(string suname) { string token = _appLoader.get_ClientToken(Request, "student_token"); 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 = _appLoader.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("sname='" + suname + "' and accetped='1'"); if (rows.Length > 0) { return(Content(MessageHelper.ExecuteFalse())); } } paramsMap_for_profle.Add("@sumnae", suname); paramsMap_for_profle.Add("@accetped", "0"); if (_appLoader.ExecuteInsert(Global.GlobalDefines.DB_KEY_IKCODER_BASIC, Global.MapStoreProcedures.ikcoder_basic.spa_operation_relations_students, paramsMap_for_profle)) { return(Content(MessageHelper.ExecuteSucessful())); } else { return(Content(MessageHelper.ExecuteFalse())); } }
public ContentResult actionResult(string name, string pwd, string checkcode) { try { Dictionary <string, string> activeParams = new Dictionary <string, string>(); activeParams.Add("name", name); if (_appLoader.VerifyNotEmpty(activeParams)) { string checkcodefromsession = string.Empty; if (HttpContext.Session.Keys.Contains("checkcode")) { checkcodefromsession = HttpContext.Session.GetString("checkcode"); } else { return(Content(MessageHelper.ExecuteFalse("400", "null checkcode"))); } if (checkcodefromsession != checkcode) { return(Content(MessageHelper.ExecuteFalse("400", "wrong checkcode"))); } DataTable dtUser = new DataTable(); dtUser = _appLoader.ExecuteSelectWithConditionsReturnDT(Global.GlobalDefines.DB_KEY_IKCODER_BASIC, Global.MapStoreProcedures.ikcoder_basic.spa_operation_account_students, activeParams); if (dtUser != null && dtUser.Rows.Count == 1) { string uid = string.Empty; string password = string.Empty; Data_dbDataHelper.GetColumnData(dtUser.Rows[0], "id", out uid); Data_dbDataHelper.GetColumnData(dtUser.Rows[0], "password", out password); if (password == pwd) { Global.ItemAccountStudents newItem = Global.ItemAccountStudents.CreateNewItem(uid, name, pwd, ""); Global.LoginServices.Push(newItem); Response.Cookies.Append("student_token", newItem.token); return(Content(MessageHelper.ExecuteSucessful("TOKEN", newItem.token))); } else { return(Content(MessageHelper.ExecuteFalse(Global.MsgMap.MsgCodeMap[Global.MsgKeyMap.MsgKey_Login_InvalidatedPwd], Global.MsgMap.MsgContentMap[Global.MsgKeyMap.MsgKey_Login_InvalidatedPwd]))); } } else { return(Content(MessageHelper.ExecuteFalse(Global.MsgMap.MsgCodeMap[Global.MsgKeyMap.MsgKey_Login_NoUser], Global.MsgMap.MsgContentMap[Global.MsgKeyMap.MsgKey_Login_NoUser]))); } } else { return(Content(MessageHelper.ExecuteSucessful())); } } catch (Basic_Exceptions err) { return(Content(MessageHelper.ExecuteFalse())); } }
public ContentResult actionResult() { try { var files = Request.Form.Files; long fileSize = files.Sum(f => f.Length); List <string> filePathResultList = new List <string>(); foreach (var file in files) { string token = _appLoader.get_ClientToken(Request, "student_token"); Global.ItemAccountStudents activeItem = Global.LoginServices.Pull(token); string fileName = ContentDispositionHeaderValue.Parse(file.ContentDisposition).FileName.ToString().Trim(); string filePath = iKCoderComps.FileStore.GetImageStore(_appLoader.GetAPICurrentPath(), activeItem.id); iKCoderComps.FileStore.VerifyUserStorItem(_appLoader.GetAPICurrentPath(), activeItem.id); fileName = Guid.NewGuid() + "." + fileName.Split('.')[1]; fileName = fileName.Replace("\"", ""); Dictionary <string, string> paramsMap_for_profle = new Dictionary <string, string>(); paramsMap_for_profle.Add("@uid", activeItem.name); DataTable dtData = _appLoader.ExecuteSelectWithConditionsReturnDT(Global.GlobalDefines.DB_KEY_IKCODER_BASIC, Global.MapStoreProcedures.ikcoder_basic.spa_operation_profile_students, paramsMap_for_profle); if (dtData != null && dtData.Rows.Count > 0) { string header = string.Empty; Data_dbDataHelper.GetColumnData(dtData.Rows[0], "header", out header); fileName = header; string id = string.Empty; Data_dbDataHelper.GetColumnData(dtData.Rows[0], "id", out id); paramsMap_for_profle = new Dictionary <string, string>(); paramsMap_for_profle.Add("@id", id); paramsMap_for_profle.Add("@header", fileName); if (_appLoader.ExecuteUpdate(Global.GlobalDefines.DB_KEY_IKCODER_BASIC, Global.MapStoreProcedures.ikcoder_basic.spa_operation_profile_students, paramsMap_for_profle)) { string fileFullName = filePath + fileName; using (FileStream fs = System.IO.File.Create(fileFullName)) { file.CopyTo(fs); fs.Flush(); } } else { return(Content(MessageHelper.ExecuteFalse())); } } else { return(Content(MessageHelper.ExecuteFalse())); } } return(Content(MessageHelper.ExecuteSucessful())); } catch (Basic_Exceptions err) { return(Content(MessageHelper.ExecuteFalse())); } }
public string Action_Get_RelationsList(string token, 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); paramsMap_for_profle.Add("@isacc", "1"); DataTable dtData = existedLoader.ExecuteSelectWithMixedConditionsReturnDT(Global.GlobalDefines.DB_KEY_IKCODER_BASIC, Global.MapStoreProcedures.ikcoder_basic.spa_operation_relations_students, paramsMap_for_profle); return(MessageHelper.TransDatatableToXML(dtData)); }
public ContentResult actionResult() { try { string token = _appLoader.get_ClientToken(Request, "student_token"); Global.ItemAccountStudents activeItem = Global.LoginServices.Pull(token); Dictionary <string, string> paramsMap_for_profle = new Dictionary <string, string>(); paramsMap_for_profle.Add("@uid", activeItem.name); DataTable dt = _appLoader.ExecuteSelectWithConditionsReturnDT(Global.GlobalDefines.DB_KEY_IKCODER_BASIC, Global.MapStoreProcedures.ikcoder_basic.spa_operation_profile_students, paramsMap_for_profle); if (dt != null && dt.Rows.Count > 0) { string header = string.Empty; Data_dbDataHelper.GetColumnData(dt.Rows[0], "header", out header); if (string.IsNullOrEmpty(header)) { return(Content("")); } string filePath = iKCoderComps.FileStore.GetImageStore(_appLoader.GetAPICurrentPath(), activeItem.id); try { FileStream fileStream = new FileStream(filePath + header, FileMode.Open); BinaryReader binaryReader = new BinaryReader(fileStream); byte[] dataBuffer = binaryReader.ReadBytes((int)fileStream.Length); string strB64 = Util_Common.Encoder_Base64(dataBuffer); binaryReader.Close(); fileStream.Close(); string[] filenameAttrs = header.Split("."); string entendType = filenameAttrs[filenameAttrs.Length - 1]; string result = "data:image/"; if (entendType == "icon") { result = result + "x-icon;base64,"; } else { result = result + entendType + ";base64,"; } return(Content(result + strB64)); } catch { return(Content("")); } } else { return(Content("")); } } catch (Basic_Exceptions err) { return(Content("")); } }
public ContentResult Action() { string token = _appLoader.get_ClientToken(Request, "student_token"); Global.ItemAccountStudents activeItem = Global.LoginServices.Pull(token); Dictionary <string, string> paramsMap_for_profle = new Dictionary <string, string>(); paramsMap_for_profle.Add("@puname", activeItem.name); paramsMap_for_profle.Add("@accetped", "1"); DataTable dtData = _appLoader.ExecuteSelectWithConditionsReturnDT(Global.GlobalDefines.DB_KEY_IKCODER_BASIC, Global.MapStoreProcedures.ikcoder_basic.spa_operation_relations_students, paramsMap_for_profle); return(Content(MessageHelper.TransDatatableToXML(dtData))); }
public string Action_Get_RelationsAcceptableList(string token, AppLoader existedLoader) { try { Global.ItemAccountStudents activeItem = Global.LoginServices.Pull(token); string sql = "select * from relations_students where suname='" + activeItem.name + "' and isacc='0'"; DataTable dtData = existedLoader.ExecuteSQL(Global.GlobalDefines.DB_KEY_IKCODER_BASIC, sql); return(Data_dbDataHelper.ActionConvertDTtoXMLString(dtData)); } catch (Exception err) { return(err.Message + "|" + err.StackTrace); } }
public ContentResult actionResult() { string token = _appLoader.get_ClientToken(Request, "student_token"); if (!string.IsNullOrEmpty(token)) { Global.ItemAccountStudents activeStudentItem = Global.LoginServices.Pull(token); return(Content(activeStudentItem.createXmlDoc().OuterXml)); } else { return(Content(MessageHelper.ExecuteFalse(Global.MsgMap.MsgCodeMap[Global.MsgKeyMap.MsgKey_Login_Needed], Global.MsgMap.MsgContentMap[Global.MsgKeyMap.MsgKey_Login_Needed]))); } }
public ContentResult actionResult() { try { string data = _appLoader.get_PostData(HttpContext.Request, "data"); string token = _appLoader.get_ClientToken(Request, "student_token"); if (string.IsNullOrEmpty(data)) { return(Content(MessageHelper.ExecuteFalse())); } byte[] dataBuffer = Util_Common.Decoder_Base64ToBytes(data); Global.ItemAccountStudents activeItem = Global.LoginServices.Pull(token); FileStore.VerifyUserStorItem(_appLoader.GetAPICurrentPath(), activeItem.id); Dictionary <string, string> paramsMap_for_profle = new Dictionary <string, string>(); paramsMap_for_profle.Add("@uid", activeItem.name); DataTable dt = _appLoader.ExecuteSelectWithConditionsReturnDT(Global.GlobalDefines.DB_KEY_IKCODER_BASIC, Global.MapStoreProcedures.ikcoder_basic.spa_operation_profile_students, paramsMap_for_profle); if (dt != null && dt.Rows.Count > 0) { string header = string.Empty; Data_dbDataHelper.GetColumnData(dt.Rows[0], "header", out header); if (string.IsNullOrEmpty(header)) { return(Content(MessageHelper.ExecuteFalse())); } string filePath = iKCoderComps.FileStore.GetImageStore(_appLoader.GetAPICurrentPath(), activeItem.id); try { FileStream fileStream = new FileStream(filePath + header, FileMode.Create); BinaryWriter binaryWriter = new BinaryWriter(fileStream); binaryWriter.Write(dataBuffer); binaryWriter.Flush(); binaryWriter.Close(); fileStream.Close(); return(Content(MessageHelper.ExecuteSucessful())); } catch { return(Content(MessageHelper.ExecuteFalse())); } } else { return(Content(MessageHelper.ExecuteFalse())); } } catch (Basic_Exceptions err) { return(Content(MessageHelper.ExecuteFalse())); } }
public ContentResult actionResult(string sex, string nickname, string birthday, string state, string city, string realname, string country = "China") { Global.ItemAccountStudents activeItem = _appLoader.get_SessionObject(HttpContext.Session, "student_item") as Global.ItemAccountStudents; Dictionary <string, string> paramsMap_for_profle = new Dictionary <string, string>(); paramsMap_for_profle.Add("@uid", activeItem.name); DataTable dtData = _appLoader.ExecuteSelectWithConditionsReturnDT(Global.GlobalDefines.DB_KEY_IKCODER_BASIC, Global.MapStoreProcedures.ikcoder_basic.spa_operation_profile_students, paramsMap_for_profle); string id = string.Empty; Data_dbDataHelper.GetColumnData(dtData.Rows[0], "id", out id); paramsMap_for_profle = new Dictionary <string, string>(); paramsMap_for_profle.Add("@id", id); if (!string.IsNullOrEmpty(nickname)) { paramsMap_for_profle.Add("@nickname", nickname); } if (!string.IsNullOrEmpty(birthday)) { paramsMap_for_profle.Add("@birthday", birthday); } if (!string.IsNullOrEmpty(country)) { paramsMap_for_profle.Add("@country", country); } if (!string.IsNullOrEmpty(state)) { paramsMap_for_profle.Add("@state", state); } if (!string.IsNullOrEmpty(city)) { paramsMap_for_profle.Add("@city", city); } if (!string.IsNullOrEmpty(realname)) { paramsMap_for_profle.Add("@realname", realname); } if (_appLoader.ExecuteUpdate(Global.GlobalDefines.DB_KEY_IKCODER_BASIC, Global.MapStoreProcedures.ikcoder_basic.spa_operation_profile_students, paramsMap_for_profle)) { return(Content(MessageHelper.ExecuteSucessful())); } else { return(Content(MessageHelper.ExecuteFalse())); } }
public ContentResult Action(string id) { string token = _appLoader.get_ClientToken(Request, "student_token"); Global.ItemAccountStudents activeItem = Global.LoginServices.Pull(token); Dictionary <string, string> paramsMap_for_profle = new Dictionary <string, string>(); paramsMap_for_profle.Add("@id", id); paramsMap_for_profle.Add("@accetped", "1"); if (_appLoader.ExecuteUpdate(Global.GlobalDefines.DB_KEY_IKCODER_BASIC, Global.MapStoreProcedures.ikcoder_basic.spa_operation_relations_students, paramsMap_for_profle)) { return(Content(MessageHelper.ExecuteSucessful())); } else { return(Content(MessageHelper.ExecuteFalse())); } }
public ContentResult actionResult(string name, string pwd) { try { Dictionary <string, string> activeParams = new Dictionary <string, string>(); activeParams.Add("name", name); if (_appLoader.VerifyNotEmpty(activeParams)) { DataTable dtUser = new DataTable(); dtUser = _appLoader.ExecuteSelectWithConditionsReturnDT(Global.GlobalDefines.DB_KEY_IKCODER_BASIC, Global.MapStoreProcedures.ikcoder_basic.spa_operation_account_students, activeParams); if (dtUser != null && dtUser.Rows.Count == 1) { string uid = string.Empty; string password = string.Empty; Data_dbDataHelper.GetColumnData(dtUser.Rows[0], "id", out uid); Data_dbDataHelper.GetColumnData(dtUser.Rows[0], "password", out password); if (password == pwd) { Global.ItemAccountStudents newItem = Global.ItemAccountStudents.CreateNewItem(uid, name, pwd, ""); Global.LoginServices.Push(newItem); Response.Cookies.Append("student_token", newItem.token); return(Content(MessageHelper.ExecuteSucessful())); } else { return(Content(MessageHelper.ExecuteFalse())); } } else { return(Content(MessageHelper.ExecuteFalse())); } } else { return(Content(MessageHelper.ExecuteFalse())); } } catch (Basic_Exceptions err) { return(Content(MessageHelper.ExecuteFalse())); } }
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()); } }
public ContentResult actionResult(string oldpwd, string newpwd) { Global.ItemAccountStudents activeItem = _appLoader.get_SessionObject(HttpContext.Session, "student_item") as Global.ItemAccountStudents; Dictionary <string, string> paramsMap_for_profle = new Dictionary <string, string>(); paramsMap_for_profle.Add("@id", activeItem.id); paramsMap_for_profle.Add("@password", oldpwd); DataTable dtData = _appLoader.ExecuteSelectWithConditionsReturnDT(Global.GlobalDefines.DB_KEY_IKCODER_BASIC, Global.MapStoreProcedures.ikcoder_basic.spa_operation_profile_students, paramsMap_for_profle); if (dtData != null && dtData.Rows.Count > 0) { paramsMap_for_profle["@password"] = newpwd; _appLoader.ExecuteUpdate(Global.GlobalDefines.DB_KEY_IKCODER_BASIC, Global.MapStoreProcedures.ikcoder_basic.spa_operation_profile_students, paramsMap_for_profle); return(Content(MessageHelper.ExecuteSucessful())); } else { return(Content(MessageHelper.ExecuteFalse())); } }
public ContentResult actionResult(string sex = "", string nickname = "", string birthday = "", string state = "", string city = "", string realname = "", string country = "China", string school = "") { try { string token = _appLoader.get_ClientToken(Request, "student_token"); Global.ItemAccountStudents activeItem = Global.LoginServices.Pull(token); Dictionary <string, string> paramsMap_for_profle = new Dictionary <string, string>(); paramsMap_for_profle.Add("@uid", activeItem.name); DataTable dtData = _appLoader.ExecuteSelectWithConditionsReturnDT(Global.GlobalDefines.DB_KEY_IKCODER_BASIC, Global.MapStoreProcedures.ikcoder_basic.spa_operation_profile_students, paramsMap_for_profle); string id = string.Empty; Data_dbDataHelper.GetColumnData(dtData.Rows[0], "id", out id); paramsMap_for_profle = new Dictionary <string, string>(); paramsMap_for_profle.Add("@id", id); if (!string.IsNullOrEmpty(nickname)) { paramsMap_for_profle.Add("@nickname", nickname); _appLoader.ExecuteUpdate(Global.GlobalDefines.DB_KEY_IKCODER_BASIC, Global.MapStoreProcedures.ikcoder_basic.spa_operation_profile_students, paramsMap_for_profle); paramsMap_for_profle.Remove("@nickname"); } if (!string.IsNullOrEmpty(birthday)) { paramsMap_for_profle.Add("@birthday", birthday); _appLoader.ExecuteUpdate(Global.GlobalDefines.DB_KEY_IKCODER_BASIC, Global.MapStoreProcedures.ikcoder_basic.spa_operation_profile_students, paramsMap_for_profle); paramsMap_for_profle.Remove("@birthday"); } if (!string.IsNullOrEmpty(country)) { paramsMap_for_profle.Add("@country", country); _appLoader.ExecuteUpdate(Global.GlobalDefines.DB_KEY_IKCODER_BASIC, Global.MapStoreProcedures.ikcoder_basic.spa_operation_profile_students, paramsMap_for_profle); paramsMap_for_profle.Remove("@country"); } if (!string.IsNullOrEmpty(state)) { paramsMap_for_profle.Add("@state", state); _appLoader.ExecuteUpdate(Global.GlobalDefines.DB_KEY_IKCODER_BASIC, Global.MapStoreProcedures.ikcoder_basic.spa_operation_profile_students, paramsMap_for_profle); paramsMap_for_profle.Remove("@state"); } if (!string.IsNullOrEmpty(city)) { paramsMap_for_profle.Add("@city", city); _appLoader.ExecuteUpdate(Global.GlobalDefines.DB_KEY_IKCODER_BASIC, Global.MapStoreProcedures.ikcoder_basic.spa_operation_profile_students, paramsMap_for_profle); paramsMap_for_profle.Remove("@city"); } if (!string.IsNullOrEmpty(sex)) { paramsMap_for_profle.Add("@sex", sex); _appLoader.ExecuteUpdate(Global.GlobalDefines.DB_KEY_IKCODER_BASIC, Global.MapStoreProcedures.ikcoder_basic.spa_operation_profile_students, paramsMap_for_profle); paramsMap_for_profle.Remove("@sex"); } if (!string.IsNullOrEmpty(realname)) { paramsMap_for_profle.Add("@realname", realname); _appLoader.ExecuteUpdate(Global.GlobalDefines.DB_KEY_IKCODER_BASIC, Global.MapStoreProcedures.ikcoder_basic.spa_operation_profile_students, paramsMap_for_profle); paramsMap_for_profle.Remove("@realname"); } if (!string.IsNullOrEmpty(school)) { paramsMap_for_profle.Add("@school", school); _appLoader.ExecuteUpdate(Global.GlobalDefines.DB_KEY_IKCODER_BASIC, Global.MapStoreProcedures.ikcoder_basic.spa_operation_profile_students, paramsMap_for_profle); paramsMap_for_profle.Remove("@school"); } return(Content(MessageHelper.ExecuteSucessful())); } catch { return(Content(MessageHelper.ExecuteFalse())); } }
private string ProcessProtocal(string token, string message, AppLoader existedLoader, out string refAction) { refAction = ""; XmlDocument protocalMessageDoc = new XmlDocument(); protocalMessageDoc.LoadXml(message); XmlNode fromNode = protocalMessageDoc.SelectSingleNode("/root/from"); if (fromNode == null) { return("<root type='error'><errmsg>nofrom</errmsg></root>"); } string from = Util_XmlOperHelper.GetNodeValue(fromNode); /*if(from != token) * return "<root type='error'><errmsg>invalidated token</errmsg></root>";*/ XmlNode actionNode = protocalMessageDoc.SelectSingleNode("/root/action"); if (actionNode == null) { return("<root type='error'><errmsg>noaction</errmsg></root>"); } string action = Util_XmlOperHelper.GetNodeValue(actionNode); XmlNode paramsNode = protocalMessageDoc.SelectSingleNode("/root/params"); refAction = action; Global.ItemAccountStudents activeStuentItem = Global.LoginServices.Pull(token); switch (action) { case Global.ActionsMap.Action_Get_DialogList: /* * <root> * <from> * token * <from> * <action> * Action_Get_DialogList * </action> * </root> * */ return(Action_Get_DialogList(activeStuentItem.name, existedLoader)); case Global.ActionsMap.Action_Get_DialogContent: /* * <root> * <from> * token * </from> * <symbol> * </symbol> * <action> * Action_Get_DialogContent * </action> * </root> * */ string message_symbol = string.Empty; XmlNode messageSymbolNode = protocalMessageDoc.SelectSingleNode("/root/symbol"); if (messageSymbolNode == null) { return("<root type='error'><errmsg>nosymbol</errmsg></root>"); } message_symbol = Util_XmlOperHelper.GetNodeValue(messageSymbolNode); if (string.IsNullOrEmpty(message_symbol)) { return("<root type='error'><errmsg>nosymbol</errmsg></root>"); } return(Action_Get_DialogContent(message_symbol, existedLoader)); case Global.ActionsMap.Action_Set_NewDialog: /* * <root> * <from> * token * </from> * <target> * <item> * u1 * </item> * <item> * u2 * </item> * </target> * <action> * Action_Set_NewDialog * </action> * </root> * */ XmlNodeList targetUserNodes = protocalMessageDoc.SelectNodes("/root/target/item"); List <string> lstTargetItems = new List <string>(); if (targetUserNodes != null && targetUserNodes.Count > 0) { foreach (XmlNode itemNode in targetUserNodes) { string value = Util_XmlOperHelper.GetNodeValue(itemNode); lstTargetItems.Add(value); } } else { return("<root type='error'><errmsg>notargets</errmsg></root>"); } Global.ItemAccountStudents activeItem = Global.LoginServices.Pull(token); lstTargetItems.Add(activeItem.name); return(Action_Set_NewDialog(token, lstTargetItems, existedLoader)); case Global.ActionsMap.Action_Get_RelationsList: /* * <root> * <from> * token * </from> * <action> * Action_Get_RelationsList * </action> * </root> */ return(Action_Get_RelationsList(from, existedLoader)); case Global.ActionsMap.Action_Get_RelationsSearch: /* * <root> * <from> * token * </from> * <action> * Action_Get_RelationsSearch * </action> * <value> * </value> * </root> */ string keyvalue = string.Empty; XmlNode valueNode = protocalMessageDoc.SelectSingleNode("/root/value"); if (valueNode != null) { keyvalue = Util_XmlOperHelper.GetNodeValue(valueNode); } return(Action_Get_RelationsSearch(keyvalue, existedLoader)); case Global.ActionsMap.Action_Get_RelationsAcceptableList: return(Action_Get_RelationsAcceptableList(token, existedLoader)); case Global.ActionsMap.Action_Set_NewFriend: /* * <root> * <from> * token * </from> * <action> * Action_Set_NewFriend * </action> * <msg> * </msg> * <suname> * </suname> * </root> */ string suname = string.Empty; XmlNode sunameNode = protocalMessageDoc.SelectSingleNode("/root/suname"); string msg = string.Empty; XmlNode msgNode = protocalMessageDoc.SelectSingleNode("/root/msg"); if (sunameNode == null) { return("<root type='error'><errmsg>nosuname</errmsg></root>"); } else { suname = Util_XmlOperHelper.GetNodeValue(sunameNode); return(Action_Set_NewFriend(from, suname, msg, existedLoader)); } case Global.ActionsMap.Action_Set_AcceptFriend: /* * <root> * <from> * token * </from> * <action> * Action_Set_AcceptFriend * </action> * <id> * </id> * </root> */ string id = string.Empty; XmlNode id_node = protocalMessageDoc.SelectSingleNode("/root/id"); if (id_node == null) { return("<root type='error'><errmsg>no puname</errmsg></root>"); } else { id = Util_XmlOperHelper.GetNodeValue(id_node); } return(Action_Set_AcceptFriend(id, existedLoader)); case Global.ActionsMap.Action_Get_BatchArrProfile: /* * <root> * <from> * token * </from> * <action> * Action_Get_BatchArrProfile * </action> * <params> * <item> * </item> * </params> * </root> */ List <string> lstID = new List <string>(); XmlNodeList items = paramsNode.SelectNodes("item"); foreach (XmlNode item in items) { string itemValue = Util_XmlOperHelper.GetNodeValue(item); lstID.Add(itemValue); } return(Action_Get_BatchArrProfile(lstID, existedLoader)); case Global.ActionsMap.Action_Set_SendMessage: /* * <root> * <from> * token * </from> * <symbol> * symbol for message * </symbol> * <action> * Action_Set_OpenDialog * </action> * <target> * <item> * u1 * </item> * <item> * u2 * </item> * </target> * <message> * </message> * </root> * */ XmlNode symbolNode = protocalMessageDoc.SelectSingleNode("/root/symbol"); if (symbolNode == null) { return("<root type='error'><errmsg>nosymbol</errmsg></root>"); } string symbolValue = Util_XmlOperHelper.GetNodeValue(symbolNode); XmlNode targetNode = protocalMessageDoc.SelectSingleNode("/root/target"); if (targetNode == null) { return("<root type='error'><errmsg>notarget</errmsg></root>"); } string tagetValue = Util_XmlOperHelper.GetNodeValue(targetNode); XmlNodeList targetItemNodes = protocalMessageDoc.SelectNodes("/root/target/item"); List <string> lstOwners = new List <string>(); foreach (XmlNode itemNode in targetItemNodes) { string value = Util_XmlOperHelper.GetNodeValue(itemNode); lstOwners.Add(value); } XmlNode messageNode = protocalMessageDoc.SelectSingleNode("/root/message"); string messageValue = Util_XmlOperHelper.GetNodeValue(messageNode); return(Action_Set_SendMessage(activeStuentItem.name, symbolValue, messageValue, lstOwners, existedLoader)); } return(""); }