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 EGV_RowCommand(object sender, GridViewCommandEventArgs e) { M_UserInfo mu = buser.GetLogin(); switch (e.CommandName) { case "capp": M_App appMod = new M_App(); appMod.APKMode = 2; appMod.AppName = "temp"; appMod.MyStatus = 0; appMod.UserID = mu.UserID.ToString(); break; case "down": { int id = Convert.ToInt32(e.CommandArgument); M_APP_APPTlp tlpMod = tlpBll.SelReturnModel(id); if (tlpMod.UserID != mu.UserID) { function.WriteErrMsg("你没有下载该模板的权限"); } SafeSC.DownFile(tlpMod.TlpUrl); } break; } }
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 Tlp_Down(int id) { M_APP_APPTlp tlpMod = tlpBll.SelReturnModel(id); if (tlpMod.UserID != buser.GetLogin().UserID) { function.WriteErrMsg("你没有下载该模板的权限"); } SafeSC.DownFile(tlpMod.TlpUrl); }
public void App_Create() { if (!Directory.Exists(@"C:\APPTlp\")) { function.WriteErrMsg("环境未配置,APP模板目录不存在!"); } string xml = SafeSC.ReadFileStr("/APP/Res/config.xml"); int Mid = DataConverter.CLng(Request["ID"]); M_UserInfo mu = buser.GetLogin(); M_App appMod = appBll.Select(Mid); if (appMod == null || DataConverter.CLng(appMod.UserID) != mu.UserID) { function.WriteErrMsg("APP不存在,或你无权访问该APP"); } //------------------------------------------------------------------ appMod.AppName = Request.Form["appname"].Trim(); appMod.Author = Request.Form["author"].Trim(); appMod.Description = Request.Form["description"]; appMod.Template = ""; int tlpID = DataConverter.CLng(Request.Form["idrad"]); if (tlpID > 0) { M_APP_APPTlp tlpMod = tlpBll.SelReturnModel(tlpID); appMod.Template = Server.MapPath(tlpMod.TlpUrl); } string appicon = Request.Form["appicon"]; string splash = Request.Form["splash"]; SaveFile(appMod.APPDir + "\\icon.png", appicon, "/APP/Res/icon.png"); //安装时显示的图标 SaveFile(appMod.APPDir + "\\screen.png", splash, "/APP/Res/screen.png"); //程序图标 switch (appMod.APKMode) { case 0: xml = xml.Replace("@launchUrl", appMod.Furl); break; case 1: xml = xml.Replace("@launchUrl", "file:///android_asset/www/index.html"); break; } xml = xml.Replace("@APPName", appMod.AppName) .Replace("@author", appMod.Author).Replace("@description", appMod.Description); System.IO.File.WriteAllBytes(appMod.APPDir + "\\config.xml", System.Text.Encoding.UTF8.GetBytes(xml)); appBll.Update(appMod); function.WriteSuccessMsg("已提交APP生成申请,正在审核生成,请稍等一分钟左右", "APPList"); }
protected void Page_Load(object sender, EventArgs e) { B_User.CheckIsLogged(); if (!IsPostBack) { if (Mid > 0) { M_UserInfo mu = buser.GetLogin(); M_APP_APPTlp tlpMod = tlpBll.SelReturnModel(Mid); if (tlpMod.UserID != mu.UserID) { function.WriteErrMsg("你无权编辑该模板!"); } } } }
public ActionResult Design() { B_User.CheckIsLogged(); int Mid = DataConverter.CLng(Request["ID"]); if (Mid > 0) { M_UserInfo mu = buser.GetLogin(); M_APP_APPTlp tlpMod = tlpBll.SelReturnModel(Mid); if (tlpMod.UserID != mu.UserID) { function.WriteErrMsg("你无权编辑该模板!"); } } ViewBag.vpath = VPath; return(View()); }