protected void uxUploadButton_Click(object sender, EventArgs e)
    {
        if (uxUploadRQFile.HasFile)
        {
            if (uxUploadRQFile.PostedFile.ContentLength
                > DataAccessContext.Configurations.GetIntValue("UploadSize") * SystemConst.UploadSizeConfigFactor)
            {
                uxMessageDiv.Visible   = true;
                uxUploadRQMessage.Text = "Upload size is exceeded.";
                return;
            }

            TempUploadedFile = new TempUploadedFile(
                new FileManager(),
                SystemConst.OptionFileTempPath,
                SystemConst.OptionFileUpload,
                uxUploadRQFile.FileName);

            uxUploadRQFile.PostedFile.SaveAs(TempUploadedFile.GetTempFileLocalPath());
            UploadedFile            = uxUploadRQFile.FileName;
            uxMessageDiv.Visible    = false;
            uxUploadedFilename.Text = " - " + UploadedFile;
        }

        Control parent  = this.Parent;
        Control control = null;

        while (parent.GetType() != typeof(Page))
        {
            control = parent.FindControl("uxAddItemButtonModalPopup");
            if (control != null)
            {
                break;
            }
            parent = parent.Parent;
        }
        if (control != null)
        {
            ModalPopupExtender popup = (ModalPopupExtender)control;
            popup.Show();
        }
    }
Exemplo n.º 2
0
 protected void uxUploadButton_Click(object sender, EventArgs e)
 {
     if (uxUploadFile.HasFile)
     {
         if (uxUploadFile.PostedFile.ContentLength
             > DataAccessContext.Configurations.GetIntValue("UploadSize") * SystemConst.UploadSizeConfigFactor)
         {
             uxMessageDiv.Visible = true;
             uxUploadMessage.Text = " " + GetLanguageText("OptionUploadMaxLimit");
             return;
         }
         TempUploadedFile = new TempUploadedFile(
             new FileManager(),
             SystemConst.OptionFileTempPath,
             SystemConst.OptionFileUpload,
             uxUploadFile.FileName);
         uxUploadFile.PostedFile.SaveAs(TempUploadedFile.GetTempFileLocalPath());
         UploadedFile            = uxUploadFile.FileName;
         uxMessageDiv.Visible    = false;
         uxUploadedFilename.Text = " - " + UploadedFile;
     }
 }
    private bool CheckFileUploaded(out string errorMessage)
    {
        errorMessage = String.Empty;
        bool isUploaded = false;

        if (!String.IsNullOrEmpty(UploadedFile))
        {
            string filename = TempUploadedFile.GetTempFileLocalPath();
            if (!String.IsNullOrEmpty(filename))
            {
                if (File.Exists(filename))
                {
                    isUploaded = true;
                }
            }
        }

        if (!isUploaded)
        {
            errorMessage = GetLanguageText("OptionUploadRequired");
        }

        return(isUploaded);
    }