示例#1
0
 protected void BindView()
 {
     ListView1.DataSource = Topic_CommentManager.admin_tc();
     ListView1.DataBind();
 }
示例#2
0
 public void selectSQL()
 {
     ListView1.DataBind();
 }
示例#3
0
 //绑定数据
 //绑定数据
 protected void BindView()
 {
     ListView1.DataSource = BBSBll.allbbs();
     ListView1.DataBind();
 }
示例#4
0
        /// <summary>
        /// Author: Charlene Remotigue
        /// Date Created: 16/04/2012
        /// (description) intialize session values
        /// </summary>
        protected void InitializeValues()
        {
            if (GlobalCode.Field2String(Session["UserName"]) == "")
            {
                Session["UserName"] = User.Identity.Name;
            }
            MembershipUser UserName = Membership.GetUser(GlobalCode.Field2String(Session["UserName"]));

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

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

            uoHiddenFieldRole.Value = GlobalCode.Field2String(Session["UserRole"]);

            if (uoHiddenFieldRole.Value == TravelMartVariable.RoleHotelVendor ||
                uoHiddenFieldRole.Value == TravelMartVariable.RoleVehicleVendor ||
                uoHiddenFieldRole.Value == TravelMartVariable.RolePortSpecialist)
            {
                if (GlobalCode.Field2String(Session["UserCountry"]) == "0" || GlobalCode.Field2String(Session["UserCountry"]) == "")
                {
                    GetBranchInfo();
                }
            }

            Session["strPrevPage"] = Request.RawUrl;

            if (GlobalCode.Field2String(Session["DateFrom"]) == "")
            {
                Session["DateFrom"] = GlobalCode.Field2DateTime(Request.QueryString["dt"]).ToShortDateString();
            }

            uoHiddenFieldDate.Value = GlobalCode.Field2DateTime(Session["DateFrom"]).ToShortDateString();

            Session["DateTo"] = GlobalCode.Field2DateTime(Session["DateFrom"]).ToShortDateString();

            bool HideVessel = HideVesselHeader();

            if (HideVessel)
            {
                ListView1.DataSource = null;
                ListView1.DataBind();
            }
            else
            {
                ListView2.DataSource = null;
                ListView2.DataBind();
            }
        }
 private void BindListview()
 {
     ListView1.DataSource = Connection.dbTable("Select ID, Name, image, Description, Min_Order from inventory where Category='Finished Product'");
     ListView1.DataBind();
 }
示例#6
0
 protected void Appointments_ItemEditing(object sender, ListViewEditEventArgs e)
 {
     ListView1.EditIndex  = e.NewEditIndex;
     ListView1.DataSource = Appointments;
     ListView1.DataBind();
 }
示例#7
0
 protected void BindView()
 {
     ListView1.DataSource = UserManager.alluser();
     ListView1.DataBind();
 }
 private void LoadGridData()
 {
     ListView1.DataSource = ec.ListAllRequest().Where(r => r.DepartmentCode == this.Master.UserDepartmentCode).ToList();
     ListView1.DataBind();
 }
示例#9
0
        private void LoadGrade()
        {
            var user    = Page.User as CustomPrincipal;
            var gradeId = Request.QueryString["gId"];

            if (user != null)
            {
                if (gradeId != null)
                {
                    using (var helper = new DbHelper.Grade())
                    {
                        var grade = helper.GetGrade(Convert.ToInt32(gradeId));
                        if (grade != null)
                        {
                            if (SiteMap.CurrentNode != null)
                            {
                                var list = new List <IdAndName>()
                                {
                                    new IdAndName()
                                    {
                                        Name    = SiteMap.RootNode.Title
                                        , Value = SiteMap.RootNode.Url
                                        , Void  = true
                                    },
                                    new IdAndName()
                                    {
                                        Name    = SiteMap.CurrentNode.ParentNode.Title
                                        , Value = SiteMap.CurrentNode.ParentNode.Url
                                        , Void  = true
                                    },
                                    new IdAndName()
                                    {
                                        Name = grade.Name
                                    }
                                };
                                SiteMapUc.SetData(list);
                            }
                            if ((grade.SchoolId ?? 0) == 0 || (grade.SchoolId ?? 0) == user.SchoolId)
                            {
                                lblHeading.Text     = grade.Name;
                                lblDescription.Text = grade.Description;
                                lblGradeType.Text   = grade.RangeOrValue ? "Value" : "Range";
                                if (grade.RangeOrValue) //value
                                {
                                    rowEquivalentPercentOrPosition.Visible = true;
                                    pnlValues.Visible = true;
                                    var isInPercent = (grade.GradeValueIsInPercentOrPostition ?? false);

                                    lblPercentOrPosition.Text = isInPercent
                                        ? " percent (%)"
                                        : " position";

                                    IsInPercentOrPosition = isInPercent;
                                    //grade.GradeValues.Where(x=>x.EquivalentPercentOrPostition)
                                    ListView1.DataSource = grade.GradeValues.Where(x => !(x.Void ?? false)).ToList();
                                    ListView1.DataBind();
                                }
                                else //range
                                {
                                    rowMaximumValue.Visible = true;
                                    rowMinimumValue.Visible = true;
                                    rowMinPassValue.Visible = true;

                                    lblMaximumValue.Text = (grade.TotalMaxValue ?? 0).ToString("F");
                                    lblMinimumValue.Text = (grade.TotalMinValue ?? 0).ToString("F");
                                    lblMinPassValue.Text = (grade.MinimumPassValue ?? 0).ToString("F");
                                }
                            }
                            else
                            {
                                Response.Redirect("~/Views/All_Resusable_Codes/Error/ErrorPage.aspx");
                            }
                        }
                    }
                }
                else
                {
                    Response.Redirect("~/Views/All_Resusable_Codes/Error/ErrorPage.aspx");
                }
            }
        }
示例#10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string query = "SELECT lo.id as id,lo.th_name lo_th_name,lo.en_name lo_en_name,pic.image img,p.en_name p_en_name,p.th_name p_th_name FROM location lo";

        query += " left join image_location pic on lo.id = pic.location_id and pic.id in (select min(id) from image_location Group by location_id)  ";
        query += " left join province p on lo.province_id = p.id ";

        /// keyword Search
        string SearchKeyWord = TextBoxSearch.Text;

        if (SearchKeyWord != "")
        {
            query += " where ( lo.th_name like '%" + SearchKeyWord + "%'";
            query += " or lo.en_name like '%" + SearchKeyWord + "%' )";
        }

        /// type Filter

        string typeFilter = "";

        foreach (ListItem type in CheckBoxListType.Items)
        {
            if (type.Selected)
            {
                if (typeFilter.Length == 0)
                {
                    typeFilter += type.Value;
                }
                else
                {
                    typeFilter += "," + type.Value;
                }
            }
        }
        string prefixType = " where ";

        if (query.IndexOf("where") > -1)
        {
            prefixType = " and ";
        }
        if (typeFilter.Length != 0)
        {
            query += prefixType + " type_location_id in (" + typeFilter + ")";
        }


        //province Filter


        string ProvinceFilter = "";

        foreach (ListItem province in CheckBoxListProvince.Items)
        {
            if (province.Selected)
            {
                if (ProvinceFilter.Length == 0)
                {
                    ProvinceFilter += province.Value;
                }
                else
                {
                    ProvinceFilter += "," + province.Value;
                }
            }
        }
        string prefixProvince = " where ";

        if (query.IndexOf("where") > -1)
        {
            prefixProvince = " and ";
        }
        if (ProvinceFilter.Length != 0)
        {
            query += prefixProvince + " province_id in (" + ProvinceFilter + ")";
        }


        //System.Diagnostics.Debug.WriteLine(query); //console.log



        string         ConnectString = WebConfigurationManager.ConnectionStrings["jojoDBConnectionString"].ConnectionString;
        SqlConnection  con           = new SqlConnection(ConnectString);
        SqlDataAdapter sda           = new SqlDataAdapter(query, con);
        DataTable      dt            = new DataTable();

        //System.Diagnostics.Debug.WriteLine(sda); //console.log

        sda.Fill(dt);

        ListView1.DataSource = dt;

        ListView1.DataBind();
    }
示例#11
0
        ////删除数据
        //protected void btnDelete_Click(object sender, EventArgs e)
        //{


        //}
        //绑定数据
        protected void BindView()
        {
            ListView1.DataSource = UsersBll.all();
            ListView1.DataBind();
        }
