예제 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            int id;
            if (!int.TryParse(Request.QueryString["id"], out id))
            {
                Response.Redirect("~/Publications.aspx");
            }

            Database db   = new Database();
            Lang     lang = new Lang();
            db.AddParameter("@lang", lang.getCurrentLang());
            DataTable dt = db.ExecuteDataTable("select top(3) * from SocialEvent where lang=@lang Order by id desc");
            Repeater2.DataSource = dt;
            Repeater2.DataBind();

            db.AddParameter("@lang", lang.getCurrentLang());
            dt = db.ExecuteDataTable("select top(3) * from news where lang=@lang Order by id desc");
            Repeater1.DataSource = dt;
            Repeater1.DataBind();



            db.AddParameter("@lang", lang.getCurrentLang());
            db.AddParameter("@id", id);
            dt = db.ExecuteDataTable("select  * from publications where lang=@lang and id=@id ");
            Repeater3.DataSource = dt;
            Repeater3.DataBind();

            if (dt.Rows.Count == 0)
            {
                Response.Redirect("~/Publications.aspx");
            }
        }
    }
예제 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string sessionUser;
            int    userID;

            try
            {
                DataAccessLayer dao = new DataAccessLayer();
                if (Session["userEmail"] != null)
                {
                    sessionUser      = Session["userEmail"].ToString();
                    hiddenUser.Value = sessionUser;
                    userID           = dao.getUserID(sessionUser);
                    SqlDataReader reader       = dao.GetFavouritePropertiesID(userID);
                    DataTable     favList      = new DataTable();
                    string        _propertyIds = string.Empty;
                    while (reader.Read())
                    {
                        int propertyID = reader.GetInt32(0);
                        _propertyIds += string.Concat(propertyID, ",");
                    }
                    _propertyIds         = _propertyIds.TrimEnd(',');
                    favList              = dao.GetUserFavouriteProperties(userID, _propertyIds, Constants.propertyEnabled);
                    Repeater1.DataSource = favList;
                    Repeater1.DataBind();
                }
                else
                {
                    Response.Redirect("Login.aspx");
                }
            }
            catch (Exception)
            {
                Console.Write("error");
            }
        }
    public void FillQuestion()
    {
        string str = "";
        int    cnt;


        if (ddl_PaperShow.SelectedIndex > 0)
        {
            str = " select *,'../'+Question_Url AS PhotoUrl  from tbl_Question, tbl_PaperSet";
            str = str + " where  tbl_Question.QuestionId= tbl_PaperSet.QuestionId";
            str = str + " and PaperId=" + ddl_PaperShow.SelectedValue.ToString();

            if (ddl_CategoryShow.SelectedIndex > 0)
            {
                str = str + " and QuestionCategoryId=" + ddl_CategoryShow.SelectedValue.ToString();
            }
            if (ddl_DifficultyLevel_Show.SelectedIndex > 0)
            {
                str = str + " and DifficultyLevel=" + ddl_DifficultyLevel_Show.SelectedValue.ToString();
            }
            Repeater1.DataSource = c1.SelectDs(str);
            Repeater1.DataBind();
        }
    }
        public void GetNews(String newsid)
        {
            MySqlConnection conn   = new MySqlConnection(connStr);
            DataTable       dtnews = new DataTable();

            try
            {
                conn.Open();
                string           sql     = "SELECT * FROM dt_news WHERE News_Id = " + newsid;
                MySqlDataAdapter adapter = new MySqlDataAdapter(sql, conn);
                adapter.Fill(dtnews);

                Repeater1.DataSource = dtnews;
                Repeater1.DataBind();

                /*
                 * Panel1.DataBind();
                 * DataRow pRow = dtnews.Rows[0];
                 * DateTime dt = pRow.Field<DateTime>("News_Date");
                 * newsdate.Text = dt.ToString("dd MMM yy");
                 * title.Text = pRow["News_Title"].ToString();
                 * newsimage.ImageUrl = "data:image/jpeg;base64," + Convert.ToBase64String((byte[])pRow["News_Image"]);
                 * Content.Text = pRow["News_Content"].ToString();
                 * Source.Text = pRow["Source"].ToString();
                 */
            }
            catch (Exception ex)
            {
                Debug.WriteLine("----> Error : " + ex.StackTrace);
            }
            finally
            {
                // close the Sql Connection
                conn.Close();
            }
        }
 public void loduser()
 {
     try
     {
         if (conn.State == ConnectionState.Closed)
         {
             conn.Open();
         }
         string         query = "select uid,fname ,lname,uemail,address from reg_users order by fname";
         SqlCommand     cmd   = new SqlCommand(query, conn);
         DataSet        ds    = new DataSet();
         SqlDataAdapter da    = new SqlDataAdapter(cmd);
         da.Fill(ds);
         Repeater1.DataSource = ds.Tables[0];
         Repeater1.DataBind();
         if (conn.State == ConnectionState.Open)
         {
             conn.Close();
         }
     }
     catch (Exception ex)
     {
     }
 }
