?? addupdateform.cs
字號:
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(72, 23);
this.label13.TabIndex = 32;
this.label13.Text = "結項日期:";
this.label13.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label14
//
this.label14.Location = new System.Drawing.Point(624, 312);
this.label14.Name = "label14";
this.label14.Size = new System.Drawing.Size(72, 23);
this.label14.TabIndex = 33;
this.label14.Text = "經(jīng)費標準:";
this.label14.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label15
//
this.label15.Location = new System.Drawing.Point(624, 344);
this.label15.Name = "label15";
this.label15.Size = new System.Drawing.Size(72, 23);
this.label15.TabIndex = 34;
this.label15.Text = "已撥經(jīng)費:";
this.label15.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label16
//
this.label16.Location = new System.Drawing.Point(624, 376);
this.label16.Name = "label16";
this.label16.Size = new System.Drawing.Size(72, 23);
this.label16.TabIndex = 35;
this.label16.Text = "剩余經(jīng)費:";
this.label16.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label17
//
this.label17.Location = new System.Drawing.Point(16, 56);
this.label17.Name = "label17";
this.label17.Size = new System.Drawing.Size(72, 23);
this.label17.TabIndex = 36;
this.label17.Text = "所屬院系:";
this.label17.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label26
//
this.label26.Location = new System.Drawing.Point(16, 96);
this.label26.Name = "label26";
this.label26.Size = new System.Drawing.Size(72, 23);
this.label26.TabIndex = 37;
this.label26.Text = "聯(lián)系電話:";
this.label26.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label27
//
this.label27.Location = new System.Drawing.Point(16, 136);
this.label27.Name = "label27";
this.label27.Size = new System.Drawing.Size(72, 23);
this.label27.TabIndex = 38;
this.label27.Text = " E-Mail :";
this.label27.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label28
//
this.label28.Location = new System.Drawing.Point(248, 56);
this.label28.Name = "label28";
this.label28.Size = new System.Drawing.Size(56, 23);
this.label28.TabIndex = 39;
this.label28.Text = "備 注:";
this.label28.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// tbStart
//
this.tbStart.Location = new System.Drawing.Point(696, 208);
this.tbStart.Name = "tbStart";
this.tbStart.Size = new System.Drawing.Size(128, 21);
this.tbStart.TabIndex = 9;
this.tbStart.Text = "";
//
// tbPlan
//
this.tbPlan.Location = new System.Drawing.Point(696, 240);
this.tbPlan.Name = "tbPlan";
this.tbPlan.Size = new System.Drawing.Size(128, 21);
this.tbPlan.TabIndex = 10;
this.tbPlan.Text = "";
//
// tbEnd
//
this.tbEnd.Location = new System.Drawing.Point(696, 272);
this.tbEnd.Name = "tbEnd";
this.tbEnd.Size = new System.Drawing.Size(128, 21);
this.tbEnd.TabIndex = 11;
this.tbEnd.Text = "";
//
// AddUpdateForm
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(840, 469);
this.Controls.Add(this.tbEnd);
this.Controls.Add(this.tbPlan);
this.Controls.Add(this.tbStart);
this.Controls.Add(this.tbRemark);
this.Controls.Add(this.label28);
this.Controls.Add(this.label27);
this.Controls.Add(this.label26);
this.Controls.Add(this.label17);
this.Controls.Add(this.label16);
this.Controls.Add(this.label15);
this.Controls.Add(this.label14);
this.Controls.Add(this.label13);
this.Controls.Add(this.label12);
this.Controls.Add(this.cmbCollege);
this.Controls.Add(this.tbEmail);
this.Controls.Add(this.tbTel);
this.Controls.Add(this.nudSurplus);
this.Controls.Add(this.nudAlready);
this.Controls.Add(this.nudStandard);
this.Controls.Add(this.lbLevelCo);
this.Controls.Add(this.lbSortCo);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOK);
this.Controls.Add(this.grbMember);
this.Controls.Add(this.tbTaskName);
this.Controls.Add(this.label5);
this.Controls.Add(this.dtpYear);
this.Controls.Add(this.cmbLevelNa);
this.Controls.Add(this.cmbSortNa);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.grbTaskCo);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "AddUpdateForm";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "AddUpdateForm";
this.Load += new System.EventHandler(this.AddUpdateForm_Load);
this.grbMember.ResumeLayout(false);
this.panelMember.ResumeLayout(false);
this.grbTaskCo.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.nudStandard)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nudAlready)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nudSurplus)).EndInit();
this.ResumeLayout(false);
}
#endregion
private void AddUpdateForm_Load(object sender, System.EventArgs e)
{
this.ReadSort();
this.ReadLevel();
this.ReadCollege();
this.AddParameters();
this.DataShow();
}
private void btnOK_Click(object sender, System.EventArgs e)
{
if(this.cmbSortNa.SelectedIndex < 1)
{
MessageBox.Show("請選擇分類!", "系統(tǒng)警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return;
}
if(this.cmbLevelNa.SelectedIndex < 1)
{
MessageBox.Show("請選擇級別!", "系統(tǒng)警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return;
}
if(this.cmbCollege.SelectedIndex < 1)
{
MessageBox.Show("請選擇所屬院系!", "系統(tǒng)警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return;
}
this.tbTaskName.Text = this.tbTaskName.Text.Trim();
if(this.tbTaskName.Text == "")
{
MessageBox.Show("請輸入課題名稱!", "系統(tǒng)警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return;
}
this.UpdateTask();
}
private void UpdateTask()
{
try
{
this.sqlConnection.Open();
this.SetParametersValue();
this.storedProcedure.ExecuteNonQuery();
this.newTaskArrayList.Add(this.storedProcedure.Parameters["@TaskID"].Value);
MessageBox.Show(this.Text + "成功!", "系統(tǒng)提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
if(this.btnOK.Text == "修 改")
{
this.dataRow.Delete();
this.Close();
}
else
{
this.ResetDataBind();
}
}
catch(Exception caught)
{
MessageBox.Show(caught.Message);
}
finally
{
this.sqlConnection.Close();
}
}
private void btnCancel_Click(object sender, System.EventArgs e)
{
this.Close();
}
#region /* 從數(shù)據(jù)庫表中讀取“分類信息”、“級別信息”、“院系信息”、“成員信息” */
/// <summary>
/// 讀取分類信息。
/// </summary>
private void ReadSort()
{
string selectStr = "select SortCo, SortNa from Sort order by SortNa";
this.ResetLC(this.lbSortCo, this.cmbSortNa, "請選擇分類", "…… 新增分類 ……");
this.ReadLC(this.lbSortCo, this.cmbSortNa, selectStr);
}
/// <summary>
/// 讀取級別信息。
/// </summary>
private void ReadLevel()
{
string selectStr = "select LevelCo, LevelNa from Level order by LevelNa";
this.ResetLC(this.lbLevelCo, this.cmbLevelNa, "請選擇級別", "…… 新增級別 ……");
this.ReadLC(this.lbLevelCo, this.cmbLevelNa, selectStr);
}
/// <summary>
/// 讀取院系信息。
/// </summary>
private void ReadCollege()
{
string selectStr = "select CollegeCo, CollegeNa from College order by CollegeNa";
this.ResetLC(this.lbCollegeCo, this.cmbCollegeNa, "請選擇院系", "…… 新增院系 ……");
this.ReadLC(this.lbCollegeCo, this.cmbCollegeNa, selectStr);
this.cmbCollege.Items.Clear();
for(int i = 0; i < this.cmbCollegeNa.Items.Count; i++)
{
this.cmbCollege.Items.Add(this.cmbCollegeNa.Items[i]);
}
this.cmbCollege.SelectedIndex = 0;
}
/// <summary>
/// 讀取成員信息。
/// </summary>
private void ReadMember()
{
int collegeCo = Convert.ToInt32(this.lbCollegeCo.Items[this.cmbCollegeNa.SelectedIndex]);
string selectStr = "select MemberCo, MemberNa from Member where CollegeCo = " + collegeCo + " order by MemberNa";
this.ResetLC(this.lbMemberCo, this.cmbMemberNa, "請選擇成員", "… 新增成員 …");
this.ReadLC(this.lbMemberCo, this.cmbMemberNa, selectStr);
}
private void cmbSortNa_SelectionChangeCommitted(object sender, System.EventArgs e)
{
if(this.cmbSortNa.SelectedIndex == (this.cmbSortNa.Items.Count - 1)) //選擇“新增分類”
{
ArrayList array = null;
//調用新增分類窗體f
addSort addSortForm = new addSort();
addSortForm.Connection = this.sqlConnection;
addSortForm.ShowDialog();
//array = f.GetArrayList();
array = addSortForm.GetArrayList();
if(array != null)
{
this.lbSortCo.Items.Insert(1, array[0]);
this.cmbSortNa.Items.Insert(1, array[1]);
this.cmbSortNa.SelectedIndex = 1;
}
else
{
int sortCo = Convert.ToInt32(this.cmbSortNa.Tag);
this.cmbSortNa.SelectedIndex = this.lbSortCo.Items.IndexOf(sortCo);
return;
}
}
this.cmbSortNa.Tag = this.lbSortCo.Items[this.cmbSortNa.SelectedIndex];
}
private void cmbLevelNa_SelectionChangeCommitted(object sender, System.EventArgs e)
{
if(this.cmbLevelNa.SelectedIndex == (this.cmbLevelNa.Items.Count - 1)) //選擇“新增級別”
{
ArrayList array = null;
//調用新增級別窗體f
AddLevel addLevelForm = new AddLevel();
addLevelForm.Connection = this.sqlConnection;
addLevelForm.ShowDialog();
//array = f.GetArrayList();
array = addLevelForm.GetArrayList();
if(array != null)
{
this.lbLevelCo.Items.Insert(1, array[0]);
this.cmbLevelNa.Items.Insert(1, array[1]);
this.cmbLevelNa.SelectedIndex = 1;
}
else
{
int levelCo = Convert.ToInt32(this.cmbLevelNa.Tag);
this.cmbLevelNa.SelectedIndex = this.lbLevelCo.Items.IndexOf(levelCo);
return;
}
}
this.cmbLevelNa.Tag = this.lbLevelCo.Items[this.cmbLevelNa.SelectedIndex];
}
private void cmbCollegeNa_SelectionChangeCommitted(object sender, System.EventArgs e)
{
if(this.cmbCollegeNa.SelectedIndex == (this.cmbCollegeNa.Items.Count - 1)) //選擇“新增院系”
{
ArrayList array = null;
//調用新增院系窗體f
AddCollege addCollegeForm = new AddCollege();
addCollegeForm.Connection = this.sqlConnection;
addCollegeForm.ShowDialog();
//array = f.GetArrayList();
array = addCollegeForm.GetArrayList();
if(array != null)
{
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -