protected void Planclick(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                if (Calendar.SelectedDate == DateTime.MinValue)
                {
                    CalendarValidator.IsValid = false;
                    return;
                }
                var firstDay     = Calendar.SelectedDates.Cast <DateTime>().First();
                var lastDay      = Calendar.SelectedDates.Cast <DateTime>().Last();
                var shoppingList = new Dictionary <string, double>();
                var allEvents    = new List <Event>();

                foreach (var searcher in Searcher.GetAllSearchers())
                {
                    var events = searcher.GetEventsBetweenDates(_garden.Id, firstDay, lastDay);
                    allEvents.AddRange(events);
                    foreach (var @event in events)
                    {
                        MergeToBigList(ref shoppingList, @event.ShoppingListForChild);
                    }
                }

                MergeToBigList(ref shoppingList, _everyweekList);
                var childrenCount = _garden.Children.Count;
                var finalList     = shoppingList.Select(d => new ShoppingItem
                {
                    Name     = d.Key,
                    Quantity = Convert.ToInt32(Math.Ceiling(d.Value * childrenCount))
                }).ToList();
                ListLabel.Visible     = true;
                ProductsLabel.Visible = true;
                ListView1.DataSource  = allEvents;
                GridView1.DataSource  = finalList;
                ListView1.DataBind();
                GridView1.DataBind();
            }
        }
Exemple #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         if (Request.Cookies["user"] == null)
         {
             lbl_username.Text   = "Guest";
             img_propic.ImageUrl = "~/img/default_profile_pic.jpg";
         }
         else
         {
             lbl_username.Text   = Request.Cookies["user"].Value;
             img_propic.ImageUrl = Request.Cookies["image"].Value;
         }
         conn.Open();
         string query = "select * from BabyandKids";
         da = new SqlDataAdapter(query, conn);
         da.Fill(ds, "tempBabyProducts");
         ListView1.DataSource = ds.Tables["tempBabyProducts"];
         ListView1.DataBind();
     }
 }
Exemple #3
0
    protected void Button1_Click1(object sender, EventArgs e)
    {
        OleDbConnection conn = new OleDbConnection();

        conn.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionStringAccess"].ToString();
        conn.Open();
        OleDbCommand command = new OleDbCommand();

        command.Connection  = conn;
        command.CommandText = "UPDATE [Patient] SET [Problems]=\"" + TextBox2.Text + "\", [Treatment]=\"" + TextBox3.Text + "\", [Medication]=\"" + TextBox4.Text + "\" WHERE [Username]=\"" + TextBox1.Text + "\";";
        // ALTERNATIVELY (THIS IS MORE ELEGANT):
        //command.CommandText = "UPDATE [Patient] SET [Problems]=@problems, [Treatment]=@treatment, [Medication]=@medication WHERE [Username]=@user;";
        //command.Parameters.AddWithValue("@user", TextBox1.Text);
        //command.Parameters.AddWithValue("@problems", TextBox2.Text);
        //command.Parameters.AddWithValue("@treatment", TextBox3.Text);
        //command.Parameters.AddWithValue("@medication", TextBox4.Text);
        try
        {
            command.ExecuteNonQuery();

            Label5.Text      = "Request was succesfully sent!";
            Label5.Visible   = true;
            Label5.ForeColor = System.Drawing.Color.Green;
            TextBox1.Text    = "";
            TextBox2.Text    = "";
            TextBox3.Text    = "";
            TextBox4.Text    = "";
        }
        catch
        {
            Label5.Text      = "<p>An error occured. The request could not be send.</p><p> Please make sure the data matches the requirements to be provided.</p>";
            Label5.Visible   = true;
            Label5.ForeColor = System.Drawing.Color.Red;
        }

        ListView1.DataBind();
        conn.Close();
    }
