Ejemplo n.º 1
0
        //****************************************************************************************************
        //加载
        private void FrmUserLevelEdit_Load(object sender, EventArgs e)
        {
            if (intId == 0)
            {
                this.Text = "添加" + this.Text;
            }
            else
            {
                this.Text = "修改" + this.Text;

                DataRow dr = new ModUserLevel().setWhere("id > 0", true).getFind(intId);
                if (dr == null)
                {
                    Function.showMessage("记录为空");
                    this.Close();
                }
                else
                {
                    txtUserLevel.Text = dr["userLevel"].ToString();
                    chkIsPass.Checked = Convert.ToBoolean(dr["isPass"]);
                }
            }
        }
Ejemplo n.º 2
0
        //****************************************************************************************************
        //会员级别
        public static void setUserLevel(ComboBox cmb, Object value = null)
        {
            DataTable dt = new ModUserLevel().getSelect();

            DataRow dr = dt.NewRow();

            dr["id"]        = 0;
            dr["userLevel"] = "--请选择会员级别--";
            dt.Rows.InsertAt(dr, 0);

            cmb.DataSource    = dt;
            cmb.ValueMember   = "id";
            cmb.DisplayMember = "userLevel";

            if (value == null)
            {
                cmb.SelectedValue = 0;
            }
            else
            {
                cmb.SelectedValue = Convert.ToInt32(value);
            }
        }
Ejemplo n.º 3
0
        //****************************************************************************************************
        //显示数据
        private void showData()
        {
            DataTable dt = new ModUserLevel().setWhere("id > 0", true).getSelect();

            if (dt == null)
            {
                btnUpdate.Enabled = false;
            }
            else
            {
                btnUpdate.Enabled = true;

                int intIndex = 0;
                if (grd.Rows.Count > 0)
                {
                    intIndex = grd.CurrentRow.Index;
                }

                grd.AutoGenerateColumns = false;
                grd.DataSource          = dt;
                grd.Rows[intIndex].Cells[1].Selected = true;
            }
        }