Пример #1
0
 private void ToolMenuItem_del_Click(object sender, EventArgs e)
 {
     if (untCommon.QuestionMsg("确定要删除" + this.dgvMaintainer.SelectedRows[0].Cells["名称"].Value.ToString() + "吗?"))
     {
         if (MaintainerMgr.Del(int.Parse(this.dgvMaintainer.SelectedRows[0].Cells["编号"].Value.ToString())))
         {
             untCommon.InfoMsg("删除成功");
             initDgv();
         }
         else
         {
             untCommon.InfoMsg("删除失败");
         }
     }
 }
Пример #2
0
        private void frmFix_Load(object sender, EventArgs e)
        {
            this.LoadEqInfo();//加载资产的基本信息
            this.btnOK.Focus();

            //初始化维修商选项框
            DataTable dt = MaintainerMgr.GetAll();

            cbxMaintainer.DataSource         = dt;
            cbxMaintainer.DisplayMember      = dt.Columns[1].ToString();
            cbxMaintainer.ValueMember        = dt.Columns[1].ToString();
            cbxMaintainer.AutoCompleteMode   = AutoCompleteMode.SuggestAppend;
            cbxMaintainer.AutoCompleteSource = AutoCompleteSource.ListItems;
            cbxMaintainer.Text = "";
        }
Пример #3
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (isAdd)
     {
         string newname      = this.txtNewName.Text;
         string newaddress   = this.txtNewAddress.Text;
         string newcontracts = this.txtNewContracts.Text;
         string newtel       = this.txtNewTel.Text;
         if (newInput())
         {
             if (MaintainerMgr.Add(newname, newaddress, newcontracts, newtel))
             {
                 untCommon.InfoMsg("增加成功");
                 clearNew();
                 initDgv();
             }
             else
             {
                 untCommon.InfoMsg("增加失败");
             }
         }
     }
     else
     {
         int    id        = int.Parse(this.txtId.Text);
         string name      = this.txtName.Text;
         string address   = this.txtAddress.Text;
         string contracts = this.txtContracts.Text;
         string tel       = this.txtTel.Text;
         if (updateInput())
         {
             if (MaintainerMgr.Update(id, name, address, contracts, tel))
             {
                 untCommon.InfoMsg("修改成功");
                 initDgv();
             }
             else
             {
                 untCommon.InfoMsg("修改失败");
             }
         }
     }
 }
Пример #4
0
 //初始化datagridview
 private void initDgv()
 {
     this.dgvMaintainer.DataSource = MaintainerMgr.GetAll();
 }
Пример #5
0
        private void toolbtnSearch_Click(object sender, EventArgs e)
        {
            DataTable dt;

            switch (this.toolcbxSearchtype.SelectedIndex)
            {
            case 0:
            {
                if (this.tooltxtContaint.Text.Trim() != "")
                {
                    dt = MaintainerMgr.GetInfoById(int.Parse(this.tooltxtContaint.Text));
                    if (dt != null)
                    {
                        this.dgvMaintainer.DataSource = dt;
                    }
                }
                break;
            }

            case 1:
            {
                if (this.tooltxtContaint.Text.Trim() != "")
                {
                    dt = MaintainerMgr.GetInfoByName(this.tooltxtContaint.Text);
                    if (dt != null)
                    {
                        this.dgvMaintainer.DataSource = dt;
                    }
                }
                break;
            }

            case 2:
            {
                if (this.tooltxtContaint.Text.Trim() != "")
                {
                    dt = MaintainerMgr.GetInfoByAddress(this.tooltxtContaint.Text);
                    if (dt != null)
                    {
                        this.dgvMaintainer.DataSource = dt;
                    }
                }
                break;
            }

            case 3:
            {
                if (this.tooltxtContaint.Text.Trim() != "")
                {
                    dt = MaintainerMgr.GetInfoByContracts(this.tooltxtContaint.Text);
                    if (dt != null)
                    {
                        this.dgvMaintainer.DataSource = dt;
                    }
                }
                break;
            }

            case 4:
            {
                if (this.tooltxtContaint.Text.Trim() != "")
                {
                    dt = MaintainerMgr.GetInfoByTel(this.tooltxtContaint.Text);
                    if (dt != null)
                    {
                        this.dgvMaintainer.DataSource = dt;
                    }
                }
                break;
            }
            }
        }