2020国产成人精品视频,性做久久久久久久久,亚洲国产成人久久综合一区,亚洲影院天堂中文av色

分享

用戶控件開發(fā):

 昵稱10504424 2014-02-24

 

 

弦斷有誰聽
 

博客園
 首頁(yè)
 博問
 閃存
 新隨筆
 聯(lián)系
 訂閱
管理
 
隨筆-3  文章-0  評(píng)論-0 

 

 


用戶控件開發(fā):

 

 

 
功能:
 
1、判斷用戶是否自動(dòng)登錄
 


有了html5,就可以在很多地方用localStorage取代cookies,sessionStorage取代Session
 
2、實(shí)現(xiàn)視頻搜索
 
首先為TextBox控件擴(kuò)展一個(gè)AutoCompleteExtender控件,實(shí)現(xiàn)輸入字符,自動(dòng)顯示相關(guān)視頻。
 
讀者需要了解AutoCompleteExtender控件的使用方法;此實(shí)例后臺(tái)WebService方法如下
 


數(shù)據(jù)庫(kù)表中有videoTitle字段,通過調(diào)用存儲(chǔ)過程selectVideoTitle
 
create proc [dbo].[selectVideoTitle]
@videoTitle nvarchar(20)
as
select * from T_videoInfo where videoTitle like '%'+@videoTitle+'%' and aduiting=0 order by clickCount desc
 
獲得視頻名稱列表,然后傳給strArray;
 
為TextBox控件添加blur事件,發(fā)生此事件時(shí),會(huì)把TextBox控件的值傳給selectVideoInfo.ashx文件,此文件負(fù)責(zé)返回視頻Id,通過參數(shù)Id傳給videoShow.asox;然后跳轉(zhuǎn)到視頻列表展示頁(yè)面videoShow.aspx
 


selectVideoInfo如下:
 


也是通過調(diào)研存儲(chǔ)過程。SqlHelp等一些公共方法在代碼中
 
3.登錄,注冊(cè)上傳視頻頁(yè)面的打開
 


當(dāng)希望鏈接被蜘蛛爬到,又不希望通過鏈接形式打開;可以使用return false語句
 
下面javaScript用來打開注冊(cè)頁(yè)面:
 


大家可以去查一下window.showModalDialog()和window.open()的區(qū)別等。
 
代碼
 


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Diagnostics;


