Ejemplo n.º 1
0
    public bool UpdateResourceString(string Value, string ResourceId, string ResourceSet, string LocaleId)
    {
        if (Manager.UpdateOrAdd(ResourceId, Value, LocaleId, ResourceSet) == -1)
        {
            return(false);
        }

        wwDbResourceConfiguration.ClearResourceCache();
        return(true);
    }
Ejemplo n.º 2
0
    protected void btnFileUpload_Click(object sender, EventArgs e)
    {
#if OnlineDemo
        this.ErrorDisplay.ShowError(Res("FeatureDisabled"));
        return;
#endif


        if (!this.FileUpload.HasFile)
        {
            return;
        }

        //FileInfo fi = new FileInfo(this.FileUpload.FileName);
        string Extension = Path.GetExtension(this.FileUpload.FileName).TrimStart('.');  // fi.Extension.TrimStart('.');

        string Filter = ",bmp,ico,gif,jpg,png,css,js,txt,wav,mp3,";
        if (Filter.IndexOf("," + Extension + ",") == -1)
        {
            this.ErrorDisplay.ShowError(Res("InvalidFileUploaded"));
            return;
        }

        string FilePath = Server.MapPath(this.FileUpload.FileName);

        File.WriteAllBytes(FilePath, FileUpload.FileBytes);

        string ResourceId = this.txtNewResourceId.Text;

        // *** Try to add the file
        wwDbResourceDataManager Data = new wwDbResourceDataManager();
        if (Data.UpdateOrAdd(ResourceId, FilePath, this.txtNewLanguage.Text, this.ResourceSet, true) == -1)
        {
            this.ErrorDisplay.ShowError(Res("ResourceUpdateFailed") + "<br/>" + Data.ErrorMessage);
        }
        else
        {
            this.ErrorDisplay.ShowMessage(Res("ResourceUpdated"));
        }

        File.Delete(FilePath);

        this.lstResourceIds.Items.Add(ResourceId);
        this.lstResourceIds.SelectedValue = ResourceId;
    }
Ejemplo n.º 3
0
    protected void btnFileUpload_Click(object sender, EventArgs e)
    {
        if (!FileUpload.HasFile)
            return;

        //FileInfo fi = new FileInfo(FileUpload.FileName);
        string Extension = Path.GetExtension(FileUpload.FileName).TrimStart('.');  // fi.Extension.TrimStart('.');

        string Filter = ",bmp,ico,gif,jpg,png,css,js,txt,wav,mp3,";
        if (Filter.IndexOf("," + Extension + ",") == -1)
        {
            ErrorDisplay.ShowError(Res("InvalidFileUploaded"));
            return;
        }

        string FilePath = Server.MapPath(FileUpload.FileName);

        File.WriteAllBytes(FilePath, FileUpload.FileBytes);

        string ResourceId = txtNewResourceId.Text;

        // *** Try to add the file
        wwDbResourceDataManager Data = new wwDbResourceDataManager();
        if (Data.UpdateOrAdd(ResourceId, FilePath, txtNewLanguage.Text, ResourceSet, true) == -1)
            ErrorDisplay.ShowError(Res("ResourceUpdateFailed") + "<br/>" + Data.ErrorMessage);
        else
            ErrorDisplay.ShowMessage(Res("ResourceUpdated"));

        File.Delete(FilePath);

        lstResourceIds.Items.Add(ResourceId);
        lstResourceIds.SelectedValue = ResourceId;
    }