Пример #1
0
 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()));
     }
 }
Пример #2
0
        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());
            }
        }
Пример #3
0
        public ContentResult Action()
        {
            string data = _appLoader.get_PostData(HttpContext.Request);
            Dictionary <string, string> paramsMap = new Dictionary <string, string>();
            DataTable dtData = _appLoader.ExecuteSelect(Global.GlobalDefines.DB_KEY_IKCODER_APPMAIN, Global.MapStoreProcedures.ikcoder_appmain.spa_operation_store_demo_raw);

            foreach (DataRow dr in dtData.Rows)
            {
                string rdt = string.Empty;
                Data_dbDataHelper.GetColumnData(dr, "rdt", out rdt);
                DateTime tmpRDT = DateTime.Parse(rdt);
                if ((DateTime.Now - tmpRDT).Days >= 7)
                {
                    string id = string.Empty;
                    Data_dbDataHelper.GetColumnData(dr, "id", out id);
                    paramsMap.Clear();
                    paramsMap.Add("id", id);
                    _appLoader.ExecuteDeleteWithID(Global.GlobalDefines.DB_KEY_IKCODER_APPMAIN, Global.MapStoreProcedures.ikcoder_appmain.spa_operation_store_demo_raw, paramsMap);
                }
            }
            paramsMap.Clear();
            paramsMap.Add("rdt", DateTime.Now.ToString("yyyy-MM-dd"));
            string symbol = Guid.NewGuid().ToString();

            paramsMap.Add("symbol", symbol);
            paramsMap.Add("content", data);
            _appLoader.ExecuteInsert(Global.GlobalDefines.DB_KEY_IKCODER_APPMAIN, Global.MapStoreProcedures.ikcoder_appmain.spa_operation_store_demo_raw, paramsMap);
            return(Content(MessageHelper.ExecuteSucessful("symbol", symbol)));
        }
 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()));
     }
 }
Пример #5
0
        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 actionResult(string uname)
 {
     try
     {
         Dictionary <string, string> activeParams = new Dictionary <string, string>();
         activeParams.Add("name", uname);
         DataTable dtUser = new DataTable();
         dtUser = _appLoader.ExecuteSelectWithConditionsReturnDT(Global.GlobalDefines.DB_KEY_IKCODER_BASIC, Global.MapStoreProcedures.ikcoder_basic.spa_operation_account_students, activeParams);
         string uid = string.Empty;
         Data_dbDataHelper.GetColumnData(dtUser.Rows[0], "id", out uid);
         Dictionary <string, string> paramsMap_for_profle = new Dictionary <string, string>();
         paramsMap_for_profle.Add("@uid", uname);
         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(), uid);
             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(""));
     }
 }
