Beispiel #1
0
        // POST: api/DocTucThoiGetResult
        public string Post(DocTucThoi value)
        {
            try
            {
                if (dicAppSet == null || dicAppSet.Count == 0)
                {
                    general gn = new general();
                    dicAppSet = gn.ReadAppseting();
                    if (dicAppSet == null || dicAppSet.Count == 0)
                    {
                        return("{\"result\":\"ERROR\",\"data\":[{\"status\":\"Đọc appsetting lỗi\"}]}");
                    }
                }

                if (value == null || value.config == null)
                {
                    return("{\"result\":\"ERROR\",\"data\":[{\"status\":\"Kiểm tra lại định dạng json đầu vào\"}]}");
                }
                var json = "";

                gnDocTucThoi orc = new gnDocTucThoi();
                json = orc.getResultDocTucThoi(value.config, value.para, dicAppSet);

                return(json);
            }
            catch (Exception ex)
            {
                return("{\"result\":\"ERROR\",\"data\":[{\"status\":\"" + ex.Message.Replace("\n", "") + "\"}]}");
            }
        }
        // POST: api/DocTucThoiUpdateCmd
        public string Post(DocTucThoi value)
        {
            try
            {
                gnDocTucThoi orc  = new gnDocTucThoi();
                var          json = orc.ExcuteDocTucThoi(value);

                return(json);
            }
            catch (Exception ex)
            { return(""); }
        }
        // GET: api/DocTucThoiUpdateCmd
        public string Get()
        {
            Dictionary <string, string> dicAppSet = new Dictionary <string, string>();

            try
            {
                general    gn   = new general();
                gnSqlNomal sqln = new gnSqlNomal();
                dicAppSet = gn.ReadAppseting();
                // doc file json
                var strfileInfo = File.ReadAllText(dicAppSet["dtt_infodoctucthoi"]);
                var dicFileInfo = sqln.convertParaToDic(strfileInfo);

                gnDocTucThoi dtt = new gnDocTucThoi();
                dtt.WriterToFileTxt(dicAppSet, dicFileInfo, "nameFile", "NoiDung");

                return(strfileInfo);
            }
            catch (Exception ex)
            {
                general.WriterLogTracking(ex.Message, dicAppSet);
                return("{\"result\":\"ERROR\",\"data\":[{\"status\":\"" + ex.Message.Replace("\n", "") + "\"}]}");
            }
        }