예제 #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string km = "";
        string dm = "";

        if (Session["dm"] != null)
        {
            dm = Session["dm"].ToString();
        }
        if (Session["km"] != null)
        {
            km = Session["km"].ToString();
        }


        DB db = new DB();
        //MINERCHECK 0:拒绝 1:通过 2:已接收 空:未处理。这里只要不是1通过,就应该显示
        string    sql = "select distinct id,(select name from t_instituteinvestigationflow where id = t.id) as name from t_minerflow t where ((minercheck is null) or (MINERCHECK<>1)) and (not submittype is null) and minername = '" + km + "'";
        DataTable dt  = new DataTable();

        dt = db.GetDataTable(sql); //数据源
        Repeater1.DataSource = dt;
        Repeater1.DataBind();
    }
    protected void filtroBut_Click(object sender, EventArgs e)
    {
        try
        {
            ReportViewer1.Visible = false;
            switch (comboFiltro.SelectedValue)
            {
            case "0": Repeater1.DataSource = persvm.getPersonasByNumDoc(inFiltro.Text); break;

            case "1": Repeater1.DataSource = persvm.getPersonasByNombre(inFiltro.Text); break;

            case "2": Repeater1.DataSource = persvm.getPersonasByID(Convert.ToInt32(inFiltro.Text)); break;

            default: { HelperUtil.showNotifi("Filtro inválido"); return; }
            }

            Repeater1.DataBind();
            if (Repeater1.Items.Count > 0)
            {
                Repeater1.Visible  = true;
                search_res.Visible = false;
                HelperUtil.showNotifi("Funcionario encontrado");
            }
            else
            {
                Repeater1.Visible  = false;
                search_res.Visible = true;
                HelperUtil.showNotifi("No se encontro funcionario");
                ReportViewer1.Visible = false;
            }
        }
        catch (Exception ex)
        {
            HelperUtil.showNotifi("No se encontro funcionario");
        }
    }
예제 #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (BigSize)
            {
                Height = "330px";
            }
            else
            {
                Height = "330px";
            }
            SqlParameter pBig = new SqlParameter("Big", SqlDbType.Bit);

            pBig.Value = BigSize;
            SqlParameter pPos = new SqlParameter("Pos", SqlDbType.Bit);

            pPos.Value = OnTop;
            DataSet ds = DataAccessLayer.ExecuteDataSet("Adv_GetImageBy", pBig, pPos);

            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                Repeater1.DataSource = ds;
                Repeater1.DataBind();
            }
        }
예제 #9
0
    void BindPresentationData()
    {
        String classid = (String)Session["class"];

        selectclass.Text = classid;

        //String cid = "cls_" + Hello.SelectedValue;
        querystr = "Select p.sno,p.chapter,p.section,p.day,p.date,p.page,p.studentid,s.uhclid from " + classid + " as p,logindetails_5433_1 s where s.uhclid=p.studentid order by sno";
        da       = new MySqlDataAdapter(querystr, conn);
        ds       = new DataSet();
        cmd      = new MySql.Data.MySqlClient.MySqlCommand(querystr, conn);
        conn.Open();
        MySqlDataReader dr = cmd.ExecuteReader();

        DataTable dt = new DataTable();

        dt.Load(dr);
        Repeater1.DataSource = dt;
        Repeater1.DataBind();

        /* da.Fill(ds, "class");
         * Repeater1.DataSource = ds.Tables["class"];
         * Repeater1.DataBind();*/
    }