Exemple #4
0
        private void ObtieneTodosDispos()
        {
            try
            {
                List <THE_Dispositivo> lstDisposDisponi = MngNegocioDispositivo.ObtieneDispositivosAsignadosUsuario();

                for (int ini = 0; ini < lstDisposDisponi.Count; ini++)
                {
                    if (lstDisposDisponi[ini].ImagenTelefono == null)
                    {
                        lstDisposDisponi[ini].ImagenTelefono = "../Images/no_foto.jpg";
                    }
                    else
                    {
                        lstDisposDisponi[ini].ImagenTelefono = "../Media/Dispositivos/" + lstDisposDisponi[ini].IdDispositivo + "/" + lstDisposDisponi[ini].ImagenTelefono;
                    }
                }

                lvDispositivosEncu.DataSource = null;
                for (int ini = 0; ini < lstDisposDisponi.Count; ini++)
                {
                    lstDisposDisponi[ini].EstatusCheck = "";
                    lstDisposDisponi[ini].ChkEnabled   = "";
                    lstDisposDisponi[ini].ColorEstatus = "../Images/not.jpg";
                    lstDisposDisponi[ini].StrColor     = "Rojo";
                }
                lvDispositivosEncu.DataSource = lstDisposDisponi;
                lvDispositivosEncu.DataBind();


                ListView1.DataSource = lstDisposDisponi;
                ListView1.DataBind();
            }
            catch (Exception ex)
            {
                EncuestasMoviles.Clases.Error.ManejadorErrores(ex, Session["UserName"].ToString(), Session["UserDomain"].ToString(), Session["userMachineName"].ToString(), Session["UserIP"].ToString(), "frmDispoEncuesta", int.Parse(Session["numeroUsuario"].ToString()));
            }
        }
    protected void btnsubmit_Click(object sender, EventArgs e)
    {
        if (txtregid.Text != "")
        {
            //select* from usersnew where spillsregno = '" + txtregid.Text + "' and node = 'one'

            dt = objsql.GetTable("select u.regno,u.fname,u.mobile,u.joined,(select count(*) from installments where regno = u.regno) as cnt from usersnew u where u.spillsregno = '" + txtregid.Text + "' and u.node = 'one' order by u.joined");
            if (dt.Rows.Count > 0)
            {
                gvpins.DataSource = dt;
                gvpins.DataBind();
                Panel1.Visible = true;
            }
            else
            {
                Panel1.Visible = false;
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('No Data Found')", true);
            }
            //select* from usersnew where spillsregno = '" + txtregid.Text + "' and node = 'two'
            dt = objsql.GetTable("select u.regno,u.fname,u.mobile,u.joined,(select count(*) from installments where regno = u.regno) as cnt from usersnew u where u.spillsregno = '" + txtregid.Text + "' and u.node = 'two' order by u.joined");
            if (dt.Rows.Count > 0)
            {
                ListView1.DataSource = dt;
                ListView1.DataBind();
                Panel1.Visible = true;
            }
            else
            {
                Panel1.Visible = false;
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('No Data Found')", true);
            }
            txtregid.Text = "";
        }
        else
        {
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Invalid RegistrationId')", true);
        }
    }
