コード例 #1
0
    /// <summary>
    /// 根据页面上用户输入的查询条件,查询职称数据
    /// </summary>
    private void Query()
    {
        //构造查询Hash对象
        Hashtable queryItems = new Hashtable();

        if (selSelRange.Value == "职称编号")
        {
            queryItems.Add("zcbh", txtSelContent.Value);
        }
        if (selSelRange.Value == "职称名称")
        {
            queryItems.Add("zcmc", txtSelContent.Value);
        }
        if (selSelRange.Value == "职称类型")
        {
            queryItems.Add("zclx", txtSelContent.Value);
        }
        DataTable dt = Gzl.BusinessLogicLayer.ZC.QueryZC(queryItems);

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

        //保存下拉框的选择项到ViewState数组对象
        ViewState.Add("selSelRange", selSelRange.Value);

        labelPage.Text = "查询结果(第" + (GV.PageIndex + 1).ToString() + "页 共" + GV.PageCount.ToString() + "页)";
    }
コード例 #2
0
        protected void GV_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "delete")
            {
                List <int> lst = new List <int>();
                lst = (List <int>)Session["ItemList"];

                lst.Remove(Convert.ToInt32(e.CommandArgument));

                string itemList = "";

                foreach (var item in lst)
                {
                    itemList += (itemList == "" ? "" : ",") + item;
                }

                using (var db = new bigshopeEntities())
                {
                    var query = db.addToCart(itemList);
                    GV.DataSource = query;
                    GV.DataBind();
                }

                Session["ItemList"] = lst;
            }
        }
コード例 #3
0
        private void Connect()
        {
            GV.Visible = false;
            if (ddl_Locations.Items.Count == 0)
            {
                return;
            }

            lblPopUpLocation.Text = ddl_Locations.SelectedItem.Text;

            DataTable dt = tools.GetMaintenanceUsers(ddl_Locations.SelectedValue, "");

            if (dt.Rows.Count > 0)
            {
                dt.Columns.Add("Location");
                foreach (DataRow dr in dt.Rows)
                {
                    dr["Location"] = dr["BP"] + " - " + tools.getPlantName(dr["BP"].ToString());
                }

                GV.DataSource = dt;
                GV.DataBind();
                GV.Visible = true;
            }
        }
コード例 #4
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        //多条件模糊查询
        DataClassesDataContext db = new DataClassesDataContext();
        //var khxxs = from k in db.JB_khxx
        //            where (k.id.Contains(tb_ID.Text) && k.mingcheng.Contains(tb_MingCheng.Text))
        //            select k;
        /////////////////////////////////////////// StartsWith 用法 /////////////////////////////////////////////////////////
        //var khxxs = from k in db.JB_khxx
        //            where (k.id.StartsWith(tb_ID.Text) && k.mingcheng.StartsWith(tb_MingCheng.Text))
        //            select k;
        /////////////////////////////////////////// EndsWith 用法 ////////////////////////////////////////////////////////
        //var khxxs = from k in db.JB_khxx
        //            where (k.id.EndsWith(tb_ID.Text) && k.mingcheng.EndsWith(tb_MingCheng.Text))
        //            select k;
        //////////////////////////////////////////////////////////////////////////////
        //多条件模糊查询 利用SqlMethods类
        //DataClassesDataContext db = new DataClassesDataContext();
        var khxxs = from k in db.JB_khxx
                    where SqlMethods.Like(k.id, "%" + tb_ID.Text + "%") && SqlMethods.Like(k.mingcheng, tb_MingCheng.Text + "%")
                    select k;

        /////
        GV.DataSource = khxxs;
        GV.DataBind();
    }
コード例 #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                return;
            }

            if (Session["ItemList"] != null)
            {
                List <int> lst = new List <int>();
                lst = (List <int>)Session["ItemList"];

                string ItemList = "";

                foreach (var item in lst)
                {
                    ItemList += (ItemList == "" ? "" : ",") + item;
                }

                using (var db = new bigshopeEntities())
                {
                    var query = db.addToCart(ItemList);
                    GV.DataSource = query;
                    GV.DataBind();
                }
            }
        }