예제 #10
0
        public void get1()
        {
            string CS = ConfigurationManager.ConnectionStrings["pmConnectionString1"].ConnectionString;

            using (SqlConnection con = new SqlConnection(CS))
            {
                SqlCommand     com = new SqlCommand("select report,[image_pm],[Order] from manager where [Order]=1 ", con);
                DataTable      dt  = new DataTable();
                SqlDataAdapter da  = new SqlDataAdapter(com);

                con.Open();
                da.Fill(dt);
                if (dt.Rows.Count > 0 && dt.Rows[0][0] != string.Empty)
                {
                    Repeater1.DataSource = dt;
                    Repeater1.DataBind();
                }
                else
                {
                    Repeater1.DataSource = null;
                    Repeater1.DataBind();
                }
            }
        }
예제 #11
0
 void Bind()
 {
     mtb = btb.GetModel(Convert.ToInt32(Request.Params["bid"]));
     mf  = bf.GetModel(mtb.b_sort);
     mtf = tf.GetModel(mf.f_form);
     if (mtf == null)
     {
         Tunnel.Common.Message.back("表单不存在或已删除,请与管理员联系"); return;
     }
     Label1.Text   = fc.From_Content(mtf.f_content, mtb.b_content, false);//取得替换后的表单数据
     TextBox1.Text = mtb.b_title;
     hfile.Value   = mtb.b_file;
     if (!"".Equals(mtb.b_file))
     {
         string[] filelist = mtb.b_file.Split(',');
         foreach (string list in filelist)
         {
             string flist = list.Substring(list.LastIndexOf('/') + 1, list.Length - list.LastIndexOf('/') - 1);
             hfilelist += "<span><img src=\"../../image/attach.png\">" + flist + "<img style='cursor:hand' onclick=\"del(this,'" + list + "')\" alt='删除附件' src=\"../../image/remove.png\">;</span>";
         }
     }
     if (mf.f_isfile.ToString() == "1")
     {
         isuploads = false;
     }
     Repeater1.DataSource = bs.GetList("s_lid=" + mf.f_id);
     Repeater1.DataBind();
     if (Repeater1.Items.Count <= 0)
     {
         Label2.Text = "本公文未设置流程,将不能保存!"; HiddenField2.Value = "0";
     }
     else
     {
         Label2.Text = ""; HiddenField2.Value = "1";
     }
 }
예제 #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            /*
             * SqlDataAdapter dAdapter = new SqlDataAdapter("SELECT * FROM STD", new SqlConnection(@"Data Source=FACULTY18;Initial Catalog=1708F;Integrated Security=False;User ID=sa;Password=sa9;Connect Timeout=15;Encrypt=False;TrustServerCertificate=True;ApplicationIntent=ReadWrite;MultiSubnetFailover=False"));
             * DataSet _ds = new DataSet();
             * dAdapter.Fill(_ds);
             * GridView1.DataSource = _ds.Tables[0];
             * GridView1.DataBind();
             */
            SqlConnection _sqlconn = new SqlConnection(@"Data Source=FACULTY18;Initial Catalog=1708F;Integrated Security=False;User ID=sa;Password=sa9;Connect Timeout=15;Encrypt=False;TrustServerCertificate=True;ApplicationIntent=ReadWrite;MultiSubnetFailover=False");

            _sqlconn.Open();
            SqlCommand _cmd = new SqlCommand("spGetStudentById", _sqlconn);

            _cmd.CommandType = CommandType.StoredProcedure;
            _cmd.Parameters.AddWithValue("@ID", 1);
            SqlDataReader dReader = _cmd.ExecuteReader();

            //  GridView1.DataSource = dReader;
            //GridView1.DataBind();

            Repeater1.DataSource = dReader;
            Repeater1.DataBind();
        }
예제 #13
0
    protected void AddBtn_Click(object sender, EventArgs e)
    {
        List <TempData> data = ViewState["datalist"] as List <TempData>;
        TempData        d    = new TempData();

        if (textofOption != null)
        {
            d.Option = textofOption.Text;
        }
        textofOption.Text = null;
        if (CheckBox1.Checked == true)
        {
            d.Status = true;
        }
        else
        {
            d.Status = false;
        }
        CheckBox1.Checked = false;
        data.Add(d);
        ViewState["datalist"] = data;
        Repeater1.DataSource  = data;
        Repeater1.DataBind();
    }