示例#12
0
 public void GenerateTimeSlot(List <slot> schedules)
 {
     ListView1.DataSource = schedules;
     ListView1.DataBind();
 }
 private void UpdateListView()
 {
     ListView1.DataSource = (List <Person>)Session["DataSource"];
     ListView1.DataBind();
 }
    protected void ListView1_ItemCommand(object sender, ListViewCommandEventArgs e)
    {
        Guid post_id = Guid.Empty; String like_Id = ""; String post_userId = "";
        Guid currentUserId = Guid.Empty; String user_Id = "";

        try
        {
            like_Id     = ListView1.DataKeys[e.Item.DataItemIndex].Values[1].ToString();
            post_userId = ListView1.DataKeys[e.Item.DataItemIndex].Values[2].ToString();
            MembershipUser currentUser = Membership.GetUser();
            post_id = (Guid)ListView1.DataKeys[e.Item.DataItemIndex].Values[0];

            currentUserId = (Guid)currentUser.ProviderUserKey;
            user_Id       = currentUserId.ToString();
        }
        catch { }
        if (String.Equals(e.CommandName, "allcomment"))
        {
            //Panel cp=  ListView1.FindControl("PanelPostComment") as Panel;
            //string cpanel = cp.ClientID;
            postId = post_id;
            //PostCommentDataSource.SelectCommand = "SELECT * FROM [UserComments] WHERE ([PostId] = @PostId) ORDER BY [CommentDate]";
            //PostCommentDataSource.SelectParameters.Clear();
            //PostCommentDataSource.SelectParameters.Add("PostId", post_id.ToString());
            PostCommentDataSource.DataBind();
            //return;
        }

        if (String.Equals(e.CommandName, "LikeButton"))
        {
            //ListViewDataItem dataItem = (ListViewDataItem)e.Item;
            //Guid code = (Guid)ListView1.DataKeys[dataItem.DisplayIndex].Value;
            likeId_in = (Guid)ListView1.DataKeys[e.Item.DataItemIndex].Values[1];

            //if (String.Equals(lbtn.Text , "Like"))
            //{

            ImageButton lb = e.Item.FindControl("LinkButtonLike") as ImageButton;
            LinkButton  lbviewallcomment = e.Item.FindControl("LinkViewAllComment") as LinkButton;

            System.Data.SqlClient.SqlDataReader rdr    = null;
            System.Data.SqlClient.SqlConnection conn   = null;
            System.Data.SqlClient.SqlCommand    sqlcmd = null;

            try
            {
                string connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ConnectionString;
                conn = new System.Data.SqlClient.SqlConnection(connectionString);

                sqlcmd = new System.Data.SqlClient.SqlCommand("select * from [UserLikes]", conn);
                conn.Open();

                rdr = sqlcmd.ExecuteReader();

                //if (rdr.HasRows)
                //{
                while (rdr.Read())
                {
                    String usrid = rdr["UserId"].ToString();
                    String lkid  = rdr["LikeId"].ToString();
                    if (user_Id == usrid && like_Id == lkid)
                    {
                        string connectionString10 = ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ConnectionString;
                        //string selectSql = "SELECT * FROM UserLikes WHERE UserId = @UserId";
                        string Sql = "delete from [UserLikes] WHERE LikeId=@LikeId and UserId=@UserId";

                        using (SqlConnection myConnection = new SqlConnection(connectionString10))
                        {
                            myConnection.Open();
                            SqlCommand myCommand = new SqlCommand(Sql, myConnection);
                            myCommand.Parameters.AddWithValue("@LikeId", new Guid(like_Id));
                            myCommand.Parameters.AddWithValue("@UserId", new Guid(user_Id));

                            myCommand.ExecuteNonQuery();

                            myConnection.Close();
                        }
                        return;
                        //rdr.NextResult();
                    }
                }
                string connectionString11 =
                    ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ConnectionString;


                string insertSql = "INSERT INTO UserLikes(LikeId,LikeUser,UserId) VALUES(@LikeId,@LikeUser,@UserId)";

                using (SqlConnection myConnection = new SqlConnection(connectionString11))
                {
                    myConnection.Open();
                    SqlCommand myCommand = new SqlCommand(insertSql, myConnection);
                    myCommand.Parameters.AddWithValue("@LikeId", like_Id);
                    myCommand.Parameters.AddWithValue("@LikeUser", HttpContext.Current.Session["user"]);
                    myCommand.Parameters.AddWithValue("@UserId", user_Id);
                    myCommand.ExecuteNonQuery();
                    myConnection.Close();
                }
                string connectionString5 = System.Configuration.ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ConnectionString;
                conn = new System.Data.SqlClient.SqlConnection(connectionString);

                sqlcmd = new System.Data.SqlClient.SqlCommand("select * from [Notifications]", conn);
                conn.Open();

                rdr = sqlcmd.ExecuteReader();

                //if (rdr.HasRows)
                //{
                while (rdr.Read())
                {
                    String usrid  = rdr["UserId"].ToString();
                    String lkid   = rdr["LikeId"].ToString();
                    String notify = rdr["NotifyTo"].ToString();
                    if (user_Id == usrid && like_Id == lkid && notify == post_userId)
                    {
                        return;
                    }
                }

                if (user_Id != post_userId)
                {
                    string connectionString12 =
                        ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ConnectionString;


                    string insertSql2 = "INSERT INTO Notifications(UserId,LikeId,Type,NotifyTo,PostId) VALUES(@UserId,@LikeId,@Type,@NotifyTo,@PostId)";

                    using (SqlConnection myConnection = new SqlConnection(connectionString12))
                    {
                        myConnection.Open();
                        SqlCommand myCommand = new SqlCommand(insertSql2, myConnection);
                        myCommand.Parameters.AddWithValue("@LikeId", like_Id);
                        myCommand.Parameters.AddWithValue("@Type", "Post_Like");
                        myCommand.Parameters.AddWithValue("@UserId", user_Id);
                        myCommand.Parameters.AddWithValue("@NotifyTo", post_userId);
                        ListView lstview  = sender as ListView;
                        Guid     post__id = (Guid)ListView1.DataKeys[e.Item.DataItemIndex].Values[0];
                        myCommand.Parameters.AddWithValue("@PostId", post__id);

                        myCommand.ExecuteNonQuery();
                        myConnection.Close();
                    }
                }
                if (rdr != null)
                {
                    rdr.Close();
                }
            }
            catch (Exception ex)
            {
            }

            finally
            {
                if (conn != null)
                {
                    conn.Close();
                }
                this.DataBind();
            }
        }

        if (String.Equals(e.CommandName, "SharePostId"))
        {
            sharepostId = (Guid)ListView1.DataKeys[e.Item.DataItemIndex].Values[0];

            //((AjaxControlToolkit.ModalPopupExtender)(ListView1.FindControl("MPEShare"))).Show();
            //MPEShare.Show();
        }
        if (String.Equals(e.CommandName, "Updatepost"))
        {
            Label lbl = ListView1.EditItem.FindControl("PostIdLabel") as Label;
            if (lbl != null)
            {
                postId_edit = new Guid(lbl.Text);
            }

            TextBox txt       = ListView1.EditItem.FindControl("PostTextBox") as TextBox;
            String  edit_text = txt.Text;



            string connectionString =
                ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ConnectionString;
            string updateSql = "UPDATE [UserPosts] SET [Post] = @Post WHERE [PostId] = @PostId and UserId=@UserId";

            using (SqlConnection myConnection = new SqlConnection(connectionString))
            {
                myConnection.Open();
                SqlCommand myCommand = new SqlCommand(updateSql, myConnection);
                myCommand.Parameters.AddWithValue("@Post", edit_text);
                myCommand.Parameters.AddWithValue("@PostId", postId_edit);
                myCommand.Parameters.AddWithValue("@UserId", currentUserId);



                myCommand.ExecuteNonQuery();
                myConnection.Close();
            }
            ListView1.EditIndex = -1;
            Button btnCancel = (ListView1.Items[e.Item.DataItemIndex].FindControl("CancelButton")) as Button;
            //Button btnCancel=   ListView1.EditItem.FindControl("CancelButton") as Button;
            //CancelButton_Click(btnCancel, EventArgs.Empty);
            //btnCancel.Visible = true;
            //Type t = typeof(Button);
            //object[] p = new object[1];
            //p[0] = EventArgs.Empty;
            //MethodInfo m = t.GetMethod("OnClick", BindingFlags.NonPublic | BindingFlags.Instance);
            //m.Invoke(btnCancel, p);

            ListView1.DataBind();
        }
        if (String.Equals(e.CommandName, "Deletepost"))
        {
            Guid post_Id = (Guid)ListView1.DataKeys[e.Item.DataItemIndex].Values[0];



            string connectionString =
                ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ConnectionString;
            string Sql = "delete from [UserPosts] WHERE [PostId]=@PostId and UserId=@UserId";

            using (SqlConnection myConnection = new SqlConnection(connectionString))
            {
                myConnection.Open();
                SqlCommand myCommand = new SqlCommand(Sql, myConnection);
                myCommand.Parameters.AddWithValue("@PostId", post_Id);
                myCommand.Parameters.AddWithValue("@UserId", currentUserId);



                myCommand.ExecuteNonQuery();
                myConnection.Close();
            }

            //ListView2.DataBind();
            //UpdatePanel1.Update();
        }
        ListView1.DataBind();
    }
示例#15
0
 //绑定数据
 protected void Bindview()
 {
     ListView1.DataSource = ActBll.allact();
     ListView1.DataBind();
 }