コード例 #6
0
        protected void GV_Sort(object sender, GridViewSortEventArgs e)
        {
            List <Entity> sortedList = GetDataSource();

            if (e.SortExpression == "Id")
            {
                if (e.SortDirection == SortDirection.Ascending)
                {
                    sortedList.Sort((x, y) => x.Id.CompareTo(y.Id));
                }
                else
                {
                    sortedList.Sort((x, y) => y.Id.CompareTo(x.Id));
                }
            }
            else if (e.SortExpression == "Name")
            {
                if (e.SortDirection == SortDirection.Ascending)
                {
                    sortedList.Sort((x, y) => x.Name.CompareTo(y.Name));
                }
                else
                {
                    sortedList.Sort((x, y) => y.Name.CompareTo(x.Name));
                }
            }

            GV.DataSource = sortedList;
            GV.DataBind();
        }
コード例 #7
0
    /// <summary>
    /// 查询数据
    /// </summary>
    private void Query()
    {
        //构造查询Hash对象
        Hashtable queryItems = new Hashtable();

        switch (selRange.Value)
        {
        case "教师编号": queryItems.Add("[js_kc_gxb].jsbh", txtContent.Value); break;

        case "教师姓名": queryItems.Add("jsxm", txtContent.Value); break;

        case "开办院系编号": queryItems.Add("[js_kc_gxb].kcbh", txtContent.Value); break;

        case "开办院系名称":
        {
            Hashtable ht = new Hashtable();
            ht.Add("yxmc", txtContent.Value);
            string yxbh = "";
            foreach (DataRow dr in YX.QueryYX(ht).Rows)
            {
                yxbh = dr["yxbh"].ToString();
            }
            queryItems.Add("[js_kc_gxb].kcbh", yxbh); break;
        }
        }

        DataTable dt = Gzl.BusinessLogicLayer.KCRW.Query(queryItems);

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

        labelPageGV.Text = "查询结果(第" + (GV.PageIndex + 1).ToString() + "页 共" + GV.PageCount.ToString() + "页)";
    }
コード例 #8
0
    private void BindGrid()
    {
        HF_Date.Value  = DDL_week.SelectedValue;
        HF_Plant.Value = DDL_plant.SelectedValue.ToString();

        string conString = ConfigurationManager.ConnectionStrings["KPI-ReportConnectionString"].ConnectionString;

        using (SqlConnection con = new SqlConnection(conString))
        {
            using (SqlCommand cmd = new SqlCommand())
            {
                cmd.CommandText = "uspGetResultsByPlantForOneWeek";
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@Action", "SELECT");
                cmd.Parameters.AddWithValue("@DateW", HF_Date.Value);
                cmd.Parameters.AddWithValue("@Plant_ID", HF_Plant.Value);
                cmd.Connection = con;
                using (SqlDataAdapter sda = new SqlDataAdapter())
                {
                    sda.SelectCommand = cmd;
                    using (DataSet ds = new DataSet())
                    {
                        sda.Fill(ds);
                        GV.DataSource = ds;
                        GV.DataBind();
                    }
                }
            }
        }
    }
コード例 #9
0
    /// <summary>
    /// 根据页面上用户输入的查询条件,查询用户数据
    /// </summary>
    private void Query()
    {
        //构造查询Hash对象
        Hashtable queryItems = new Hashtable();

        if (selSelRange.Value == "院系编号")
        {
            queryItems.Add("yxbh", txtSelContent.Value);
        }
        else if (selSelRange.Value == "院系名称")
        {
            queryItems.Add("yxmc", txtSelContent.Value);
        }
        if (showAll.Checked != true)
        {
            queryItems.Add("yxbz", 1);
        }



        DataTable dt = Gzl.BusinessLogicLayer.YX.QueryYX(queryItems);

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

        labelPage.Text = "查询结果(第" + (GV.PageIndex + 1).ToString() + "页 共" + GV.PageCount.ToString() + "页)";
    }
