protected void btnOL_Click(object sender, EventArgs e)
 {
     //RepeaterFiles.DataSource = UCDataList;//MossObject.Xml2FuJianList(txtFJXML.Value);
     RepeaterFiles.DataSource = MossObject.Xml2FuJianList(txtFJXML.Value);
     RepeaterFiles.DataBind();
     RunScript();
 }
        /// <summary>
        /// 删除附件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnDel_Click(object sender, EventArgs e)
        {
            try
            {
                String URL = (sender as LinkButton).CommandName;

                if (UCIsAgain == "1")// 二次分发不刷新实体和不真正删除附件
                {
                    Remove(URL);
                }
                else
                {
                    int ret = MossObject.Del(UCProcessType, URL);

                    if (ret > 0)
                    {
                        Remove(URL);
                        //刷新实体
                        MossObject mossObject = new MossObject();
                        mossObject.SaveNewList(UCProcessType, UCWorkItemID, UCDataList, UCTBID);
                    }
                }
                RepeaterFiles.DataSource = UCDataList;
                RepeaterFiles.DataBind();

                RunScript();
            }
            catch (Exception ex)
            {
                JScript.ShowMsgBox(Page, MsgType.VbExclamation, ex.Message);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                var solicitud = base.ServicesLayer.ServicioJuventudADM.GetNextPrevalidacion();

                if (solicitud != null)
                {
                    NoSolicitud.Text = solicitud.CodigoSolicitud;

                    Nombre.Text         = solicitud.Apellidos.ToUpper();
                    Apellido.Text       = solicitud.Nombres.ToUpper();
                    DOB.Text            = solicitud.FechaNacimiento.ToString("dd/MM/yyyy");
                    FechaSolicitud.Text = solicitud.FechaCreacion.ToString("dd/MM/yyyy");
                    Email.Text          = solicitud.Email;
                    Telefonos.Text      = solicitud.TelCelular + "," + solicitud.TelResidencial;
                    Identificacion.Text = solicitud.IdentificacionCedula;

                    RepeaterFiles.DataSource = solicitud.SolicitudAnexoes;
                    RepeaterFiles.DataBind();

                    base.ViewStateSet("ID", solicitud.SolicitudID.ToString());
                }
                else
                {
                    Response.Redirect("PrevalidacionJuventud.aspx");
                }
            }
        }
        /// <summary>
        /// 绑定动态模块到页面
        /// </summary>
        private void BindDownFilesToPage()
        {
            if (CampaignID > 0)
            {
                //绑定动态模块的模态窗口 Resource_Attachments|Manager_Modal_SelectDownloadFiles
                hlSelectFiles.Attributes.Add("data-href", String.Format("{0}Resource_Masters.aspx?PortalId={1}&TabId={2}&ModuleId={3}&language={4}&Master=Manager_Modal_Downloads", ModulePath, PortalId, TabId, ModuleId, language));
            }
            else
            {
                hlSelectFiles.Enabled = false;
                hlSelectFiles.Attributes.Add("disabled", "disabled");
            }


            List <Object> Items = new List <Object>();

            if (CampaignItem != null && CampaignItem.ID > 0)
            {
                var Relations = Playngo_ClientZone_DownloadRelation.FindListByItem(CampaignItem.ID, (Int32)EnumDisplayModuleType.Campaigns);


                if (Relations != null && Relations.Count > 0)
                {
                    foreach (var Relation in Relations)
                    {
                        var Item = Playngo_ClientZone_DownloadFile.FindByKeyForEdit(Relation.DownloadID);
                        Items.Add(new { ID = Relation.ID, ItemID = Item.ID, DownloadID = Relation.DownloadID, Title = Item.Title, PageType = (Int32)EnumDisplayModuleType.Campaigns, PageTypeText = "Campaigns" });
                    }
                }
            }



            //绑定参数项
            RepeaterFiles.DataSource = Items;
            RepeaterFiles.DataBind();
        }
        /// <summary>
        /// 上传附件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnUpload_Click(object sender, EventArgs e)
        {
            try
            {
                if (String.IsNullOrEmpty(UCProcessType))
                {
                    JScript.ShowMsgBox(Page, MsgType.VbExclamation, "文档库设置不能为空!");
                    return;
                }
                if (multiFile.Files.Length <= 0)
                {
                    return;
                }

                foreach (UploadedFile file in multiFile.Files)
                {
                    if (file.FileName.Contains("#") || file.FileName.Contains("'"))
                    {
                        JScript.ShowMsgBox(Page, MsgType.VbExclamation, file.FileName + "含有特殊字符,请替换后再上传");
                        JScript.ResponseScript(this, "javascript:__doPostBack('LinkButton1','')");
                        return;
                    }
                }
                foreach (UploadedFile file in multiFile.Files)
                {
                    if (file.ContentLength <= MossObject.maxFileSize * 1024 * 1024)
                    {
                        MossObject attach = new MossObject();
                        attach.ServerWeb    = OAConfig.GetConfig("MOSS认证", "ServerWeb");
                        attach.OldFileName  = file.FileName;
                        attach.DocumentName = UCProcessType;
                        #region 更新栏位
                        List <DictionaryEntry> lst = new List <DictionaryEntry>();
                        DictionaryEntry        de  = new DictionaryEntry();
                        de.Key   = "流程实例";
                        de.Value = UCProcessID;
                        lst.Add(de);

                        de       = new DictionaryEntry();
                        de.Key   = "别名";
                        de.Value = file.FileName;
                        lst.Add(de);

                        de       = new DictionaryEntry();
                        de.Key   = "上次修改者";
                        de.Value = CurrentUserInfo.DisplayName;
                        lst.Add(de);
                        #endregion
                        DictionaryEntry[] result = attach.ConvertToDE(lst.ToArray());
                        attach.DocumentEntry = result;
                        //文件扩展名
                        string fileType = System.IO.Path.GetExtension(file.FileName);
                        if (fileType.IndexOf('.') == 0)
                        {
                            fileType = fileType.Substring(1);
                        }
                        bool IsSuccess = false;
                        if ("exe,dll".Contains(fileType.ToLower()))
                        {
                            IMessage im = new WebFormMessage(Page, "不可上传exe或dll文件!");
                            im.Show();

                            IsSuccess = false;
                        }
                        else
                        {
                            attach.UploadFilesStream = file.InputStream;
                            //上传附件并更新栏位
                            IsSuccess = attach.Upload();
                        }
                        if (IsSuccess)
                        {
                            CFuJian ff = new CFuJian();
                            ff.Type = System.IO.Path.GetExtension(attach.FileName);

                            if (ff.Type.IndexOf('.') == 0)
                            {
                                ff.Type = ff.Type.Substring(1);
                            }
                            ff.Title      = attach.FileName;
                            ff.Alias      = System.IO.Path.GetFileNameWithoutExtension(attach.OldFileName);
                            ff.FolderName = attach.FolderName;
                            ff.FileName   = attach.FileName;

                            ff.Size        = attach.ToFileSize_new(file.ContentLength); //文件大小
                            ff.ProcessType = UCProcessType;
                            ff.WorkItemID  = UCWorkItemID;

                            ff.fullURL = attach.UploadFullName; //全路径
                            ff.URL     = attach.UploadURL;      //文件夹+/文件名
                            UCDataList.Add(ff);
                        }
                        //CFuJian l_objAttachment = MossObject.Upload(file, UCProcessType, UCProcessID, UCWorkItemID);
                        //UCDataList.Add(l_objAttachment);
                    }
                    else
                    {
                        JScript.ShowMsgBox(Page, MsgType.VbExclamation, file.FileName + "大小超过" + MossObject.maxFileSize + "M");
                    }
                }

                RepeaterFiles.DataSource = UCDataList;
                RepeaterFiles.DataBind();
                RunScript();
            }
            catch (Exception ex)
            {
                JScript.ShowMsgBox(Page, MsgType.VbExclamation, ex.Message);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                //进度条
                inlineProgressBar.AddTrigger(btnUpload);

                //首次加载
                if (!IsPostBack)
                {
                    //Response.Expires = -1;
                    //Response.ExpiresAbsolute = DateTime.Now;
                    //Response.CacheControl = "no-cache";

                    //设置控件状态
                    if (UCIsAgain == "")
                    {
                        if (!UCIsEditable)
                        {
                            tbUpload.Visible  = false;
                            divUpload.Visible = false;
                            btnOL.Visible     = false;
                        }
                    }

                    #region 接收值

                    //初始化赋值
                    if (Session["附件ListTemp"] != null) //从用户控件接收过来
                    {
                        UCDataList     = MossObject.Xml2FuJianList((String)Session["附件ListTemp"]);
                        txtFJXML.Value = Session["附件ListTemp"].ToString();
                        Session.Remove("附件ListTemp"); //移除Session
                    }
                    #endregion

                    multiFile.StorageConfig["tempDirectory"] = Path.Combine("App_Data", "file1temp");


                    //zhouli 处理历史附件
                    if (UCDataList.Count > 0 && UCWorkItemID != "" && UCIsEditable)
                    {
                        MossObject mossObject = new MossObject();
                        UCDataList = mossObject.GetNewListFuJian(UCProcessType, UCWorkItemID, UCDataList);
                    }
                    RepeaterFiles.DataSource = UCDataList;
                    RepeaterFiles.DataBind();

                    #region 在线编辑设置
                    //在线编辑设置
                    //第一个是webservice地址 第二个是本地路径地址 第三个moss server web地址 第四个当前用户名
                    txtServicePath.Value = OAConfig.GetConfig("MOSS认证", "MossServiceUrl") + @",C:\\LocalTemp," + OAConfig.GetConfig("MOSS认证", "ServerWeb") + "," + CurrentUserInfo.DisplayName + ",";
                    if (!UCIsEditable)
                    {
                        Panel1.Visible = false;
                    }
                    else
                    {
                        btnOL.Attributes.Add("onClick", String.Format("AttachmentWork('{0}','{1}');", UCControlID, txtServicePath.ClientID));
                    }
                    #endregion

                    RunScript();
                }
            }
            catch (Exception ex)
            {
                JScript.ShowMsgBox(Page, MsgType.VbExclamation, ex.Message);
            }
        }