Beispiel #1
0
        private void toolStripButtonSave_Click(object sender, EventArgs e)
        {
            SqlParameter[] param = null;

            AreaInfo areaInfo = this.buttonEditArea1.Tag as AreaInfo;
            string   sql      = String.Format("update IO_AreaName2 set M_Name='{0}', M_Devs='{1}', M_Title='{2}', M_Used={3} where M_AreaId = {4}",
                                              areaInfo.AreaName, areaInfo.AreaDevs, this.textBoxArea1.Text, Convert.ToInt32(this.checkBox1.Checked), areaInfo.AreaId);

            areaInfo = this.buttonEditArea2.Tag as AreaInfo;
            sql     += String.Format(" update IO_AreaName2 set M_Name='{0}', M_Devs='{1}', M_Title='{2}', M_Used={3} where M_AreaId = {4}",
                                     areaInfo.AreaName, areaInfo.AreaDevs, this.textBoxArea2.Text, Convert.ToInt32(this.checkBox2.Checked), areaInfo.AreaId);

            areaInfo = this.buttonEditArea3.Tag as AreaInfo;
            sql     += String.Format(" update IO_AreaName2 set M_Name='{0}', M_Devs='{1}', M_Title='{2}', M_Used={3} where M_AreaId = {4}",
                                     areaInfo.AreaName, areaInfo.AreaDevs, this.textBoxArea3.Text, Convert.ToInt32(this.checkBox3.Checked), areaInfo.AreaId);

            areaInfo = this.buttonEditArea4.Tag as AreaInfo;
            sql     += String.Format(" update IO_AreaName2 set M_Name='{0}', M_Devs='{1}', M_Title='{2}', M_Used={3} where M_AreaId = {4}",
                                     areaInfo.AreaName, areaInfo.AreaDevs, this.textBoxArea4.Text, Convert.ToInt32(this.checkBox4.Checked), areaInfo.AreaId);

            areaInfo = this.buttonEditArea5.Tag as AreaInfo;
            sql     += String.Format(" update IO_AreaName2 set M_Name='{0}', M_Devs='{1}', M_Title='{2}', M_Used={3} where M_AreaId = {4}",
                                     areaInfo.AreaName, areaInfo.AreaDevs, this.textBoxArea5.Text, Convert.ToInt32(this.checkBox5.Checked), areaInfo.AreaId);

            areaInfo = this.buttonEditArea6.Tag as AreaInfo;
            sql     += String.Format(" update IO_AreaName2 set M_Name='{0}', M_Devs='{1}', M_Title='{2}', M_Used={3} where M_AreaId = {4}",
                                     areaInfo.AreaName, areaInfo.AreaDevs, this.textBoxArea6.Text, Convert.ToInt32(this.checkBox6.Checked), areaInfo.AreaId);

            SqlHelper.ExecuteSql(sql, param);

            MessageBox.Show("保存成功", "提示");
        }
Beispiel #2
0
        private void buttonEditArea6_Click(object sender, EventArgs e)
        {
            FrmAreaSelect frmAreaSelect = new FrmAreaSelect(this.buttonEditArea6.Tag as AreaInfo);

            frmAreaSelect.ShowDialog();
            AreaInfo areaInfo = frmAreaSelect.AreaInfo;

            if (!this.buttonEditArea6.Text.Equals(areaInfo.AreaName))
            {
                this.buttonEditArea6.Text = areaInfo.AreaName;
            }
        }