示例#16
0
 private void BindListview()
 {
     ListView1.DataSource = Connection.dbTable("SELECT ID, Name, image, Description, Min_Order FROM inventory WHERE Category='Finished Product'");
     ListView1.DataBind();
 }
示例#17
0
 protected void Appointments_ItemCanceling(object sender, ListViewCancelEventArgs e)
 {
     ListView1.EditIndex  = -1;
     ListView1.DataSource = Appointments;
     ListView1.DataBind();
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["pessoaID"] == null)
            {
                Response.Redirect("login.aspx");
            }

            int ticketID = int.Parse(Request.QueryString["tickID"].ToString());

            PessoasDominio     domPessoas = new PessoasDominio();
            AtualizacaoDominio adom       = new AtualizacaoDominio();
            TicketsDominio     tickDom    = new TicketsDominio();
            List <Atualizacao> listaS     = new List <Atualizacao>();

            Pessoas cara   = domPessoas.selecionar(int.Parse(Session["pessoaID"].ToString()));
            Tickets ticket = tickDom.pegarTicket(ticketID);

            if (ticket == null || cara.id != ticket.Usuario && cara.TipoPessoa != 2)
            {
                Response.Redirect("index.aspx");
            }

            listaS = adom.listarTickets(ticketID);

            ListView1.DataSource = adom.reescreveLista(listaS);
            ListView1.DataBind();

            if (IsPostBack)
            {
                string descricao = mensagem.Text;
                string titulos   = titulo.Text;

                if (titulos == "" || descricao == "")
                {
                    lblMessageSucess.Text            = "Por favor preencha todos os campos.";
                    sucessoAlert.Attributes["class"] = alerta.Attributes["class"].Replace("hidden", "");
                }
                else
                {
                    String filename = "";

                    if (uploadAnexo.HasFile)
                    {
                        filename = Path.GetFileName(uploadAnexo.FileName);
                        uploadAnexo.SaveAs(Server.MapPath("~/anexos/") + filename);
                    }

                    adom.novaAtualizacao(ticketID, titulos, descricao, cara.id, filename);

                    if (fecharTicket.Checked == true)
                    {
                        adom.fecharTicketsPorID(ticketID);
                    }

                    if (abrirTicket.Checked == true)
                    {
                        adom.abrirTicketsPorID(ticketID);
                    }

                    mensagem.Text = "";
                    titulo.Text   = "";

                    lblMessageSucess.Text            = "Resposta enviada com sucesso.";
                    sucessoAlert.Attributes["class"] = sucessoAlert.Attributes["class"].Replace("hidden", "");
                    Response.AddHeader("REFRESH", "5;URL=lista_tickets.aspx");
                }
            }
        }