Exemple #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SqlConnection connection = Connection_Manger.getConnection();

            MessageBox.Show(Request.QueryString["id"]);
            MessageBox.Show(Request.QueryString["tablename"]);
            if (Request.QueryString["id"] != null && Request.QueryString["tablename"] != null)
            {
                connection.Open();
                string viewquery = "update  ad_" + Request.QueryString["tablename"] + " set  " + Request.QueryString["tablename"] + "_views=" + Request.QueryString["tablename"] + "_views+1  where " + Request.QueryString["tablename"] + "_id =  " + Request.QueryString["id"];
                string query     = "select custom.firstname as firstname,custom.lastname as lastname,custom.mobile as mobile ,ad_" + Request.QueryString["tablename"] + "." + Request.QueryString["tablename"] + "_title as title,ad_" + Request.QueryString["tablename"] + "." + Request.QueryString["tablename"] + "_content as content,ad_" + Request.QueryString["tablename"] + "." + Request.QueryString["tablename"] + "_id as id,ad_" + Request.QueryString["tablename"] + "." + Request.QueryString["tablename"] + "_price as price,ad_" + Request.QueryString["tablename"] + "." + Request.QueryString["tablename"] + "_city as city,ad_" + Request.QueryString["tablename"] + "." + Request.QueryString["tablename"] + "_datetime as datetime,ad_" + Request.QueryString["tablename"] + "." + Request.QueryString["tablename"] + "_views as views,ad_" + Request.QueryString["tablename"] + "." + Request.QueryString["tablename"] + "_image as image from  ad_" + Request.QueryString["tablename"] + " ad_" + Request.QueryString["tablename"] + "    left join custom_profile custom on ad_" + Request.QueryString["tablename"] + "." + Request.QueryString["tablename"] + "_userid =custom.userid where ad_" + Request.QueryString["tablename"] + "." + Request.QueryString["tablename"] + "_id = " + Request.QueryString["id"] + "";

                //string query = "select " + Request.QueryString["tablename"] + "_title as title," + Request.QueryString["tablename"] + "_content as content," + Request.QueryString["tablename"] + "_price as price," + Request.QueryString["tablename"] + "_city as city," + Request.QueryString["tablename"] + "_datetime as datetime," + Request.QueryString["tablename"] + "_views as views," + Request.QueryString["tablename"] + "_image as image  from  ad_" + Request.QueryString["tablename"] + " where " + Request.QueryString["tablename"] + "_id =  " + Request.QueryString["id"];
                SqlCommand command     = new SqlCommand(query, connection);
                SqlCommand viewcommand = new SqlCommand(viewquery, connection);

                viewcommand.ExecuteNonQuery();

                SqlDataAdapter dp = new SqlDataAdapter(command);

                DataSet ds = new DataSet();
                dp.Fill(ds);
                ListView1.DataSource = ds;
                ListView1.DataBind();
                connection.Close();
            }

            //string userinfoquery = "select firstname as firstname ,lastname as lastname,mobile as mobile from custom_profile where userid=(select " + Request.QueryString["tablename"] + "_userid from ad_" + Request.QueryString["tablename"] + " where " + Request.QueryString["tablename"] + "_id =  " + Request.QueryString["id"] + " )";
            //SqlCommand userinfocommand = new SqlCommand(userinfoquery, connection);
            //SqlDataAdapter userdp = new SqlDataAdapter(userinfocommand);
            //DataSet userds = new DataSet();
            //userdp.Fill(userds);
            //ListView1.DataSource = userds;
            //ListView1.DataBind();
            //connection.Close();

            //string abc = "select custom.firstname as firstname,custom.lastname as lastname,custom.mobile as mobile ,ad_" + Request.QueryString["tablename"] + "." + Request.QueryString["tablename"] + "_title,ad_" + Request.QueryString["tablename"] + "." + Request.QueryString["tablename"] + "_content as content,ad_" + Request.QueryString["tablename"] + "." + Request.QueryString["tablename"] + "_price as price,ad_" + Request.QueryString["tablename"] + "." + Request.QueryString["tablename"] + "_city as city,ad_" + Request.QueryString["tablename"] + "." + Request.QueryString["tablename"] + "_datetime as datetime,ad_" + Request.QueryString["tablename"] + "." + Request.QueryString["tablename"] + "_views as views,ad_" + Request.QueryString["tablename"] + "." + Request.QueryString["tablename"] + "_image as image from table ad_" + Request.QueryString["tablename"] + "   left join table custom on ad_" + Request.QueryString["tablename"] + "." + Request.QueryString["tablename"] + "_userid =custom.userid where ad_" + Request.QueryString["tablename"] + "." + Request.QueryString["tablename"] + "_id = " + Request.QueryString["id"]+"";
        }
Exemple #7
0
        /// <summary>
        /// Author: Charlene Remotigue
        /// Date Created: 11/04/2012
        /// Description: Initialize Session Values (user, role)
        /// </summary>
        protected void InitializeValues()
        {
            string UserRolePrimary = GlobalCode.Field2String(Session["UserRole"]);
            string Name            = GlobalCode.Field2String(Session["UserName"]);

            if (GlobalCode.Field2String(Session["UserName"]) == "")
            {
                Session["UserName"] = User.Identity.Name;
                Name = GlobalCode.Field2String(Session["UserName"]);
            }

            MembershipUser UserName = Membership.GetUser(Name);

            if (UserName == null)
            {
                Response.Redirect("~/Login.aspx", false);
            }
            else
            {
                if (!UserName.IsOnline)
                {
                    Response.Redirect("~/Login.aspx", false);
                }
            }

            if (GlobalCode.Field2String(Session["UserRole"]) == "")
            {
                UserRolePrimary     = UserAccountBLL.GetUserPrimaryRole(Name);
                Session["UserRole"] = UserRolePrimary;
            }

            uoHiddenFieldUser.Value = Name;
            uoHiddenFieldRole.Value = UserRolePrimary;
            Session["strPrevPage"]  = Request.RawUrl;

            ListView1.DataSource = null;
            ListView1.DataBind();
        }
