public void LoadDataImagePhienban(string _maphienban)
        {
            TinBaiAnhDAL _daltinanh = new TinBaiAnhDAL();
            string       _sql       = string.Empty;

            _sql = "select * from VersionImg where  Ma_phienban=" + _maphienban + " order by NgayTao DESC";
            DataSet _ds = _ulti.ExecSqlDataSet(_sql);

            this.DataListAnh.DataSource = _ds;
            this.DataListAnh.DataBind();
        }
Ejemplo n.º 2
0
        public void BindGridPhotosByMatin()
        {
            TinBaiAnhDAL _DAL = new TinBaiAnhDAL();
            DataSet      _ds  = _DAL.ListPhotoByMatinbai(" Ma_TinBai =" + ViewState["id"].ToString());
            DataView     _dv  = BindGridPhotoOfNews(_ds.Tables[0], int.Parse(ViewState["id"].ToString()));

            if (_ds != null)
            {
                this.DataListAnh.DataSource = _dv;
                this.DataListAnh.DataBind();
            }
        }
        public void LoadDataImageTinBai(string _matinbai)
        {
            TinBaiAnhDAL _daltinanh = new TinBaiAnhDAL();

            string where = string.Empty;

            where = " Ma_TinBai=" + _matinbai;
            DataSet _ds = _daltinanh.Sp_SelectTinAnhDynamic(where, "NgayTao DESC");

            this.DataListAnh.DataSource = _ds;
            this.DataListAnh.DataBind();
        }
Ejemplo n.º 4
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            context.Response.Write("Hello World");

            try
            {
                string[] sArrProdID = null;
                char[]   sep        = { '?' };
                string[] sArrVkey   = null;
                string   strUserID  = "";
                char[]   sep2       = { ',' };
                sArrProdID = context.Request.QueryString["user"].ToString().Trim().Split(sep);
                sArrVkey   = sArrProdID[0].ToString().Trim().Split(sep2);
                user       = DAL.GetUserByUserName(sArrVkey[0].ToString());
                strUserID  = user.UserID.ToString();
                int matinbai = 0;
                if (sArrVkey[1].ToString() != "")
                {
                    matinbai = int.Parse(sArrVkey[1].ToString());
                }
                HttpPostedFile postedFile = context.Request.Files["Filedata"];

                string tempPath = System.Configuration.ConfigurationManager.AppSettings["UploadPath"].ToString() + DateTime.Now.Year.ToString() + "/" + DateTime.Now.Month.ToString() + "/" + DateTime.Now.Day.ToString() + "/";

                //Create forder
                CreateFolderByUserName(tempPath);

                string   savepath    = context.Server.MapPath("/" + tempPath);
                string   filename    = postedFile.FileName;
                string[] sArrTenfile = null;
                char[]   cat         = { '.' };
                sArrTenfile = filename.ToString().Trim().Split(cat);
                string _extenfile  = GetDateTimeStringUnique() + "." + sArrTenfile[1].ToString();
                string _tenfilegoc = UltilFunc.RemoveSign4VietnameseString(Path.GetFileNameWithoutExtension(filename)) + "." + _extenfile.ToString();

                _tenfilegoc = _tenfilegoc.Replace(" ", "");
                postedFile.SaveAs(savepath + @"\" + _tenfilegoc);

                int startchar = tempPath.Substring(1, tempPath.Length - 1).IndexOf("/");
                startchar += 1;
                string _PathFile = tempPath.Substring(startchar, tempPath.Length - startchar);
                string _savePath = _PathFile + "" + _tenfilegoc;

                AnhDAL _DAL = new AnhDAL();
                T_Anh  _obj = new T_Anh();
                _obj = SetItem(_savePath, _tenfilegoc, _tenfilegoc);
                int _MaAnhReturn = _DAL.InsertUpdateT_Anh(_obj);
                if (matinbai > 0 && _MaAnhReturn > 0)
                {
                    TinBaiAnhDAL _daltinanh = new TinBaiAnhDAL();
                    T_Tinbai_Anh _objTA     = new T_Tinbai_Anh();
                    _objTA.ID        = 0;
                    _objTA.Ma_Anh    = _MaAnhReturn;
                    _objTA.Ma_TinBai = matinbai;
                    _objTA.ChuThich  = "";
                    _daltinanh.InsertUpdateTin_Anh(_objTA);
                }

                context.Response.Write(tempPath + "/" + filename);
                context.Response.StatusCode = 200;
            }
            catch (Exception ex)
            {
                context.Response.Write("Error: " + ex.Message);
            }
        }