Example #1
0
        public JsonResult T1(int id, bool isReset = false)
        {
            var info = DBContext.UploadInfo.FirstOrDefault(x => x.Id == id);

            if (info == null)
            {
                return(Json(null, "error"));
            }

            string dataPath = GetDataPath(id.ToString());
            List <StatsisLib.BaseDataInfo> infos = null;

            if (isReset || !System.IO.File.Exists(dataPath))
            {
                if (System.IO.File.Exists(dataPath))
                {
                    System.IO.File.Move(dataPath, dataPath + DateTime.Now.ToFileTime() + ".bak");
                }
                string absoluFilePath           = GetPath(info.SaveName);
                UnionLib.AnaysleService service = new UnionLib.AnaysleService();
                infos = service.GetSumLineTable(absoluFilePath, GetAssistParams(id));
                infos.Serialize(dataPath);
            }
            else
            {
                infos = infos.Deserialize(dataPath);
            }
            infos = infos.OrderByDescending(x => x.通过率).ThenByDescending(x => x.净满意度).ToList();
            return(Json(infos));
        }
Example #2
0
        public FileStreamResult DownAnaysleFile(int id)
        {
            string dataPath = GetDataPath(id.ToString());
            List <StatsisLib.BaseDataInfo> infos = null;

            if (!System.IO.File.Exists(dataPath))
            {
                return(null);
            }
            else
            {
                infos = infos.Deserialize(dataPath);
            }
            UnionLib.AnaysleService service = new UnionLib.AnaysleService();
            var tb = DataProcess.T1_0(infos);

            tb.TableName = "调整后的";
            string path = GetDataPath_excel(id.ToString());

            NPOIHelper.ExportSimple(new List <System.Data.DataTable>()
            {
                tb
            }, path);

            var fileStream = new FileStream(path, FileMode.Open);

            return(File(fileStream, "application/octet-stream", Server.UrlEncode(path)));
        }
Example #3
0
        public FileStreamResult DownAnaysleFile(int id)
        {
            var info = DBContext.UploadInfo.FirstOrDefault(x => x.Id == id);

            if (info == null)
            {
                return(new FileStreamResult(null, "error"));
            }
            string absoluFilePath = GetPath(info.SaveName);

            UnionLib.AnaysleService service = new UnionLib.AnaysleService();
            string file = service.Create(absoluFilePath, GetAssistParams(id));

            var fileStream = new FileStream(file, FileMode.Open);

            return(File(fileStream, "application/octet-stream", Server.UrlEncode(file)));
        }
Example #4
0
        public JsonResult SendTo(int id)
        {
            Common.ResultInfo rInfo = new Common.ResultInfo();

            try
            {
                var currentInfo = DBContext.UploadInfo.FirstOrDefault(x => x.Id == id);

                if (currentInfo != null)
                {
                    string absoluFilePath = GetPath(currentInfo.SaveName);

                    UnionLib.AnaysleService service = new UnionLib.AnaysleService();
                    string file = service.Create(absoluFilePath, GetAssistParams(id));

                    var msg      = "";
                    var sendMail = new MailLib.MailHelper("smtp.163.com", 25, "*****@*****.**", "qwerty123", System.Configuration.ConfigurationManager.AppSettings["toUsers"].Split(','), "how are you", "body is xxxx", false);
                    sendMail.IsSendAttachments = true;
                    sendMail.Attachments       = new string[] { file };
                    var s = sendMail.Send(out msg);
                    if (s == MailLib.MailHelper.SendStatus.Success)
                    {
                        rInfo.IsSuccess = true;
                    }
                    else
                    {
                        rInfo.Message = msg;
                    }
                }
                else
                {
                    rInfo.Message = string.Format("没有 {0}", id);
                }
            }
            catch (Exception ex)
            {
                rInfo.Message = ex.Message;
            }

            return(Json(rInfo, JsonRequestBehavior.AllowGet));
        }