Exemple #8
0
        public void SearchFriends_Click(object sender, EventArgs e)
        {
            SqlConnection connection = new SqlConnection();
            SqlCommand    command    = new SqlCommand();
            // 戻り値
            DataTable dataTable = null;

            try
            {
                // 接続
                connection.ConnectionString = connectInfo;
                connection.Open();

                // SELECT文を設定
                command.CommandText = "SELECT * FROM Table_1 WHERE dog = '" + Dog.SelectedItem.Text + "'";
                command.Connection  = connection;

                // SQL実行
                SqlDataReader reader = command.ExecuteReader();

                // 結果取得
                dataTable = new DataTable();
                dataTable.Load(reader);
            }
            catch (Exception ex)
            {
                //メッセージボックスを表示する
                MessageBox.Show("何らかのエラーが発生しました。", "エラー", MessageBoxButtons.OK);
            }
            finally
            {
                // 接続解除
                connection.Close();
                // バインド
                ListView1.DataSource = dataTable;
                ListView1.DataBind();
            }
        }
Exemple #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // 把两个xml数据文件绑定到ListView控件上,实际上你可以把“打开”属性的值设置为0.
            // 这样,它将不会显示在ListView控件中。
            XmlDocument xmlDocument = new XmlDocument();

            using (DataTable tabListView1 = new DataTable())
            {
                tabListView1.Columns.Add("value", Type.GetType("System.String"));
                xmlDocument.Load(AppDomain.CurrentDomain.BaseDirectory + "/XmlFile/ListView1.xml");
                XmlNodeList xmlNodeList = xmlDocument.SelectNodes("root/data[@open='1']");
                foreach (XmlNode xmlNode in xmlNodeList)
                {
                    DataRow dr = tabListView1.NewRow();
                    dr["value"] = xmlNode.InnerText;
                    tabListView1.Rows.Add(dr);
                }
                ListView1.DataSource = tabListView1;
                ListView1.DataBind();
            }

            XmlDocument xmlDocument2 = new XmlDocument();

            using (DataTable tabListView2 = new DataTable())
            {
                tabListView2.Columns.Add("value2", Type.GetType("System.String"));
                xmlDocument2.Load(AppDomain.CurrentDomain.BaseDirectory + "/XmlFile/ListView2.xml");
                XmlNodeList xmlNodeList2 = xmlDocument2.SelectNodes("root/data[@open='1']");
                foreach (XmlNode xmlNode in xmlNodeList2)
                {
                    DataRow dr = tabListView2.NewRow();
                    dr["value2"] = xmlNode.InnerText;
                    tabListView2.Rows.Add(dr);
                }
                ListView2.DataSource = tabListView2;
                ListView2.DataBind();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            // Bind two xml data file to ListView control, actually you can change the "open" property to "0",
            // In that way, it will not display in ListView control.
            XmlDocument xmlDocument = new XmlDocument();

            using (DataTable tabListView1 = new DataTable())
            {
                tabListView1.Columns.Add("value", Type.GetType("System.String"));
                xmlDocument.Load(AppDomain.CurrentDomain.BaseDirectory + "/XmlFile/ListView1.xml");
                XmlNodeList xmlNodeList = xmlDocument.SelectNodes("root/data[@open='1']");
                foreach (XmlNode xmlNode in xmlNodeList)
                {
                    DataRow dr = tabListView1.NewRow();
                    dr["value"] = xmlNode.InnerText;
                    tabListView1.Rows.Add(dr);
                }
                ListView1.DataSource = tabListView1;
                ListView1.DataBind();
            }

            XmlDocument xmlDocument2 = new XmlDocument();

            using (DataTable tabListView2 = new DataTable())
            {
                tabListView2.Columns.Add("value2", Type.GetType("System.String"));
                xmlDocument2.Load(AppDomain.CurrentDomain.BaseDirectory + "/XmlFile/ListView2.xml");
                XmlNodeList xmlNodeList2 = xmlDocument2.SelectNodes("root/data[@open='1']");
                foreach (XmlNode xmlNode in xmlNodeList2)
                {
                    DataRow dr = tabListView2.NewRow();
                    dr["value2"] = xmlNode.InnerText;
                    tabListView2.Rows.Add(dr);
                }
                ListView2.DataSource = tabListView2;
                ListView2.DataBind();
            }
        }
    private void BindData()
    {
        SqlConnection  conexion  = new SqlConnection("Data Source=LAPTOP-2V9EL9OT\\SQLEXPRESS;Initial Catalog=Fase2;Integrated Security=True");
        SqlDataAdapter adaptador = new SqlDataAdapter("SELECT Software.id_software, Software.nombre,Software.Descripcion, Software.Link, Software.Demo, Software.Soporte, Software.Año_Creacion, " +
                                                      "Software.Imagen, Empresa_Propietaria.nombre As \"empresa\", Plataforma.tipo,Licencia.descricpcion as \"Licencia\", Categoria=STUFF((SELECT ','+COALESCE(LTRIM(RTRIM(Categoria.nombre)),'') " +
                                                      "FROM CategoriaSoftware INNER JOIN Categoria ON " +
                                                      "CategoriaSoftware.idcategoria = Categoria.id_venta WHERE  CategoriaSoftware.idsoft = Software.id_software FOR XML PATH('')), 1, 1, '') FROM Software " +
                                                      "JOIN Empresa_Propietaria " +
                                                      "On codempresa = id_Empresa  JOIN Software_Plataforma " +
                                                      "ON Software_Plataforma.idsoftware = Software.id_software JOIN Plataforma " +
                                                      "ON Software_Plataforma.idplataforma = Plataforma.id_Plataforma JOIN CategoriaSoftware " +
                                                      "ON CategoriaSoftware.idsoft = Software.id_software JOIN Categoria " +
                                                      "ON Categoria.id_venta = CategoriaSoftware.idcategoria JOIN LicenciaSoftware ON " +
                                                      "LicenciaSoftware.idsoftware = Software.id_software JOIN Licencia ON " +
                                                      "Licencia.id_licencia = LicenciaSoftware.idlicencia " +
                                                      "GROUP BY Software.id_software,Software.nombre,Software.Link,Software.Demo,Licencia.descricpcion,Software.Soporte,Software.Año_Creacion, " +
                                                      "Software.Imagen,Empresa_Propietaria.nombre,Plataforma.tipo,Software.Descripcion; ", conexion);
        DataTable dt = new DataTable();

        adaptador.Fill(dt);
        ListView1.DataSource = dt;
        ListView1.DataBind();
    }
 protected void Button1_Click(object sender, EventArgs e)
 {
     if (DropDownList_Class.SelectedIndex == 0)
     {
         ListView1.DataSource = NewsBll.luandou();
         ListView1.DataBind();
     }
     else if (DropDownList_Class.SelectedIndex == 1)
     {
         ListView1.DataSource = NewsBll.zatan();
         ListView1.DataBind();
     }
     else if (DropDownList_Class.SelectedIndex == 2)
     {
         ListView1.DataSource = NewsBll.banben();
         ListView1.DataBind();
     }
     else
     {
         ListView1.DataSource = NewsBll.kazu();
         ListView1.DataBind();
     }
 }
        protected void Page_PreRender(object sender, EventArgs e)
        {
            string address = (Request.QueryString["id"]);

            List <Card> cards = new List <Card>();

            string[] imagesdirectory  = Directory.GetFiles(Server.MapPath(address), "*.jpg");
            string[] contentdirectory = Directory.GetFiles(Server.MapPath(address), "*.txt");

            Array.Sort(imagesdirectory, CompareStrings);
            Array.Sort(contentdirectory, CompareStrings);

            for (int i = 0; i < (imagesdirectory.Length); i++)
            {
                if (contentdirectory.Length == imagesdirectory.Length)
                {
                    cards.Add(new Card(address + "/" + Path.GetFileName(imagesdirectory[i]) + "?lightbox[width]=600&lightbox[height]=400", File.ReadAllText(contentdirectory[i])));
                }
            }

            ListView1.DataSource = cards;
            ListView1.DataBind();
        }
        protected void btnAddPolicy_Click(object sender, EventArgs e)
        {
            using (SqlConnection con = new SqlConnection(_Default.conString))
            {
                con.Open();
                String query = "INSERT INTO policies VALUES (" +
                               "'" + txtPolicyName.Text.Trim() + "'," +
                               "'" + txtPolicyDesc.Text.Trim() + "')";

                using (SqlCommand cmd = new SqlCommand(query, con))
                {
                    if (cmd.ExecuteNonQuery() > 0)
                    {
                        ListView1.DataBind();
                        Response.Write("<script>alert('Policy Added.');</script>");
                    }
                    else
                    {
                        Response.Write("<script>alert('Couldn't add Policy, please try again.');</script>");
                    }
                }
            }
        }