示例#19
0
 protected void btnSearch_Click(object sender, EventArgs e)
 {
     ListView1.DataBind();
 }
    protected void ListView1_ItemCommand(object sender, ListViewCommandEventArgs e)
    {
        if (String.Equals(e.CommandName, "LikeButton"))
        {
            //ListViewDataItem dataItem = (ListViewDataItem)e.Item;
            //Guid code = (Guid)ListView1.DataKeys[dataItem.DisplayIndex].Value;

            String         like_Id     = ListView1.DataKeys[e.Item.DataItemIndex].Values[1].ToString();
            MembershipUser currentUser = Membership.GetUser();

            Guid   currentUserId = (Guid)currentUser.ProviderUserKey;
            String user_Id       = currentUserId.ToString();
            String post_userId   = ListView1.DataKeys[e.Item.DataItemIndex].Values[2].ToString();
            //if (String.Equals(lbtn.Text , "Like"))
            //{

            ImageButton lb = e.Item.FindControl("LinkButtonLike") as ImageButton;
            LinkButton  lbviewallcomment = e.Item.FindControl("LinkViewAllComment") as LinkButton;

            System.Data.SqlClient.SqlDataReader rdr    = null;
            System.Data.SqlClient.SqlConnection conn   = null;
            System.Data.SqlClient.SqlCommand    sqlcmd = null;

            try
            {
                string connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ConnectionString;
                conn = new System.Data.SqlClient.SqlConnection(connectionString);

                sqlcmd = new System.Data.SqlClient.SqlCommand("select * from [UserLikes]", conn);
                conn.Open();

                rdr = sqlcmd.ExecuteReader();

                //if (rdr.HasRows)
                //{
                while (rdr.Read())
                {
                    String usrid = rdr["UserId"].ToString();
                    String lkid  = rdr["LikeId"].ToString();
                    if (user_Id == usrid && like_Id == lkid)
                    {
                        string connectionString10 = ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ConnectionString;
                        //string selectSql = "SELECT * FROM UserLikes WHERE UserId = @UserId";
                        string Sql = "delete from [UserLikes] WHERE LikeId=@LikeId and UserId=@UserId";

                        using (SqlConnection myConnection = new SqlConnection(connectionString10))
                        {
                            myConnection.Open();
                            SqlCommand myCommand = new SqlCommand(Sql, myConnection);
                            myCommand.Parameters.AddWithValue("@LikeId", new Guid(like_Id));
                            myCommand.Parameters.AddWithValue("@UserId", new Guid(user_Id));

                            myCommand.ExecuteNonQuery();

                            myConnection.Close();
                        }
                        return;
                        //rdr.NextResult();
                    }
                }
                string connectionString11 =
                    ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ConnectionString;


                string insertSql = "INSERT INTO UserLikes(LikeId,LikeUser,UserId) VALUES(@LikeId,@LikeUser,@UserId)";

                using (SqlConnection myConnection = new SqlConnection(connectionString11))
                {
                    myConnection.Open();
                    SqlCommand myCommand = new SqlCommand(insertSql, myConnection);
                    myCommand.Parameters.AddWithValue("@LikeId", like_Id);
                    myCommand.Parameters.AddWithValue("@LikeUser", HttpContext.Current.Session["user"]);



                    myCommand.Parameters.AddWithValue("@UserId", user_Id);



                    myCommand.ExecuteNonQuery();
                    myConnection.Close();
                }
                string connectionString5 = System.Configuration.ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ConnectionString;
                conn = new System.Data.SqlClient.SqlConnection(connectionString);

                sqlcmd = new System.Data.SqlClient.SqlCommand("select * from [Notifications]", conn);
                conn.Open();

                rdr = sqlcmd.ExecuteReader();

                //if (rdr.HasRows)
                //{
                while (rdr.Read())
                {
                    String usrid  = rdr["UserId"].ToString();
                    String lkid   = rdr["LikeId"].ToString();
                    String notify = rdr["NotifyTo"].ToString();
                    if (user_Id == usrid && like_Id == lkid && notify == post_userId)
                    {
                        return;
                    }
                }

                if (user_Id != post_userId)
                {
                    string connectionString12 =
                        ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ConnectionString;


                    string insertSql2 = "INSERT INTO Notifications(UserId,LikeId,Type,NotifyTo,PostId) VALUES(@UserId,@LikeId,@Type,@NotifyTo,@PostId)";

                    using (SqlConnection myConnection = new SqlConnection(connectionString12))
                    {
                        myConnection.Open();
                        SqlCommand myCommand = new SqlCommand(insertSql2, myConnection);
                        myCommand.Parameters.AddWithValue("@LikeId", like_Id);
                        myCommand.Parameters.AddWithValue("@Type", "Covert_Post_Like");
                        myCommand.Parameters.AddWithValue("@UserId", user_Id);
                        myCommand.Parameters.AddWithValue("@NotifyTo", post_userId);
                        ListView lstview  = sender as ListView;
                        Guid     post__id = (Guid)lstview.DataKeys[e.Item.DataItemIndex].Values[0];
                        myCommand.Parameters.AddWithValue("@PostId", post__id);
                        myCommand.ExecuteNonQuery();
                        myConnection.Close();
                    }
                }
                if (rdr != null)
                {
                    rdr.Close();
                }
            }
            catch (Exception ex)
            {
            }

            finally
            {
                if (conn != null)
                {
                    conn.Close();
                }
                this.DataBind();
            }
        }
        if (String.Equals(e.CommandName, "Updatepost"))
        {
            Label lbl = ListView1.EditItem.FindControl("CovertIdLabel") as Label;
            if (lbl != null)
            {
                postId_edit = new Guid(lbl.Text);
            }

            TextBox txt       = ListView1.EditItem.FindControl("CovertPostTextBox") as TextBox;
            String  edit_text = txt.Text;

            string connectionString =
                ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ConnectionString;
            string updateSql = "UPDATE [CovertPosts] SET [CovertPost] = @CovertPost WHERE [CovertId] = @CovertId and UserId=@UserId";

            using (SqlConnection myConnection = new SqlConnection(connectionString))
            {
                myConnection.Open();
                SqlCommand myCommand = new SqlCommand(updateSql, myConnection);
                myCommand.Parameters.AddWithValue("@CovertPost", edit_text);
                myCommand.Parameters.AddWithValue("@CovertId", postId_edit);
                myCommand.Parameters.AddWithValue("@UserId", currentUserId);



                myCommand.ExecuteNonQuery();
                myConnection.Close();
            }
            ListView1.EditIndex = -1;
            //Button btnCancel = (ListView1.Items[e.Item.DataItemIndex].FindControl("CancelButton")) as Button;


            ListView1.DataBind();
        }
        if (String.Equals(e.CommandName, "Deletepost"))
        {
            Guid post_Id = (Guid)ListView1.DataKeys[e.Item.DataItemIndex].Values[0];



            string connectionString =
                ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ConnectionString;
            string Sql = "delete from [CovertPosts] WHERE [CovertId]=@CovertId and UserId=@UserId";

            using (SqlConnection myConnection = new SqlConnection(connectionString))
            {
                myConnection.Open();
                SqlCommand myCommand = new SqlCommand(Sql, myConnection);
                myCommand.Parameters.AddWithValue("@CovertId", post_Id);
                myCommand.Parameters.AddWithValue("@UserId", currentUserId);

                myCommand.ExecuteNonQuery();
                myConnection.Close();
            }

            //ListView2.DataBind();
            //UpdatePanel1.Update();
        }
        if (String.Equals(e.CommandName, "Bookmarkpost"))
        {
            Guid post_Id = (Guid)ListView1.DataKeys[e.Item.DataItemIndex].Values[0];

            System.Data.SqlClient.SqlDataReader rdr = null; System.Data.SqlClient.SqlConnection conn = null; System.Data.SqlClient.SqlCommand sqlcmd = null;

            try
            {
                string connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ConnectionString;
                conn = new System.Data.SqlClient.SqlConnection(connectionString);

                sqlcmd = new System.Data.SqlClient.SqlCommand("select * from [CovertBookmark]", conn);
                conn.Open();

                rdr = sqlcmd.ExecuteReader();

                //if (rdr.HasRows)
                //{
                while (rdr.Read())
                {
                    String covertid = rdr["CovertId"].ToString();
                    String userid   = rdr["UserId"].ToString();
                    if (covertid == post_Id.ToString() && userid == currentUserId.ToString())
                    {
                        string connectionString10 = ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ConnectionString;
                        //string selectSql = "SELECT * FROM UserLikes WHERE UserId = @UserId";
                        string Sql = "delete from [CovertBookmark] WHERE CovertId=@CovertId and UserId=@UserId";

                        using (SqlConnection myConnection = new SqlConnection(connectionString10))
                        {
                            myConnection.Open();
                            SqlCommand myCommand = new SqlCommand(Sql, myConnection);
                            myCommand.Parameters.AddWithValue("@CovertId", new Guid(covertid));
                            myCommand.Parameters.AddWithValue("@UserId", new Guid(userid));

                            myCommand.ExecuteNonQuery();

                            myConnection.Close();
                        }
                        return;
                        //rdr.NextResult();
                    }
                }
                string connectionString2 =
                    ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ConnectionString;
                string Sql2 = "INSERT INTO CovertBookmark(CovertId,UserId) VALUES(@CovertId,@UserId)";

                using (SqlConnection myConnection = new SqlConnection(connectionString2))
                {
                    myConnection.Open();
                    SqlCommand myCommand = new SqlCommand(Sql2, myConnection);
                    myCommand.Parameters.AddWithValue("@CovertId", post_Id);
                    myCommand.Parameters.AddWithValue("@UserId", currentUserId);

                    myCommand.ExecuteNonQuery();
                    myConnection.Close();
                }


                if (rdr != null)
                {
                    rdr.Close();
                }
            }
            catch (Exception ex)
            {
            }

            finally
            {
                if (conn != null)
                {
                    conn.Close();
                }
                this.DataBind();
            }



            //ListView2.DataBind();
            //UpdatePanel1.Update();
        }
        this.DataBind();
    }