예제 #14
0
    public void databind()
    {
        loginNameStr = Page.User.Identity.Name.Trim();
        SqlConnection con    = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["SQLConnString1"].ToString());
        string        sqlStr = "select * from serviceincrementtab where loginname='" + loginNameStr + "' order by ApplyTime desc";
        SqlCommand    com    = new SqlCommand(sqlStr, con);

        try
        {
            con.Open();
            DataSet ds = new DataSet();
            new SqlDataAdapter(com).Fill(ds);
            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0] != null)
            {
                Repeater1.DataSource = ds.Tables[0];
                Repeater1.DataBind();
            }
            con.Close();
        }
        catch
        {
            con.Close();
        }
    }
예제 #15
0
        /// <summary>
        /// 绑定数据
        /// </summary>
        private void BindData()
        {
            List <String> list      = new List <String>();
            String        key       = txtKey.Text;
            String        starttime = starTime.Text;
            String        endtime   = endTime.Text;

            list.Add("0=0");
            //关键词
            if (!String.IsNullOrEmpty(key))
            {
                list.Add(dropField.SelectedValue + " LIKE '%" + key + "%'");
            }
            //起始日期
            if (!String.IsNullOrEmpty(starttime))
            {
                list.Add("joindate>='" + starttime + "'");
            }
            //结束日期
            if (!String.IsNullOrEmpty(endtime))
            {
                DateTime time = Convert.ToDateTime(endtime).AddDays(1).AddSeconds(-1);
                list.Add("joindate<='" + time.ToString() + "'");
            }

            String filter = String.Join(" AND ", list.ToArray());
            String _sql   = "SELECT COUNT(id) FROM [t_members] WHERE " + filter;

            String sql = String.Format("SELECT TOP {0} * FROM [t_members] WHERE (id NOT IN (SELECT TOP {1} id FROM [t_members] WHERE {2} ORDER BY id DESC)) AND {2} ORDER BY id DESC", Pager1.PageSize, Pager1.PageSize * (Pager1.CurrentPageIndex - 1), filter);

            DataTable dt = db.ExecuteDataTable(sql);

            Pager1.RecordCount   = Convert.ToInt32(db.ExecuteScalar(_sql));
            Repeater1.DataSource = dt;
            Repeater1.DataBind();
        }
        /// <summary>
        ///
        /// </summary>
        public void SearchUsers()
        {
            //获取搜索参数
            string account  = TextBox_Account.Text;
            string time     = TextBox_CreateTime.Text;
            string roleName = DropDownList_Roles.SelectedItem.Text;
            //查询数据
            DateTime  bornTime = string.IsNullOrEmpty(time) ? DateTime.Now : Convert.ToDateTime(time);
            UserModel model    = new UserModel();

            model.Account     = account;
            model.RoleName    = roleName;
            model.CheckInTime = bornTime;
            //调用dal层分页查询代码
            List <UserModel> result = dal.GetNewUserPageList(pageIndex, pageSize, model, out total);

            //把数据绑定到界面 repeater
            Repeater1.DataSource = result;
            Repeater1.DataBind();
            //页码repeater2
            //查询页码的数据
            Repeater2.DataSource = PageDataHelper.GetPageList(total, pageSize);
            Repeater2.DataBind();
        }
예제 #17
0
파일: cart.aspx.cs 프로젝트: Yzy-pg/Yzy-pg
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                FormsAuthenticationTicket ticke1 = null;
                string user1 = Request.Cookies["user"].Value;
                ticke1       = FormsAuthentication.Decrypt(user1);
                cookiename   = ticke1.Name;
                lblogin.Text = "欢迎您!" + cookiename;
            }
            catch (Exception)
            {
                if (cookiename == null)
                {
                    lblogin.Text = "还没登陆,请登录!";
                }
            }
            if (!IsPostBack)
            {
                Repeater1.DataSource = BLL.UserBLL.CategoryList();
                Repeater1.DataBind();


                FormsAuthenticationTicket ticke = null;
                string user = Request.Cookies["user"].Value;
                ticke                = FormsAuthentication.Decrypt(user);
                cookiename           = ticke.Name;
                Repeater2.DataSource = BLL.UserBLL.CartList(cookiename);
                Repeater2.DataBind();

                Repeater3.DataSource = BLL.UserBLL.CartList(cookiename);
                Repeater3.DataBind();

                num = BLL.UserBLL.CountNum(cookiename);
            }
        }