Exemple #15
0
        //gv绑定
        public void ListViewBind()
        {
            string  Str1 = "";
            DataSet ds;

            if (txt_query.Text == "wjs")
            {
                Str1 = "where b.jszt='未接收' and a.fbsj+1<GETDATE() and a.rwzt='已发布'";
                AspNetPager1.RecordCount = (int)SqlHelper.ExecuteScalar("select count(*) from OA_Rwd01 a left join OA_Rwd02 b on a .rwid=b.ssrwid " + Str1);
                ds = SqlHelper.ExecuteDs("select case when(ynxs = '是' and getdate() > jzrq) then 'wz' else 'wz' end as cqzt,datediff(day,fbsj,GETDATE()) as day,rwid,rwbt,fbsj,jsr,jszt,jzrq,ynxs from OA_Rwd01 a left join OA_Rwd02 b on a .rwid=b.ssrwid " + Str1 + " order by a.fbsj asc", AspNetPager1.PageSize * (AspNetPager1.CurrentPageIndex - 1), AspNetPager1.PageSize);
                ListView1.DataSource = ds;
                ListView1.DataBind();
            }
            if (txt_query.Text == "ycs")
            {
                Str1 = "where  b.jszt!='已办结' and a.ynxs='是' and a.jzrq<GETDATE()";
                AspNetPager1.RecordCount = (int)SqlHelper.ExecuteScalar("select count(*) from OA_Rwd01 a left join OA_Rwd02 b on a .rwid=b.ssrwid " + Str1);
                ds = SqlHelper.ExecuteDs("select case when(ynxs = '是' and getdate() > jzrq) then 'yes' else 'yes' end as cqzt,datediff(day,fbsj,GETDATE()) as day,rwid,rwbt,fbsj,jsr,jszt,jzrq,ynxs from OA_Rwd01 a left join OA_Rwd02 b on a .rwid=b.ssrwid " + Str1 + " order by a.fbsj asc",
                                         AspNetPager1.PageSize * (AspNetPager1.CurrentPageIndex - 1), AspNetPager1.PageSize);
                ListView1.DataSource = ds;
                ListView1.DataBind();
            }
        }
