public FormLocalization(string ResourceSet)
 {
     wwDbResourceDataManager Data = new wwDbResourceDataManager();
     InitializeComponent();
 }
示例#2
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;
    }
 public FormLocalization(string ResourceSet,string ConnectionString)
 {
     wwDbResourceConfiguration.Current.ConnectionString = ConnectionString;
     wwDbResourceDataManager Data = new wwDbResourceDataManager();
     InitializeComponent();
 }