示例#1
0
        private void alButton1_Click(object sender, EventArgs e)
        {
            VipSoft.BLL.Master mBll = new BLL.Master();
            VipSoft.Model.Master mModel = new Model.Master();

            String account = this.f_account.Text.ToString();
            String password = this.f_password.Text.ToString();
            String name = this.f_name.Text.ToString();
            String shopid = this.f_shopid.Text.ToString();

            if (account == null || account == "")
            {
                MessageBox.Show("管理员代码不能为空!");
                return;
            }

            if (password == null || password == "")
            {
                MessageBox.Show("管理员密码不能为空!");
                return;
            }

            if (name == null || name == "")
            {
                MessageBox.Show("管理员名称不能为空!");
                return;
            }

            if (shopid == null || shopid == "")
            {
                MessageBox.Show("所属机构不能为空!");
                return;
            }

            mModel.Account = account;
            mModel.Password = password;
            mModel.Name = name;
            mModel.TelPhone = this.f_telphone.Text.ToString();
            mModel.Sex = int.Parse(((System.Collections.DictionaryEntry)f_sex.Items[0]).Value.ToString());
            mModel.IsSuper = f_issuper.Checked;
            mModel.ShopID = int.Parse(f_shopid.Text.ToString());
            mModel.ShopName = f_shopname.Text.ToString();

            if (this.currentId == 0)
            {
                if (mBll.Add(mModel) > 0)
                {
                    MessageBox.Show("新增记录成功!");
                    BindList();
                    reset();
                }
                else
                {
                    MessageBox.Show("新增记录失败!");
                }
            }
            else
            {
                mModel.ID = currentId;
                if (mBll.Update(mModel))
                {
                    MessageBox.Show("修改记录成功!");
                    BindList();
                    reset();

                }
                else
                {
                    MessageBox.Show("修改记录失败!");
                }

            }
        }
示例#2
0
 private void BindMasterInfo()
 {
     VipSoft.BLL.Master mBll = new BLL.Master();
     VipSoft.Model.Master model = mBll.GetModel(currentId);
     if (model != null)
     {
         this.f_account.Text = model.Account;
         this.f_name.Text = model.Name;
         this.f_password.Text = model.Password;
         this.f_sex.SelectedIndex = (int)model.Sex;
         this.f_issuper.Checked = model.IsSuper;
         this.f_telphone.Text = model.TelPhone;
         this.f_shopid.Text = model.ShopID.ToString();
         this.f_shopname.Text = model.ShopName;
     }
 }
示例#3
0
 private void delBtn_Click()
 {
     if (currentId > 0)
      {
          VipSoft.BLL.Master mBll = new BLL.Master();
          if (mBll.Delete(currentId))
          {
              MessageBox.Show("删除管理员成功!");
              BindList();
              reset();
          }
      }
      else
      {
          MessageBox.Show("请先选择一条数据!");
      }
 }
示例#4
0
        private void BindList()
        {
            VipSoft.BLL.Master mrBll = new BLL.Master();
            DataSet ds = mrBll.GetList(pageSize, currentPage, out resCount, condition);
            this.dataGridView1.DataSource = ds.Tables[0];

            for (int i = 0; i < dataGridView1.Rows.Count; i++)
            {
                dataGridView1.Rows[i].Cells[0].Value = false;
            }

            BindPage();
        }