Exemple #16
0
        /// <summary>
        /// Ustawinie tytułu strony. Po otworzeniu strony z parametrm "string" rozpoczęcie wyszukiwania podstawowego.
        /// Jeśli strona została załadowana ponownie z parametrem "command" w ViewState - wyszukiwanie zaawansowane.
        /// </summary>
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.Title = "Biblioteka - Wyszukiwarka";
            query      = Request.QueryString["string"];

            if (!Page.IsPostBack)
            {
                int page = 1;
                Int32.TryParse(Request.QueryString["page"], out page);

                if (query != null && !query.Equals(""))
                {
                    ListView1.DataSource = searchSimple(query);
                    ListView1.DataBind();
                    txtSzukanyTekst.Text = query;
                    ListView1.Visible    = true;
                }
                else
                {
                    ListView1.Visible = false;
                }
            }
        }
Exemple #17
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (Session["uid_gender"] != null)
         {
             if (Request.QueryString["Req"] == null)
             {
                 BindInbox();
                 lblTitle.Text  = "Inbox";
                 lblHeader.Text = "Sender";
             }
             else
             {
                 ObjMSG.User_Id       = Session["uid_gender"].ToString().Split('_')[0];
                 ListView1.DataSource = ObjMSG.Get_SentMSG();
                 ListView1.DataBind();
                 lblTitle.Text  = "OutBox";
                 lblHeader.Text = "Receiver";
             }
         }
     }
 }
Exemple #18
0
    protected void addBtnClick(object sender, EventArgs e)
    {
        Ingredient item = new Ingredient();

        item.Name     = nameText.Text;
        item.Quantity = quantityText.Text;
        item.Unit     = unitText.Text;
        if (item.Name.Length + item.Quantity.Length + item.Unit.Length > 0)
        {
            ingredients.Add(item);
            ListView1.DataBind();
            nameText.Text     = "";
            quantityText.Text = "";
            unitText.Text     = "";
        }
        if (15 == ingredients.Count)
        {
            nameText.Enabled     = false;
            quantityText.Enabled = false;
            unitText.Enabled     = false;
            addBtn.Enabled       = false;
        }
    }
Exemple #19
0
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        if (txtname.Text != "" && txtemail.Text != "" && txtpw.Text != "" && txtadd.Text != "" && txtdept.Text != "" && txtphone.Text != "")
        {
            cmd = new SqlCommand("update tbl_student set stud_name=@name,stud_email=@email,stud_pw=@pass,stud_add=@add,stud_dept=@dept,stud_phone=@phone where stud_name=@name", con);
            con.Open();

            cmd.Parameters.AddWithValue("@name", txtname.Text);
            cmd.Parameters.AddWithValue("@email", txtemail.Text);
            cmd.Parameters.AddWithValue("@pass", txtpw.Text);
            cmd.Parameters.AddWithValue("@add", txtadd.Text);
            cmd.Parameters.AddWithValue("@dept", txtdept.Text);
            cmd.Parameters.AddWithValue("@phone", txtphone.Text);
            cmd.ExecuteNonQuery();
            lblMessage.Text = "Record Updated...";
            con.Close();
            ListView1.DataBind();
        }
        else
        {
            lblMessage.Text = "Please Select Record to Update";
        }
    }