示例#21
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Cookies["info"] != null)
            {
                string succ      = Request.QueryString["confirm"];
                string del       = Request.QueryString["delete"];
                string constring = ConfigurationManager.ConnectionStrings["coe125ConnectionString"].ConnectionString;

                if (succ == "1")
                {
                    lblCheck.Visible = true;
                }
                if (del != null)
                {
                    using (SqlConnection con = new SqlConnection(constring))
                    {
                        using (SqlCommand cmd = new SqlCommand("deleteItem", con))
                        {
                            cmd.CommandType = CommandType.StoredProcedure;
                            SqlDataAdapter da = new SqlDataAdapter(cmd);

                            cmd.Parameters.Add("@cid", SqlDbType.VarChar, 40);

                            cmd.Parameters["@cid"].Value = del;
                            con.Open();
                            cmd.ExecuteNonQuery();
                            con.Close();
                        }
                    }
                }


                string  cart = "";
                int     size = 0;
                string  pid = "";
                decimal price = 0;
                string  pd = "", pn = "", pp = "", pc = "", pi = "", pq = "";
                using (SqlConnection con = new SqlConnection(constring))
                {
                    using (SqlCommand cmd = new SqlCommand("getCart", con))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        SqlDataAdapter da = new SqlDataAdapter(cmd);

                        cmd.Parameters.Add("@user", SqlDbType.VarChar, 40);

                        cmd.Parameters["@user"].Value = Request.Cookies["info"]["userName"];
                        con.Open();

                        //login = Convert.ToInt32(cmd.Parameters["@login"].Value);
                        DataTable dt = new DataTable();
                        da.Fill(dt);
                        dt.Columns.Add("name", typeof(string));
                        dt.Columns.Add("price", typeof(string));

                        con.Close();
                        foreach (DataRow dr in dt.Rows)
                        {
                            using (SqlConnection con2 = new SqlConnection(constring))
                            {
                                using (SqlCommand cmd2 = new SqlCommand("getItem", con2))
                                {
                                    cmd2.CommandType = CommandType.StoredProcedure;
                                    SqlDataAdapter da2 = new SqlDataAdapter(cmd2);

                                    cmd2.Parameters.Add("@PID", SqlDbType.Int);

                                    cmd2.Parameters["@PID"].Value = dr["pid"].ToString();

                                    con2.Open();

                                    //login = Convert.ToInt32(cmd.Parameters["@login"].Value);
                                    DataTable dt2 = new DataTable();
                                    da2.Fill(dt2);

                                    foreach (DataRow dr2 in dt2.Rows)
                                    {
                                        pn = dr2["PName"].ToString();
                                        pp = dr2["PPrice"].ToString();
                                        pd = dr2["PDescription"].ToString();
                                        pc = dr2["PCateg"].ToString();
                                        pi = dr2["PImgPath"].ToString();
                                        pq = dr2["PQuantity"].ToString();
                                    }
                                    dt.Rows[size]["name"]  = pn;
                                    dt.Rows[size]["price"] = pp;
                                    price += Convert.ToDecimal(pp);

                                    con2.Close();
                                }
                            }

                            size++;
                        }
                        //cmd.ExecuteNonQuery();
                        cart                 = size.ToString();
                        btnCart.Text         = "Cart (" + cart + ")";
                        ListView1.DataSource = dt;
                        ListView1.DataBind();
                        if (size == 0)
                        {
                            ImbPaypal.Visible   = false;
                            btnCheckout.Visible = false;
                            lblHead.Text        = "No items on cart";
                            lblPrice.Visible    = false;
                            lblTotal.Visible    = false;
                        }
                    }
                }

                lblTotal.Text = "PHP " + price.ToString();
            }


            else
            {
                btnLogout.Text    = "Login";
                ImbPaypal.Visible = false;
                lblHead.Text      = "Please login to view your cart";
                lblHead.Attributes["Font-Italic"] = "true";
                lblPrice.Visible    = false;
                btnCheckout.Visible = false;
            }
        }