コード例 #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                try
                {
                    List <BO.FamilyMember> familyMembers = familyMemberRepository.GetAllFamilyMembers();
                    if (familyMembers.Count != (int)Utilities.OperationState.ZeroCount)
                    {
                        Session["FamilyMembers"] = familyMembers;
                        GV.DataSource            = familyMemberRepository.GetAllFamilyMembers();
                        GV.DataBind();
                    }
                    else
                    {
                        errorMessage.InnerText = "No Record Found!";
                        message.Attributes.Add("Class", "alert alert-danger show");
                    }
                }

                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
コード例 #11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Session["userID"] == null)
            {
                Response.Redirect("Login.aspx");
            }
            else
            {
                string userId   = Session["userID"].ToString();
                string userName = UserManager.GetUserName(userId);
                Label  i        = (Label)Page.Master.FindControl("labUser");
                i.Text = userName;

                if (!RoleManager.IsHasDuty(userName, "HasDuty_RoleManage"))
                {
                    Response.Redirect("noDuty.aspx");
                }
                else
                {
                    GV.DataSource = RoleManager.DutyListRoles();
                    GV.DataBind();
                }
            }
        }
        this.Page.Title = "权限管理";
    }
コード例 #12
0
        public void bindGv()
        {
            DataTable dt = getNewsDt();

            GV.DataSource = dt.DefaultView;
            GV.DataBind();
        }
コード例 #13
0
        public void BindGrid()
        {
            string mySql = "SELECT Intern.InternID, Intern.Fname, Intern.Lname, InternContact.Email FROM Intern INNER JOIN InternContact ON InternContact.InternID=Intern.InternID;";
            var sda = myCrud.dataAdapt(mySql);

            using (DataTable dt = new DataTable())
            {
                sda.Fill(dt);
                GV.DataSource = dt;
                GV.DataBind();

                if (dt.Rows.Count > 0)
                {
                    GV.DataSource = dt;
                    GV.DataBind();
                }
                else
                {
                    dt.Rows.Add(dt.NewRow());
                    GV.DataSource = dt;
                    GV.DataBind();
                    GV.Rows[0].Cells.Clear();
                    GV.Rows[0].Cells.Add(new TableCell());
                    GV.Rows[0].Cells[0].ColumnSpan = dt.Columns.Count;
                    GV.Rows[0].Cells[0].Text = "No Data Found ..!";
                    GV.Rows[0].Cells[0].HorizontalAlign = HorizontalAlign.Center;
                }
            }
        }
コード例 #14
0
    private void Query()
    {
        Database  db     = new Database();
        DataTable dt     = new DataTable();
        string    strXnd = selSelXnxz.SelectedItem.Text;

        switch (selSelCxfw.Value)
        {
        case "院系编号": dt = db.GetDataTable("exec proYxbhZgzlJs " + SqlStringConstructor.GetQuotedString(txtSelCxnr.Value) + " , " + SqlStringConstructor.GetQuotedString(strXnd)); break;

        case "院系名称": dt = db.GetDataTable("exec proYxmcZgzlJs " + SqlStringConstructor.GetQuotedString(txtSelCxnr.Value) + " , " + SqlStringConstructor.GetQuotedString(strXnd)); break;

        case "教师编号": dt = db.GetDataTable("exec proJsbhZgzlJs " + SqlStringConstructor.GetQuotedString(txtSelCxnr.Value) + " , " + SqlStringConstructor.GetQuotedString(strXnd)); break;

        case "教师姓名": dt = db.GetDataTable("exec proJsxmZgzlJs " + SqlStringConstructor.GetQuotedString(txtSelCxnr.Value) + " , " + SqlStringConstructor.GetQuotedString(strXnd)); break;
        }

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

        labelPage.Text = "查询结果(第" + (GV.PageIndex + 1).ToString() + "页 共" + GV.PageCount.ToString() + "页)";
        foreach (GridViewRow row in GV.Rows)
        {
            row.Cells[8].Attributes.Add("onclick", "window.open('pageJsGzlxx.aspx?jsbh=" + row.Cells[1].Text + "&xnd=" + strXnd + "')");
        }
    }