Пример #7
0
 public ContentResult Action()
 {
     try
     {
         XmlDocument resultDoc = new XmlDocument();
         resultDoc.LoadXml("<root></root>");
         string uname = GetAccountInfoFromBasicController("name");
         Dictionary <string, string> paramsForBasic = new Dictionary <string, string>();
         paramsForBasic.Add("@uid", uname);
         DataTable dtData = _appLoader.ExecuteSelectWithMixedConditionsReturnDT(Global.GlobalDefines.DB_KEY_IKCODER_APPMAIN, Global.MapStoreProcedures.ikcoder_appmain.spa_operation_course_exp, paramsForBasic);
         if (dtData != null && dtData.Rows.Count > 0)
         {
             DataRow currentRow = null;
             Data_dbDataHelper.GetActiveRow(dtData, 0, out currentRow);
             if (currentRow != null)
             {
                 int       exp_value = Data_dbDataHelper.GetColumnIntData(currentRow, "exp");
                 DataTable dtTitle   = _appLoader.ExecuteSelect(Global.GlobalDefines.DB_KEY_IKCODER_APPMAIN, Global.MapStoreProcedures.ikcoder_appmain.spa_operation_titles_defined);
                 if (dtData != null && dtData.Rows.Count > 0)
                 {
                     foreach (DataRow activeRow in dtData.Rows)
                     {
                         string title_name    = string.Empty;
                         string title_titles  = string.Empty;
                         int    title_exp_min = 0;
                         int    title_exp_max = 0;
                         Data_dbDataHelper.GetColumnData(activeRow, "name", out title_name);
                         Data_dbDataHelper.GetColumnData(activeRow, "titles", out title_titles);
                         title_exp_min = Data_dbDataHelper.GetColumnIntData(activeRow, "exp_min");
                         title_exp_max = Data_dbDataHelper.GetColumnIntData(activeRow, "exp_max");
                         if (exp_value >= title_exp_max)
                         {
                             XmlNode itemNode = Util_XmlOperHelper.CreateNode(resultDoc, "item", "");
                             resultDoc.SelectSingleNode("/root").AppendChild(itemNode);
                             Util_XmlOperHelper.SetAttribute(itemNode, "name", title_name);
                             Util_XmlOperHelper.SetAttribute(itemNode, "title", title_titles);
                             Util_XmlOperHelper.SetAttribute(itemNode, "isget", "1");
                         }
                         else
                         {
                             XmlNode itemNode = Util_XmlOperHelper.CreateNode(resultDoc, "item", "");
                             resultDoc.SelectSingleNode("/root").AppendChild(itemNode);
                             Util_XmlOperHelper.SetAttribute(itemNode, "name", title_name);
                             Util_XmlOperHelper.SetAttribute(itemNode, "title", title_titles);
                             Util_XmlOperHelper.SetAttribute(itemNode, "expvalue", exp_value.ToString());
                             Util_XmlOperHelper.SetAttribute(itemNode, "isget", "0");
                         }
                     }
                 }
             }
         }
         return(Content(resultDoc.OuterXml));
     }
     catch
     {
         return(Content(MessageHelper.ExecuteFalse(Global.MsgMap.MsgCodeMap[Global.MsgKeyMap.MsgKey_Fetch_Error], Global.MsgMap.MsgContentMap[Global.MsgKeyMap.MsgKey_Fetch_Error])));
     }
 }
Пример #8
0
        public ContentResult Action(string course_name)
        {
            Dictionary <string, string> paramsMap = new Dictionary <string, string>();

            paramsMap.Add("@course", course_name);
            DataTable dtData = _appLoader.ExecuteSelectWithConditionsReturnDT(AppMain.Global.GlobalDefines.DB_KEY_IKCODER_APPMAIN, AppMain.Global.MapStoreProcedures.ikcoder_appmain.spa_operation_course_exp, paramsMap);

            return(Content(Data_dbDataHelper.ActionConvertDTtoXMLString(dtData)));
        }
Пример #9
0
 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()));
     }
 }
Пример #10
0
        public ContentResult Action()
        {
            Dictionary <string, string> paramsmap = new Dictionary <string, string>();
            string uname = GetAccountInfoFromBasicController("name");

            paramsmap.Add("@uid", uname);
            DataTable dtData = _appLoader.ExecuteSelectWithConditionsReturnDT(Global.GlobalDefines.DB_KEY_IKCODER_APPMAIN, Global.MapStoreProcedures.ikcoder_appmain.spa_operation_students_lessonfinished, paramsmap);

            return(Content(Data_dbDataHelper.ActionConvertDTtoXMLString(dtData)));
        }