示例#22
0
        private void BindTagCloud()
        {
            int year = 2002;

            var tagSummaryNegative = from t in GetRaces()
                                     where t.Year == 2002
                                     group t by t.TeamWinner into tagGroup
                                     select new
            {
                Tag      = tagGroup.Key,
                tagCount = tagGroup.Count()
            };

            var tagSummaryNegativeIteration = from t in GetRaces()
                                              where t.Year == 2002
                                              group t by t.TeamWinner into tagGroup
                                              select new
            {
                Tag      = tagGroup.Key,
                tagCount = tagGroup.Count()
            };

            var tagSummaryPositive = from t in GetRaces()
                                     where t.Year == 2003
                                     group t by t.TeamWinner into tagGroup
                                     select new
            {
                Tag      = tagGroup.Key,
                tagCount = tagGroup.Count()
            };

            var tagSummaryPositiveIteration = from t in GetRaces()
                                              where t.Year == 2003
                                              group t by t.TeamWinner into tagGroup
                                              select new
            {
                Tag      = tagGroup.Key,
                tagCount = tagGroup.Count()
            };


            int maxTagFrequencyNegative = (from t in tagSummaryNegative select(int?) t.tagCount).Max() ?? 0;
            int maxTagFrequencyPositive = (from t in tagSummaryPositive select(int?) t.tagCount).Max() ?? 0;

            int maxTagFrequencyNegativeIteration = (from t in tagSummaryNegativeIteration select(int?) t.tagCount).Max() ?? 0;
            int maxTagFrequencyPositiveIteration = (from t in tagSummaryPositiveIteration select(int?) t.tagCount).Max() ?? 0;


            var tagCloudNegative = from t in GetRaces()
                                   where t.Year == 2002
                                   group t by t.TeamWinner into tagGroup
                                   select new
            {
                Tag    = tagGroup.Key,
                weight = (double)tagGroup.Count() / maxTagFrequencyNegative * 100
            };

            var tagCloudNegativeIteration = from t in GetRaces()
                                            where t.Year == 2002
                                            group t by t.TeamWinner into tagGroup
                                            select new
            {
                Tag    = tagGroup.Key,
                weight = (double)tagGroup.Count() / maxTagFrequencyNegativeIteration * 100
            };

            var tagCloudPositive = from t in GetRaces()
                                   where t.Year == 2003
                                   group t by t.TeamWinner into tagGroup
                                   select new
            {
                Tag    = tagGroup.Key,
                weight = (double)tagGroup.Count() / maxTagFrequencyPositive * 100
            };

            var tagCloudPositiveIteration = from t in GetRaces()
                                            where t.Year == 2003
                                            group t by t.TeamWinner into tagGroup
                                            select new
            {
                Tag    = tagGroup.Key,
                weight = (double)tagGroup.Count() / maxTagFrequencyPositiveIteration * 100
            };

            if (year == 2002)
            {
                ListView1.DataSource = tagCloudNegativeIteration;
                ListView1.DataBind();

                ListView2.DataSource = tagCloudPositiveIteration;
                ListView2.DataBind();
            }
            else
            {
                ListView1.DataSource = tagCloudNegative;
                ListView1.DataBind();

                ListView2.DataSource = tagCloudPositive;
                ListView2.DataBind();
            }
        }
示例#23
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                Home.PrevPage = HttpContext.Current.Request.Url.AbsoluteUri; //"Registration.aspx";
            }
            catch (Exception) { }

            try
            {
                if (!IsLogin())
                {
                    return;
                }

                var crEntity = new CourseRegistrationEntity
                {
                    CourseId  = Convert.ToInt32(Request.QueryString["Course"]),
                    StudentId = Student.Id,
                    DateTime  = TafsirLib.Tools.Shamsi.DateShamsiBaformat
                };

                var cr = new TafsirLib.CourseRegistration().Save(crEntity);
            }
            catch (Exception ex)
            {
                var t = ex.Message;
            }

            try
            {
                if (!IsLogin())
                {
                    return;
                }

                var typeid = Request.QueryString["id"];

                switch (typeid)
                {
                case "1":
                    titledore.InnerText = "ثبت نام دوره های حضوری";
                    break;

                case "2":
                    titledore.InnerText = "ثبت نام دوره های مجازی";
                    break;

                default:
                    typeid = "1";
                    titledore.InnerText = "ثبت نام دوره های حضوری";
                    break;
                }

                ListView1.DataSource = new TafsirLib.Course().Load(typeid, Student.Id.ToString());
                ListView1.DataBind();
            }
            catch (Exception ex)
            {
                var t = ex.Message;
            }
        }
示例#24
0
    protected void BindListView()
    {
        string query = "select  tl.tour_code id ,tl.location_id location_id,t.th_name t_th_name,t.en_name t_en_name, l.province_id province, l.type_location_id type_location ,ml.image img  from tour_location tl ";

        query += " inner join location l on l.id = tl.location_id";
        query += " inner join tour t on t.tour_code = tl.tour_code ";
        query += " left join image_location ml on ml.location_id = tl.location_id  ";
        query += " where t.type_tour_id = 1 ";

        /// keyword Search
        string SearchKeyWord = TextBoxSearch.Text;

        if (SearchKeyWord != "")
        {
            query += " and ( t.th_name like '%" + SearchKeyWord + "%'";
            query += " or t.en_name like '%" + SearchKeyWord + "%' )";
        }

        /// type Filter

        string typeFilter = "";

        foreach (ListItem type in CheckBoxListType.Items)
        {
            if (type.Selected)
            {
                if (typeFilter.Length == 0)
                {
                    typeFilter += type.Value;
                }
                else
                {
                    typeFilter += "," + type.Value;
                }
            }
        }
        string prefixType = " where ";

        if (query.IndexOf("where") > -1)
        {
            prefixType = " and ";
        }
        if (typeFilter.Length != 0)
        {
            query += prefixType + " l.type_location_id in (" + typeFilter + ")";
        }


        //province Filter


        string ProvinceFilter = "";

        foreach (ListItem province in CheckBoxListProvince.Items)
        {
            if (province.Selected)
            {
                if (ProvinceFilter.Length == 0)
                {
                    ProvinceFilter += province.Value;
                }
                else
                {
                    ProvinceFilter += "," + province.Value;
                }
            }
        }
        string prefixProvince = " where ";

        if (query.IndexOf("where") > -1)
        {
            prefixProvince = " and ";
        }
        if (ProvinceFilter.Length != 0)
        {
            query += prefixProvince + " l.province_id in (" + ProvinceFilter + ")";
        }

        System.Diagnostics.Debug.WriteLine("query" + query);



        string         ConnectString = WebConfigurationManager.ConnectionStrings["jojoDBConnectionString"].ConnectionString;
        SqlConnection  con           = new SqlConnection(ConnectString);
        SqlDataAdapter sda           = new SqlDataAdapter(query, con);
        DataTable      dt            = new DataTable();

        sda.Fill(dt);

        System.Diagnostics.Debug.WriteLine("start" + dt.Rows.Count);
        string Ids = "";

        for (int i = dt.Rows.Count - 1; i >= 0; i--)
        {
            DataRow dr    = dt.Rows[i];
            string  catid = dr["id"].ToString();
            if (Ids.Contains(catid))
            {
                dr.Delete();
            }
            else
            {
                Ids += catid;
            }
        }
        dt.AcceptChanges();
        System.Diagnostics.Debug.WriteLine("end");

        ListView1.DataSource = dt;
        ListView1.DataBind();
    }
 protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
 {
     ListView1.DataSource = Connection.dbTable("Select ID, Name, image, Description, Min_Order from inventory where Name LIKE '%" + DropDownList1.SelectedItem.Text + "%'");
     ListView1.DataBind();
 }
