public bool ReBox(string ids) { if (SafeSC.CheckIDS(ids)) { string sql = "Update " + TbName + " Set Status=1 Where ID IN(" + ids + ")"; return(SqlHelper.ExecuteNonQuery(CommandType.Text, sql) > 0); } return(false); }
/// <summary> /// 恢复信息 /// </summary> public void RelByIDS(string ids) { if (string.IsNullOrEmpty(ids)) { return; } SafeSC.CheckIDSEx(ids); DBCenter.UpdateSQL(TbName, "Status=1", "ID IN (" + ids + ")"); }
public bool DelByIds(string ids) { if (SafeSC.CheckIDS(ids)) { string sql = "Delete From " + TbName + " Where ID IN(" + ids + ")"; return(SqlHelper.ExecuteNonQuery(CommandType.Text, sql) > 0); } return(false); }
public void DelByIDS(string ids) { if (string.IsNullOrEmpty(ids)) { return; } SafeSC.CheckIDSEx(ids); DBCenter.DelByIDS(TbName, PK, ids); }
public void Audit(string ids, int audit) { if (string.IsNullOrEmpty(ids)) { return; } SafeSC.CheckIDSEx(ids); DBCenter.UpdateSQL(TbName, "Audit=" + audit, "ID IN (" + ids + ")"); }
public DataTable GetContent(string tablename, int Itemid) { if (string.IsNullOrEmpty(tablename) || Itemid < 1) { return(null); } SafeSC.CheckDataEx(tablename); return(DBCenter.Sel(tablename, "ID=" + Itemid)); }
public string GetSubmit() { string option = SafeSC.ReadFileStr(M_Exam_Sys_Questions.OptionDir + Eval("p_id") + ".opt"); int id = Convert.ToInt32(Eval("p_id")); JArray arr = JsonConvert.DeserializeObject <JArray>(option); StringBuilder builder = new StringBuilder(); //单,多,填,解 switch (DataConverter.CLng(Eval("p_Type"))) { case (int)M_Exam_Sys_Questions.QType.Radio: { if (arr == null || arr.Count < 1) { return("未定义选项"); } string name = "srad_" + id; string tlp = "<li class='opitem'><label><input type='radio' name='{0}' value='{1}'>{1}. {2}</label></li>"; foreach (JObject obj in arr) { builder.Append(string.Format(tlp, name, obj["op"], obj["val"])); } } break; case (int)M_Exam_Sys_Questions.QType.Multi: { if (arr == null || arr.Count < 1) { return("未定义选项"); } string name = "mchk_" + id; string tlp = "<li class='opitem'><label><input class='opitem' type='checkbox' name='{0}' value='{1}'>{1}. {2}</label></li>"; foreach (JObject obj in arr) { builder.Append(string.Format(tlp, name, obj["op"], obj["val"])); } } break; case (int)M_Exam_Sys_Questions.QType.FillBlank: { //string tlp = "<div contenteditable='true' class='answerdiv'>解:</div>"; //builder.Append(tlp); } break; case (int)M_Exam_Sys_Questions.QType.Answer: //放置一个ueditor { string name = "answer_" + id; string tlp = "<div id='" + name + "' contenteditable='true' class='answerdiv'>解:</div>"; builder.Append(tlp); } break; } return(builder.ToString()); }
public ContentResult Product_API() { string action = GetParam("action"); string ids = GetParam("ids"); switch (action) { //case "upmove": // { // M_Product product = proBll.GetproductByid(Mid); // M_Product productPre = proBll.GetNearID(NodeID, product.OrderID, 1); //int NodeID, int CurrentID, int UporDown // if (productPre.OrderID != 0) // { // int CurrOrder = product.OrderID; // product.OrderID = productPre.OrderID; // productPre.OrderID = CurrOrder; // proBll.UpdateOrder(product); // proBll.UpdateOrder(productPre); // } // } // break; //case "downmove": // { // M_Product product = proBll.GetproductByid(Mid); // M_Product productPre = proBll.GetNearID(NodeID, product.OrderID, 0); // if (productPre.ID != 0) // { // int CurrOrder = product.OrderID; // product.OrderID = productPre.OrderID; // productPre.OrderID = CurrOrder; // proBll.UpdateOrder(product); // proBll.UpdateOrder(productPre); // } // } // break; case "refresh": //刷新/重发布,将商品ctreatime和updatatime改为当前值 SafeSC.CheckIDSEx(ids); string date = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"); DBCenter.UpdateSQL(proBll.TbName, "AddTime='" + date + "',UpdateTime='" + date + "'", "ID IN (" + ids + ")"); break; case "del": SafeSC.CheckIDSEx(ids); proBll.RealDelByIDS(ids); break; case "clear": proBll.ClearRecycle(); break; default: proBll.setproduct(action, ids); break; } return(Content(Success.ToString())); }
protected void Add_Btn_Click(object sender, EventArgs e) { if (File_UP.PostedFile.ContentLength < 100) { function.Script(this, "alert('请先选择文件');"); } string vpath = "/UploadFiles/Admin/Temp/WordConver/"; string exname = Path.GetExtension(File_UP.FileName).ToLower().Replace(".", ""); //string fpath = SafeSC.SaveFile(vpath, File_UP.PostedFile); string fpath = vpath + Path.GetFileName(File_UP.FileName); File_UP.SaveAs(fpath); if ("doc,docx,rtf".Split(',').Contains(exname)) { Document doc = new Document(Server.MapPath(fpath)); vpath = vpath + function.GetRandomString(3) + "/"; string dirpath = Server.MapPath(vpath); string htmlpath = dirpath + function.GetRandomString(3) + ".html"; if (!Directory.Exists(dirpath)) { Directory.CreateDirectory(dirpath); } doc.Save(htmlpath, SaveFormat.Html); string text = SafeSC.ReadFileStr(htmlpath); text = regHelper.GetValueBySE(text, "<body>", "</body>", false); text = text.Replace("<img", " <img"); MatchCollection matchs = regHelper.GetValuesBySE(text, "<img", "/>"); foreach (Match mc in matchs) { if (string.IsNullOrEmpty(mc.Value)) { continue; } string src = regHelper.GetValueBySE(mc.Value, "src=\"", "\"", false); string newvalue = ""; newvalue = mc.Value.Replace(src, vpath + src); text = text.Replace(mc.Value, newvalue); } text = text.Replace(" ", ""); Content_Div.InnerHtml = text; function.Script(this, "SetContent();"); } else if (exname.Equals("txt")) { string text = SafeSC.ReadFileStr(Server.MapPath(fpath), true); Content_Div.InnerHtml = text; function.Script(this, "SetContent();"); } else if (exname.Equals("rtf")) { } else { function.Script(this, "alert('请上传doc,docx文件!!');"); } }
public void Del(string ids) { if (string.IsNullOrEmpty(ids)) { return; } SafeSC.CheckIDSEx(ids); string where = "ID IN (" + ids + ") "; DBCenter.DelByWhere(TbName, where); }
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 Page_Load(object sender, EventArgs e) { if (!IsPostBack) { String content = SafeSC.ReadFileStr(vdir + TlpName); TxtTempName.Text = TlpName; TxtContent.Value = content; Call.SetBreadCrumb(Master, "<li><a href='" + CustomerPageAction.customPath2 + "Main.aspx'>工作台</a></li><li><a href='" + CustomerPageAction.customPath2 + "User/UserManage.aspx'>用户管理</a></li><li><a href='MailSysTlp.aspx'>系统模板</a></li><li class='active'>修改系统模板</li>"); } }
public bool UpdateByField(string fieldName, string value, string ids) { SafeSC.CheckDataEx(fieldName); SafeSC.CheckIDSEx(ids); string sql = "Update " + strTableName + " Set " + fieldName + " =@value Where [id] in(" + ids + ")"; SqlParameter[] sp = new SqlParameter[] { new SqlParameter("value", value) }; SqlHelper.ExecuteNonQuery(CommandType.Text, sql, sp); return(true); }
public bool DelByIds(string ids) { if (!string.IsNullOrEmpty(ids)) { SafeSC.CheckIDSEx(ids); string sql = "DELETE FROM " + TbName + " WHERE ID IN (" + ids + ")"; return(SqlHelper.ExecuteSql(sql)); } return(false); }
public DataTable SelByMsgIDS(string ids, string source) { SafeSC.CheckIDSEx(ids); List <SqlParameter> sp = new List <SqlParameter>() { new SqlParameter("source", source) }; return(DBCenter.JoinQuery("A.*,B.salt,B.HoneyName,B.UserName", TbName, "ZL_User", "A.CUser=B.UserID AND Source=@source", "MsgID IN (" + ids + ")", "", sp.ToArray())); }
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 DataTable SelByIDS(string ids, string field = "*") { ids = StrHelper.PureIDSForDB(ids); if (string.IsNullOrEmpty(ids)) { return(null); } SafeSC.CheckIDSEx(ids); return(DBCenter.SelWithField(TbName, field, "ID IN(" + ids + ")")); }
// 取消推荐问题 protected void BtnSubmit5_Click(object sender, EventArgs e) { string ids = Request.Form["idchk"]; if (SafeSC.CheckIDS(ids)) { askBll.UpdateByField("Elite", "0", ids); } MyBind(); }
/// <summary> /// 为角色添加新用户 /// </summary> public void AddToRole(string uids, int roleId) { if (string.IsNullOrEmpty(uids) || roleId < 1) { return; } SafeSC.CheckIDSEx(uids); string where = "UserID IN (" + uids + ")"; DBCenter.UpdateSQL(TbName, "UserRole=UserRole+'," + roleId + ",'", where); }
public void DelModelTemplate(int NodeID, string ModelIDs) { ModelIDs = StrHelper.PureIDSForDB(ModelIDs); if (string.IsNullOrEmpty(ModelIDs)) { return; } SafeSC.CheckIDSEx(ModelIDs); DBCenter.DelByWhere("ZL_Node_ModelTemplate", "NodeID=" + NodeID + " AND ModelID Not IN (" + ModelIDs + ")"); }
//public DataTable SelByPid(int pid, bool isall = false) //{ // DataTable dt = new DataTable(); // dt = DBCenter.ExecuteTable("SELECT * FROM ZL_Node WHERE ParentID=" + pid); // dt.DefaultView.RowFilter = "ZStatus IS NULL OR ZStatus NOT IN ('" + (int)ZLEnum.ConStatus.Recycle + "')"; // dt = dt.DefaultView.ToTable(); // return dt; //} public DataTable SelByIDS(string nodeids, string nodeType = "") { SafeSC.CheckIDSEx(nodeids); string where = "NodeID IN (" + nodeids + ")"; if (!string.IsNullOrEmpty(nodeType)) { SafeSC.CheckIDSEx(nodeType); where += " AND NodeType IN (" + nodeType + ")"; } return(DBCenter.Sel(TbName, where, defOrder)); }
protected void DownWord_B_Click(object sender, EventArgs e) { StringWriter sw = new StringWriter(); var mu = buser.GetLogin(); string url = "ExportIDCOrder.aspx?id=" + Mid + "&uname=" + mu.UserName + "&upwd=" + mu.UserPwd; string vpath = "/UploadFiles/IDC订单详情-" + Mid + ".doc"; Server.Execute(url, sw); SafeSC.DownFile(OfficeHelper.W_HtmlToWord(sw.ToString(), vpath)); }
public IActionResult Default_Field() { DataTable dt = new DataTable(); if (!string.IsNullOrEmpty(TbName)) { SafeSC.CheckDataEx(TbName); dt = DBHelper.Table_FieldList(TbName); } return(PartialView(dt)); }
//添加水印,fileName视频地址,imgFile水印图片地址,outputFile输出地址 /// <summary> /// 1,图片文件必须在工作目录下,不能带/,如果要同时加多个或加在其他位置,建议直接用Png透明图 /// 2,水印图片不能大于视频 /// </summary> /// <param name="imgfile">水印图片路径</param> /// <param pos="位置">1:左上,2:右上,3:左下,4:右下</param> public string WaterMark(string infile, string outfile, string imgfile, int pos = 1) { //if (imgfile.Contains("\\") || imgfile.Contains("/")) { throw new Exception("水印图片路径错误"); } infile = function.VToP(infile); outfile = function.VToP(outfile); imgfile = function.VToP(imgfile); if (!File.Exists(imgfile)) { throw new Exception(imgfile + ",不存在"); } if (File.Exists(outfile)) { SafeSC.DelFile(function.PToV(outfile)); } string imgname = Path.GetFileName(imgfile); File.Copy(imgfile, WorkingPath + imgname, true);//图片必须指定工作路径,否则无法加上,图片也不能传全路径 //string param = " -i " + infile + " -vf \"movie=" + imgfile + " [watermark]; [in][watermark] overlay=0:0 [out]\" " + outfile; string param = ""; switch (pos) { case 2: //右上 param = " -i {0} -vf \"movie={1} [watermark]; [in][watermark] overlay=main_w-overlay_w-10:10 [out]\" {2}"; break; case 3: //左下 param = " -i {0} -vf \"movie={1} [watermark]; [in][watermark] overlay=10:main_h-overlay_h-10 [out]\" {2}"; break; case 4: //右下 param = " -i {0} -vf \"movie={1} [watermark]; [in][watermark] overlay=main_w-overlay_w-10:main_h-overlay_h-10 [out]\" {2}"; break; default: //左上 param = " -i {0} -vf \"movie={1} [watermark]; [in][watermark] overlay=0:0 [out]\" {2}"; break; } param = string.Format(param, infile, imgname, outfile); //Top left corner //ffmpeg -i inputvideo.avi -vf "movie=watermarklogo.png [watermark]; [in][watermark] overlay=10:10 [out]" outputvideo.flv //Top right corner //ffmpeg -i inputvideo.avi -vf "movie=watermarklogo.png [watermark]; [in][watermark] overlay=main_w-overlay_w-10:10 [out]" outputvideo.flv //Bottom left corner //ffmpeg -i inputvideo.avi -vf "movie=watermarklogo.png [watermark]; [in][watermark] overlay=10:main_h-overlay_h-10 [out]" outputvideo.flv //Bottom right corner //ffmpeg -i inputvideo.avi -vf "movie=watermarklogo.png [watermark]; [in][watermark] overlay=main_w-overlay_w-10:main_h-overlay_h-10 [out]" outputvideo.flv RunProcess(param, WorkingPath);//第二个参数为物理路径 return(outfile); }
/// <summary> /// 从指定站点下载文件,并保存在指定位置,//下载,迁入ZipClass /// </summary> /// <param name="strUrl">目标Url</param> /// <param name="strFileName">本地物理路径</param> /// <param name="flag">appliatoin[flag]用于存进度</param> /// <param name="ct">当前上下文HttpContext</param> /// <param name="begin">从指定位置开始下载(未实现)</param> public void DownloadFile(string strUrl, string strFileName, string flag = "", HttpContext ct = null, int begin = 0) { if (SafeSC.FileNameCheck(strFileName)) { throw new Exception(strFileName + "取消保存"); } //已完成的,1%长度 int CompletedLength = 0; long percent = 0; long sPosstion = 0; //磁盘现盘文件的长度 //long count = 0;// count += sPosstion,从指定位置开始写入字节 FileStream FStream; if (File.Exists(strFileName)) //如果文件存在 { FStream = File.OpenWrite(strFileName); //打开继续写入,并从尾部开始,用于断点续传 sPosstion = FStream.Length; FStream.Seek(sPosstion, SeekOrigin.Current); //移动文件流中的当前指针 } else { FStream = new FileStream(strFileName, FileMode.Create); sPosstion = 0; } //打开网络连接 try { HttpWebRequest myRequest = (HttpWebRequest)HttpWebRequest.Create(strUrl); //if (CompletedLength > 0)//断点续传 // myRequest.AddRange((int)CompletedLength);//设置Range值,即头,从指定位置开始接收文件.. //向服务器请求,获得服务器的回应数据流 HttpWebResponse webResponse = (HttpWebResponse)myRequest.GetResponse(); long FileLength = webResponse.ContentLength;//文件大小 percent = FileLength / 100; Stream myStream = webResponse.GetResponseStream(); byte[] btContent = new byte[1024]; //开始写入 int count = 0; while ((count = myStream.Read(btContent, 0, 1024)) > 0) //返回读了多少字节,为0表示全部读完 { FStream.Write(btContent, 0, count); //知道有多少个数字节后再写入 CompletedLength += count; if (ct != null && !string.IsNullOrEmpty(flag)) { ct.Application[flag] = CompletedLength; } } myStream.Close(); } finally { FStream.Close(); } }
private void MyBind() { pageMod = pageBll.SelReturnModel(Mid); if (!File.Exists(Server.MapPath(pageMod.PageUrl))) { function.WriteErrMsg(pageMod.PageUrl + "文件不存在"); } PageStr_T.Text = SafeSC.ReadFileStr(pageMod.PageUrl); CodeStr_T.Text = SafeSC.ReadFileStr(pageMod.PageUrl + ".cs"); Call.SetBreadCrumb(Master, "<li><a href='" + customPath2 + "Main.aspx'>工作台</a></li><li><a href='" + customPath2 + "Config/SiteInfo.aspx'>系统设置</a></li><li><a href=\"PageList.aspx\">页面列表</a></li><li class='active'><a href='" + Request.RawUrl + "'>页面源码</a>页面:" + pageMod.PageAlias + "[" + pageMod.PageUrl + "]</li>"); }
public void MyBind() { if (!Directory.Exists(function.VToP(BaseDir))) { SafeSC.CreateDir(BaseDir); } DataTable fileList = FileSystemObject.SearchWord(function.VToP(BaseDir)); EGV.DataSource = fileList; EGV.DataBind(); }
public bool DelByIDS(string ids, int uid) { SafeSC.CheckIDSEx(ids); if (string.IsNullOrEmpty(ids)) { return(false); } string sql = "Delete From " + TbName + " Where ID IN(" + ids + ") And UserID=" + uid; return(SqlHelper.ExecuteNonQuery(CommandType.Text, sql) > 0); }
public void DelToRecycle(string ids) { if (string.IsNullOrEmpty(ids)) { return; } SafeSC.CheckIDSEx(ids); int status = (int)ZLEnum.ConStatus.Recycle; DBCenter.UpdateSQL(TbName, "ZStatus=" + status, "NodeID IN (" + ids + ")"); }
public void UpdateStatus(string ids) { if (string.IsNullOrEmpty(ids)) { return; } SafeSC.CheckIDSEx(ids); string sql = string.Format("Update ZL_CommonModel set IsCatch =1 where GeneralID in ({0})", ids);//生成SQL开始执行 SqlHelper.ExecuteTable(CommandType.Text, sql); }