public void Question_Add() { var model = new VM_Question(); M_Exam_Sys_Questions questMod = Question_FillMod(); if (Mid > 0) { questBll.GetUpdate(questMod); } else { questMod.p_id = questBll.GetInsert(questMod); } SafeSC.WriteFile(questMod.GetOPDir(), Request.Form["Optioninfo_Hid"]); if (model.IsSmall > 0)//判断当前是否是添加小题状态 { DataTable dt = questBll.SelByIDSForType(questMod.p_id.ToString()); string json = JsonConvert.SerializeObject(dt); //function.Script(this, "parent.SelQuestion(" + json + ")"); } else { function.WriteSuccessMsg("操作成功!", "QuestList?NodeID=" + model.NodeID); return; } }
protected void btnSave_Click(object sender, EventArgs e) { int num = TxtFilename.Value.IndexOf("."); if (num > 0) { TxtFilename.Value = TxtFilename.Value.Substring(0, num); } TxtFilename.Value = TxtFilename.Value + ".html"; string fileExtension = System.IO.Path.GetExtension(TxtFilename.Value.Trim()).ToLower(); if (Page.IsValid) { if (Hdnmethod.Value == "add") { SafeSC.WriteFile(FileVPath + "/" + TxtFilename.Value, textContent.Text); } else if (Hdnmethod.Value == "append") { SafeSC.WriteFile(FileVPath, textContent.Text); } string sPath = HdnShowPath.Value;//.Replace("", ""); function.WriteSuccessMsg("操作成功", "TemplateManage.aspx?setTemplate=" + Server.UrlEncode(TemplateDir) + "&Dir=" + sPath); } }
public IActionResult TalkLog_Down() { DataTable dt = msgbll.SelByWhere(mu.UserID, buser.GetUserByName(RequestEx["reuser"]).UserID, RequestEx["sdate"], RequestEx["edate"]); if (dt.Rows.Count < 1) { return(WriteErr("没有聊天记录,无法导出")); } StringBuilder sb = new StringBuilder(); foreach (DataRow dr in dt.Rows) { sb.Append(dr["UserName"] + dr["CDate"].ToString() + ":\r\n"); sb.Append(dr["Content"].ToString() + "\r\n"); sb.Append("---------------------------------------------------------------\r\n"); } string vpath = "/Temp/ChatHis/"; string filename = function.GetRandomString(8) + ".txt"; SafeSC.WriteFile(vpath + filename, sb.ToString()); //SafeSC.DownFile(vpath + filename); SafeSC.DelFile(vpath + filename); // Response.End(); return(View()); }
public void Design_Save() { M_UserInfo mu = buser.GetLogin(); M_APP_APPTlp tlpMod = new M_APP_APPTlp(); string saveurl = "", fname = ""; int Mid = DataConverter.CLng(Request["ID"]); //-------------------------------- string head = HttpUtility.UrlDecode(Request.Form["Head_Hid"]); string html = Request.Form["AllHtml_Hid"]; int start = html.IndexOf(Call.Boundary) + Call.Boundary.Length; int len = html.Length - start; html = "<body>" + html.Substring(start, len); //处理iframe中标签错位Bug head = head.Replace(Call.Boundary, html); if (Mid > 0) //更新 { tlpMod = tlpBll.SelReturnModel(Mid); tlpMod.Alias = Request.Form["TlpName_T"]; tlpBll.UpdateByID(tlpMod); SafeSC.WriteFile(tlpMod.TlpUrl, head); } else { saveurl = "/App/AppTlp/Users/" + mu.UserName + mu.UserID + "/";//存储模板路径 fname = DateTime.Now.ToString("yyyyMMddhhmm") + function.GetRandomString(4) + Path.GetExtension(VPath); tlpMod.CDate = DateTime.Now; tlpMod.Alias = Request.Form["TlpName_T"]; tlpMod.TlpUrl = saveurl + fname; tlpMod.UserID = mu.UserID; tlpBll.Insert(tlpMod); SafeSC.WriteFile(saveurl + fname, head); } function.WriteSuccessMsg("模板保存成功", "/App//MyTlpList"); }
protected void Save_Btn_Click(object sender, EventArgs e) { M_UserInfo mu = buser.GetLogin(); M_APP_APPTlp tlpMod = new M_APP_APPTlp(); string saveurl = "", fname = ""; //-------------------------------- string head = HttpUtility.UrlDecode(Head_Hid.Value); string html = AllHtml_Hid.Value; int start = html.IndexOf(Call.Boundary) + Call.Boundary.Length; int len = html.Length - start; html = "<body>" + html.Substring(start, len); //处理iframe中标签错位Bug head = head.Replace(Call.Boundary, html); if (Mid > 0) //更新 { tlpMod = tlpBll.SelReturnModel(Mid); tlpMod.Alias = TlpName_T.Text; tlpBll.UpdateByID(tlpMod); SafeSC.WriteFile(tlpMod.TlpUrl, head); } else { saveurl = "/App/AppTlp/Users/" + mu.UserName + mu.UserID + "/";//存储模板路径 fname = DateTime.Now.ToString("yyyyMMddhhmm") + function.GetRandomString(4) + Path.GetExtension(VPath); tlpMod.CDate = DateTime.Now; tlpMod.Alias = TlpName_T.Text; tlpMod.TlpUrl = saveurl + fname; tlpMod.UserID = mu.UserID; tlpBll.Insert(tlpMod); SafeSC.WriteFile(saveurl + fname, head); } function.WriteSuccessMsg("模板保存成功", "/App/AppTlp/MyTlpList.aspx"); }
public void HtmlToImage(string html, string imgPath) { //html文件与图片放同一目录 string htmlPath = imgPath.Split('.')[0] + ".html"; string pdfPath = imgPath.Split('.')[0] + ".pdf"; SafeSC.WriteFile(htmlPath, html); HtmlToPdf(htmlPath, pdfPath); PdfToImage(pdfPath, imgPath); }
protected void Save_Btn_Click(object sender, EventArgs e) { string head = HttpUtility.UrlDecode(Head_Hid.Value); string html = AllHtml_Hid.Value; int start = html.IndexOf(Call.Boundary) + Call.Boundary.Length; int len = html.Length - start; html = "<body>" + html.Substring(start, len);//处理iframe中标签错位Bug head = head.Replace(Call.Boundary, html); SafeSC.WriteFile(HttpUtility.UrlDecode(VPath), head); function.WriteSuccessMsg("模板保存成功"); }
/// <summary> /// 保存事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void EBtnSubmit_Click(object sender, EventArgs e) { string[] cont = GetContent(); bq = new B_Exam_Sys_Questions(); int id = DataConverter.CLng(hfpid.Value); M_Exam_Sys_Questions questions = bq.GetSelect(id); questions.p_Shipin = hffilename.Value; questions.p_shuming = this.shuming.Text; questions.p_Content = this.txtP_Content.Text; questions.p_ChoseNum = DataConverter.CLng(ddlNumber1.SelectedValue); questions.p_defaultScores = DataConverter.CFloat(txtCourse.Text); if (cont != null && cont.Length > 0) { questions.p_Answer = cont[1]; } if (cont != null && cont.Length > 0) { SafeSC.WriteFile(M_Exam_Sys_Questions.OptionDir + id + ".opt", cont[0]); } //questions.p_Optioninfo = cont[0]; if (id > 0) //修改 { bool result = bq.GetUpdate(questions); if (result) { function.WriteSuccessMsg("修改成功!"); Response.Write("<script>window.close();</script>"); } else { function.WriteErrMsg("修改失败!"); } } else //添加 { questions.p_Type = DataConverter.CLng(ddlType.SelectedValue); questions.p_Inputer = badmin.GetAdminLogin().AdminName; //当前登录ID questions.p_CreateTime = DateTime.Now.Date; questions.p_Views = 1; questions.parentId = DataConverter.CLng(hfParentId.Value); int result = bq.GetInsert(questions); if (result > 0) { Response.Write("<script>alert('添加成功!');window.close();</script>"); } else { function.WriteErrMsg("添加失败!"); } } }
private void CreateDataLabel(M_ModelInfo info) { //创建数据源标签 M_Label lab = new M_Label(); lab.LableName = info.ModelName + "数据源标签"; lab.LabelCate = "数据源标签"; lab.LableType = 3; lab.LabelTable = "ZL_CommonModel left join " + info.TableName + " on ZL_CommonModel.ItemID=" + info.TableName + ".ID"; lab.LabelField = "ZL_CommonModel.*," + info.TableName + ".*"; lab.LabelWhere = "ZL_CommonModel.GeneralID=@InfoID"; lab.Param = "InfoID,0,2,内容ID"; lab.LabelOrder = ""; lab.LabelCount = ""; lab.Content = ""; lab.Desc = info.ModelName + "数据源标签"; lab.LabelNodeID = 0; B_Label blab = new B_Label(); //blab.AddLabel(lab); blab.AddLabelXML(lab); //创建空白内容页模板并绑定到模型 string fname = "默认" + info.ModelName + "内容页.html"; info.ContentModule = "内容页/" + fname; string vpath = SiteConfig.SiteOption.TemplateDir + "/内容页/" + fname; string strcontent = @"{ZL.Source id=""[ZL_Modelname/]"" /} <!DOCTYPEHTML> <html> <head> <meta http-equiv=""Content-Type"" content=""text/html;charset=utf-8""/> <title>{SField sid=""[ZL_Modelname/]"" FD=""Title"" page=""0""/}</title> {ZL:Boot()/} <meta name=""Keywords"" content=""{SField sid=""[ZL_Modelname/]"" FD=""Tagkey"" page=""0"" /}""> <style> .container-fulid{ height:50vh;padding-top:10%;background:#ccc;text-align:center;} span{font-size:10em;} </style> </head> <body> <div class=""container-fulid""> <div class=""row""> <span class=""fa fa-info-circle""></span><h1>模板内容放这里!</h1><a href=""/hlep.html"" target=""_blank"">快速帮助></a> </div> </div> </body> </html>"; strcontent = strcontent.Replace("[ZL_Modelname/]", info.ModelName + "数据源标签"); SafeSC.WriteFile(vpath, strcontent); }
protected void EBtnSubmit_Click(object sender, EventArgs e)//保存 { if (this.Page.IsValid) { M_ModelInfo info = new M_ModelInfo(); info.ModelID = DataConverter.CLng(this.HdnModelId.Value); info.ModelName = this.TxtModelName.Text; if (info.ModelID > 0) { info.TableName = this.TxtTableName.Text; } else { info.TableName = this.LblTablePrefix.Text + this.TxtTableName.Text; } info.ItemName = this.TxtItemName.Text; info.ItemUnit = this.TxtItemUnit.Text; info.ItemIcon = this.TxtItemIcon.Text; info.Description = this.TxtDescription.Text; info.ModelType = 4; if (info.ModelID == 0) { //创建数据源标签 M_Label lab = new M_Label(); lab.LableName = info.ModelName + "数据源标签"; lab.LabelCate = "数据源标签"; lab.LableType = 3; lab.LabelTable = "ZL_CommonModel left join " + info.TableName + " on ZL_CommonModel.ItemID=" + info.TableName + ".ID"; lab.LabelField = "ZL_CommonModel.*," + info.TableName + ".*"; lab.LabelWhere = "ZL_CommonModel.GeneralID=@InfoID"; lab.Param = "InfoID,0,2,内容ID"; lab.LabelOrder = ""; lab.LabelCount = ""; lab.Content = ""; lab.Desc = info.ModelName + "数据源标签"; lab.LabelNodeID = 0; B_Label blab = new B_Label(); blab.AddLabelXML(lab); //创建空白内容页模板并绑定到模型 string strPath = "默认" + info.ModelName + "内容页.html"; SafeSC.WriteFile(SiteConfig.SiteOption.TemplateDir + "/内容页/" + strPath, info.ModelName + "内容页"); this.bll.AddModel(info); Response.Redirect("../Content/ModelManage.aspx?ModelType=4"); } else { this.bll.UpdateModel(info); Response.Redirect("../Content/ModelManage.aspx?ModelType=4"); } } }
public void Question_Add() { var model = new VM_Question(); M_Exam_Sys_Questions questMod = Question_FillMod(); if (Mid > 0) { questBll.GetUpdate(questMod); } else { questMod.p_id = questBll.GetInsert(questMod); } SafeSC.WriteFile(questMod.GetOPDir(), Request.Form["Optioninfo_Hid"]); function.WriteSuccessMsg("操作成功!", "QuestList?NodeID=" + model.NodeID); }
public IActionResult Question_Add() { var model = new VM_Question(HttpContext); M_Exam_Sys_Questions questMod = Question_FillMod(); if (Mid > 0) { questBll.GetUpdate(questMod); } else { questMod.p_id = questBll.GetInsert(questMod); } SafeSC.WriteFile(questMod.GetOPDir(), RequestEx["Optioninfo_Hid"]); return(WriteOK("操作成功!", "QuestList?NodeID=" + model.NodeID)); }
public IActionResult CSSEdit_Submit() { string CSSPath = ""; if (!string.IsNullOrEmpty(FilePath)) { CSSPath = CSSBaseDir + FilePath.Split('.')[0] + ".css"; } else { string fname = GetParam("TxtFilename").Replace(" ", "").Split('.')[0]; if (SafeC.FileNameCheck(fname)) { return(WriteErr("文件名不符合规则")); } CSSPath = CSSBaseDir + fname + ".css"; } SafeSC.WriteFile(CSSPath, GetParam("textContent")); return(WriteOK("操作成功", "CSSManage")); }
protected void Button1_Click(object sender, EventArgs e) { int num = TxtFilename.Value.IndexOf("."); if (num > 0) { TxtFilename.Value = TxtFilename.Value.Substring(0, num); } TxtFilename.Value = TxtFilename.Value + ".css"; string fileExtension = System.IO.Path.GetExtension(TxtFilename.Value.Trim()).ToLower(); if (this.Page.IsValid) { if (this.Hdnmethod.Value == "add" || this.Hdnmethod.Value == "append") { this.FilePath = this.HdnFilePath.Value; SafeSC.WriteFile(function.PToV(FilePath), textContent.Text); } string sPath = this.HdnShowPath.Value.Replace("/", ""); base.Response.Redirect("CssManage.aspx?Dir=" + sPath); } }
protected void CreateFont_Btn_Click(object sender, EventArgs e) { string fontsrc = Font_DP.SelectedValue + ".ttf"; string tlp = SafeSC.ReadFileStr("/WebFont/tlp.html"); DataRow dr = codeBll.NewModel(); dr["Text"] = StringHelper.SubStr(T1.Text, 500, ""); dr["FlowCode"] = DateTime.Now.ToString("yyyyMMddHHmm") + function.GetRandomString(6); dr["CDate"] = DateTime.Now; tlp = tlp.Replace("{Text}", dr["Text"].ToString()); string fontdir = "/WebFont/Users/" + dr["FlowCode"].ToString() + "/"; dr["FontDir"] = function.VToP(fontdir); SafeSC.WriteFile(fontdir + "tlp.html", tlp); dr["ZStatus"] = 0; //1,将选定的字体拷入 string src = "/WebFont/Fonts/" + fontsrc; string tar = fontdir + "pen.ttf"; Copy(src, tar); int id = codeBll.Insert(dr); result_div.Visible = true; result_t_div.InnerText = T1.Text; r_quote_t.Text = GetQuote(dr["FlowCode"].ToString(), "pen"); font_css.InnerHtml = GetQuote(dr["FlowCode"].ToString(), "pen"); //2,运行命令开始生成(命令行中已处理) //3,拷贝完成后回发指令,表示完成,客户端可预览或下载 while (Response.IsClientConnected) { System.Threading.Thread.Sleep(1000); dr = codeBll.SelByID(id); if (dr["ZStatus"].ToString().Equals("1")) { break; } } }
public IActionResult TemplateEdit_Submit() { if (string.IsNullOrEmpty(GetParam("FileName_T"))) { return(WriteErr("未指定文件名称")); } string oldfname = Path.GetFileNameWithoutExtension(RealVPath); string newfname = GetParam("FileName_T"); if (SafeSC.FileNameCheck(newfname)) { return(WriteErr("文件名或后缀名不符合规范,不可包含特殊字符")); } if (string.IsNullOrEmpty(Path.GetExtension(RealVPath))) { SafeSC.WriteFile(FileDir + newfname + ".html", GetParam("textContent")); } else { SafeSC.WriteFile(RealVPath, GetParam("textContent")); } return(WriteOK("保存成功")); }
// 保存 protected void EBtnSubmit_Click(object sender, EventArgs e) { M_Exam_Sys_Questions questMod = FillMod(); if (Mid > 0) { questBll.GetUpdate(questMod); } else { questMod.p_id = questBll.GetInsert(questMod); } SafeSC.WriteFile(questMod.GetOPDir(), Optioninfo_Hid.Value); if (IsSmall > 0)//判断当前是否是添加小题状态 { DataTable dt = questBll.SelByIDSForType(questMod.p_id.ToString()); string json = JsonConvert.SerializeObject(dt); function.Script(this, "parent.SelQuestion(" + json + ")"); } else { function.WriteSuccessMsg("操作完成!", "QuestList.aspx?NodeID=" + NodeID); } }
protected void BtnSubmit_Click(object sender, EventArgs e) { SafeSC.WriteFile(vdir + TlpName, TxtContent.Value); function.WriteSuccessMsg("操作成功", "MailSysTlp.aspx"); }
public IActionResult PWA_Submit() { string dir = ZLHelper.GetUploadDir_System("PWA"); string dir_icon = (dir + function.GetRandomString(8) + "_icon-");//文件名不重复,避免更新不生效 string ext = ".png"; var file = Request.Form.Files["pwa_icon_up"]; if (file != null && file.Length > 100) { //144 96 //192 180 152 120 76 int[] sizes = new int[] { 180, 152, 120, 76, 144, 96 }; //--------------------- System.Drawing.Image img = System.Drawing.Image.FromStream(file.OpenReadStream()); if (img.Width != 192 || img.Height != 192) { return(WriteErr("上传的图片宽高必须为192*192")); } ImgHelper imgHelp = new ImgHelper(); foreach (int size in sizes) { System.Drawing.Bitmap bmp = imgHelp.ZoomImg(img, size, size); string path = dir_icon + size + ext; imgHelp.SaveImg(path, bmp); img = System.Drawing.Image.FromStream(file.OpenReadStream()); } ImgHelper.SaveImage(dir_icon + "192" + ext, img); SiteConfig.SiteOption.PWA_Icon = dir_icon + "192" + ext; } //-------------------写入文件生成mainfest string json = SafeSC.ReadFileStr("/lib/pwa/pwa.json"); json = json.Replace("@short_name", GetParam("ShortName_T")) .Replace("@name", GetParam("Name_T")) .Replace("@background_color", string.IsNullOrEmpty(GetParam("BKColor_T")) ? "#fff" : GetParam("BKColor_T")) .Replace("@icon96", dir_icon + "96" + ext) .Replace("@icon144", dir_icon + "144" + ext) .Replace("@start_url", GetParam("StartUrl_T")); SafeSC.WriteFile(dir + "manifest.json", json); StringBuilder sb = new StringBuilder(); sb.Append("<link rel=\"manifest\" href=\"" + dir + "manifest.json\">\n"); sb.Append("<meta name=\"apple-mobile-web-app-capable\" content=\"yes\"/>\n"); sb.Append("<meta name=\"apple-mobile-web-app-status-bar-style\" content=\"black-translucent\" />\n"); sb.Append("<meta name=\"apple-mobile-web-app-title\" content=\"" + GetParam("ShortName_T") + "\">\n"); foreach (int size in (new int[] { 180, 152, 120, 76 })) { string path = dir_icon + size + ext; sb.Append("<link rel=\"apple-touch-icon\" sizes=\"" + size + "x" + size + "\" href=\"" + path + "\" />\n"); } sb.Append("<link rel=\"icon\" sizes=\"192x192\" href=\"" + (dir_icon + "192" + ext) + "\" />"); //QuoteContent_T.Text = sb.ToString(); SiteConfig.SiteOption.PWA_ShortName = GetParam("ShortName_T"); SiteConfig.SiteOption.PWA_Name = GetParam("Name_T"); SiteConfig.SiteOption.PWA_BKColor = GetParam("BKColor_T"); SiteConfig.SiteOption.PWA_StartUrl = GetParam("StartUrl_T"); SiteConfig.SiteOption.PWA_Content = sb.ToString(); SiteConfig.Update(); return(WriteOK("PWA配置保存成功")); }
protected void EBtnSubmit_Click(object sender, EventArgs e) { if (this.Page.IsValid) { if (!String.IsNullOrEmpty(this.TxtTableName.Text)) { string str = this.TxtTableName.Text; bool b = this.bll.isExistTableName("ZL_P_" + str); if (b) { function.WriteErrMsg("数据库表名已存在,请重新输入!"); return; } } M_ModelInfo info = new M_ModelInfo(); info.ModelID = DataConverter.CLng(this.HdnModelId.Value); info.ModelName = this.TxtModelName.Text; if (info.ModelID > 0) { info.TableName = this.TxtTableName.Text; } else { info.TableName = this.LblTablePrefix.Text + this.TxtTableName.Text; } info.ItemName = this.TxtItemName.Text; info.ItemUnit = this.TxtItemUnit.Text; info.ItemIcon = this.TxtItemIcon.Text; info.Description = this.TxtDescription.Text; info.ModelType = 2; info.MultiFlag = true; if (info.ModelID == 0) { //创建数据源标签 M_Label lab = new M_Label(); lab.LableName = info.ModelName + "数据源标签"; lab.LabelCate = "数据源标签"; lab.LableType = 3; lab.LabelTable = "ZL_Commodities left join " + info.TableName + " on ZL_Commodities.ItemID=" + info.TableName + ".ID"; lab.LabelField = "ZL_Commodities.*," + info.TableName + ".*"; lab.LabelWhere = "ZL_Commodities.ID=@InfoID"; lab.Param = "InfoID,0,2,商品ID"; lab.LabelOrder = ""; lab.LabelCount = ""; lab.Content = ""; lab.Desc = info.ModelName + "数据源标签"; lab.LabelNodeID = 0; B_Label blab = new B_Label(); //blab.AddLabel(lab); blab.AddLabelXML(lab); //创建空白内容页模板并绑定到模型 string strPath = "默认" + info.ModelName + "内容页.html"; info.ContentModule = "/内容页/" + strPath; SafeSC.WriteFile(SiteConfig.SiteOption.TemplateDir + "/内容页/" + strPath, info.ModelName + "内容页"); bool iscrate = this.bll.AddModel(info); if (iscrate) { Response.Redirect("ModelManage.aspx"); } } else { if (this.bll.UpdateModel(info)) { Response.Redirect("ModelManage.aspx"); } } } Response.Redirect("ModelManage.aspx"); }