예제 #18
0
        private void bindData()
        {
            List <ItemData> list = new List <ItemData>();

            for (int i = 0; i < 6000; i++)
            {
                list.Add(new ItemData()
                {
                    ID   = i,
                    Name = "列表数据:" + i
                });
            }
            recordCount = list.Count;
            //获取分页数据
            var pageData = list.OrderBy(l => l.ID)
                           .Skip((pageIndex - 1) * pageSize)
                           .Take(pageSize)
                           .ToList();

            Repeater1.DataSource = pageData;
            Repeater1.DataBind();
            Repeater2.DataSource = pageData;
            Repeater2.DataBind();
        }
예제 #19
0
    private void BindData()
    {
        Common.Cookie cookie     = new Common.Cookie();
        string        taobaoNick = cookie.getCookie("nick");

        Rijndael_ encode = new Rijndael_("tetesoft");

        taobaoNick = encode.Decrypt(taobaoNick);


        string id = utils.NewRequest("id", utils.RequestType.QueryString);

        string    sql   = "SELECT * FROM TopGroupBuyDetail WHERE groupbuyid =" + id;
        DataTable dtNew = utils.ExecuteDataTable(sql);

        rptArticle.DataSource = dtNew;
        rptArticle.DataBind();


        sql   = "SELECT * FROM TopGroupBuy WHERE nick = '" + taobaoNick + "' AND id = " + id;
        dtNew = utils.ExecuteDataTable(sql);
        Repeater1.DataSource = dtNew;
        Repeater1.DataBind();
    }
예제 #20
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int         id          = Convert.ToInt32(Request.QueryString["id"]);
        BLLHelpcate bllhelpcate = new BLLHelpcate();
        DataSet     ds          = bllhelpcate.select();

        Repeater1.DataSource = ds;
        Repeater1.DataBind();

        DataSet ds2 = bllhelpcate.select(id);

        Repeater3.DataSource = ds2;
        Repeater3.DataBind();


        BLLhelp bllhelp = new BLLhelp();
        DataSet ds1     = bllhelp.selectAll(id);

        Repeater2.DataSource = ds1;
        Repeater2.DataBind();


        Model.Helpcate helpcate = new Model.Helpcate();
        helpcate.ID = id;

        SqlDataReader sdr = bllhelpcate.sqldatareader(helpcate);

        if (sdr.Read())
        {
            Page.Title = sdr["_catename"].ToString();
        }
        else
        {
            sdr.Close();
        }
    }
        protected void cmbMaterialMark_SelectedIndexChanged(object sender, EventArgs e)
        {
            string sql = " SELECT material.code AS كود, material.name AS اسم, FORMAT(SUM((Pen_company.price + Pen_company.mesarif) * Pen_company.qty) / SUM(Pen_company.qty), 'C', 'en-us') AS سعر,  SUM(Pen_company.qty - Pen_company.frotin) AS كمية, FORMAT(SUM((Pen_company.price + Pen_company.mesarif) * Pen_company.qty) / SUM(Pen_company.qty) * SUM(Pen_company.qty - Pen_company.frotin),'C', 'en-us') AS مجموع, material.measure AS وحدة, material.width AS تعبئة, material.wezin AS وزن, material.mark AS ماركة, material.cat AS صنف, material.limit AS [حد الادنى]FROM Pen_company INNER JOIN material ON Pen_company.p_id = material.code WHERE(Pen_company.count - Pen_company.frotin > 0) AND (material.code <> '#')and material.mark =N'" + cmbMaterialMark.SelectedValue + "' GROUP BY material.code, material.name, material.qty, material.measure, material.wezin, material.cat, material.mark, material.width, material.limit ORDER BY كود";

            string        connStr = ConfigurationManager.ConnectionStrings["myConnectionString"].ConnectionString;
            SqlConnection conn    = new SqlConnection(connStr);

            SqlDataAdapter adap = new SqlDataAdapter(sql, conn);
            DataTable      dt   = new DataTable();

            adap.Fill(dt);

            Repeater1.DataSource = dt;
            Repeater1.DataBind();

            double total = 0;

            foreach (DataRow row in dt.Rows)
            {
                double x = Convert.ToDouble(row[4].ToString().Replace("$", ""));
                total += x;
            }
            lblTotal.Text = Math.Round(total, 2).ToString() + "$";
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        String name = null;

        if (!String.IsNullOrEmpty(Request.QueryString["name"]))
        {
            name = Request.QueryString["name"];
            name = name.ToLower();

            int  n;
            bool isNumeric = int.TryParse(name, out n);
            Debug.WriteLine(isNumeric + "try parse");

            SqlConnection cn = new SqlConnection("Data Source=dcm.uhcl.edu; Database=c563315fa02g3; uid=c563315fa02g3; pwd=5989040");
            if (isNumeric)
            {
                SqlDataAdapter sda = new SqlDataAdapter("select * from cars,brands where cars.bid = brands.bid and (cars.mileage = " + name + " or brands.bname like '%" + name + "%' or cars.carname like '%" + name + "%')", cn);
                DataTable      dt  = new DataTable();
                sda.Fill(dt);
                Repeater1.DataSource = dt;
                Repeater1.DataBind();
                Debug.WriteLine(name);
                Debug.WriteLine(dt.Rows.Count + "count");
            }
            else
            {
                SqlDataAdapter sda = new SqlDataAdapter("select * from cars,brands where cars.bid = brands.bid and (brands.bname like '%" + name + "%' or cars.carname like '%" + name + "%')", cn);
                DataTable      dt  = new DataTable();
                sda.Fill(dt);
                Repeater1.DataSource = dt;
                Repeater1.DataBind();
                Debug.WriteLine(name);
                Debug.WriteLine(dt.Rows.Count + "count");
            }
        }
    }
