Exemplo n.º 1
0
        /// <summary>
        /// 下载文件
        /// 作者:章建国
        /// </summary>
        /// <param name="id">主键ID</param>
        /// <returns></returns>
        public FilePathResult GetFileFromDisk(int id)
        {
            tb_attachmentBLL _attachmentbll = new tb_attachmentBLL();
            var    model    = _attachmentbll.GetModel(id);
            string iFile    = AppDomain.CurrentDomain.BaseDirectory + "UpFile//" + model.filePath;
            var    strs     = model.fileName.Split('.');
            string oFile    = AppDomain.CurrentDomain.BaseDirectory + "UpFile//DownLoads//" + strs[0] + ".zip";
            string fileName = model.fileName;

            PublicClass.CompressFile(iFile, oFile);
            return(File(oFile, "application/octet-stream", strs[0] + ".zip"));
        }
Exemplo n.º 2
0
        public string GetMeasureCertificateList(int _measureId)
        {
            DataTable dt = new DataTable();

            if (_measureId > 0)
            {
                try
                {
                    tb_attachmentBLL _attachmentbll = new tb_attachmentBLL();
                    dt = _attachmentbll.GetList(" type1='计量管理' and type2='计量' and tId = " + _measureId).Tables[0];
                }
                catch
                {
                }
            }
            return(PublicClass.ToJson(dt, dt.Rows.Count));
        }
Exemplo n.º 3
0
        public JsonResult Delete_certification(int id)
        {
            tb_attachmentBLL _attachmentbll = new tb_attachmentBLL();
            string           str            = "删除失败!";

            try
            {
                if (_attachmentbll.Delete(id))
                {
                    str = "删除成功!";
                }
            }
            catch
            {
            }
            return(Json(str, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 4
0
        public JsonResult doattachment(int _tid, string _urls, string _names, string _size)
        {
            string flag = "0";

            try
            {
                var strfilename = _names.Split(',');
                var strfilePath = _urls.Split(',');
                var strfileSize = _size.Split(',');
                if (strfilename.Count() >= 1 && strfilePath.Count() >= 1 && strfileSize.Count() >= 1)
                {
                    tb_attachmentBLL _attachmentbll = new tb_attachmentBLL();
                    for (int i = 0; i < strfilename.Count(); i++)
                    {
                        if (!string.IsNullOrEmpty(strfilename[i]) && !string.IsNullOrEmpty(strfilename[i]))
                        {
                            tb_attachment model = new tb_attachment();
                            model.fileName   = strfilename[i];
                            model.filePath   = strfilePath[i];
                            model.fileSize   = strfileSize[i];
                            model.type1      = "计量管理";
                            model.type2      = "计量";
                            model.tId        = _tid;
                            model.createDate = DateTime.Now;
                            model.createUser = CurrentUserInfo.PersonnelID;
                            model.updateDate = DateTime.Now;
                            model.updateUser = CurrentUserInfo.PersonnelID;
                            _attachmentbll.Add(model);
                        }
                    }
                }
            }
            catch
            {
                flag = "0";
            }
            return(Json(flag, JsonRequestBehavior.AllowGet));
        }