예제 #1
0
 public static string DeCode(string Text)
 {
     return(Public.DeCode(Text, "DoSeenSoft"));
 }
예제 #2
0
 public static string GetOrderStr()
 {
     return(DateTime.Now.ToString("yyyyMMddhhmmss") + Public.GetRndStr("$a$A$0", 5));
 }
예제 #3
0
 public static string ToString(int v)
 {
     return(Public.ToString(v));
 }
예제 #4
0
 public static int GetRnd()
 {
     return(Public.GetRnd(0, 9));
 }
예제 #5
0
 public static string GetRndStr()
 {
     return(Public.GetRndStr("$a$A", 1));
 }
예제 #6
0
 public static string CutStr(string strSrc, int intLen)
 {
     return(Public.CutStr(strSrc, intLen, "..."));
 }
예제 #7
0
 public static string RemoveHTML(string strSrc)
 {
     return(Public.RemoveHTML(strSrc, false));
 }
예제 #8
0
 public static string UploadFile(FileUpload FileUploadCtrl, string SaveFolder, string SaveName)
 {
     return(Public.UploadFile(FileUploadCtrl.PostedFile, SaveFolder, SaveName, 100000000, true));
 }
예제 #9
0
 public static string UploadFile(FileUpload FileUploadCtrl, string SaveFolder, int CutWidth, int CutHeight)
 {
     return(Public.UploadFile(FileUploadCtrl.PostedFile, SaveFolder, "", 100000000, CutWidth, CutHeight, true));
 }
예제 #10
0
 public static string UploadFile(FileUpload FileUploadCtrl, string SaveFolder, int FileSize)
 {
     return(Public.UploadFile(FileUploadCtrl.PostedFile, SaveFolder, "", FileSize, true));
 }
예제 #11
0
 public static string UploadFile(HttpPostedFile FileUpload, string SaveFolder, string SaveName, int FileMaxSize, bool havePath)
 {
     return(Public.UploadFile(FileUpload, SaveFolder, SaveName, FileMaxSize, 0, 0, havePath));
 }
예제 #12
0
        public static string UploadFile(HttpPostedFile FileUpload, string SaveFolder, string SaveName, int FileMaxSize, int CutWidth, int CutHeight, bool havePath)
        {
            string fileName   = FileUpload.FileName;
            string folderName = "/upload/" + SaveFolder;
            string result;

            if (fileName == "")
            {
                result = "";
            }
            else
            {
                string text2 = HttpContext.Current.Server.MapPath("~" + folderName);
                int    num   = FileUpload.ContentLength / 1024;
                string text3 = fileName.Substring(fileName.LastIndexOf("."));
                string text4 = ".jpg|.jpeg|.gif|.bmp|.png|.doc|.docx|.xls|.xlsx|.pdf|.rar|.dxf|.dwg|.txt|.rar";
                string text5 = "";
                bool   flag  = true;
                try
                {
                    string[] array = text4.ToLower().Split(new char[]
                    {
                        '|'
                    });
                    bool flag2 = false;
                    for (int i = 0; i < array.Length; i++)
                    {
                        if (array[i] == text3)
                        {
                            flag2 = true;
                        }
                    }
                    if (!flag2)
                    {
                        flag = false;
                        Script.AlertAndGoBack("文件格式上传不被许可");
                    }
                    if (num > FileMaxSize)
                    {
                        int num2 = num - FileMaxSize;
                        flag = false;
                        Script.AlertAndGoBack("文件大小超出了" + num2.ToString() + "KB");
                    }
                    if (flag)
                    {
                        if (text2.Contains(text3))
                        {
                            string path = text2.Substring(0, text2.LastIndexOf("\\"));
                            if (!Directory.Exists(path))
                            {
                                Directory.CreateDirectory(path);
                            }
                            FileUpload.SaveAs(text2);
                            result = SaveFolder;
                            return(result);
                        }
                        if (!Directory.Exists(text2))
                        {
                            Directory.CreateDirectory(text2);
                        }
                        text5 = DateTime.Now.Ticks.ToString() + text3;
                        FileUpload.SaveAs(text2 + "/" + text5);
                        if (CutWidth > 0 && CutHeight > 0)
                        {
                            string str   = DateTime.Now.Ticks.ToString() + text3;
                            string text6 = Public.CutPic(folderName + "/" + text5, folderName + "/" + str, CutWidth, CutHeight, 90);
                            File.Delete(HttpContext.Current.Server.MapPath(folderName + "/" + text5));
                            result = text6;
                            return(result);
                        }
                    }
                    if (havePath)
                    {
                        result = folderName + "/" + text5;
                    }
                    else
                    {
                        result = text5;
                    }
                }
                catch (Exception e)
                {
                    Script.AlertAndGoBack("上传文件发生错误");
                    result = "";
                }
            }
            return(result);
        }
예제 #13
0
        public static string GetUserLimit()
        {
            string result;

            try
            {
                if (HttpContext.Current.Request.Cookies["UserLimit"] != null && HttpContext.Current.Request.Cookies["UserLimitUser"] != null)
                {
                    string a    = Public.ToString(HttpUtility.UrlDecode(HttpContext.Current.Request.Cookies["UserLimitUser"].Value));
                    string text = Public.ToString(HttpUtility.UrlDecode(HttpContext.Current.Request.Cookies["UserLimit"].Value));
                    if (text != "" && a == Public.GetUserName())
                    {
                        result = text;
                        return(result);
                    }
                }
                string     text2      = Public.DataTableGet("tbl_limit", 1, 1, "limitname=(select top 1 limitid from tbl_user where username='******')", "").Rows[0]["limitinfo"].ToString();
                HttpCookie httpCookie = new HttpCookie("UserLimit", HttpUtility.UrlEncode(text2));
                httpCookie.Expires = DateTime.Now.AddDays(15.0);
                HttpContext.Current.Response.Cookies.Remove("UserLimit");
                HttpContext.Current.Response.Cookies.Add(httpCookie);
                HttpCookie httpCookie2 = new HttpCookie("UserLimitUser", HttpUtility.UrlEncode(Public.GetUserName()));
                httpCookie2.Expires = DateTime.Now.AddDays(15.0);
                HttpContext.Current.Response.Cookies.Remove("UserLimitUser");
                HttpContext.Current.Response.Cookies.Add(httpCookie2);
                result = text2;
            }
            catch
            {
                result = "";
            }
            return(result);
        }
예제 #14
0
        public static string ExcuteSql(string Sql)
        {
            string connectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;

            return(Public.ToString(DBHelper.ExecuteScalar(connectionString, CommandType.Text, Sql, new SqlParameter[0])));
        }