Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                OnDataLoad();
            }

            string json = string.Empty;

            try
            {
                UserInfo user = AdminUtil.GetLoginUser(this);

                string action = Request["action"];
                if (action == "addPicture")
                {
                    string response = Request["response"];

                    string        ImgUrl = System.IO.Path.Combine(UPLOAD_PATH, DateTime.Now.ToString("yyyyMMdd"), response.Split(',')[0] + response.Split(',')[1]).Replace("\\", "/");
                    StringBuilder sb     = new StringBuilder();
                    sb.AppendFormat("insert into SWX_GroupPicture(OrgID,ImgUrl,ImgName) ");
                    sb.AppendFormat("values('{0}','{1}','{2}') ", user.OrgID, ImgUrl, response.Split(',')[1]);

                    MSSQLHelper.Exists(sb.ToString());

                    json = "1";
                }

                if (action == "deletePic")
                {
                    string id = Request["Id"];

                    StringBuilder sb = new StringBuilder();
                    sb.AppendFormat(" select * from SWX_GroupPicture where Id = {0} ", id);
                    DataTable dt     = MSSQLHelper.Query(sb.ToString()).Tables[0];
                    string    ImgUrl = dt.Rows[0]["ImgUrl"].ToString();

                    StringBuilder sb1 = new StringBuilder();
                    sb1.AppendFormat("delete from SWX_GroupPicture where Id = {0}", id);

                    MSSQLHelper.Exists(sb1.ToString());

                    File.Delete(Server.MapPath(ImgUrl));
                    json = "1";
                }

                if (action == "copyPic")
                {
                    string        id = Request["Id"];
                    StringBuilder sb = new StringBuilder();
                    sb.AppendFormat(" select * from SWX_GroupPicture where Id = {0} ", id);
                    DataTable dt     = MSSQLHelper.Query(sb.ToString()).Tables[0];
                    string    ImgUrl = dt.Rows[0]["ImgUrl"].ToString();

                    string ImgPa = AdminUtil.GetRootUrl() + ImgUrl;
                    json = ImgPa;
                }
            }
            catch (Exception ex)
            {
                string err = ex.Message;
            }

            if (!string.IsNullOrEmpty(json))
            {
                Response.Write(json);
                Response.End();
            }
        }
Пример #2
0
        public string GetFile()
        {
            string jdUrl = AdminUtil.GetRootUrl();

            return(jdUrl);
        }