Beispiel #3
0
        private void LoadAreaDevInfo()
        {
            string sql = "select * from IO_AreaName2";

            SqlParameter[] param     = null;
            DataTable      dataTable = null;

            dataTable = SqlHelper.ExecuteDataTable(sql, param);

            if (dataTable.Rows.Count > 0)
            {
                AreaInfo areaInfo = new AreaInfo();
                areaInfo.AreaId          = dataTable.Rows[0]["M_AreaId"].ToString();
                areaInfo.AreaName        = this.buttonEditArea1.Text = dataTable.Rows[0]["M_Name"].ToString();
                areaInfo.Title           = this.textBoxArea1.Text = dataTable.Rows[0]["M_Title"].ToString();
                areaInfo.AreaDevs        = dataTable.Rows[0]["M_Devs"].ToString();
                areaInfo.Used            = Convert.ToInt32(dataTable.Rows[0]["M_Used"].ToString());
                this.checkBox1.Checked   = (areaInfo.Used > 0);
                this.buttonEditArea1.Tag = areaInfo;
            }
            if (dataTable.Rows.Count > 1)
            {
                AreaInfo areaInfo = new AreaInfo();
                areaInfo.AreaId          = dataTable.Rows[1]["M_AreaId"].ToString();
                areaInfo.AreaDevs        = dataTable.Rows[1]["M_Devs"].ToString();
                areaInfo.AreaName        = this.buttonEditArea2.Text = dataTable.Rows[1]["M_Name"].ToString();
                areaInfo.Title           = this.textBoxArea2.Text = dataTable.Rows[1]["M_Title"].ToString();
                areaInfo.Used            = Convert.ToInt32(dataTable.Rows[1]["M_Used"].ToString());
                this.checkBox2.Checked   = (areaInfo.Used > 0);
                this.buttonEditArea2.Tag = areaInfo;
            }
            if (dataTable.Rows.Count > 2)
            {
                AreaInfo areaInfo = new AreaInfo();
                areaInfo.AreaId          = dataTable.Rows[2]["M_AreaId"].ToString();
                areaInfo.AreaDevs        = dataTable.Rows[2]["M_Devs"].ToString();
                areaInfo.AreaName        = this.buttonEditArea3.Text = dataTable.Rows[2]["M_Name"].ToString();
                areaInfo.Title           = this.textBoxArea3.Text = dataTable.Rows[2]["M_Title"].ToString();
                areaInfo.Used            = Convert.ToInt32(dataTable.Rows[2]["M_Used"].ToString());
                this.checkBox3.Checked   = (areaInfo.Used > 0);
                this.buttonEditArea3.Tag = areaInfo;
            }
            if (dataTable.Rows.Count > 3)
            {
                AreaInfo areaInfo = new AreaInfo();
                areaInfo.AreaId          = dataTable.Rows[3]["M_AreaId"].ToString();
                areaInfo.AreaDevs        = dataTable.Rows[3]["M_Devs"].ToString();
                areaInfo.AreaName        = this.buttonEditArea4.Text = dataTable.Rows[3]["M_Name"].ToString();
                areaInfo.Title           = this.textBoxArea4.Text = dataTable.Rows[3]["M_Title"].ToString();
                areaInfo.Used            = Convert.ToInt32(dataTable.Rows[3]["M_Used"].ToString());
                this.checkBox4.Checked   = (areaInfo.Used > 0);
                this.buttonEditArea4.Tag = areaInfo;
            }
            if (dataTable.Rows.Count > 4)
            {
                AreaInfo areaInfo = new AreaInfo();
                areaInfo.AreaId          = dataTable.Rows[4]["M_AreaId"].ToString();
                areaInfo.AreaDevs        = dataTable.Rows[4]["M_Devs"].ToString();
                areaInfo.AreaName        = this.buttonEditArea5.Text = dataTable.Rows[4]["M_Name"].ToString();
                areaInfo.Title           = this.textBoxArea5.Text = dataTable.Rows[4]["M_Title"].ToString();
                areaInfo.Used            = Convert.ToInt32(dataTable.Rows[4]["M_Used"].ToString());
                this.checkBox5.Checked   = (areaInfo.Used > 0);
                this.buttonEditArea5.Tag = areaInfo;
            }
            if (dataTable.Rows.Count > 5)
            {
                AreaInfo areaInfo = new AreaInfo();
                areaInfo.AreaId          = dataTable.Rows[5]["M_AreaId"].ToString();
                areaInfo.AreaDevs        = dataTable.Rows[5]["M_Devs"].ToString();
                areaInfo.AreaName        = this.buttonEditArea6.Text = dataTable.Rows[5]["M_Name"].ToString();
                areaInfo.Title           = this.textBoxArea6.Text = dataTable.Rows[5]["M_Title"].ToString();
                areaInfo.Used            = Convert.ToInt32(dataTable.Rows[5]["M_Used"].ToString());
                this.checkBox6.Checked   = (areaInfo.Used > 0);
                this.buttonEditArea6.Tag = areaInfo;
            }
        }