Пример #11
0
 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 ContentResult Action()
 {
     try
     {
         DataTable dtData = _appLoader.ExecuteSelect(Global.GlobalDefines.DB_KEY_IKCODER_APPMAIN, Global.MapStoreProcedures.ikcoder_appmain.spa_operation_course_main);
         return(Content(Data_dbDataHelper.ActionConvertDTtoXMLString(dtData)));
     }
     catch
     {
         return(Content(MessageHelper.ExecuteFalse(Global.MsgMap.MsgCodeMap[Global.MsgKeyMap.MsgKey_Fetch_Error], Global.MsgMap.MsgContentMap[Global.MsgKeyMap.MsgKey_Fetch_Error])));
     }
 }
        public ContentResult Action()
        {
            string strRequest = _appLoader.get_PostData(HttpContext.Request);

            try
            {
                if (string.IsNullOrEmpty(strRequest))
                {
                    return(Content(MessageHelper.ExecuteFalse(Global.MsgMap.MsgCodeMap[Global.MsgKeyMap.MsgKey_Request_Invalidate], Global.MsgMap.MsgContentMap[Global.MsgKeyMap.MsgKey_Request_Invalidate])));
                }
                XmlDocument requestDoc = new XmlDocument();
                requestDoc.LoadXml(strRequest);
                XmlNode typeNode   = requestDoc.SelectSingleNode("/root/type");
                XmlNode actionNode = requestDoc.SelectSingleNode("/root/action");
                XmlNode codeNode   = requestDoc.SelectSingleNode("/root/code");
                string  str_code   = Util_XmlOperHelper.GetNodeValue(codeNode);
                string  str_action = Util_XmlOperHelper.GetNodeValue(actionNode);
                string  str_type   = Util_XmlOperHelper.GetNodeValue(typeNode);
                Dictionary <string, string> paramsmap = new Dictionary <string, string>();
                string uname = GetAccountInfoFromBasicController("name");
                paramsmap.Add("@uid", uname);
                paramsmap.Add("@rdt", DateTime.Now.ToString("yyyy-MM-dd"));
                paramsmap.Add("@actions", str_action);
                paramsmap.Add("@code", str_code);
                paramsmap.Add("@type", str_type);
                DataTable dtLearning = _appLoader.ExecuteSelectWithMixedConditionsReturnDT(Global.GlobalDefines.DB_KEY_IKCODER_APPMAIN, Global.MapStoreProcedures.ikcoder_appmain.spa_operation_students_learninrecord, paramsmap);
                if (dtLearning != null)
                {
                    if (dtLearning.Rows.Count >= 1)
                    {
                        int    times = Data_dbDataHelper.GetColumnIntData(dtLearning.Rows[0], "times");
                        string id    = string.Empty;
                        Data_dbDataHelper.GetColumnData(dtLearning.Rows[0], "id", out id);
                        paramsmap.Add("@times", (times++).ToString());
                        paramsmap.Add("@rtime", DateTime.Now.Hour + ":" + DateTime.Now.Minute + ":" + DateTime.Now.Second);
                        paramsmap.Add("@rfultime", DateTime.Now.ToString());
                        paramsmap.Add("@id", id);
                        _appLoader.ExecuteUpdate(Global.GlobalDefines.DB_KEY_IKCODER_APPMAIN, Global.MapStoreProcedures.ikcoder_appmain.spa_operation_students_learninrecord, paramsmap);
                        return(Content(MessageHelper.ExecuteSucessful()));
                    }
                }
                paramsmap.Add("@times", "1");
                paramsmap.Add("@rtime", DateTime.Now.Hour + ":" + DateTime.Now.Minute + ":" + DateTime.Now.Second);
                paramsmap.Add("@rfultime", DateTime.Now.ToString());
                _appLoader.ExecuteInsert(Global.GlobalDefines.DB_KEY_IKCODER_APPMAIN, Global.MapStoreProcedures.ikcoder_appmain.spa_operation_students_learninrecord, paramsmap);
                return(Content(MessageHelper.ExecuteSucessful()));
            }
            catch
            {
                return(Content(MessageHelper.ExecuteFalse(Global.MsgMap.MsgCodeMap[Global.MsgKeyMap.MsgKey_Fetch_Error], Global.MsgMap.MsgContentMap[Global.MsgKeyMap.MsgKey_Fetch_Error])));
            }
        }
