protected void Page_Load(object sender, EventArgs e) { // ea_id = DESEncrypt.Decrypt(MyRequest.GetQueryString("ea_id")); id1 = DESEncrypt.Decrypt(MyRequest.GetQueryString("id1")); id2 = DESEncrypt.Decrypt(MyRequest.GetQueryString("id2")); id3 = MyRequest.GetQueryString("id3"); }
//单个删除 protected void lbtSingleDelete_Click(object sender, EventArgs e) { var lbtn = sender as LinkButton; BLL.CCOM.News_type bll = new BLL.CCOM.News_type(); BLL.CCOM.News news_bll = new BLL.CCOM.News(); if (lbtn != null) { bool result = false; int newsTypeId = Int32.Parse(DESEncrypt.Decrypt(lbtn.ToolTip.ToString())); if (newsTypeId > 0) { Model.CCOM.News_type model = bll.GetModel(newsTypeId); if (model.News_type_creator_id == GetAdminInfo_CCOM().User_id) { news_bll.Delete(" News_type_id=" + newsTypeId); result = bll.Delete(newsTypeId); } int page = MyRequest.GetQueryInt("page", 1); if (result) { JscriptMsg("删除成功!", Utils.CombUrlTxt("News_type_manage.aspx", "&keywords={0}&page={1}&fun_id={2}", keywords, page.ToString(), DESEncrypt.Encrypt(this.fun_id)), "Success"); } } } }
protected int TotalNumber = 0; //学工处通知使用的总人数和 protected void Page_Load(object sender, EventArgs e) { //this.fun_id = get_fun_id("CCOM/notice/ReleaseOrEditNotice.aspx"); string _action = MyRequest.GetQueryString("action"); this.keywords = MyRequest.GetQueryString("keywords"); if (!string.IsNullOrEmpty(_action) && _action == MyEnums.ActionEnum.Edit.ToString()) { this.action = MyEnums.ActionEnum.Edit.ToString(); //修改类型 long.TryParse(DESEncrypt.Decrypt(MyRequest.GetQueryString("id")), out this.pushId); if (this.pushId == 0) { JscriptMsg("传输参数不正确!", "back", "Error"); return; } if (!new BLL.CCOM.Notice().Exists(this.pushId)) { JscriptMsg("通知不存在或已被删除!", "back", "Error"); return; } } if (!IsPostBack) { //绑定推送类别 //BindPushType(); if (action == MyEnums.ActionEnum.Edit.ToString()) //修改 { ShowInfo(this.pushId); } } }
//将Page_Load里的处理逻辑挪到此方法中,客户端种完js后再由前台调用此方法,通过隐藏域传token protected void PushRedirect(object sender, EventArgs e) { String pushId = ""; Int64 userid = 0; String token = ""; String userAgent = ""; if (Request.Headers["user-agent"] != null) { userAgent = Request.Headers["user-agent"].ToString(); } pushId = MyRequest.GetString("id"); try { pushId = DESEncrypt.Decrypt(pushId); } catch { Response.Redirect("/home/push/template/push_error.html"); } try { if (IsAdminLogin()) { userid = GetAdminInfo_CCOM().User_id; } } catch (Exception ex) { Response.Redirect("/home/push/template/push_error.html"); } ShowWebPush(userid, pushId); }
protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { String filePath = HttpUtility.UrlDecode(MyRequest.GetQueryString("address")); String fileName = HttpUtility.UrlDecode(MyRequest.GetQueryString("name")); filePath = Server.MapPath(filePath); var file = new System.IO.FileInfo(filePath); if (System.IO.File.Exists(filePath) & filePath.Contains("upload")) { Response.Clear(); Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(fileName)); Response.AddHeader("Content-Length", file.Length.ToString()); Response.ContentType = "application/octet-stream"; //Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8"); Response.WriteFile(file.FullName); Response.Flush(); //Response.End(); } else { Response.Write("附件不存在!"); Response.Flush(); } } }
private void RptBind(string _order) { string _strWhere = ""; string str = GetStudentID(); if (str != "") { _strWhere += "Student_id in (" + str + ")"; } else { _strWhere += "Student_id=-1"; } int pageSize = GetPageSize(15); //每页数量 int page = MyRequest.GetQueryInt("page", 1); string keywords = MyRequest.GetQueryString("keywords"); int start_index = pageSize * (page - 1) + 1; this.st_index = pageSize * (page - 1) + 1; int end_index = pageSize * page; BLL.CCOM.View_Selete_Topic bll = new BLL.CCOM.View_Selete_Topic(); //计算数量 // int totalCount = bll.GetRecordCount(_strWhere); //绑定我的选题 this.rptList.DataSource = bll.GetListByPage(_strWhere, _order, start_index, end_index); this.rptList.DataBind(); }
private List <Centerr> GetListOfNewRecords(List <Centerr> checkRows) // проверка по всем записям - ДОЛЬШЕ { List <Centerr> inpList = (List <Centerr>) this.ListResponse; List <Centerr> result = new List <Centerr>(); if (inpList == null) { lastError = MyRequest.LastError(); return(result); } bool needBreak = false; for (int i = 0; i < inpList.Count; i++) { for (int j = 0; j < checkRows.Count; j++) { //if (inpList[i].ToString() == checkRows[j].ToString()) if (inpList[i].Equals(checkRows[j])) { needBreak = true; break; } } if (needBreak) { continue; } result.Add(inpList[i]); } return(result); }
//删除 protected void lbtSingleDelete_Click(object sender, EventArgs e) { BLL.CCOM.Topic bll = new BLL.CCOM.Topic(); var lbtn = sender as LinkButton; if (lbtn != null) { var id = Int32.Parse(DESEncrypt.Decrypt(lbtn.ToolTip.ToString())); bool result = true; try { result = bll.Delete(id); } catch { result = false; } string keywords = MyRequest.GetQueryString("keywords"); int page = MyRequest.GetQueryInt("page", 1); if (result == true) { //JscriptMsg("删除成功!", Utils.CombUrlTxt("ManagerList.aspx", "fun_id={0}&keywords={1}&page={2}", // DESEncrypt.Encrypt(this.fun_id), keywords, page.ToString()), "Success"); JscriptMsg("删除成功!", Utils.CombUrlTxt("TopicList.aspx", "fun_id={0}&keywords={1}&page={2}", this.fun_id, keywords, page.ToString()), "Success"); // Response.Redirect("TopicList.aspx?fun_id=" + get_fun_id("CCOM/TopicManage/TopicList.aspx")); } else { JscriptMsg("删除失败!", Utils.CombUrlTxt("TopicList.aspx", "fun_id={0}&keywords={1}&page={2}", DESEncrypt.Encrypt(this.fun_id), keywords, page.ToString()), "Error"); } } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { ListItem list1 = new ListItem("行政机构", "0"); ListItem list2 = new ListItem("部", "1"); ListItem list3 = new ListItem("系", "2"); ListItem list4 = new ListItem("专业", "3"); //this.DropDownList1.Items.Add(list1); //this.DropDownList1.Items.Add(list2); //this.DropDownList1.Items.Add(list3); //this.DropDownList1.Items.Add(list4); Model.CCOM.Agency model = new BLL.CCOM.Agency().GetModel(1); //this.hiduo_id.Value = model.Agency_id.ToString(); //this.ddlAddParentID.DataSource = GetOrgList_DataSet(false); //this.ddlAddParentID.DataTextField = "Agency_name"; //this.ddlAddParentID.DataValueField = "Agency_id"; //this.ddlAddParentID.DataBind(); try { UD_PID = Utils.StrToInt(DESEncrypt.Decrypt(MyRequest.GetString("selectid")), 0); } catch { } //this.ddlAddParentID.SelectedValue = selectOrgan.ToString(); //} } }
public string NewRecordsOutput(IResponse checkResponse = null, bool html = true) { if (!haveNewRecords) { if (!HaveNewRecords(checkResponse)) { if (MyRequest.LastError() != null) { return("ERROR: " + MyRequest.LastError().Message); } else { return(""); } } } string itemsTable = CreateTableForMailing(html); return(PrepareMailBody(itemsTable, NewRecords.Count(), html)); /* * if (HaveNewRecords(checkResponse)) * { * string itemsTable = CreateTableForMailing(html); * return PrepareMailBody(itemsTable, NewRecords.Count(), html); * } * return MyRequest.LastError.Message; */ }
protected void Page_Load(object sender, EventArgs e) { var period = new BLL.CCOM.Period().GetModel("Period_state = 1"); if (period != null) { period_id = period.Period_id; } pro_id = MyRequest.GetQueryString("pro_id"); if (!string.IsNullOrEmpty(pro_id))//编辑 { this.pro_id = DESEncrypt.Decrypt(pro_id); } if (!Page.IsPostBack) { keywords = MyRequest.GetQueryString("keywords"); if (Tools.CheckParams(keywords)) { keywords = ""; } this.txtKeywords.Text = keywords; RptBind(); } }
protected void BindRpt() { if (uo_id.Equals("")) { this.uo_id = this.ddlOrgan.SelectedValue; } if (provence.Equals("")) { this.provence = this.ddlprovence.SelectedValue; } else { if (!uo_id.Equals("-1")) { this.ddlOrgan.SelectedValue = uo_id.ToString(); } if (!provence.Equals("-1")) { this.ddlprovence.SelectedValue = provence.ToString(); } } string _order = MyRequest.GetString("sort").Replace(",", " "); if (_order == "" || Tools.CheckParams(_order)) { _order = " User_id asc"; } RptBind(CombSqlTxt(this.uo_id, this.provence, this.keywords), _order); }
protected void Page_Load(object sender, EventArgs e) { this.fun_id = MyRequest.GetQueryString("fun_id"); if (!Page.IsPostBack) { //判断是不是管理员登录 //Model.CCOM.User_information model = GetAdminInfo_CCOM(); //if (model.User_type != 6) // InnerRedirect(MyEnums.RediirectErrorEnum.NotAdmin); //绑定机构下拉菜单 this.ddlOrgan.DataSource = GetOrgList_DataSet(false); this.ddlOrgan.DataTextField = "Agency_name"; this.ddlOrgan.DataValueField = "Agency_id"; this.ddlOrgan.DataBind(); this.ddlOrgan.Items.Insert(0, new ListItem("全选", "0")); //绑定角色下拉菜单 new BLL.CCOM.Role().BindDDL(this.ddlprovence); //this.ddlprovence.DataSource = GetOrgList_DataSet(false); //this.ddlprovence.DataTextField = "Role_name"; //this.ddlprovence.DataValueField = "Role_id"; //this.ddlprovence.DataBind(); //new BLL.CCOM.Province().BindDDL(this.ddlprovence); this.ddlprovence.Items.Insert(0, new ListItem("全选", "0")); ListItem it = this.ddlprovence.Items.FindByValue("1"); this.ddlprovence.Items.Remove(it); //ListItem it2 = this.ddlprovence.Items.FindByValue("4"); //this.ddlprovence.Items.Remove(it2); BindRpt(); } }
protected void Page_Load(object sender, EventArgs e) { user_id = GetAdminInfo_CCOM().User_id; var agency = new BLL.CCOM.Admin_agency().GetModel("User_id = " + user_id); if (agency != null) { agency_id = agency.Agency_id; } var period = new BLL.CCOM.Period().GetModel("Period_state = " + DataDic.Period_state_On); if (period != null) { period_id = period.Period_id; } string str = MyRequest.GetQueryString("major_id"); if (str != null && str != "") { major_id = DESEncrypt.Decrypt(MyRequest.GetQueryString("major_id")); } if (!Page.IsPostBack) { RalBind(); } this.major_id = this.ddlMajor.SelectedValue; }
protected void Page_Load(object sender, EventArgs e) { studentID = 0; if (GetAdminInfo_CCOM().Role_id == 3) { studentID = GetAdminInfo_CCOM().User_id; } else { studentID = long.Parse(DESEncrypt.Decrypt(MyRequest.GetQueryString("studentID"))); } this.MyUserID.Text = studentID.ToString(); if (!Page.IsPostBack) { if (studentID == 0) { JscriptMsg("传输参数不正确!", "back", "Error"); return; } string ht = ""; Model.CCOM.Topic_relation model = new Model.CCOM.Topic_relation(); model = new BLL.CCOM.Topic_relation().GetModel(" Student_id=" + studentID + "and Accept_state=1"); if (model == null) { ht = " <div class=\"content\" align=\"center\"><h3>您尚无选题<h3></div>"; this.print_div.InnerHtml = ht; } else { AddSubmitButton(); ShowInfo(); } } }
//public ViewNews() //{ // this.checkFunID = false; // this.checkUserStaus = false; // this.checkSchoolLevelAdminUser = false; //} //private static String tokenValidateUrl = ConfigurationManager.AppSettings["ApiServerUrl"].ToString(); protected void Page_Load(object sender, EventArgs e) { String encNewsId = ""; //String userAgent = ""; //if (Request.Headers["user-agent"] != null) //{ // userAgent = Request.Headers["user-agent"].ToString(); //} int newsId = 0; try { encNewsId = MyRequest.GetString("id"); newsId = Int32.Parse(DESEncrypt.Decrypt(encNewsId)); } catch (Exception ex) { Response.Redirect("/home/news/template/news_error.html"); } if (newsId > 0) { ShowNews(newsId); } }
private void RptBind(string _strWhere, string _order) { int pageSize = GetPageSize(15); //每页数量 int page = MyRequest.GetQueryInt("page", 1); string keywords = MyRequest.GetQueryString("keywords"); int start_index = pageSize * (page - 1) + 1; this.st_index = pageSize * (page - 1) + 1; int end_index = pageSize * page; this.txtKeywords.Value = keywords; BLL.CCOM.View_User bll = new BLL.CCOM.View_User(); //计算数量 int totalCount = bll.GetRecordCount(_strWhere); //绑定当页 this.rptList.DataSource = bll.GetListByPage(_strWhere, _order, start_index, end_index); this.rptList.DataBind(); //绑定页码 txtPageNum.Text = pageSize.ToString(); string pageUrl = Utils.CombUrlTxt("ScoreList.aspx", "fun_id={0}&keywords={1}&page={2}", this.fun_id, this.keywords, "__id__"); this.PageContent.InnerHtml = Utils.OutPageList(pageSize, page, totalCount, pageUrl, 8, true); }
protected void Page_Load(object sender, EventArgs e) { user_id = GetAdminInfo_CCOM().User_id; var agency = new BLL.CCOM.Admin_agency().GetModel("User_id = " + user_id); if (agency != null) { agency_id = agency.Agency_id; } string str = MyRequest.GetQueryString("major_id"); if (str != null && str != "") { major_id = DESEncrypt.Decrypt(MyRequest.GetQueryString("major_id")); } var period = new BLL.CCOM.Period().GetModel("Period_state = " + DataDic.Period_state_On); if (period != null) { period_id = period.Period_id; } if (!Page.IsPostBack) { RalBind(); string strWhere = " Major_Agency_id = " + major_id + " AND Subject_level=2 AND Period_id=" + period_id; string order = ""; RptBind(strWhere, order); } }
private void ShowApplyTitle() { var m = new BLL.CCOM.Reply_group().GetModel((int)this.apply_id); title.HRef = "ExamList.aspx?fun_id=" + MyRequest.GetQueryString("fun_id"); this.lblTitle.Text += m.Group_name; }
protected void Page_Load(object sender, EventArgs e) { action = MyEnums.ActionEnum.Add.ToString(); userId = 0; action = MyRequest.GetQueryString("action"); userId = MyRequest.GetQueryInt("userId"); if (!Page.IsPostBack) { // BindId_Type(); BindAgency(); // BindRole(); if (action == MyEnums.ActionEnum.Edit.ToString()) { if (userId == 0) { JscriptMsg("传输参数不正确!", "back", "Error"); return; } ShowInfo(userId); this.btnSubmit.Text = "确认保存"; } else { this.btnSubmit.Text = "确认添加"; } } }
private void RptBind(string _strWhere, string _order) { int pageSize = GetPageSize(15); //每页数量 int page = MyRequest.GetQueryInt("page", 1); string keywords = MyRequest.GetQueryString("keywords"); int start_index = pageSize * (page - 1) + 1; this.st_index = pageSize * (page - 1) + 1; int end_index = pageSize * page; this.txtKeywords.Value = keywords; BLL.CCOM.Topic bll = new BLL.CCOM.Topic(); //计算数量 int totalCount = bll.GetRecordCount(_strWhere); //绑定当页 this.rptList.DataSource = bll.GetListByPage(_strWhere, _order, start_index, end_index); this.rptList.DataBind(); //绑定页码 txtPageNum.Text = pageSize.ToString(); string pageUrl = Utils.CombUrlTxt("StudentChoose.aspx", "fun_id={0}&keywords={1}&sort={2}&page={3}", this.fun_id, this.keywords, MyRequest.GetString("sort"), "__id__"); this.PageContent.InnerHtml = Utils.OutPageList(pageSize, page, totalCount, pageUrl, 8, true); //绑定我的选题 BLL.CCOM.View_Selete_Topic selete_bll = new BLL.CCOM.View_Selete_Topic(); this.rptList2.DataSource = selete_bll.GetList(" Student_id =" + GetAdminInfo_CCOM().User_id); //this.rptList2.DataSource = selete_bll.GetListByPage(_strWhere + "and Student_id ="+GetAdminInfo_CCOM().User_id, _order, start_index, end_index); this.rptList2.DataBind(); }
public void When_response_has_sensitive_property_then_it_is_masked_for_content_logging() { var request = new MyRequest(); var response = new Response <MyResponse> { Data = new MyResponse { SensitiveResponseString = "secret", SensitiveResponseLong = 12341234, NonSensitiveResponseString = "info", NonSensitiveResponseLong = 123456789 } }; var result = request.GetResponseContentForLogging(JsonConvert.SerializeObject(response), "application/json"); const string expected = @"{ ""ApiVersion"": null, ""Context"": null, ""Data"": { ""SensitiveResponseString"": ""-"", ""SensitiveResponseLong"": ""12##HIDDEN##"", ""NonSensitiveResponseString"": ""info"", ""NonSensitiveResponseLong"": 123456789 }, ""Error"": null, ""CorrelationId"": null }"; Assert.AreEqual(expected, result); }
private void RptBind(string _strWhere, string _order) { int pageSize = GetPageSize(30); //每页数量 int page = MyRequest.GetQueryInt("page", 1); int start_index = pageSize * (page - 1) + 1; int end_index = pageSize * page; BLL.CCOM.View_AEE_Score bll = new BLL.CCOM.View_AEE_Score(); //计算数量 int totalCount = bll.GetRecordCount(_strWhere); // txtSearchResult.Text = "本次命中" + totalCount.ToString() + "条"; //绑定当页 this.rptList.DataSource = bll.GetListByPage(_strWhere, _order, start_index, end_index); this.rptList.DataBind(); //绑定页码 txtPageNum.Text = pageSize.ToString(); string pageUrl = Utils.CombUrlTxt("AEEScoreList.aspx", "fun_id={0}&page={1}&keywords={2}&major_id={3}", DESEncrypt.Encrypt(this.fun_id), "__id__", this.txtKeywords.Text, DESEncrypt.Encrypt(this.major_id)); this.PageContent.InnerHtml = Utils.OutPageList(pageSize, page, totalCount, pageUrl, 8, true); }
protected void lbtSingleDelete_Click(object sender, EventArgs e) { var bll = new BLL.CCOM.SMS_apply_record(); var lbtn = sender as LinkButton; if (lbtn != null) { var SMS_apply_id = Int64.Parse(DESEncrypt.Decrypt(lbtn.ToolTip.ToString())); bool result = true; try { result = bll.Delete(SMS_apply_id); } catch { result = false; } //string keywords = MyRequest.GetQueryString("keywords"); int page = MyRequest.GetQueryInt("page", 1); if (result == true) { JscriptMsg("删除成功!", Utils.CombUrlTxt("Manage_SMS_apply.aspx", "fun_id={0}&keywords={1}&page={2}", this.fun_id, this.keywords, page.ToString()), "Success"); } else { JscriptMsg("删除失败!", Utils.CombUrlTxt("Manage_SMS_apply.aspx", "fun_id={0}&keywords={1}&page={2}", this.fun_id, this.keywords, page.ToString()), "Error"); } } }
private void RptBind(string _strWhere, string _order) { int pageSize = GetPageSize(15); //每页数量 int page = MyRequest.GetQueryInt("page", 1); string keywords = MyRequest.GetQueryString("keywords"); int start_index = pageSize * (page - 1) + 1; int end_index = pageSize * page; this.txtKeywords.Text = keywords; var bll = new BLL.CCOM.SMS_apply_record(); //计算数量 int totalCount = bll.GetRecordCount(_strWhere); //绑定当页 if (check_type == 0 || check_type == -1) { this.rptList.DataSource = bll.GetListByPage(_strWhere, _order, start_index, end_index); this.rptList.DataBind(); } else { this.Repeater1.DataSource = bll.GetListByPage(_strWhere, _order, start_index, end_index); this.Repeater1.DataBind(); } //绑定页码 txtPageNum.Text = pageSize.ToString(); string pageUrl = Utils.CombUrlTxt("Manage_SMS_apply.aspx", "fun_id={0}&keywords={1}&page={2}", this.fun_id, this.keywords, "__id__"); this.PageContent.InnerHtml = Utils.OutPageList(pageSize, page, totalCount, pageUrl, 8, true); }
protected void Page_Load(object sender, EventArgs e) { //获取SchoolUserID try { string getID = DESEncrypt.Decrypt(MyRequest.GetQueryString("id")); if (getID == "") { Page.Title = "基本信息"; this.id = GetAdminInfo_CCOM().User_id; } else { Page.Title = "管理考生"; this.id = long.Parse(DESEncrypt.Decrypt(MyRequest.GetQueryString("id"))); } } catch { Response.Redirect("/adminmetro/CCOM/center.aspx"); } if (!Page.IsPostBack) { bllBasicFace(id); bllBasicInfo(id); bllPictureInfo(id); bllNatureInfo(id); bllStuInfo(id); MemberBing(id); CheckInfo(); } }
//#region 组合SQL查询语句========================== //protected string CombSqlTxt() //{ // int flag = 0; // int i = 0; // var model = GetAdminInfo_CCOM(); // StringBuilder strTemp = new StringBuilder(); // BLL.CCOM.Reply_student rs_bll = new BLL.CCOM.Reply_student(); // BLL.CCOM.Reply_commission rc_bll = new BLL.CCOM.Reply_commission(); // BLL.CCOM.Reply_group rg_bll = new BLL.CCOM.Reply_group(); // strTemp.Append("("); // //学生 // DataSet ds = rs_bll.GetList("User_id=" + model.User_id); // //if (ds.Tables[0].Rows.Count > 0) // //{ // // flag = 1; // // strTemp.Append(ds.Tables[0].Rows[0]["Group_id"]); // // for ( i = 1; i < ds.Tables[0].Rows.Count; i++) // // { // // strTemp.Append(","+ds.Tables[0].Rows[i]["Group_id"]); // // } // //} // //组长 // ds = rg_bll.GetList("User_id=" + model.User_id); // if (ds.Tables[0].Rows.Count > 0) // { // if (flag == 0) // { // flag = 1; // strTemp.Append(ds.Tables[0].Rows[0]["Group_id"]); // i = 1; // } // else // i = 0; // for (; i < ds.Tables[0].Rows.Count; i++) // { // strTemp.Append("," + ds.Tables[0].Rows[i]["Group_id"]); // } // } // //组员 // //ds = rc_bll.GetList("User_id=" + model.User_id); // //if (ds.Tables[0].Rows.Count > 0) // //{ // // if (flag == 0) // // { // // flag = 1; // // strTemp.Append(ds.Tables[0].Rows[0]["Group_id"]); // // i = 1; // // } // // else // // i = 0; // // for (; i < ds.Tables[0].Rows.Count; i++) // // { // // strTemp.Append("," + ds.Tables[0].Rows[i]["Group_id"]); // // } // //} // //if (flag == 0) // // strTemp.Append("-1"); // //strTemp.Append(")"); // return strTemp.ToString(); //} //#endregion #region 数据绑定================================= private void RptBind(string _strWhere, string _order) { BLL.CCOM.Reply_group bll = new BLL.CCOM.Reply_group(); int pageSize = GetPageSize(15);//每页数量 int page = MyRequest.GetQueryInt("page", 1); string keywords = MyRequest.GetQueryString("keywords"); int start_index = pageSize * (page - 1) + 1; this.st_index = pageSize * (page - 1) + 1; int end_index = pageSize * page; if (_strWhere != "") { _strWhere = "Group_id in" + _strWhere; } //计算数量 int totalCount = bll.GetRecordCount(_strWhere); //绑定当页 this.rptList.DataSource = bll.GetListByPage(_strWhere, _order, start_index, end_index); this.rptList.DataBind(); //绑定页码 txtPageNum.Text = pageSize.ToString(); string pageUrl = Utils.CombUrlTxt("MyExamList.aspx", "fun_id={0}&keywords={1}&sort={2}&page={3}", this.fun_id, this.keywords, MyRequest.GetString("sort"), "__id__"); this.PageContent.InnerHtml = Utils.OutPageList(pageSize, page, totalCount, pageUrl, 8, true); }
protected void Button1_OnClick(object sender, EventArgs e) { var src = Server.UrlDecode(MyRequest.GetQueryString("src")); var name = Server.UrlDecode(MyRequest.GetQueryString("name")); DownLoadFile(src, name); }
protected void Page_Load(object sender, EventArgs e) { var src = Server.UrlDecode(MyRequest.GetQueryString("src")); var name = Server.UrlDecode(MyRequest.GetQueryString("name")); if (src != null) { var fileExt = src.Substring(src.LastIndexOf('.') + 1); if (Utils.IsTxtExt(fileExt)) { //读取文件显示 if (File.Exists(Server.MapPath(src))) { ShowFileName(src, name); //var content = FileOperate.Read_Txt(Server.MapPath(src), code); var content = FileOperate.ReadFile(Server.MapPath(src), Encoding.Default); content = content.Replace("\n", "<br />"); this.txtContainner.InnerHtml = content; //ResponsePreview(src); } else { this.txtContainner.InnerHtml = "预览文件不存在!"; } } } }
/// <summary> /// This method calls third-party service and sends request /// Client will process request within few days. This is why we are /// just posting data and only check is to make sure that request submitted successfuly /// </summary> /// <param name="request">client details, request sent from front-end, request id</param> /// <returns>status of request</returns> public string StartPostingProcess(IMyClient myClient, MyRequest preDefinedRequest, string requestId) { string result = string.Empty; var request = new MyClientRequest() { Body = preDefinedRequest, CallBackUrl = $"api/MyTask/RequestReceived/{requestId}" //Since this is an exercise it is ok to have hard coded values }; //calling third party service //This method just posts data to the third party service //We want to make sure that post was successful. //"PostData" method has a simple logic to check transaction status //the purpose of "response" class is to return status of http rerequest and based on status we can have logic to populate apiResponse which is json var response = myClient.PostData(request); //process response if (response.ResponseType == MyClientResponseTypes.BadRequest || response.ResponseType == MyClientResponseTypes.Error) { //this is the part where we can have handle error class and take care of errors; we can log error and other details //for this exercise we are just returning string result = "HRTTP REQUEST ERROR"; } else if (response.ResponseType == MyClientResponseTypes.Success) { //if we would have some additional logic this is the part where we can have handle success class result = "HRTTP REQUEST SUCCESS"; } return(result); }
/// <summary>Sends a request of contentype application/xml </summary> private void IncorrectRequest() { var client = new XmlServiceClient(HostingAt); var request = new MyRequest {Data = "RequestData"}; var response = client.Post(request); }
public void SteadyState() { Console.WriteLine(_index + ": replacing old every " + _old_time + "; med every " + _med_time + ";creating young " + _young_time + "times (" + "(size " + _mean_young_alloc_size + ")"); Console.WriteLine("iterating {0} times", _iter_count); int iter_interval = _iter_count / 10; Stopwatch stopwatch = new Stopwatch(); stopwatch.Reset(); stopwatch.Start(); //int lastGen2Count = 0; int lastGen1Count = 0; int checkInterval = _old.Length / 10; int lastChecked = 0; int iCheckedEnd = 0; int timeoutInterval = 5; double pinRatio = 0.1; bool fIsPinned = false; int iPinInterval = (int)((double)1 / pinRatio); Console.WriteLine("Pinning every {0} object", iPinInterval); int iNextPin = _rand.getRand(iPinInterval * 4) + 1; int iPinnedObject = 0; int iPinnedMidSize = _mean_old_alloc_size * 2; int countObjects = 0; int countObjectsGen1 = 0; int[] countWithGen = new int[3]; MiddlePin[] steadyPinningArray = new MiddlePin[100]; GCHandle[] steadyPinningHandles = new GCHandle[100]; int steadyPinningIndex = 0; for (steadyPinningIndex = 0; steadyPinningIndex < steadyPinningArray.Length; steadyPinningIndex++) { steadyPinningArray[steadyPinningIndex] = new MiddlePin(); steadyPinningHandles[steadyPinningIndex] = new GCHandle(); } for (int j = 0; j < _iter_count; j++) { if (steadyPinningIndex >= steadyPinningArray.Length) { steadyPinningIndex = 0; // Console.WriteLine("steady array wrapped, press enter to continue"); // Console.ReadLine(); } byte[] tempObj = new byte[1]; steadyPinningArray[steadyPinningIndex].smallNonePinned = new byte[8]; steadyPinningArray[steadyPinningIndex].pinnedObj = new byte[8]; steadyPinningArray[steadyPinningIndex].nonePinned = new byte[24]; steadyPinningHandles[steadyPinningIndex] = GCHandle.Alloc(steadyPinningArray[steadyPinningIndex].pinnedObj, GCHandleType.Pinned); steadyPinningArray[steadyPinningIndex].smallNonePinned[3] = 0x31; steadyPinningArray[steadyPinningIndex].smallNonePinned[5] = 0x51; steadyPinningArray[steadyPinningIndex].smallNonePinned[7] = 0x71; steadyPinningArray[steadyPinningIndex].pinnedObj[3] = 0x21; steadyPinningArray[steadyPinningIndex].pinnedObj[5] = 0x41; steadyPinningArray[steadyPinningIndex].pinnedObj[7] = 0x61; tempObj = new byte[256]; steadyPinningIndex++; countObjects = 0; countObjectsGen1 = 0; iCheckedEnd = lastChecked + checkInterval; if (iCheckedEnd > _old.Length) { iCheckedEnd = _old.Length; } //Console.WriteLine("timing out item {0} to {1}", lastChecked, iCheckedEnd); // time out requests in this range. // for the range we are looking at time out requests (ie, end them and replace them with new ones). // we go from the beginning of the range to the end, time out every Nth one; then time out everyone // after that, and so on. for (int iIter = 0; iIter < timeoutInterval; iIter++) { for (int iCheckIndex = 0; iCheckIndex < ((iCheckedEnd - lastChecked) / timeoutInterval); iCheckIndex++) { int iItemIndex = (lastChecked + iCheckIndex * timeoutInterval + iIter) % _old.Length; // Console.WriteLine("replacing item {0}", iItemIndex); _old[iItemIndex].Free(); countObjects++; if ((countObjects % 10) == 0) { byte[] temp = new byte[_mean_med_alloc_size * 3]; temp[0] = (byte)27; // 0x1b } else if ((countObjects % 4) == 0) { byte[] temp = new byte[1]; temp[0] = (byte)27; // 0x1b } if (countObjects == iNextPin) { fIsPinned = true; iNextPin += _rand.getRand(iPinInterval * 4) + 1; } else { fIsPinned = false; } iPinnedMidSize = _mean_old_alloc_size * 2; if (fIsPinned) { iPinnedObject++; if ((iPinnedObject % 10) == 0) { iPinnedMidSize = _mean_old_alloc_size * 10; } } //Console.WriteLine("perm {0}, mid {1}, {2}", mean_old_alloc_size, iPinnedMidSize, (fIsPinned ? "pinned" : "not pinned")); _old[iItemIndex] = new MyRequest(_mean_old_alloc_size, iPinnedMidSize, fIsPinned); } } for (int i = 0; i < 3; i++) { countWithGen[i] = 0; } // Console.WriteLine("Checking {0} to {1}", lastChecked, iCheckedEnd); for (int iItemIndex = lastChecked; iItemIndex < iCheckedEnd; iItemIndex++) { //int iGen = GC.GetGeneration(old[iItemIndex].mObj); int iGen = _rand.getRand(3); countWithGen[iGen]++; if (iGen == 1) { //Console.WriteLine("item {0} is in gen1, getting rid of it", iItemIndex); if ((countObjectsGen1 % 5) == 0) _old[iItemIndex].mObj = null; countObjectsGen1++; } } // Console.WriteLine("{0} in gen0, {1} in gen1, {2} in gen2", // countWithGen[0], // countWithGen[1], // countWithGen[2]); // // Console.WriteLine("{0} objects out of {1} are in gen1", countObjectsGen1, (iCheckedEnd - lastChecked)); if (iCheckedEnd == _old.Length) { lastChecked = 0; } else { lastChecked += checkInterval; } int currentGen1Count = GC.CollectionCount(1); if ((currentGen1Count - lastGen1Count) > 30) { GC.Collect(2, GCCollectionMode.Forced, false); Console.WriteLine("{0}: iter {1}, heap size: {2}", _index, j, GC.GetTotalMemory(false)); lastGen1Count = currentGen1Count; } } for (steadyPinningIndex = 0; steadyPinningIndex < steadyPinningArray.Length; steadyPinningIndex++) { if (steadyPinningHandles[steadyPinningIndex].IsAllocated) steadyPinningHandles[steadyPinningIndex].Free(); } stopwatch.Stop(); Console.WriteLine("{0}: steady: {1:d} seconds({2:d} ms. Heap size {3})", _index, (int)stopwatch.Elapsed.TotalSeconds, (int)stopwatch.Elapsed.TotalMilliseconds, GC.GetTotalMemory(false)); }
// This pins every few objects (defined by pinRatio) in the old array. // med is just created with non pinned. public void AllocTest() { // Console.WriteLine(index + ": Allocating memory - old: " + num_old_data + "[~" + mean_old_alloc_size + "]; med: " // + num_med_data + "[~" + mean_med_alloc_size + "]"); Stopwatch stopwatch = new Stopwatch(); stopwatch.Reset(); stopwatch.Start(); _old = new MyRequest[_num_old_data]; _med = new MyRequest[_num_med_data]; bool fIsPinned = false; int iPinInterval = (int)((double)1 / _pinRatio); //Console.WriteLine("Pinning approx every {0} object", iPinInterval); int iPinnedObject = 0; int iPinnedMidSize = 0; //int iNextPin = iPinInterval / 5 + rand.getRand(iPinInterval); int iNextPin = _rand.getRand(iPinInterval * 4) + 1; //Console.WriteLine("Pin object {0}", iNextPin); for (int j = 0; j < _old.Length; j++) { //old [j] = new byte [GetSizeRandom (mean_old_alloc_size)]; if (j == iNextPin) { fIsPinned = true; //iNextPin = j + iPinInterval / 5 + rand.getRand(iPinInterval); iNextPin = j + _rand.getRand(iPinInterval * 4) + 1; //Console.WriteLine("Pin object {0}", iNextPin); } else { fIsPinned = false; } iPinnedMidSize = _mean_old_alloc_size * 2; if (fIsPinned) { iPinnedObject++; if ((iPinnedObject % 10) == 0) { iPinnedMidSize = _mean_old_alloc_size * 10; //Console.WriteLine("{0}th pinned object, non pin size is {1}", iPinnedObject, iPinnedMidSize); } else { //Console.WriteLine("{0}th pinned object, non pin size is {1}", iPinnedObject, iPinnedMidSize); } } //Console.WriteLine("item {0}: {1}, pin size: {2}, non pin size: {3}", j, (fIsPinned ? "pinned" : "not pinned"), mean_old_alloc_size, iPinnedMidSize); byte[] temp = new byte[_mean_med_alloc_size * 3]; _old[j] = new MyRequest(_mean_old_alloc_size, iPinnedMidSize, fIsPinned); //if ((j % (old.Length / 10)) == 0) //{ // Console.WriteLine("{0}: allocated {1} on old array, {2}ms elapsed, Heap size {3}, gen0: {4}, gen1: {5}, gen2: {6})", // index, // j, // (int)stopwatch.Elapsed.TotalMilliseconds, // GC.GetTotalMemory(false), // GC.CollectionCount(0), // GC.CollectionCount(1), // GC.CollectionCount(2)); //} } //Console.WriteLine("pinned {0} objects out of {1}", iPinnedObject, old.Length); { // Console.WriteLine("{0}: allocated {1} on old array, {2}ms elapsed, Heap size {3}, gen0: {4}, gen1: {5}, gen2: {6})", // index, // old.Length, // (int)stopwatch.Elapsed.TotalMilliseconds, // GC.GetTotalMemory(false), // GC.CollectionCount(0), // GC.CollectionCount(1), // GC.CollectionCount(2)); } for (int j = 0; j < _med.Length; j++) { //med [j] = new byte [GetSizeRandom (mean_med_alloc_size)]; _med[j] = new MyRequest(_mean_med_alloc_size, (_mean_med_alloc_size * 2), false); } stopwatch.Stop(); // Console.WriteLine ("{0}: startup: {1:d} seconds({2:d} ms. Heap size {3})", // index, (int)stopwatch.Elapsed.TotalSeconds, (int)stopwatch.Elapsed.TotalMilliseconds, // GC.GetTotalMemory(false)); }