示例#26
0
 public void AddItem(WcfServiceReference.MenuItem menuItem)
 {
     classClsItemsManager.AddItem(menuItem);
     updateTextFields();
     ListView1.DataBind();
 }
示例#27
0
 protected void delmark(object s, CommandEventArgs e)
 {
     new BLL.t_commodity().Delete(Convert.ToInt32(e.CommandArgument.ToString()));
     ListView1.DataBind();
 }
示例#28
0
 protected void PhotoAlbumList_SelectedIndexChanged(object sender, EventArgs e)
 {
     ListView1.DataBind();
 }
 public void BindGridView()
 {
     ListView1.DataSource = StaffMasterManagement.GetInstance.GetOfficeEmployeeList();
     ListView1.DataBind();
 }
示例#30
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (CurrentSession.Current.userEmail == null)
        {
            Response.Redirect("Signin.aspx");
        }
        else
        {
            AccomID = Convert.ToInt32(Request.QueryString["id"]);

            sc.Open();
            SqlCommand getAccom = new SqlCommand();
            getAccom.Connection  = sc;
            getAccom.CommandText = "SELECT Street, CityCo, AccomState, Zip, CONVERT(Decimal(10,2), Price) as Price, RoomType, Neighborhood, Description, Image1, Image2, Image3, HostID, AccomName FROM ACCOMMODATION WHERE AccommodationID=@AccomID;";
            getAccom.Parameters.Add(new SqlParameter("@AccomID", AccomID));
            SqlDataReader AccomReader = getAccom.ExecuteReader();
            while (AccomReader.Read())
            {
                strCity         += AccomReader.GetString(1);
                lblcity.Text     = strCity;
                lblState.Text    = AccomReader.GetString(2);
                lblZip.Text      = AccomReader.GetString(3);
                lblPrice.Text    = "$" + AccomReader.GetDecimal(4) + " /Month";
                strType         += AccomReader.GetString(5);
                lblRoomType.Text = strType;
                neigb            = AccomReader.GetString(6);
                if (neigb == "NULL")
                {
                    lblNeigb.Text = "(N/A)";
                }
                else
                {
                    lblNeigb.Text = neigb;
                }
                txtDes.Value   = AccomReader.GetString(7);
                accomImg1      = String.Concat("data:image/jpg;base64,", Convert.ToBase64String((byte[])AccomReader["Image1"]));
                accomImg2      = String.Concat("data:image/jpg;base64,", Convert.ToBase64String((byte[])AccomReader["Image2"]));
                accomImg3      = String.Concat("data:image/jpg;base64,", Convert.ToBase64String((byte[])AccomReader["Image3"]));
                hostID         = AccomReader.GetInt32(11);
                lblDetail.Text = AccomReader.GetString(12);
            }
            AccomReader.Close();

            SqlCommand getHostName = new SqlCommand();
            getHostName.Connection  = sc;
            getHostName.CommandText = "Select HostFirstName, HostLastName from HOMEOWNER where HostID = @HostID;";
            getHostName.Parameters.Add(new SqlParameter("@HostID", hostID));
            SqlDataReader getNameReader = getHostName.ExecuteReader();
            while (getNameReader.Read())
            {
                lblHostName.Text = getNameReader.GetString(0) + " " + getNameReader.GetString(1);
            }
            getNameReader.Close();

            SqlCommand getSurvey = new SqlCommand();
            getSurvey.Connection  = sc;
            getSurvey.CommandText = "SELECT PrivateBath, PrivateLaundry, Kitchen, PrivateLiving, LowNoise, " +
                                    "ModerateNoise, NoNoise, PetsAllowed, Watch, NonSmoking, SmokerFriendly, Chores FROM SURVEY WHERE AccommodationID=@AccomID;";
            getSurvey.Parameters.Add(new SqlParameter("@AccomID", AccomID));
            SqlDataReader getSurReader = getSurvey.ExecuteReader();
            while (getSurReader.Read())
            {
                if (getSurReader.GetString(0) == "y")
                {
                    chkBath.Checked = true;
                }
                if (getSurReader.GetString(1) == "y")
                {
                    chkLaundry.Checked = true;
                }
                if (getSurReader.GetString(2) == "y")
                {
                    chkKitchen.Checked = true;
                }
                if (getSurReader.GetString(3) == "y")
                {
                    chkLiving.Checked = true;
                }
                if (getSurReader.GetString(4) == "y")
                {
                    chkLow.Checked = true;
                }
                if (getSurReader.GetString(5) == "y")
                {
                    chkModerate.Checked = true;
                }
                if (getSurReader.GetString(6) == "y")
                {
                    chkNoNoise.Checked = true;
                }
                if (getSurReader.GetString(7) == "y")
                {
                    chkPet.Checked = true;
                }
                if (getSurReader.GetString(8) == "y")
                {
                    chkWatch.Checked = true;
                }
                if (getSurReader.GetString(9) == "y")
                {
                    chkNonSmoke.Checked = true;
                }
                if (getSurReader.GetString(10) == "y")
                {
                    chkSmoke.Checked = true;
                }
                if (getSurReader.GetString(11) == "y")
                {
                    chkChores.Checked = true;
                }
            }
            getSurReader.Close();


            sc.Close();

            SqlDataAdapter getReview = new SqlDataAdapter("SELECT TenFName, TenLName, ReviewDate, ReviewStars, ReviewText FROM REVIEW WHERE AccommodationID=@AccomID", sc);
            getReview.SelectCommand.Parameters.Add(new SqlParameter("@AccomID", AccomID));
            DataTable dt = new DataTable();
            getReview.Fill(dt);
            ListView1.DataSource = dt;
            ListView1.DataBind();
        }
    }