namespace 在線視頻.CommonClass
{
    public class SqlHelp
    {
        static string connstr = ConfigurationManager.ConnectionStrings["conVedioStr"].ConnectionString;
        public static DataTable ExecuteDataTable(string str, params SqlParameter[] parameters)
        {
            using (SqlConnection conn = new SqlConnection(connstr))
            {
                using (SqlCommand com = conn.CreateCommand())
                {
                    com.CommandText = str;
                    com.Parameters.AddRange(parameters);
                    SqlDataAdapter adapter = new SqlDataAdapter(com);
                    DataTable table = new DataTable();
                    adapter.Fill(table);
                    return table;
                }
            }
        }
        public static DataTable ExecuteDataTablePro(string procName, params SqlParameter[] parameters)
        {
            using (SqlConnection conn = new SqlConnection(connstr))
            {
                using (SqlCommand com = conn.CreateCommand())
                {
                    com.CommandType = CommandType.StoredProcedure;
                    com.CommandText = procName;
                    com.Parameters.AddRange(parameters);
                    SqlDataAdapter adapter = new SqlDataAdapter(com);
                    DataTable table = new DataTable();
                    adapter.Fill(table);
                    return table;
                }
            }
        }
        public static int  ExecuteNonQuery(string str, params SqlParameter[] parameters)
        {
            using (SqlConnection conn = new SqlConnection(connstr))
            {
                conn.Open();
                using (SqlCommand com = conn.CreateCommand())
                {
                    com.CommandText = str;
                    com.Parameters.AddRange(parameters);
                   return com.ExecuteNonQuery();
                }
            }

        }
        public static int ExecuteNonQueryPro(string procName, params SqlParameter[] parameters)
        {
            using (SqlConnection con = new SqlConnection(connstr))
            {
                con.Open();
                using(SqlCommand com=con.CreateCommand())
                {
                    com.CommandType = CommandType.StoredProcedure;
                    com.CommandText = procName;
                    com.Parameters.AddRange(parameters);
                    return com.ExecuteNonQuery();
                }
            }
        }
        public static object ExecuteScalar(string str, params SqlParameter[] parameters)
        {
            using (SqlConnection conn = new SqlConnection(connstr))
            {
                conn.Open();
                using (SqlCommand com = conn.CreateCommand())
                {
                    com.CommandText = str;
                    com.Parameters.AddRange(parameters);
                    return com.ExecuteScalar();
                }

            }

        }
        public static object ExecuteScalarPro(string procName, params SqlParameter[] parameters)
        {
            using (SqlConnection conn = new SqlConnection(connstr))
            {
                conn.Open();
                using (SqlCommand com = conn.CreateCommand())
                {
                    com.CommandType = CommandType.StoredProcedure;
                    com.CommandText = procName;
                    com.Parameters.AddRange(parameters);
                    return com.ExecuteScalar();
                }

            }

        }
        public static SqlDataReader ExecuteReader(string str, params SqlParameter[] parameters)
        {
            using (SqlConnection conn = new SqlConnection(connstr))
            {
                conn.Open();
                using (SqlCommand com = conn.CreateCommand())
                {
                    com.CommandText = str;
                    com.Connection = conn;
                    com.Parameters.AddRange(parameters);
                    SqlDataReader reader = com.ExecuteReader();
                    return reader;
                }
               
            }

        }
        public static object FromDbValue(object value)
        {
            if (value == DBNull.Value)
            {
                return null;
            }
            else
            {
                return value;
            }
        }
        public static object ToDbValue(object value)
        {
            if (value == null)
            {
                return DBNull.Value;
            }
            else
            {
                return value;
            }
        }
        public static string AlertMsg(string msg)
        {
            string str = "<script type=\"text/javascript\" >alert('" + msg + "');</script>";
            return str;
        }
        public static  string getUniqueName(string tempPath)//tempPath上傳路徑
        {
            string strPre = tempPath.Substring(0, tempPath.LastIndexOf("."));

            string strLast = tempPath.Substring(tempPath.LastIndexOf(".") + 1);
            int i = 0;
            while (File.Exists(tempPath))
            {
                tempPath = strPre + "(" + i.ToString() + ")." + strLast;
                i++;
            }
            return tempPath;//返回唯一路徑

        }
        public static void catchImg(string videoFileName, string imgSavePath)//截取圖片
        {
            string fmpeg = @"F:\html\在線視頻\在線視頻\CommonFiles\ffmpeg.exe";
            string savePath = imgSavePath;
            string imgSize = ConfigurationManager.AppSettings["sizeofImg"];
            Process pass = new Process();
            pass.StartInfo.FileName = fmpeg;
            pass.StartInfo.Arguments = "  -i  " + videoFileName + "  -y  -f  image2   -ss 2 -vframes 1 -s " + imgSize + " " + savePath;
            pass.Start();
        }

    }
}


 前臺(tái)代碼:
 

 

 

 


1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

 

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Header.ascx.cs" Inherits="在線視頻.Header" %>

<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>

<link href="CSS/Header.css" rel="stylesheet" />

<script src="JS/jquery-1.7.1.js"></script>

    <script type="text/javascript">

        function showDialog(url,width,height) {

            var opensettings = "toolbar=no,menubar=no,status=no,scrollbars=no,location=no,resizable=no,center=yes";

            //var modalsettings = "center=yes;";

            var left, top;

            left = (screen.width - width) / 2;

            top = (screen.height - height) / 2;

            // opensettings = opensettings + ",left=" + left + ",top=" + top+",screenx="+left+",screeny="+top;

           var modalsettings = opensettings + ",dialogLeft=" + left + ",dialogTop=" + top;

            var d = new Object("dd");

            // window.open(url,tarert,opensettings);

            window.showModalDialog(url, d, modalsettings);

        }

        window.onload = function () {

            if (localStorage.userName != null && localStorage.userName != "")

            {

                document.getElementById("notLogin").style.display ="none";

                document.getElementById("spUerName").innerHTML = localStorage.userName;

            }

        }

        $(function () {

            $("#Header_txtSearch").blur(function () {

                $.get("Ajax/selectVideoInfo.ashx", { "videoTitle": $("#Header_txtSearch").val() }, function (data, status) {

                    if (status == 'success') {

                        window.location.href = "videoShow.aspx?Id=" + data;

                    }

                    else {

                        alert("視頻獲取失敗");

                    }

                });

            });

            $("#spUerName").mouseover(function () {

 

            });

   });

    </script>