Пример #14
0
 public ContentResult Action()
 {
     try
     {
         string uname = GetAccountInfoFromBasicController("name");
         Dictionary <string, string> paramsMap = new Dictionary <string, string>();
         paramsMap.Add("@uid", uname);
         DataTable     dtData = _appLoader.ExecuteSelectWithConditionsReturnDT(AppMain.Global.GlobalDefines.DB_KEY_IKCODER_APPMAIN, AppMain.Global.MapStoreProcedures.ikcoder_appmain.spa_operation_students_coursepackage, paramsMap);
         List <string> lstCoursesFromPackage = new List <string>();
         foreach (DataRow activeDR in dtData.Rows)
         {
             string courseid = string.Empty;
             Data_dbDataHelper.GetColumnData(activeDR, "courseid", out courseid);
             string overdate = string.Empty;
             Data_dbDataHelper.GetColumnData(activeDR, "overdate", out overdate);
             DateTime dtOverdate = DateTime.Now;
             DateTime.TryParse(overdate, out dtOverdate);
             if (dtOverdate <= DateTime.Now)
             {
                 lstCoursesFromPackage.Add(courseid);
             }
         }
         XmlDocument returnDoc = new XmlDocument();
         returnDoc.LoadXml("<root></root>");
         dtData = _appLoader.ExecuteSelect(Global.GlobalDefines.DB_KEY_IKCODER_APPMAIN, Global.MapStoreProcedures.ikcoder_appmain.spa_operation_course_main);
         foreach (DataRow activeRow in dtData.Rows)
         {
             string course_name = string.Empty;
             Data_dbDataHelper.GetColumnData(activeRow, "name", out course_name);
             string course_id = string.Empty;
             Data_dbDataHelper.GetColumnData(activeRow, "id", out course_id);
             string course_title = string.Empty;
             Data_dbDataHelper.GetColumnData(activeRow, "title", out course_title);
             string course_isfree = string.Empty;
             Data_dbDataHelper.GetColumnData(activeRow, "isfree", out course_isfree);
             if (lstCoursesFromPackage.Contains(course_id) || course_isfree == "1")
             {
                 XmlNode newItemNode = Util_XmlOperHelper.CreateNode(returnDoc, "item", "");
                 Util_XmlOperHelper.SetAttribute(newItemNode, "name", course_name);
                 Util_XmlOperHelper.SetAttribute(newItemNode, "id", course_id);
                 Util_XmlOperHelper.SetAttribute(newItemNode, "title", course_title);
                 returnDoc.SelectSingleNode("/root").AppendChild(newItemNode);
             }
         }
         return(Content(returnDoc.OuterXml));
     }
     catch
     {
         return(Content(MessageHelper.ExecuteFalse(Global.MsgMap.MsgCodeMap[Global.MsgKeyMap.MsgKey_Fetch_Error], Global.MsgMap.MsgContentMap[Global.MsgKeyMap.MsgKey_Fetch_Error])));
     }
 }
Пример #15
0
 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()));
     }
 }
Пример #16
0
 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 Action(string course_name)
 {
     try
     {
         Dictionary <string, string> paramsForBasic = new Dictionary <string, string>();
         paramsForBasic.Add("@course_name", course_name);
         List <string> lstCourses = new List <string>();
         DataTable     dtData     = _appLoader.ExecuteSelectWithConditionsReturnDT(Global.GlobalDefines.DB_KEY_IKCODER_APPMAIN, Global.MapStoreProcedures.ikcoder_appmain.spa_operation_course_basic, paramsForBasic);
         return(Content(Data_dbDataHelper.ActionConvertDTtoXMLString(dtData)));
     }
     catch
     {
         return(Content(MessageHelper.ExecuteFalse(Global.MsgMap.MsgCodeMap[Global.MsgKeyMap.MsgKey_Fetch_Error], Global.MsgMap.MsgContentMap[Global.MsgKeyMap.MsgKey_Fetch_Error])));
     }
 }
Пример #18
0
 public ContentResult Action()
 {
     try
     {
         string uname = GetAccountInfoFromBasicController("name");
         Dictionary <string, string> paramsForBasic = new Dictionary <string, string>();
         paramsForBasic.Add("@uid", uname);
         paramsForBasic.Add("@date", DateTime.Now.ToString("yyyy-MM-dd"));
         DataTable dtData = _appLoader.ExecuteSelectWithMixedConditionsReturnDT(Global.GlobalDefines.DB_KEY_IKCODER_APPMAIN, Global.MapStoreProcedures.ikcoder_appmain.spa_operation_students_mood, paramsForBasic);
         return(Content(Data_dbDataHelper.ActionConvertDTtoXMLString(dtData)));
     }
     catch
     {
         return(Content(MessageHelper.ExecuteFalse(Global.MsgMap.MsgCodeMap[Global.MsgKeyMap.MsgKey_Fetch_Error], Global.MsgMap.MsgContentMap[Global.MsgKeyMap.MsgKey_Fetch_Error])));
     }
 }