예제 #23
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                int AcctId = 0;
                if (Request.QueryString["Id"] != null)
                {
                    AcctId = Convert.ToInt32(Request.QueryString["Id"]);
                }

                DataTable dt = EditAccountDA.ACM_List(AcctId);

                if (dt.Rows.Count > 0)
                {
                    LblCustIdFK.Text = dt.Rows[0]["CustomerFK"].ToString();
                    LblAcctId.Text   = dt.Rows[0]["AccountId"].ToString();
                    Txtacctno.Text   = dt.Rows[0]["AccountNo"].ToString();
                    Txtname.Text     = dt.Rows[0]["CustomerName"].ToString();
                    //Txtmobile.Text = dt.Rows[0]["MobileNumber"].ToString();
                }

                DataTable rdt = EditAccountDA.ViewMobile(LblCustIdFK.Text);

                if (rdt.Rows.Count > 0)
                {
                    Repeater1.DataSource = rdt;
                    Repeater1.DataBind();
                }

                if (AcctId == 0)
                {
                    Btnsave.Text  = "Save New";
                    Lbltitle.Text = "Add New";
                }
            }
        }
예제 #24
0
        protected void btnAddLink_Click(object sender, EventArgs e)
        {
            SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ProjectDB"].ToString());
            string        url = TextBox1.Text;

            if (url.Contains("youtube.com"))
            {
                string ytFormattedUrl = GetYouTubeID(url);
                int    uid            = Convert.ToInt32(HttpContext.Current.Session["userID"]);
                if (!CheckDuplicate(ytFormattedUrl))
                {
                    SqlCommand cmd = new SqlCommand("INSERT INTO YouTubeVideos (userID,[url]) VALUES (" + uid + ",'" + ytFormattedUrl + "')", con);
                    using (con)
                    {
                        con.Open();
                        int result = cmd.ExecuteNonQuery();
                        if (result != -1)
                        {
                            Repeater1.DataBind();
                        }
                        else
                        {
                            Response.Write("Error inserting new url!");
                        }
                    }
                }
                else
                {
                    Response.Write("This video already exists in our database!");
                }
            }
            else
            {
                Response.Write("This URL is not a valid YOUTUBE video link because it does not contain youtube.com in it");
            }
        }
예제 #25
0
        protected override void OnDataBinding(EventArgs e)
        {
            base.OnDataBinding(e);

            object entity;
            var    rowDescriptor = Row as ICustomTypeDescriptor;

            if (rowDescriptor != null)
            {
                // Get the real entity from the wrapper
                entity = rowDescriptor.GetPropertyOwner(null);
            }
            else
            {
                entity = Row;
            }

            // Get the collection
            var entityCollection = Column.EntityTypeProperty.GetValue(entity, null);

            // Bind the repeater to the list of children entities
            Repeater1.DataSource = entityCollection;
            Repeater1.DataBind();
        }
