示例#1
0
    public string GetFileType(string FileName, string FileType)
    {
        FileTypeBll fileTypeBll = new FileTypeBll();
        string      strWhere;

        if (FileType == "1" || FileType == "2")
        {
            strWhere = " where TypeSuffix='.folder'";
        }
        else
        {
            if (string.IsNullOrEmpty(FileName) || FileName.LastIndexOf(".") == -1)
            {
                strWhere = " where TypeSuffix='.other'";
            }
            else
            {
                FileName.LastIndexOf('.');
                string str = FileName.Substring(FileName.LastIndexOf('.'), FileName.Length - FileName.LastIndexOf('.'));
                strWhere = " where TypeSuffix='" + str + "'";
            }
        }
        System.Collections.Generic.List <FileTypeModel> listArray = fileTypeBll.GetListArray(strWhere);
        if (listArray.Count > 0)
        {
            return(listArray[0].TypeName);
        }
        listArray = fileTypeBll.GetListArray(" where TypeSuffix='.other'");
        return(listArray[0].TypeName);
    }
示例#2
0
    public string GetFileName(string FileName, string FileType, string fileNewName)
    {
        string text = "";

        if (FileType == "0" && FileName.IndexOf(".") != -1)
        {
            text = FileName.Substring(FileName.LastIndexOf('.'), FileName.Length - FileName.LastIndexOf('.'));
        }
        FileTypeBll fileTypeBll = new FileTypeBll();
        string      strWhere;

        if (FileType == "1" || FileType == "2")
        {
            strWhere = " where TypeSuffix='.folder'";
        }
        else
        {
            if (string.IsNullOrEmpty(FileName) || FileName.LastIndexOf(".") == -1)
            {
                strWhere = " where TypeSuffix='.other'";
            }
            else
            {
                FileName.LastIndexOf('.');
                strWhere = " where TypeSuffix='" + text + "'";
            }
        }
        System.Collections.Generic.List <FileTypeModel> listArray = fileTypeBll.GetListArray(strWhere);
        string text2;

        if (listArray.Count > 0)
        {
            text2 = string.Concat(new string[]
            {
                "<img src='",
                listArray[0].TypeImg,
                "' style='border:0px;float: left;padding: 5px 5px 0px 0px;'  /><span style='float: left;padding-top: 5px; text-decoration:underline;'>",
                StringUtility.GetStr(FileName, 25),
                "</span>"
            });
        }
        else
        {
            listArray = fileTypeBll.GetListArray(" where TypeSuffix='.other'");
            text2     = string.Concat(new string[]
            {
                "<img src='",
                listArray[0].TypeImg,
                "' style='border:0px;float: left;padding: 5px 5px 0px 0px;' /><span style='float: left;padding-top: 5px; text-decoration:underline;'>",
                StringUtility.GetStr(FileName, 25),
                "</span>"
            });
        }
        if (FileType != "0")
        {
            text2 = string.Concat(new string[]
            {
                "<a class='tooltip' title='",
                FileName,
                "'dfTitle='",
                FileName,
                "' href='#' onclick='ondbSelectValue(this.parentNode.parentNode.id)'>",
                text2,
                " </a>"
            });
        }
        else
        {
            if (text == ".jpg" || text == ".gif" || text == ".html" || text == ".htm" || text == ".txt")
            {
                text2 = string.Concat(new string[]
                {
                    "<a class='tooltip' title='",
                    FileName,
                    "'dfTitle='",
                    FileName,
                    "' href='#' onclick=\"DownLoad('/UploadFiles/FileInfo/",
                    fileNewName,
                    "')\">",
                    text2,
                    " </a>"
                });
            }
            else
            {
                text2 = string.Concat(new string[]
                {
                    "<a class='tooltip' title='",
                    FileName,
                    "'dfTitle='",
                    FileName,
                    "' href='/UploadFiles/FileInfo/",
                    fileNewName,
                    "' target='_blank' >",
                    text2,
                    " </a>"
                });
            }
        }
        return(text2);
    }
示例#3
0
    public string GetFileName(string FileName, string FileType, string fileNewName)
    {
        string text = "";

        if (FileType == "0" && FileName.IndexOf(".") != -1)
        {
            text = FileName.Substring(FileName.LastIndexOf('.'), FileName.Length - FileName.LastIndexOf('.'));
        }
        FileTypeBll fileTypeBll = new FileTypeBll();
        string      strWhere;

        if (FileType == "1" || FileType == "2")
        {
            strWhere = " where TypeSuffix='.folder'";
        }
        else
        {
            if (string.IsNullOrEmpty(FileName) || FileName.LastIndexOf(".") == -1)
            {
                strWhere = " where TypeSuffix='.other'";
            }
            else
            {
                FileName.LastIndexOf('.');
                strWhere = " where TypeSuffix='" + text + "'";
            }
        }
        System.Collections.Generic.List <FileTypeModel> listArray = fileTypeBll.GetListArray(strWhere);
        string text2;

        if (listArray.Count > 0)
        {
            text2 = string.Concat(new string[]
            {
                "<img src='",
                listArray[0].TypeImg,
                "' style='border:0px;float: left;padding: 5px 5px 0px 0px;'  /><span style='float: left;padding-top: 5px;'>",
                StringUtility.GetStr(FileName, 25),
                "</span>"
            });
        }
        else
        {
            listArray = fileTypeBll.GetListArray(" where TypeSuffix='.other'");
            text2     = string.Concat(new string[]
            {
                "<img src='",
                listArray[0].TypeImg,
                "' style='border:0px;float: left;padding: 5px 5px 0px 0px;' /><span style='float: left;padding-top: 5px;'>",
                StringUtility.GetStr(FileName, 25),
                "</span>"
            });
        }
        if (FileType != "0")
        {
            text2 = string.Concat(new string[]
            {
                "<span class='tooltip' title='",
                FileName,
                "' dfTitle='",
                FileName,
                "'  >",
                text2,
                " </span>"
            });
        }
        else
        {
            if (text == ".jpg" || text == ".gif" || text == ".html" || text == ".htm" || text == ".txt")
            {
                text2 = string.Concat(new string[]
                {
                    "<span class='tooltip' title='",
                    FileName,
                    "' dfTitle='",
                    FileName,
                    "' >",
                    text2,
                    " </span>"
                });
            }
            else
            {
                text2 = string.Concat(new string[]
                {
                    "<span class='tooltip' title='",
                    FileName,
                    "' fTitle='",
                    FileName,
                    "' >",
                    text2,
                    " </span>"
                });
            }
        }
        return(text2);
    }