Пример #19
0
 public ContentResult Action(string lesson_code, string course_name)
 {
     try
     {
         if (string.IsNullOrEmpty(lesson_code))
         {
             return(Content(MessageHelper.ExecuteFalse()));
         }
         Dictionary <string, string> paramsmap = new Dictionary <string, string>();
         string uname = GetAccountInfoFromBasicController("name");
         paramsmap.Add("@uid", uname);
         paramsmap.Add("@lesson_code", lesson_code);
         DataTable dtData = _appLoader.ExecuteSelectWithMixedConditionsReturnDT(Global.GlobalDefines.DB_KEY_IKCODER_APPMAIN, Global.MapStoreProcedures.ikcoder_appmain.spa_operation_students_lessonfinished, paramsmap);
         if (dtData != null && dtData.Rows.Count == 1)
         {
             string finished_id = string.Empty;
             Data_dbDataHelper.GetColumnData(dtData.Rows[0], "id", out finished_id);
             paramsmap.Clear();
             paramsmap.Add("@id", finished_id);
             paramsmap.Add("@rdt", DateTime.Now.ToString("yyyy-MM-dd"));
             _appLoader.ExecuteUpdate(Global.GlobalDefines.DB_KEY_IKCODER_APPMAIN, Global.MapStoreProcedures.ikcoder_appmain.spa_operation_students_lessonfinished, paramsmap);
         }
         else
         {
             paramsmap.Add("@rdt", DateTime.Now.ToString("yyyy-MM-dd"));
             paramsmap.Add("@course_name", course_name);
             _appLoader.ExecuteInsert(Global.GlobalDefines.DB_KEY_IKCODER_APPMAIN, Global.MapStoreProcedures.ikcoder_appmain.spa_operation_students_lessonfinished, paramsmap);
             paramsmap.Clear();
             paramsmap.Add("@lesson_code", lesson_code);
             DataTable dt_lessonExp        = _appLoader.ExecuteSelectWithConditionsReturnDT(Global.GlobalDefines.DB_KEY_IKCODER_APPMAIN, Global.MapStoreProcedures.ikcoder_appmain.spa_operation_exp_defined, paramsmap);
             DataRow   activeRow_LessonExp = null;
             Data_dbDataHelper.GetActiveRow(dt_lessonExp, 0, out activeRow_LessonExp);
             int iLessonExp = Data_dbDataHelper.GetColumnIntData(activeRow_LessonExp, "exp");
             paramsmap.Clear();
             paramsmap.Add("@uid", uname);
             paramsmap.Add("@exp", iLessonExp.ToString());
             paramsmap.Add("@rdate", DateTime.Now.ToString());
             paramsmap.Add("@symbol", lesson_code);
             _appLoader.ExecuteInsert(Global.GlobalDefines.DB_KEY_IKCODER_APPMAIN, Global.MapStoreProcedures.ikcoder_appmain.spa_operation_students_exp, paramsmap);
         }
         return(Content(MessageHelper.ExecuteSucessful()));
     }
     catch
     {
         return(Content(MessageHelper.ExecuteFalse(Global.MsgMap.MsgCodeMap[Global.MsgKeyMap.MsgKey_Fetch_Error], Global.MsgMap.MsgContentMap[Global.MsgKeyMap.MsgKey_Fetch_Error])));
     }
 }
        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()));
            }
        }
Пример #21
0
        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()));
            }
        }
