using IsoInterface; using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Collections.Generic; using System.Linq; using ItlRuntime; [GeneratedPage("sme:sme")] [ItlRuntime.XRM.LoginRedirection("./login.aspx#I00006aa3")] public partial class _albumPrivateDialog : IsoPage { protected void Page_PreInit(object sender, EventArgs e) { Response.Expires = -1 ; Response.CacheControl = "Private"; EC.pageCoding = "UTF-8"; EC.rootPath = "./"; EC.globalRootPath = "./"; EC.lang = "fr"; EC.thisFromGlobalRoot = "./albumPrivateDialog.aspx"; EC.hasDocType = true; EC.imageProviderUrl = "./imageProvider.aspx"; } // Members protected bool _autocommit; protected bool _bConfigSupportUpload; protected bool _isResource; protected string _oid; protected string _submitLabel; protected string _label; protected string _description; // Constructor protected void init() { string aspConfig; this._autocommit = false; aspConfig = EC.destination["aspFeatures"]; if(aspConfig == null) aspConfig = ""; this._isResource = EC.Request.getVar("resource") == "true"; this._bConfigSupportUpload = true; this._oid = EC.Request.getVar("reference"); this._submitLabel = this._oid != null ? EC.itl.translate("@alb78") : EC.itl.translate("@alb77"); this._label = ""; this._description = ""; this.handleUpload(); } // Static Methods // Methods public string formatAttribute(string str) { return ITL.formatAttribute(str); } public void handleUpload() { string title; string alt; IFileDescr fileDescr; string oid; title = EC.Request.getStringVar("label", null); if(title == null) return; alt = EC.Request.getStringVar("alt", ""); fileDescr = EC.Request.getFileDescriptor("file"); if(fileDescr == null) { oid = EC.Request.getVar("oid"); if(oid == null && oid == "") return; this._oid = oid; AlbAlbumManager.updatePrivateResource(int.Parse(oid), title, alt); } else { int? iOid = AlbAlbumManager.createPrivateResource(fileDescr, title, alt); if (iOid != null) this._oid = iOid.ToString(); } this._autocommit = true; } public void generateData() { Query query; QueryTable resourceTable; QueryJoinedTable imageTable; QueryFunction predicate; string oidAlias; string urlDirAlias; string filenameAlias; string extensionAlias; string labelAlias; string descriptionAlias; string sizeAlias; string widthAlias; string heightAlias; string framesAlias; string sql; string code; IRecord record; string html; if(this._oid == null) return; query = EC.sqlEngine.buildQuery(QueryType.Select); resourceTable = query.addTable("alb_private_resource"); imageTable = query.addJoinedTable(resourceTable, "alb_private_image", JoinType.Left); predicate = query.createFunction(QueryFunctionType.Equal, query.createColumnExpression(resourceTable, "_oid"), query.createColumnExpression(imageTable, "_oid")); imageTable.setPredicate(predicate); oidAlias = query.addOutput(query.createColumnExpression(resourceTable, "_oid")); urlDirAlias = query.addOutput(query.createColumnExpression(resourceTable, "urlDir")); filenameAlias = query.addOutput(query.createColumnExpression(resourceTable, "filename")); extensionAlias = query.addOutput(query.createColumnExpression(resourceTable, "extension")); labelAlias = query.addOutput(query.createColumnExpression(resourceTable, "label_" + EC.lang.Replace("-", "_"))); descriptionAlias = query.addOutput(query.createColumnExpression(resourceTable, "description_" + EC.lang.Replace("-", "_"))); sizeAlias = query.addOutput(query.createColumnExpression(resourceTable, "filesize")); widthAlias = query.addOutput(query.createColumnExpression(imageTable, "width")); heightAlias = query.addOutput(query.createColumnExpression(imageTable, "height")); framesAlias = query.addOutput(query.createColumnExpression(imageTable, "frames")); query.addWhereClause(query.createFunction(QueryFunctionType.Equal, query.createColumnExpression(resourceTable, "_oid"), query.createConstant(SqlType.Integer, this._oid))); sql = query.dump(); code = ""; record = EC.sqlEngine.executeSelect(sql, "select"); if(record != null) { if(! record.EOF()) { this._label = (string)record.valueOf(labelAlias); this._description = (string)record.valueOf(descriptionAlias); html = "\n"; EC.Response.write(html); } record.close(); } } }