protected void GvUsersOnRowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName.Equals("UpdateUser")) { var userUpdated = PageDataService.DeleteUserByAdoNet(Convert.ToInt32(e.CommandArgument)); if (userUpdated) { Response.Redirect(Request.RawUrl, false); } } }
protected void GvMediumRowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName.Equals("Insert")) { var mName = GvMedium.FooterRow.FindControl("ftrMediumName") as TextBox; if (mName != null && !string.IsNullOrEmpty(mName.Text.Trim())) { PageDataService.AddMediumByAdoNet(mName.Text); } Response.Redirect(Request.RawUrl); } }
protected void GvGroupRowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName.Equals("Insert")) { var grpCode = GvGroup.FooterRow.FindControl("ftrGroupCode") as TextBox; var grpDescription = GvGroup.FooterRow.FindControl("ftrGroupDescription") as TextBox; if (grpCode != null && grpDescription != null && !string.IsNullOrEmpty(grpCode.Text.Trim()) && !string.IsNullOrEmpty(grpDescription.Text.Trim())) { PageDataService.AddGroupAdoNet(grpCode.Text.Trim(), grpDescription.Text.Trim()); } Response.Redirect(Request.RawUrl); } }
protected void GvFeeMasterRowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName.Equals("Insert")) { Page.Validate("addFee"); if (!Page.IsValid) { return; } var ddlclass = GvFeeMaster.FooterRow.FindControl("ddlClass") as DropDownList; var ddlMedium = GvFeeMaster.FooterRow.FindControl("ddlMedium") as DropDownList; var txtFeeName = GvFeeMaster.FooterRow.FindControl("ftrFeeName") as TextBox; var currentAcademicYear = PageDataService.GetActiveAcademicYearAdoNet(); if (ddlclass != null && ddlMedium != null && txtFeeName != null && currentAcademicYear != null) { if (PageDataService.GetFeeMasterByMediumIdAndClassIdAndAcademicYearIdAdoNet(Convert.ToInt32(ddlMedium.SelectedValue), Convert.ToInt32(ddlclass.SelectedValue), currentAcademicYear.AcademicYearId) != null) { lblError.Visible = true; } else { PageDataService.AddFeeMasterAdoNet(Convert.ToInt32(ddlMedium.SelectedValue), Convert.ToInt32(ddlclass.SelectedValue), Convert.ToInt32(txtFeeName.Text.Trim()), currentAcademicYear.AcademicYearId); Response.Redirect(Request.RawUrl, false); } } } else if (e.CommandName.Equals("Update")) { Page.Validate("editFee"); EntityDataSourceFeeMasters.EnableUpdate = Page.IsValid; //var txtId = GvFeeMaster.Rows[GvFeeMaster.EditIndex].FindControl("txtId") as Label; //var txtFeeName = GvFeeMaster.Rows[GvFeeMaster.EditIndex].FindControl("txtFeeName") as TextBox; // if (txtId != null && txtFeeName != null) // { // PageDataService.UpdateFeeMaster(Convert.ToInt32(txtId.Text), // Convert.ToInt32(txtFeeName.Text.Trim())); // } } }
public new ActionResult Content(string iiid) { var handleUnknownFormat = Request["handleunknownformat"] == "1"; var request = GetSearchMetadataRequest(iiid); var result = SearchService.GetMetadata(request); if (result == null) { return(View("NotFound")); } IndexPageData pagedata = null; var userbehavior = new UserBehavior(); userbehavior.Referer = Request.UrlReferrer?.ToString() ?? ""; userbehavior.IIId = result.IIId; userbehavior.System = result.GetValue(MetadataConsts.System).ToString(); userbehavior.Title = result.Title; userbehavior.Type = "预览"; userbehavior.LogDate = DateTime.UtcNow; if ((string.IsNullOrWhiteSpace(result.PageId) || result.PageId == "0")) { handleUnknownFormat = true; userbehavior.Url = "/DataRender/DownloadFile"; } else { pagedata = PageDataService.Get(result.PageId ?? result[MetadataConsts.PageId].ToString()); userbehavior.Url = pagedata.ContentRef; } var principal = this.PKSUser; userbehavior.User = principal.Identity.Name; userbehavior.Role = principal.Roles.First().Name; UserBehaviorService.Add(userbehavior); //处理未知格式,作下载处理 var showType = result.ShowType; if (handleUnknownFormat) { return(Redirect("/DataRender/DownloadFile?iiid=" + iiid + "&dataid=" + result.DataId)); } //string[] list = pagedata.ContentRef.Split('/'); string relativeUrl = pagedata.ContentRef; if (pagedata.System == PKSSubSystems.Forum) { relativeUrl = Regex.Replace(relativeUrl, @"\[(?<tag>[^\]+])\]", match => result[match.Groups["tag"].Value].ToString()); } else if (pagedata.ContentRef.IndexOf("?") > -1) { relativeUrl = relativeUrl + "&iiid=" + iiid + "&dataid=" + result.DataId; } else { relativeUrl = relativeUrl + "?iiid=" + iiid + "&dataid=" + result.DataId; } Uri uri = new Uri(new Uri(HttpContext.GetSubSystemUrl(pagedata.System)), relativeUrl); return(Redirect(uri.ToString())); //return RedirectToAction(list[2], list[1], new { iiid = iiid, dataid = result.DataId }); }