Пример #1
0
        /// <summary>
        /// 二级联动职位
        /// </summary>
        private void position()
        {
            string deptno = DropDownList1.SelectedValue;

            if (deptno != "-1")
            {
                List <CustomClass> myList2 = new List <CustomClass>();

                Demo.BLL.tb_JC_Position          bll   = new Demo.BLL.tb_JC_Position();
                List <Demo.Model.tb_JC_Position> model = new List <Demo.Model.tb_JC_Position>();
                //联动
                model = bll.GetModelList("DepartmentNO = '" + deptno + "'");

                foreach (Demo.Model.tb_JC_Position temp in model)
                {
                    myList2.Add(new CustomClass(temp.PositionNO, temp.PositionName));
                }

                DropDownList2.DataTextField  = "Name";
                DropDownList2.DataValueField = "ID";
                DropDownList2.DataSource     = myList2;
                DropDownList2.DataBind();
            }

            DropDownList2.Items.Insert(0, new ListItem("请选择职位", "-1"));
            DropDownList2.SelectedValue = "-1";

            // 是否禁用
            DropDownList2.Enabled = !(DropDownList1.Items.Count == 1);
        }
Пример #2
0
        public void BindGrid(string id)
        {
            Demo.BLL.tb_JC_Position   bll   = new Demo.BLL.tb_JC_Position();
            Demo.Model.tb_JC_Position model = new Demo.Model.tb_JC_Position();
            model = bll.GetModel(id);


            model.ID           = Guid.NewGuid().ToString();
            positionid.Text    = model.ID;
            positionnno.Text   = model.PositionNO;
            positionname.Text  = model.PositionName;
            DropDownList1.Text = model.DepartmentNO;

            // deptno.SelectedValue = deptbll.GetModelList("where DeptmentNo = "+  model.DepartmentNO)[0].DepartmentName;
        }
Пример #3
0
        protected void ttbSearch2_Trigger2Click(object sender, EventArgs e)
        {
            //search
            Demo.BLL.tb_JC_Position   bll   = new Demo.BLL.tb_JC_Position();
            Demo.Model.tb_JC_Position model = new Demo.Model.tb_JC_Position();
            string posiname = ttbSearch2.Text.Trim();



            if (bll.GetModelList("PositionName = '" + posiname + "'").Count == 0)
            {
                Alert.ShowInTop("未找到该职位!");
            }
            else
            {
                model = bll.GetModelList("PositionName = '" + posiname + "'")[0];
                PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("~/Web/JC/deptment/listpositionmodify.aspx?id={0}&PositionNO={1}", model.ID, model.PositionNO), "编辑"));
            }
        }
Пример #4
0
        protected void btnDelete2_Click(object sender, EventArgs e)
        {
            if (Grid2.SelectedRowIndexArray.Length == 0)
            {
                Alert.ShowInTop("请至少选择一条记录!");
                return;
            }

            Demo.BLL.tb_JC_Position bll = new Demo.BLL.tb_JC_Position();

            foreach (int n in Grid2.SelectedRowIndexArray)
            {
                object[] keys = Grid2.DataKeys[n];
                string   id   = keys[0].ToString();
                bll.Delete(id);
            }

            BindGrid2();

            Alert.ShowInTop("删除选中的 " + Grid2.SelectedRowIndexArray.Length + " 项纪录!");
        }
Пример #5
0
        /// <summary>
        /// 模拟数据库分页
        /// </summary>
        /// <returns></returns>
        private DataTable GetPagedDataTable2(int pageIndex, int pageSize)
        {
            Demo.BLL.tb_JC_Position bll = new Demo.BLL.tb_JC_Position();
            DataTable source            = bll.GetList("").Tables[0];

            DataTable paged = source.Clone();

            int rowbegin = pageIndex * pageSize;
            int rowend   = (pageIndex + 1) * pageSize;

            if (rowend > source.Rows.Count)
            {
                rowend = source.Rows.Count;
            }

            for (int i = rowbegin; i < rowend; i++)
            {
                paged.ImportRow(source.Rows[i]);
            }

            return(paged);
        }
Пример #6
0
        protected void btnSaveRefresh_Click(object sender, EventArgs e)
        {
            // 1. 这里放置保存窗体中数据的逻辑

            Demo.BLL.tb_JC_Position   bll   = new Demo.BLL.tb_JC_Position();
            Demo.Model.tb_JC_Position model = new Demo.Model.tb_JC_Position();

            model.ID           = Guid.NewGuid().ToString();
            model.PositionNO   = positionnno.Text.Trim();
            model.PositionName = positionname.Text.Trim();
            model.DepartmentNO = DropDownList1.SelectedItem.Value.Trim();


            if (bll.Add(model))
            {
                Alert.ShowInTop("添加成功");
            }
            else
            {
                Alert.ShowInTop("添加失败");
            }
            PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
        }
Пример #7
0
 /// <summary>
 /// 模拟返回总项数
 /// </summary>
 /// <returns></returns>
 private int GetTotalCount3()
 {
     Demo.BLL.tb_JC_Position bll = new Demo.BLL.tb_JC_Position();
     return(bll.GetList("").Tables[0].Rows.Count);
 }