コード例 #15
0
    protected void GV_Sorting(object sender, GridViewSortEventArgs e)
    {
        //排序
        DataClassesDataContext db = new DataClassesDataContext();
        //var khxxs = from k in db.JB_khxx
        //            where (k.dizhi.Contains("") && k.id.Contains(""))
        //            select k;
        var lst = db.JB_khxx.OrderBy(ee => ee.id);

        switch (e.SortExpression)
        {
        case "mingcheng":
            lst = db.JB_khxx.OrderBy(ee => ee.mingcheng);;
            break;

        case "Dianhua":
            lst = db.JB_khxx.OrderBy(ee => ee.dianhua);;
            break;

        case "ChuanZhen":
            lst = db.JB_khxx.OrderBy(ee => ee.chuanzhen);;
            break;
        }
        //var lst = khxxs.OrderByDescending(ee=>ee.mingcheng);
        GV.DataSource = lst;
        GV.DataBind();
    }
コード例 #16
0
    /// <summary>
    /// 查询数据
    /// </summary>
    private void Query()
    {
        //构造查询Hash对象
        Hashtable queryItems = new Hashtable();

        switch (selSelRange.Value)        //根据查询范围下拉框的选择,把对应的查询内容添加到查询哈希表中
        {
        case "教师编号": queryItems.Add("jsbh", txtSelContent.Value); break;

        case "教师姓名": queryItems.Add("jsxm", txtSelContent.Value); break;

        case "所属院系编号": queryItems.Add("jsb.yxbh", txtSelContent.Value); break;

        case "所属院系名称": queryItems.Add("yxmc", txtSelContent.Value); break;
        }
        if (showAll.Checked != true)      //判断是否显示全部
        {
            queryItems.Add("zzzt", 1);    //显示全部时,把在职状态为true添加到查询条件中
        }

        DataTable dt = Gzl.BusinessLogicLayer.JS.QueryJS(queryItems); //执行查询

        GV.DataSource = dt;                                           //把GirdView表的数据源设为dt
        GV.DataBind();                                                //绑定数据源

        labelPage.Text = "查询结果(第" + (GV.PageIndex + 1).ToString() + "页 共" + GV.PageCount.ToString() + "页)";
    }
コード例 #17
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (YetkiKontrol(pageName + "-Delete"))
        {
            if (Page.IsPostBack && !string.IsNullOrEmpty(Request.Form["HdnSil"]) && Regex.IsMatch(Request.Form["HdnSil"].Replace(",", ""), "^\\d+$"))
            {//seçilen değerler varsa siliniyor
                Snlg_DBConnect vt = new Snlg_DBConnect(true);
                try
                {
                    vt.SorguCalistir("snlg_V1.msp_EPostaSablonSil", CommandType.StoredProcedure, new Snlg_DBParameter[1] {
                        new Snlg_DBParameter("@EPId", SqlDbType.VarChar, Request.Form["HdnSil"])
                    });
                    Snlg_Hata.ziyaretci.HataGosterBasarili("Seçtiğiniz e-posta şablonu silindi.", false);
                    GV.DataBind();
                }
                catch (Exception exc)
                {
                    Snlg_Hata.ziyaretci.ExceptionLogla(exc);
                    Snlg_Hata.ziyaretci.HataGosterHatali("Beklenmeyen bir hata oluştu.", false);
                }
                vt.Kapat();
            }
        }
        else
        {
            Snlg_Hata.ziyaretci.HataGosterHatali("Bu işlemi yapmak için yetkili değilsiniz.", false);
            return;
        }

        if (IsPostBack)
        {
            GridSayfala(GV, "Sayfalama");
        }
    }