<div class="divHead">

        <div class="divHeader">     

                <div class="divWeatherInfo" >

                    <span id="cityName">城市:</span> 

                    <span ><img id="weaPic" src="" alt="無法顯示天氣圖片" /></span>

                    <span id="temp">溫度:</span>

                    <span>| 空氣質(zhì)量:</span>

                    <span id="airQuality"></span>

                </div>

                <div class="divVideoSearch">

                    <asp:TextBox ID="txtSearch" runat="server" Height="29px" Width="200px" ></asp:TextBox>

                    <asp:AutoCompleteExtender ID="txtSearch_AutoCompleteExtender" runat="server" Enabled="True" ServicePath="~/WebService/videoSearch.asmx" TargetControlID="txtSearch" ServiceMethod="GetTextString" MinimumPrefixLength="1" >

                    </asp:AutoCompleteExtender>

                <asp:Button ID="btnSearch" runat="server" Text="搜索" BackColor="#FFECDF" BorderStyle="None" BorderWidth="0px" Font-Bold="True" Font-Italic="False" Font-Size="Large" ForeColor="#FF6E0C" Height="34px" OnClick="btnSearch_Click"  Width="70px"/>            

                </div>

                <div class="divUserInfo">

                    <span id="notLogin">

                    <a href="UserLogin.html" onclick="showDialog('UserLogin.html','200','150');return false;">登錄</a>

                    <a href="UserRegister.aspx" target="_blank">注冊(cè)</a></span>

                    <span id="spUerName" ><button id="userCan">退出</button></span>

                    <a href="videoUpLoad.aspx">上傳</a>

                </div>

        </div>

    </div>

 

 

 


綠色通道: 好文要頂 關(guān)注我 收藏該文與我聯(lián)系

 


弦斷有誰聽
 關(guān)注 - 1
 粉絲 - 1

 

+加關(guān)注


0

0


 (請(qǐng)您對(duì)文章做出評(píng)價(jià))


上一篇:驗(yàn)證碼
下一篇:?jiǎn)挝恢悼丶ǚ?wù)端)開發(fā)(原創(chuàng)由鄭健前輩所寫)

 
posted @ 2014-02-15 10:21 弦斷有誰聽 閱讀(118) 評(píng)論(0) 編輯 收藏
 

 

刷新評(píng)論刷新頁(yè)面返回頂部
 

注冊(cè)用戶登錄后才能發(fā)表評(píng)論,請(qǐng) 登錄 或 注冊(cè),訪問網(wǎng)站首頁(yè)。
 
程序員找工作,就在博客園招聘頻道
 
博客園首頁(yè)博問新聞閃存程序員招聘知識(shí)庫(kù)
 

 

 


最新IT新聞:
 · 諾基亞 MWC 2014 發(fā)布會(huì)直播預(yù)告,Nokia X 即將揭曉
 · 網(wǎng)絡(luò)購(gòu)火車票下月起將驗(yàn)證身份:防止黃牛囤票
 · 谷歌智能手表或6月I/O大會(huì)發(fā)布 由LG代工
 · Mozilla發(fā)三款Firefox OS新機(jī):最低25美元
 · 創(chuàng)業(yè)者自述:選擇正確VC的7個(gè)關(guān)鍵點(diǎn)
更多新聞...

最新知識(shí)庫(kù)文章:

 · Node.js 究竟是什么?
 · Habya'a(臨時(shí)拼湊的組件)與技術(shù)債務(wù)
 · 關(guān)于在線教育和線下教育的六個(gè)問題
 · 別錯(cuò)把需求當(dāng)市場(chǎng)
 · 瀏覽器中關(guān)于事件的那點(diǎn)事兒

更多知識(shí)庫(kù)文章...

 


公告


昵稱:弦斷有誰聽
園齡:13天
粉絲:1
關(guān)注:1
+加關(guān)注
 

 

 

 

<

2014年2月

>

 


 

26

27

28

29

30

31

1

 

2

3

4

5

6

7

8

 

9

10

11

12

13

14

15

 

16

17

18

19

20

21

22

 

23

24

25

26

27

28

1

 

2

3

4

5

6

7

8

 

 

搜索
 
 
 
 
 

常用鏈接
 我的隨筆
我的評(píng)論
我的參與
最新評(píng)論
我的標(biāo)簽
 


隨筆檔案
2014年2月 (3)


最新評(píng)論

 

閱讀排行榜

1. 用戶控件開發(fā):(118)
2. 驗(yàn)證碼(64)
3. 單位值控件(服務(wù)端)開發(fā)(原創(chuàng)由鄭健前輩所寫)(29)
 

評(píng)論排行榜

1. 驗(yàn)證碼(0)
2. 用戶控件開發(fā):(0)
3. 單位值控件(服務(wù)端)開發(fā)(原創(chuàng)由鄭健前輩所寫)(0)
 

推薦排行榜
 

 


 

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約

    類似文章 更多