Exemple #1
0
        /// <summary>
        /// 职员下拉框(添加弹窗)
        /// </summary>
        private void xialakuang1()
        {
            this.DropDownList1.DataSourceID    = null;
            DropDownList1.AppendDataBoundItems = true;
            ListItem s = new ListItem("选择职员", "0");

            DropDownList1.Items.Add(s);
            DataSet ds = st.GetList(" by1=1");

            this.DropDownList1.DataSource     = ds.Tables[0].DefaultView;
            this.DropDownList1.DataTextField  = "Staffname";
            this.DropDownList1.DataValueField = "id";
            this.DropDownList1.DataBind();//绑定数据
        }
Exemple #2
0
        public void BindData()
        {
            #region
            //if (!Context.User.Identity.IsAuthenticated)
            //{
            //    return;
            //}
            //AccountsPrincipal user = new AccountsPrincipal(Context.User.Identity.Name);
            //if (user.HasPermissionID(PermId_Modify))
            //{
            //    gridView.Columns[6].Visible = true;
            //}
            //if (user.HasPermissionID(PermId_Delete))
            //{
            //    gridView.Columns[7].Visible = true;
            //}
            #endregion

            DataSet       ds       = new DataSet();
            StringBuilder strWhere = new StringBuilder();
            if (txtKeyword.Text.Trim() != "")
            {
                #warning 代码生成警告:请修改 keywordField 为需要匹配查询的真实字段名称
                //strWhere.AppendFormat("keywordField like '%{0}%'", txtKeyword.Text.Trim());
            }
            ds = bll.GetList(strWhere.ToString());
            gridView.DataSource = ds;
            gridView.DataBind();
        }
Exemple #3
0
 /// <summary>
 /// 删除(验证该部门有职员绑定无法删除)
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void LinkButton2_Click(object sender, EventArgs e)
 {
     try
     {
         //获取button 控件
         LinkButton lb = (LinkButton)sender;
         //获取传过来的commwntid
         int     id  = Convert.ToInt32(lb.CommandArgument);
         DataSet dwq = st.GetList(" departmentID like '" + id + "'");
         if (dwq.Tables[0].Rows.Count > 0)
         {
             ClientScript.RegisterClientScriptBlock(this.GetType(), "this", "<script language=javascript>alert('该部门有职员!');</script>");
         }
         else
         {
             bool a = dep.Delete(id);
             if (a == true)
             {
                 ClientScript.RegisterClientScriptBlock(this.GetType(), "this", "<script language=javascript>alert('删除成功!');</script>");
                 bind(sql);
             }
             else
             {
                 ClientScript.RegisterClientScriptBlock(this.GetType(), "this", "<script language=javascript>alert('删除失败!');</script>");
                 bind(sql);
             }
         }
     }
     catch (Exception ee)
     {
         //Response.Write("<script>alert('确定异常 " + ee.Message + "')</script>");
         ClientScript.RegisterClientScriptBlock(this.GetType(), "this", "<script language=javascript>alert('删除异常 " + ee.Message + "');</script>");
     }
 }