Exemple #20
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        string checkValue = seleClass.Value;

        using (var conn = new SqlConnection(dblink))
        {
            SqlDataAdapter da = new SqlDataAdapter("select * , case SortID " +
                                                   "when '1' then N'3C產品' " +
                                                   "when '2' then N'周邊器材' " +
                                                   "when '3' then N'五金工具' " +
                                                   "when '4' then N'活動設備' end as StrSortID " +
                                                   "from Equipment " +
                                                   "where SortID =@checkValue", conn);
            //"select EquipmentID,SortID,EquipmentName,EquipmentAmount, Audit from Equipment where SortID =@checkValue", conn);

            da.SelectCommand.Parameters.AddWithValue("checkValue", checkValue);//@checkValue 需要再加上這行給值
            conn.Open();
            DataTable dt = new DataTable();
            da.Fill(dt);
            ListView1.DataSource = dt;//網頁&disgin 只要設定一邊
            ListView1.DataBind();
        }
    }
Exemple #21
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            string search = txtSearch.Text;

            using (var DbContext = new shows_dbEntities())
            {
                List <show> results = DbContext.shows.Where(x => x.genre == search).ToList();
                ListView1.Items.Clear();
                foreach (var result in results)
                {
                    var item = new ListViewDataItem(result.showId, result.showId);
                    item.DataItem = new
                    {
                        result.performer,
                        result.genre,
                        result.dates,
                        result.times
                    };
                    ListView1.Items.Add(item);
                }
            }
            ListView1.DataBind();
        }
Exemple #22
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            string            name     = name_box.Text;
            string            category = category_box.Text;
            string            period   = period_box.Text;
            string            museum   = museum_box.Text;
            string            author   = author_box.Text;
            SqlServerDataBase sdb      = new SqlServerDataBase();

            string  stroresqlstring = "select  * from Image_info where tag='" + name + "' or Category='" + category + "' or Period='" + period + "' or Museum='" + museum + "' or Author='" + author + "'";
            DataSet ds = sdb.Select(stroresqlstring, null);

            if (sdb.ErrorMessage != null)
            {
                int _length = ds.Tables[0].Rows.Count;
                ListView1.DataSource = ds;
                ListView1.DataBind();
            }
            else
            {
                Response.Write(sdb.ErrorMessage);
            }
        }
Exemple #23
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if ((String)Session["email"] == "" || Session["email"] == null)
            {
                Response.Redirect("login.aspx");
            }
            if (!IsPostBack)
            {
                Session["inicial"] = Convert.ToString(0);
            }

            PublicacionCEN        publiCEN   = new PublicacionCEN();
            IList <PublicacionEN> lista      = publiCEN.Listar(Convert.ToInt32((String)Session["inicial"]), 10);
            IList <PublicacionEN> destacados = publiCEN.Por_likes();
            List <PublicacionEN>  lParsed    = lista as List <PublicacionEN>;
            List <PublicacionEN>  dParsed    = destacados as List <PublicacionEN>;

            ListView1.DataSource = lParsed;
            ListView1.DataBind();

            ListView2.DataSource = dParsed;
            ListView2.DataBind();
        }
Exemple #24
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if ((String)Session["email"] == "" || Session["email"] == null)
            {
                Response.Redirect("login.aspx");
            }

            if (!IsPostBack)
            {
                inicial = 0;
                final   = inicial + 10;
            }
            else
            {
                final = inicial + 10;
            }
            MaterialCEN        matCEN  = new MaterialCEN();
            IList <MaterialEN> lista   = matCEN.Listar(inicial, final);
            List <MaterialEN>  lParsed = lista as List <MaterialEN>;

            ListView1.DataSource = lParsed;
            ListView1.DataBind();
        }
        protected void btnAdd_ServerClick(object sender, EventArgs e)
        {
            DbContext     db  = new DbContext();
            OracleCommand cmd = new OracleCommand("Create_Course_SP");

            cmd.CommandType = System.Data.CommandType.StoredProcedure;

            OracleParameter para1 = new OracleParameter("v_title", txtTitle.Text);
            OracleParameter para2 = new OracleParameter("v_credit", txtCredit.Text);
            OracleParameter para3 = new OracleParameter("v_deptname", ucDepartment1.Value);
            OracleParameter para4 = new OracleParameter("v_instructorid", ddlInstructor.SelectedValue);

            cmd.Parameters.Add(para1);
            cmd.Parameters.Add(para2);
            cmd.Parameters.Add(para3);
            cmd.Parameters.Add(para4);
            db.ExecuteNonQuery(cmd);
            txtCredit.Text = string.Empty;
            txtTitle.Text  = string.Empty;
            ucDepartment1.SelectedIndex = 0;

            ListView1.DataBind();
        }