コード例 #18
0
        private void Connect()
        {
            DataTable dt = workflow2.GetUserInWorkflow(Request["userID"], false);

            GV.DataSource = dt;
            GV.DataBind();
        }
コード例 #19
0
    public void getData()
    {
        string c = "select * from TblReview where userid='" + Session["userid"].ToString() + "'";

        System.Data.DataTable dt = dm.ExecuteSelect(c);
        GV.DataSource = dt;
        GV.DataBind();
    }
コード例 #20
0
        private void initData(bool useExcel)
        {
            DataTable dt = init();

            SetupGridView(useExcel);
            GV.DataSource = dt;
            GV.DataBind();
        }
コード例 #21
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["Cart"] != null)
     {
         List <product> Cart_list = Session["Cart"] as  List <product>;
         GV.DataSource = Session["Cart"];
         GV.DataBind();
     }
 }
コード例 #22
0
        private void BindGrid()
        {
            string         query = "SELECT * FROM details where Delete_Flag = 'N'";
            SqlDataAdapter sda   = new SqlDataAdapter(query, con);

            sda.Fill(dtable);
            GV.DataSource = dtable;
            GV.DataBind();
        }
コード例 #23
0
    protected void Button4_Click(object sender, EventArgs e)
    {
        //查询
        DataClassesDataContext db = new DataClassesDataContext();
        var data = db.UP_JB_khxx_GetList();

        GV.DataSource = data;
        GV.DataBind();
    }
コード例 #24
0
 private void FillClients()
 {
     using (var db = new bigshopeEntities())
     {
         var query = db.showCustomers();
         GV.DataSource = query;
         GV.DataBind();
     }
 }
コード例 #25
0
 protected void Page_Load(object sender, EventArgs e)
 {
     using (var db = new bigshopeEntities())
     {
         var query = db.getOrder();
         GV.DataSource = query;
         GV.DataBind();
     }
 }
コード例 #26
0
        private void BindPageView()
        {
            const string sql = @"SELECT    PVID, ModuleID, ModuleName, PVTitle, DisOrder, ParentIDAll
                            FROM     V_FU_List_FilterRoleListPV
                            ORDER BY DisOrder";

            GV.DataSource = Dal.DalCustomer.ExecuteFillDataTable(sql);
            GV.DataBind();
        }
コード例 #27
0
 private void FillProducts()
 {
     using (var db = new bigshopeEntities())
     {
         var query = db.showProducts();
         GV.DataSource = query;
         GV.DataBind();
     }
 }
コード例 #28
0
        private void GridData()
        {
            string         query = "SELECT * FROM details where FirstName like '" + txtSearch.Text + "'" + "or LastName like '" + txtSearch.Text + "'" + "or City like '" + txtSearch.Text + "'" + "and Delete_Flag = 'N'";
            SqlDataAdapter sda   = new SqlDataAdapter(query, con);
            DataTable      dt    = new DataTable();

            sda.Fill(dt);
            GV.DataSource = dt;
            GV.DataBind();
        }
コード例 #29
0
 void GV_Refresh()
 {
     //GV.DataSource = Repos.Repo;
     cbCountries.DataTextField  = "Name";
     cbCountries.DataValueField = "Id";
     cbCountries.DataSource     = countryService.getAll_1();
     cbCountries.DataBind();
     GV.DataSource = countryService.getAll_1();
     GV.DataBind();
 }
コード例 #30
0
        //connectionString = WebConfigurationManager.ConnectionStrings["constr"].ConnectionString;
        ///cnn = new SqlConnection(connectionString);
        protected void Page_Load(object sender, EventArgs e)
        {
            cnn = new SqlConnection(connectionString);
            cnn.Open();
            SqlCommand DA = new SqlCommand("SELECT * FROM [EVENT] ", cnn);

            GV.DataSource = DA.ExecuteReader();
            GV.DataBind();
            cnn.Close();
        }