예제 #26
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(tbText.Text) && tbText.Text.Trim() != "")
            {
                var c = new Comment()
                {
                    ModelID = ModelID, UnitID = UnitID, UserID = Global.LoggedUserID.Value, Time = DateTime.UtcNow, Text = tbText.Text
                };
                Global.Db.Comments.InsertOnSubmit(c);
                Global.Db.SubmitChanges();

                var evType = EventType.UnitCommented;
                if (ModelID != null)
                {
                    evType = EventType.ModelCommented;
                }
                Global.AddEvent(evType, c.CommentID, UnitID, ModelID, c.Text);
                Global.Db.SubmitChanges();


                tbText.Text = "";
                Repeater1.DataBind();
            }
        }
예제 #27
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         if ((string)Session["UserType"] == "老师")
         {
             if ((string)Session["UserId"] != null)
             {
                 Business.themess themess = new Business.themess();
                 Repeater1.DataSource = themess.Get("");
                 Repeater1.DataBind();
                 themess = null;
             }
             else
             {
                 Response.Redirect("login.aspx");
             }
         }
         else
         {
             Response.Redirect("login.aspx");
         }
     }
 }
        protected override void OnDataBinding(EventArgs e)
        {
            base.OnDataBinding(e);

            object entity;
            var    rowDescriptor = Row as ICustomTypeDescriptor;

            if (rowDescriptor != null)
            {
                // Get the real entity from the wrapper
                entity = rowDescriptor.GetPropertyOwner(null);
            }
            else
            {
                entity = Row;
            }

            // Get the collection and make sure it's loaded
            var entityCollection = Column.EntityTypeProperty.GetValue(entity, null) as RelatedEnd;

            if (entityCollection == null)
            {
                throw new InvalidOperationException(
                          String.Format(
                              "The ManyToMany template does not support the collection type of the '{0}' column on the '{1}' table.",
                              Column.Name, Table.Name));
            }
            if (!entityCollection.IsLoaded)
            {
                entityCollection.Load();
            }

            // Bind the repeater to the list of children entities
            Repeater1.DataSource = entityCollection;
            Repeater1.DataBind();
        }
예제 #29
0
        protected void ShowData()
        {
            #region 文章內容
            string        ConnectionStrings = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["ConnectionString"].ToString();
            SqlConnection connection        = new SqlConnection(ConnectionStrings);
            SqlCommand    command           = new SqlCommand("SELECT * from news where id =@id", connection);
            command.Parameters.Add("@id", SqlDbType.NVarChar);
            command.Parameters["@id"].Value = Request.QueryString["id"];
            //SqlDataAdapter dataAdapter = new SqlDataAdapter(command);
            //DataTable dataTable = new DataTable();
            //dataAdapter.Fill(dataTable);
            //title.Text = dataTable.Rows[0][2].ToString();
            //content.Text= dataTable.Rows[0][5].ToString();
            connection.Open();
            SqlDataReader ereader = command.ExecuteReader();
            ereader.Read();
            title.Text   = ereader["title"].ToString();
            content.Text = ereader["newsContent"].ToString();
            connection.Close();
            #endregion

            #region   內容
            string        ConnectionStrings1 = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["ConnectionString"].ToString();
            SqlConnection connection1        = new SqlConnection(ConnectionStrings1);
            SqlCommand    command1           = new SqlCommand("SELECT * from newsDownloads WHERE newsId=@newsId", connection1);
            command1.Parameters.Add("@newsId", SqlDbType.NVarChar);
            command1.Parameters["@newsId"].Value = Request.QueryString["id"];
            SqlDataAdapter dataAdapter1 = new SqlDataAdapter(command1);
            DataTable      dataTable1   = new DataTable();
            dataAdapter1.Fill(dataTable1);
            Repeater1.DataSource = dataTable1;
            Repeater1.DataBind();


            #endregion
        }
예제 #30
0
 void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
     if (e.CommandName == "xg")
     {
         users u = con.users.Where(r => r.ids == Convert.ToInt32(e.CommandArgument)).FirstOrDefault();
         if (u != null)
         {
             if (u.state == true)
             {
                 u.state = false;
                 con.SubmitChanges();
                 Repeater1.DataSource = select().Take(Pagecount);
                 Repeater1.DataBind();
             }
             else
             {
                 u.state = true;
                 con.SubmitChanges();
                 Repeater1.DataSource = select().Take(Pagecount);
                 Repeater1.DataBind();
             }
         }
     }
 }