Пример #22
0
        /*
         * 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());
        }
Пример #23
0
 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 ContentResult Action()
        {
            try
            {
                string      accoutInfo     = RequestForString("Account_Students_GetCurrentAccountInfo", true);
                XmlDocument accountInfoDoc = new XmlDocument();
                accountInfoDoc.LoadXml(accoutInfo);
                XmlNode rootNode = accountInfoDoc.SelectSingleNode("/root");
                if (rootNode != null)
                {
                    string id = Util_XmlOperHelper.GetAttrValue(rootNode, "id");
                    Dictionary <string, string> lstParams = new Dictionary <string, string>();
                    lstParams.Add("uid", id);
                    DataTable dtExp = _appLoader.ExecuteSelectWithMixedConditionsReturnDT(Global.GlobalDefines.DB_KEY_IKCODER_APPMAIN, Global.MapStoreProcedures.ikcoder_appmain.spa_operation_students_exp, lstParams);
                    if (dtExp != null && dtExp.Rows.Count > 0)
                    {
                        DataRow currentRow = null;
                        Data_dbDataHelper.GetActiveRow(dtExp, 0, out currentRow);
                        string strExp = string.Empty;
                        Data_dbDataHelper.GetColumnData(currentRow, "exp", out strExp);
                        int currentExp = 0;
                        int.TryParse(strExp, out currentExp);
                        DataTable dtData = _appLoader.ExecuteSelect(Global.GlobalDefines.DB_KEY_IKCODER_APPMAIN, Global.MapStoreProcedures.ikcoder_appmain.spa_operation_titles_defined);
                        //foreach(DataRow )


                        return(Content(Data_dbDataHelper.ActionConvertDTtoXMLString(dtData)));
                    }
                    else
                    {
                        return(Content(MessageHelper.ExecuteFalse(Global.MsgMap.MsgCodeMap[Global.MsgKeyMap.MsgKey_Fetch_Error], Global.MsgMap.MsgContentMap[Global.MsgKeyMap.MsgKey_Fetch_Error])));
                    }
                }
                else
                {
                    return(Content(MessageHelper.ExecuteFalse(Global.MsgMap.MsgCodeMap[Global.MsgKeyMap.MsgKey_Login_Needed], Global.MsgMap.MsgContentMap[Global.MsgKeyMap.MsgKey_Login_Needed])));
                }
            }
            catch
            {
                return(Content(MessageHelper.ExecuteFalse(Global.MsgMap.MsgCodeMap[Global.MsgKeyMap.MsgKey_Fetch_Error], Global.MsgMap.MsgContentMap[Global.MsgKeyMap.MsgKey_Fetch_Error])));
            }
        }
Пример #25
0
        public ContentResult Action(string id)
        {
            Dictionary <string, string> paramsmap = new Dictionary <string, string>();
            string uname = GetAccountInfoFromBasicController("name");

            paramsmap.Add("@id", id);
            DataTable dtData = _appLoader.ExecuteSelectWithMixedConditionsReturnDT(Global.GlobalDefines.DB_KEY_IKCODER_APPMAIN, Global.MapStoreProcedures.ikcoder_appmain.spa_operation_appstudio_store, paramsmap);

            if (dtData != null && dtData.Rows.Count == 1)
            {
                string base64StrContentDoc = string.Empty;
                string StrContentDoc       = string.Empty;
                Data_dbDataHelper.GetColumnData(dtData.Rows[0], "contentdoc", out base64StrContentDoc);
                StrContentDoc = Util_Common.Decoder_Base64(base64StrContentDoc);
                return(Content(StrContentDoc));
            }
            else
            {
                return(Content(MessageHelper.ExecuteFalse()));
            }
        }
Пример #26
0
        public string Action_Set_AcceptFriend(string id, AppLoader existedLoader)
        {
            Dictionary <string, string> paramsMap_for_profle = new Dictionary <string, string>();

            paramsMap_for_profle.Add("@id", id);
            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 == 1)
            {
                paramsMap_for_profle.Add("@isacc", "1");
                if (existedLoader.ExecuteUpdate(Global.GlobalDefines.DB_KEY_IKCODER_BASIC, Global.MapStoreProcedures.ikcoder_basic.spa_operation_relations_students, paramsMap_for_profle))
                {
                    string puname = string.Empty;
                    Data_dbDataHelper.GetColumnData(dtData.Rows[0], "puname", out puname);
                    if (_accountTokenMap.ContainsKey(puname))
                    {
                        string    owner_token  = _accountTokenMap[puname];
                        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_RelationsList + "</action>");
                            message.Append("</root>");
                            SendStringAsync(owner_socket, BuildReturnDoc(message.ToString(), Global.ActionsMap.Action_Get_RelationsList, false));
                        }
                    }
                    return(MessageHelper.ExecuteSucessful());
                }
                else
                {
                    return(MessageHelper.ExecuteFalse());
                }
            }
            else
            {
                return(MessageHelper.ExecuteFalse());
            }
        }
Пример #27
0
        public string Action_Get_DialogList(string uid, AppLoader existedLoader)
        {
            string    query_sql       = "SELECT * FROM ikcoder_basic.messagesindex_students where symbol in (select symbol from ikcoder_basic.messagesindex_students where uid = '" + uid + "')";
            DataTable activeDataTable = existedLoader.ExecuteSQL(Global.GlobalDefines.DB_KEY_IKCODER_BASIC, query_sql);

            if (activeDataTable == null)
            {
                return("<root type='error'><errmsg>nodata</errmsg></root>");
            }
            else
            {
                XmlDocument returnDoc = new XmlDocument();
                returnDoc.LoadXml("<root></root>");
                XmlNode rootNode  = returnDoc.SelectSingleNode("/root");
                int     uid_index = 1;
                foreach (DataRow activeRow in activeDataTable.Rows)
                {
                    string strSymbol = string.Empty;
                    Data_dbDataHelper.GetColumnData(activeRow, "symbol", out strSymbol);
                    string uid_fromdb = string.Empty;
                    Data_dbDataHelper.GetColumnData(activeRow, "uid", out uid_fromdb);
                    if (uid == uid_fromdb)
                    {
                        continue;
                    }
                    XmlNode itemNode = returnDoc.SelectSingleNode("/root/item[@symbol='" + strSymbol + "']");
                    if (itemNode == null)
                    {
                        itemNode = Util_XmlOperHelper.CreateNode(returnDoc, "item", "");
                        rootNode.AppendChild(itemNode);
                    }
                    Util_XmlOperHelper.SetAttribute(itemNode, "uid", uid_fromdb);
                    Util_XmlOperHelper.SetAttribute(itemNode, "symbol", strSymbol);
                    Util_XmlOperHelper.SetAttribute(itemNode, "index", uid_index.ToString());
                    uid_index++;
                }
                return(returnDoc.OuterXml.ToString());
            }
        }
 public ContentResult action(string projectname)
 {
     try
     {
         string postData       = _appLoader.get_PostData(HttpContext.Request);
         string base64PostData = Util_Common.Encoder_Base64(postData);
         Dictionary <string, string> paramsmap = new Dictionary <string, string>();
         string uname = GetAccountInfoFromBasicController("name");
         paramsmap.Add("@uid", uname);
         paramsmap.Add("@pname", projectname);
         DataTable dtData    = _appLoader.ExecuteSelectWithMixedConditionsReturnDT(Global.GlobalDefines.DB_KEY_IKCODER_APPMAIN, Global.MapStoreProcedures.ikcoder_appmain.spa_operation_appstudio_store, paramsmap);
         bool      isUpdated = false;
         if (dtData != null && dtData.Rows.Count == 1)
         {
             isUpdated = true;
             string id = string.Empty;
             Data_dbDataHelper.GetColumnData(dtData.Rows[0], "id", out id);
             paramsmap.Add("@id", id);
         }
         paramsmap.Add("@contentdoc", base64PostData);
         paramsmap.Add("@imdt", DateTime.Now.ToString());
         if (isUpdated)
         {
             _appLoader.ExecuteUpdate(Global.GlobalDefines.DB_KEY_IKCODER_APPMAIN, Global.MapStoreProcedures.ikcoder_appmain.spa_operation_appstudio_store, paramsmap);
         }
         else
         {
             _appLoader.ExecuteInsert(Global.GlobalDefines.DB_KEY_IKCODER_APPMAIN, Global.MapStoreProcedures.ikcoder_appmain.spa_operation_appstudio_store, paramsmap);
         }
         return(Content(MessageHelper.ExecuteSucessful()));
     }
     catch
     {
         return(Content(MessageHelper.ExecuteFalse()));
     }
 }
Пример #29
0
        public ContentResult actionResult()
        {
            DataTable dataTable = _appLoader.ExecuteSQL(Global.GlobalDefines.DB_KEY_IKCODER_BASIC, "select count(*) as total from account_students");

            return(Content(Data_dbDataHelper.ActionConvertDTtoXMLString(dataTable)));
        }
Пример #30
0
        public void Processor_CheckStatus(Object param)
        {
            class_Data_SqlSPEntry activeSP = Map_SPS["spa_operation_db_reg"];

            while (true)
            {
                DataTable regTable = db_objectSqlHelper.ExecuteSelectSPForDT(activeSP, db_objectConnectionHelper, Program.key_db_ikcoder_store);
                foreach (DataRow activeDR in regTable.Rows)
                {
                    string id          = string.Empty;
                    string dbkey       = string.Empty;
                    string dbserver    = string.Empty;
                    string dbuid       = string.Empty;
                    string dbpwd       = string.Empty;
                    string dbdatabase  = string.Empty;
                    string tindex      = string.Empty;
                    string storetable  = string.Empty;
                    string limitedrows = string.Empty;
                    string rows        = string.Empty;
                    string online      = string.Empty;
                    Data_dbDataHelper.GetColumnData(activeDR, "id", out id);
                    Data_dbDataHelper.GetColumnData(activeDR, "dbkey", out dbkey);
                    Data_dbDataHelper.GetColumnData(activeDR, "dbserver", out dbserver);
                    Data_dbDataHelper.GetColumnData(activeDR, "dbuid", out dbuid);
                    Data_dbDataHelper.GetColumnData(activeDR, "dbpwd", out dbpwd);
                    Data_dbDataHelper.GetColumnData(activeDR, "dbdatabase", out dbdatabase);
                    Data_dbDataHelper.GetColumnData(activeDR, "storetable", out storetable);
                    Data_dbDataHelper.GetColumnData(activeDR, "limitedrows", out limitedrows);
                    Data_dbDataHelper.GetColumnData(activeDR, "rows", out rows);
                    Data_dbDataHelper.GetColumnData(activeDR, "online", out online);
                    if (db_objectConnectionHelper.Get_ExistedConnection(dbkey))
                    {
                        db_objectConnectionHelper.Set_RemoveExistedConnection(dbkey);
                    }
                    ConsoleMessageItem CMI = new ConsoleMessageItem();
                    CMI.Message = "Try:@->Connect to server:" + dbserver;
                    Program.obj_message.set_newMessage(CMI);
                    if (db_objectConnectionHelper.Set_NewConnectionItem(dbkey, dbserver, dbuid, dbpwd, dbdatabase, enum_DatabaseType.MySql))
                    {
                        CMI.Message = "Result:@->Faild to connect to;" + dbserver;
                        Program.obj_message.set_newMessage(CMI);
                        online = "0";
                    }
                    else
                    {
                        CMI.Message = "Result:@->Connected to:" + dbserver;
                        Program.obj_message.set_newMessage(CMI);
                        online = "1";
                        string    tmpSql  = "select count(*) as rows from " + storetable;
                        DataTable dtCount = null;
                        Data_dbDataHelper.ActionExecuteSQLForDT(db_objectConnectionHelper.Get_ActiveConnection(dbkey), tmpSql, out dtCount);
                        if (dtCount != null && dtCount.Rows.Count > 0)
                        {
                            string tmpRows = string.Empty;
                            Data_dbDataHelper.GetColumnData(dtCount.Rows[0], "rows", out tmpRows);
                            if (tmpRows != rows)
                            {
                                rows = tmpRows;
                            }
                        }
                        activeSP.ModifyParameterValue("id", id);
                        activeSP.ModifyParameterValue("rows", rows);
                        activeSP.ModifyParameterValue("online", online);
                        db_objectSqlHelper.ExecuteUpdateSP(activeSP, db_objectConnectionHelper, dbkey);
                        CMI.Message = "Result:@->Update reg information:" + dbserver;
                        Program.obj_message.set_newMessage(CMI);
                    }
                }
                Thread.Sleep(1000 * 30);
            }
        }