Exemple #26
0
    protected void lbtSearchExpences_Click(object sender, EventArgs e)
    {
        SqlDataReader sdr = uc.getExpenceSet(txtSearch.Text);

        if (sdr.HasRows)
        {
            if (sdr.Read())
            {
                Session["propertyvalue"] = sdr["e_PropertyVal"].ToString();
                string propertyvalue = Session["propertyvalue"].ToString();
                showExpenses();
                showExpensesCount();
                ListView1.DataSource = uc.getexpense(propertyvalue);
                ListView1.DataBind();
            }
            sdr.Close();
        }
        else
        {
            string text = "Record Not Found";
            ScriptManager.RegisterStartupScript(this, typeof(Page), "Warning", "<script>showpoperror('" + text + "')</script>", false);
        }
    }
Exemple #27
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Session["strPrevPage"]  = Request.RawUrl;
                uoHiddenFieldUser.Value = GlobalCode.Field2String(Session["UserName"]);

                HtmlTable uoTblDate = (HtmlTable)Master.FindControl("uoTblDate");
                uoTblDate.Style.Add("display", "none");

                //BindRegionList();
                //BindPortList();
                BindYear();
                BindMonth();

                uoHiddenFieldLoadType.Value = "0";
                //BindSeafarer();
                BindDashboard();
                BindSourceType();
            }
            ListView1.DataSource = null;
            ListView1.DataBind();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            HiddenField uoHiddenFieldPopupCalendar = (HiddenField)Master.FindControl("uoHiddenFieldPopupCalendar");

            uoHiddenFieldUser.Value = GlobalCode.Field2String(Session["UserName"]);

            if (!IsPostBack)
            {
                Session["strPrevPage"] = Request.RawUrl;

                uoHiddenFieldDate.Value = Request.QueryString["dt"];
                Session["DateFrom"]     = uoHiddenFieldDate.Value;

                BindPortList();
                GetPortNotInTM();
            }
            else
            {
                if (Session["DateFrom"] != null && GlobalCode.Field2String(Session["DateFrom"]) != "")
                {
                    uoHiddenFieldDate.Value = GlobalCode.Field2String(Session["DateFrom"]);
                }
                else
                {
                    uoHiddenFieldDate.Value = Request.QueryString["dt"];
                }
            }

            if (uoHiddenFieldPopupCalendar.Value == "1")
            {
                BindPortList();
                GetPortNotInTM();
            }

            ListView1.DataSource = null;
            ListView1.DataBind();
        }
Exemple #29
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                List <string> providerNames =
                    HttpContext.Current.GetOwinContext().Authentication
                    .GetAuthenticationTypes((d) => d.Properties != null && d.Properties.ContainsKey("Caption"))
                    .Select(t => t.AuthenticationType).ToList();

                ListView1.DataSource = providerNames;
                ListView1.DataBind();
            }
            else
            {
                var provider = Request.Form["provider"];
                if (provider == null)
                {
                    return;
                }
                else
                {
                    string returnUrl = Request["ReturnUrl"];

                    if (String.IsNullOrEmpty(returnUrl))
                    {
                        returnUrl = "/";
                    }

                    var properties = new Microsoft.Owin.Security.AuthenticationProperties
                    {
                        RedirectUri = returnUrl
                    };

                    HttpContext.Current.GetOwinContext().Authentication.Challenge(properties, provider);
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                var typeid = 1;
                var type   = Request.QueryString["type"];
                if (string.IsNullOrEmpty(type))
                {
                    type = "news";
                }
                type = type.ToLower();


                switch (type)
                {
                case "news":
                    typeid = 1;
                    break;

                case "roydad":
                    typeid = 2;
                    break;

                case "maqale":
                default:
                    typeid = 3;
                    break;
                }

                ListView1.DataSource = new TafsirLib.News().Load(typeid.ToString());
                ListView1.DataBind();
            }
            catch (Exception)
            {
                //var err = ex.Message;
            }
        }