private void InitControl() { SearchFilesRequest request = new SearchFilesRequest(SearchFileType.SunnetFile, true, "ModifiedOn", "DESC"); request.CurrentPage = anpFiles.CurrentPageIndex; request.PageCount = anpFiles.PageSize; request.CompanyID = UserInfo.CompanyID; string[] dires = hidCurrentDirectory.Value.Split("-".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); if (dires.Length == 2) { if (dires[1] == "0") { request.ParentID = int.Parse(dires[0]); request.IncludeChildDirectory = true; } else { request.ParentID = int.Parse(dires[1]); request.IncludeChildDirectory = false; } } else { request.ParentID = 1; request.IncludeChildDirectory = true; hidCurrentDirectory.Value = "1-0"; } if (request.ParentID == 1) { request.ParentID = 0; } int direobjID = 0; if (int.TryParse(txtID.Text, out direobjID)) { request.SearchID = direobjID; } request.Keyword = txtKeyword.Text.NoHTML(); List <DirectoryEntity> list = fileApp.GetObjects(request); if (list != null && list.Count > 0) { rptFiles.Visible = true; rptFiles.DataSource = list; rptFiles.DataBind(); trNoTickets.Visible = false; anpFiles.RecordCount = request.RecordCount; } else { rptFiles.Visible = false; trNoTickets.Visible = true; anpFiles.RecordCount = 0; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (string.IsNullOrEmpty(Request.QueryString["id"]) || string.IsNullOrEmpty(Request.QueryString["type"]) || (QS("id", 0) == 0)) { ShowArgumentErrorMessageToClient(); return; } int id = int.Parse(Request.QueryString["id"]); string type = Request.QueryString["type"]; if (type == DirectoryObjectType.Directory.ToString()) { rbtnNewDirectory.Checked = true; rbtnNewFile.Checked = false; DirectoryEntity model = fileApp.GetDirectory(int.Parse(Request.Params["id"])); DirectoryEntity parent = fileApp.GetDirectory(model.ParentID); List <DirectoryEntity> list = fileApp.GetDirectories(parent.ParentID); list.BindDropdown <DirectoryEntity>(ddlCurrent, "Title", "ID", "Please Select", "0"); ddlCurrent.SelectedValue = model.ParentID.ToString(); txtTitle.Text = model.Title; txtDesc.Text = model.Description; } else if (type == DirectoryObjectType.File.ToString()) { int direid = 0; if (!string.IsNullOrEmpty(Request.Params["direid"]) && int.TryParse(Request.Params["direid"], out direid)) { DirectoryObjectsEntity objects = fileApp.GetObjects(direid); if (!ISReadOnlyRole || UserInfo.ID == objects.CreatedBy) { DirectoryEntity parent = fileApp.GetDirectory(objects.DirectoryID); ddlCurrent.Items.Add(new ListItem(parent.Title, parent.ID.ToString(), true)); FilesEntity file = fileApp.Get(objects.ObjectID); txtDesc.Text = file.ThumbPath; } else { ShowArgumentErrorMessageToClient(); return; } } rbtnNewDirectory.Checked = false; rbtnNewFile.Checked = true; } } }