Ejemplo n.º 1
0
        private void Frm_operator_Load(object sender, EventArgs e)
        {
            //1.设置角色列表数据源
            clbx_roles.DataSource    = dt_roles;
            clbx_roles.DisplayMember = "RO003";
            clbx_roles.ValueMember   = "RO001";
            ro01Adapter.Fill(dt_roles);

            //2.检索信息
            string s_uc001 = string.Empty;

            action = this.swapdata["action"].ToString();
            if (action == "add")
            {
                this.Text = "新建";
                uc01      = new Uc01();
            }
            else if (this.swapdata["action"].ToString() == "edit")
            {
                this.Text = "编辑";
                s_uc001   = this.swapdata["uc001"].ToString();

                uc01 = uc01_dao.GetSingle(s => s.uc001 == s_uc001);

                txtedit_uc002.Text = uc01.uc002;
                txtedit_uc003.Text = uc01.uc003;

                txtedit_pwd.ReadOnly  = true;
                txtedit_pwd2.ReadOnly = true;

                Ur_Mapper_dao    ur_Mapper_dao = new Ur_Mapper_dao();
                List <Ur_Mapper> mapper        = ur_Mapper_dao.GetList(s => s.uc001 == s_uc001);
                if (mapper.Count > 0)
                {
                    for (int i = 0; i < clbx_roles.ItemCount; i++)
                    {
                        string ro001 = clbx_roles.GetItemValue(i).ToString();
                        if (mapper.FindIndex(x => x.ro001.Equals(ro001)) >= 0)
                        {
                            clbx_roles.SetItemChecked(i, true);
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private void Frm_Operator_Load(object sender, EventArgs e)
        {
            clbx_roles.DataSource    = ro01_ds.Ro01;
            clbx_roles.DisplayMember = "RO003";
            clbx_roles.ValueMember   = "RO001";
            ro01_ds.ro01Adapter.Fill(ro01_ds.Ro01);

            if (this.swapdata["action"].ToString() == "add")
            {
                this.Text = "新建用户";
                uc01      = new Uc01();
            }
            else if (this.swapdata["action"].ToString() == "edit")
            {
                this.Text = "编辑用户";
                s_uc001   = this.swapdata["uc001"].ToString();

                uc01 = uc01_dao.GetSingle(s => s.uc001 == s_uc001);

                txtedit_uc002.Text = uc01.uc002;
                txtedit_uc003.Text = uc01.uc003;

                checkEdit1.EditValue = uc01.uc005;

                txtedit_uc009.Text = uc01.uc009;
                txtedit_uc010.Text = uc01.uc010;

                txtedit_pwd.ReadOnly  = true;
                txtedit_pwd2.ReadOnly = true;

                Ur_Mapper_dao    ur_Mapper_dao = new Ur_Mapper_dao();
                List <Ur_Mapper> mapper        = ur_Mapper_dao.GetList(s => s.uc001 == s_uc001);
                if (mapper.Count > 0)
                {
                    for (int i = 0; i < clbx_roles.ItemCount; i++)
                    {
                        string ro001 = clbx_roles.GetItemValue(i).ToString();
                        if (mapper.FindIndex(x => x.ro001.Equals(ro001)) >= 0)
                        {
                            clbx_roles.SetItemChecked(i, true);
                        }
                    }
                }
            }
        }