Пример #1
0
        public JsonResult UploadPersonPhotoFile(HttpPostedFileBase File)
        {
            if (File != null && File.ContentLength > 0)
            {
                string Path = string.Format("{0}/{1}", GetItem.UpdPath(), "Manager");
                if (!System.IO.Directory.Exists(Path))
                {
                    System.IO.Directory.CreateDirectory(Path);
                }
                string       saveName = WorkV3.Golbal.UpdFileInfo.SaveFiles(File, Path);
                MemberModels mem      = MemberDAO.SysCurrent;
                string       sql      = "UPDATE Member  SET Img=@Img WHERE LoginID=@ID";

                SQLData.Database            db       = new SQLData.Database(WebInfo.Conn);
                SQLData.ParameterCollection paraList = new SQLData.ParameterCollection();
                paraList.Add("@ID", mem.LoginID);
                paraList.Add("@Img", saveName);
                int exeCount = db.ExecuteNonQuery(sql, paraList);
                if (exeCount > 0)
                {
                    return(Json("success"));
                }
            }
            return(Json("fail"));
        }
Пример #2
0
        public string GetFileLink()
        {
            string desc = String.IsNullOrEmpty(Descriptions) ? Descriptions : FileInfo;

            return(string.Format(
                       "<a href=\"{0}\" target=\"_blank\" title=\"{1}\"><img src=\"{2}\" alt=\"\" />{1}</a>",
                       GetItem.UpdPath().TrimEnd('/') + "/" + FileInfo,
                       desc,
                       PubFunc.GetFileIcon(FileInfo)));
        }
Пример #3
0
        /// <summary>
        /// 取得實體上傳目錄by SiteID
        /// </summary>
        /// <param name="MenuID"></param>
        /// <param name="SiteID"></param>
        /// <returns></returns>
        public static string GetUPathByMenuID(long SiteID, long MenuID)
        {
            string      Path  = GetItem.UpdPath();
            MenusModels datas = MenusDAO.GetInfo(SiteID, MenuID);

            if (datas != null)
            {
                Path += "\\" + datas.SiteSN + "\\" + datas.SN + "\\";
            }

            return(Path);
        }
Пример #4
0
        /// <summary>
        /// 取得實體上傳目錄by SiteID
        /// </summary>
        /// <param name="SiteID"></param>
        /// <returns></returns>
        public static string GetUPathBySiteID(long SiteID, string CustomFolder = "")
        {
            string      Path  = GetItem.UpdPath();
            SitesModels datas = SitesDAO.GetInfo(SiteID);

            if (datas != null)
            {
                Path += "\\" + datas.SN + "\\";
            }

            if (CustomFolder != "")
            {
                Path += CustomFolder + "\\";
            }

            return(Path);
        }
Пример #5
0
        public ActionResult Edit(MemberModels model, IEnumerable <MemberToCompanyModel> companyItems, long siteId = 0)
        {
            ////密碼
            //string hidpassword = Request["hidpassword"];
            //string hashKey = uRandom.GetRandomCode(10);

            //if (!string.IsNullOrEmpty(hidpassword))
            //{
            //    model.HashKey = hashKey;
            //    model.HashPwd = HashWord.EncryptSHA256(hidpassword, hashKey);
            //}

            ViewBag.Exit = true;

            HttpPostedFileBase imgFile = model.imgFile;

            if (imgFile != null && imgFile.ContentLength > 0)
            {
                string Path = string.Format("{0}/{1}", GetItem.UpdPath(), "Manager");
                if (!System.IO.Directory.Exists(Path))
                {
                    System.IO.Directory.CreateDirectory(Path);
                }
                string saveName = WorkV3.Golbal.UpdFileInfo.SaveFiles(imgFile, Path);

                model.Img = saveName;
            }
            ManagerDAO.SetItem(model);
            //ManagerDAO.SetMemberToCompany(model.Id, companyItems); 20190912 Joe 問題單,目前尚無MemberToCompany這張表,故先註解

            var group = GroupDAO.GetItems();

            ViewBag.group     = group;
            ViewBag.UploadUrl = Golbal.UpdFileInfo.GetVPathBySiteID(siteId).TrimEnd('/') + "/";
            ViewBag.SiteID    = siteId;

            return(View(model));
        }