Example #1
0
        /// <summary>
        /// 修改按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AlterButton_Click(object sender, EventArgs e)
        {
            //throw new NotImplementedException();
            CententForm.Employee.WinForm.AddDemand addDemand = new CententForm.Employee.WinForm.AddDemand();
            int     buttonName = int.Parse(((Button)sender).Name);//获取要修改的数据所在行
            int     No         = 0;
            int     y          = 0;
            LinkSQL linkSql    = new LinkSQL();

            try
            {
                linkSql.OpenSQL();
            }
            catch
            {
                MessageBox.Show("无法连接数据库!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            linkSql.SQLSelect(@"select No from demand");
            System.Data.SqlClient.SqlDataReader DR = linkSql.Comm.ExecuteReader();
            while (DR.Read())
            {
                if (buttonName == y)
                {
                    No = int.Parse(DR[0].ToString());
                }
                y++;
            }
            addDemand.UpDataNo           = No;
            addDemand.Department_ID.Text = table[buttonName, 1].Text;
            if (table[buttonName, 1].Text == "采购部")
            {
                addDemand.Department_ID.Text = "PU0001";
            }
            if (table[buttonName, 1].Text == "仓储部")
            {
                addDemand.Department_ID.Text = "ST0001";
            }
            addDemand.Post.Text       = table[buttonName, 2].Text;
            addDemand.Rec_Number.Text = table[buttonName, 3].Text;
            addDemand.Explain.Text    = detail[buttonName];
            DialogResult dr = addDemand.ShowDialog();

            if (dr == DialogResult.Cancel)
            {
                RefreshData();
            }
            else
            {
                return;
            }
        }
Example #2
0
        /// <summary>
        /// 添加需求事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            int number = 22;  //记录当前的需求信息的数量

            try
            {
                LinkSQL linkSql = new LinkSQL();
                linkSql.OpenSQL();
                linkSql.SQLSelect(@"select count(*) from demand");
                number = int.Parse(linkSql.Comm.ExecuteScalar().ToString());
                linkSql.CloseSQL();
            }
            catch
            {
                MessageBox.Show("无法连接到服务器!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (number >= 20)
            {
                MessageBox.Show("最大只可发布20条招聘信息,请先删除部分的招聘信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
            if (number == 22)
            {
                MessageBox.Show("无法连接到服务器!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            CententForm.Employee.WinForm.AddDemand addDemand = new CententForm.Employee.WinForm.AddDemand();
            DialogResult dr = addDemand.ShowDialog();

            if (dr == DialogResult.Cancel)
            {
                RefreshData();
            }
            else
            {
                return;
            }
        }