📄 addsuper.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace _3Dmanager
{
/// <summary>
/// AddSuper 的摘要说明。
/// </summary>
public class AddSuper : System.Windows.Forms.Form
{
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox textBox4;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.RichTextBox richTextBox1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.TextBox textBox5;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.TextBox textBox6;
private System.Windows.Forms.DataGrid dataGrid1;
private System.Windows.Forms.Button button4;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public AddSuper()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.textBox2 = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.textBox3 = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.textBox4 = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.label6 = new System.Windows.Forms.Label();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.label7 = new System.Windows.Forms.Label();
this.textBox5 = new System.Windows.Forms.TextBox();
this.label8 = new System.Windows.Forms.Label();
this.textBox6 = new System.Windows.Forms.TextBox();
this.dataGrid1 = new System.Windows.Forms.DataGrid();
this.button4 = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
this.SuspendLayout();
//
// label1
//
this.label1.Location = new System.Drawing.Point(96, 24);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(80, 16);
this.label1.TabIndex = 0;
this.label1.Text = "提供商名称:";
//
// textBox1
//
this.textBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textBox1.Location = new System.Drawing.Point(192, 16);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(240, 21);
this.textBox1.TabIndex = 1;
this.textBox1.Text = "";
//
// label2
//
this.label2.Location = new System.Drawing.Point(104, 64);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(64, 16);
this.label2.TabIndex = 2;
this.label2.Text = "地址:";
//
// textBox2
//
this.textBox2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textBox2.Location = new System.Drawing.Point(192, 56);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(240, 21);
this.textBox2.TabIndex = 3;
this.textBox2.Text = "";
//
// label3
//
this.label3.Location = new System.Drawing.Point(96, 136);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(80, 16);
this.label3.TabIndex = 4;
this.label3.Text = "联系电话:";
//
// textBox3
//
this.textBox3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textBox3.Location = new System.Drawing.Point(192, 128);
this.textBox3.Name = "textBox3";
this.textBox3.Size = new System.Drawing.Size(64, 21);
this.textBox3.TabIndex = 5;
this.textBox3.Text = "";
//
// label4
//
this.label4.Location = new System.Drawing.Point(96, 168);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(64, 16);
this.label4.TabIndex = 6;
this.label4.Text = "负责人:";
//
// textBox4
//
this.textBox4.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textBox4.Location = new System.Drawing.Point(184, 168);
this.textBox4.Name = "textBox4";
this.textBox4.Size = new System.Drawing.Size(112, 21);
this.textBox4.TabIndex = 7;
this.textBox4.Text = "";
//
// label5
//
this.label5.Location = new System.Drawing.Point(64, 216);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(48, 56);
this.label5.TabIndex = 8;
this.label5.Text = "简介(字数不超过200个):";
//
// richTextBox1
//
this.richTextBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.richTextBox1.Location = new System.Drawing.Point(120, 208);
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.Size = new System.Drawing.Size(336, 88);
this.richTextBox1.TabIndex = 9;
this.richTextBox1.Text = "";
//
// button1
//
this.button1.Location = new System.Drawing.Point(88, 320);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(88, 24);
this.button1.TabIndex = 10;
this.button1.Text = "入库";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(256, 320);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(88, 24);
this.button2.TabIndex = 11;
this.button2.Text = "取消";
//
// button3
//
this.button3.Location = new System.Drawing.Point(400, 320);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(80, 24);
this.button3.TabIndex = 12;
this.button3.Text = "退出";
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// label6
//
this.label6.Location = new System.Drawing.Point(96, 96);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(72, 16);
this.label6.TabIndex = 13;
this.label6.Text = "提供类别:";
//
// comboBox1
//
this.comboBox1.Location = new System.Drawing.Point(192, 96);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(144, 20);
this.comboBox1.TabIndex = 14;
this.comboBox1.Text = "======请选择======";
//
// label7
//
this.label7.Font = new System.Drawing.Font("隶书", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.label7.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(128)), ((System.Byte)(128)), ((System.Byte)(255)));
this.label7.Location = new System.Drawing.Point(280, 128);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(16, 16);
this.label7.TabIndex = 15;
this.label7.Text = "-";
//
// textBox5
//
this.textBox5.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textBox5.Location = new System.Drawing.Point(304, 128);
this.textBox5.Name = "textBox5";
this.textBox5.Size = new System.Drawing.Size(136, 21);
this.textBox5.TabIndex = 16;
this.textBox5.Text = "";
//
// label8
//
this.label8.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(128)), ((System.Byte)(128)), ((System.Byte)(255)));
this.label8.Location = new System.Drawing.Point(312, 168);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(24, 16);
this.label8.TabIndex = 17;
this.label8.Text = "or";
//
// textBox6
//
this.textBox6.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textBox6.Location = new System.Drawing.Point(344, 168);
this.textBox6.Name = "textBox6";
this.textBox6.Size = new System.Drawing.Size(104, 21);
this.textBox6.TabIndex = 18;
this.textBox6.Text = "";
//
// dataGrid1
//
this.dataGrid1.AlternatingBackColor = System.Drawing.Color.WhiteSmoke;
this.dataGrid1.BackColor = System.Drawing.Color.Gainsboro;
this.dataGrid1.BackgroundColor = System.Drawing.Color.DarkGray;
this.dataGrid1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.dataGrid1.CaptionBackColor = System.Drawing.Color.DarkKhaki;
this.dataGrid1.CaptionFont = new System.Drawing.Font("Tahoma", 8F, System.Drawing.FontStyle.Bold);
this.dataGrid1.CaptionForeColor = System.Drawing.Color.Black;
this.dataGrid1.DataMember = "";
this.dataGrid1.Dock = System.Windows.Forms.DockStyle.Bottom;
this.dataGrid1.FlatMode = true;
this.dataGrid1.Font = new System.Drawing.Font("Times New Roman", 9F);
this.dataGrid1.ForeColor = System.Drawing.Color.Black;
this.dataGrid1.GridLineColor = System.Drawing.Color.Silver;
this.dataGrid1.HeaderBackColor = System.Drawing.Color.Black;
this.dataGrid1.HeaderFont = new System.Drawing.Font("Tahoma", 8F, System.Drawing.FontStyle.Bold);
this.dataGrid1.HeaderForeColor = System.Drawing.Color.White;
this.dataGrid1.LinkColor = System.Drawing.Color.DarkSlateBlue;
this.dataGrid1.Location = new System.Drawing.Point(0, 368);
this.dataGrid1.Name = "dataGrid1";
this.dataGrid1.ParentRowsBackColor = System.Drawing.Color.LightGray;
this.dataGrid1.ParentRowsForeColor = System.Drawing.Color.Black;
this.dataGrid1.SelectionBackColor = System.Drawing.Color.Firebrick;
this.dataGrid1.SelectionForeColor = System.Drawing.Color.White;
this.dataGrid1.Size = new System.Drawing.Size(528, 108);
this.dataGrid1.TabIndex = 19;
//
// button4
//
this.button4.Location = new System.Drawing.Point(464, 272);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(40, 23);
this.button4.TabIndex = 20;
this.button4.Text = "...";
//
// AddSuper
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(528, 476);
this.Controls.Add(this.button4);
this.Controls.Add(this.dataGrid1);
this.Controls.Add(this.textBox6);
this.Controls.Add(this.label8);
this.Controls.Add(this.textBox5);
this.Controls.Add(this.label7);
this.Controls.Add(this.comboBox1);
this.Controls.Add(this.label6);
this.Controls.Add(this.button3);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.richTextBox1);
this.Controls.Add(this.label5);
this.Controls.Add(this.textBox4);
this.Controls.Add(this.label4);
this.Controls.Add(this.textBox3);
this.Controls.Add(this.label3);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.label2);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.label1);
this.Name = "AddSuper";
this.Text = "AddSuper";
this.Load += new System.EventHandler(this.AddSuper_Load);
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
this.ResumeLayout(false);
}
#endregion
private void button3_Click(object sender, System.EventArgs e)
{
this.Dispose();
}
private void AddSuper_Load(object sender, System.EventArgs e)
{
object[] my1=_3DLib.InitComcoBox.getItem("类别");
this.comboBox1.Items.AddRange(my1);
}
private void button1_Click(object sender, System.EventArgs e)
{
string name=textBox1.Text.Trim();
string address=textBox2.Text.Trim();
string type=this.comboBox1.Text.Trim();
if(type.Equals("======请选择======"))
{
type=null;
}
string pre=textBox3.Text.Trim();
string after=textBox5.Text.Trim();
string phone=pre+"-"+after;
string fzr1=textBox4.Text.Trim();
string fzr2=textBox6.Text.Trim();
string fzr=fzr1+"或者"+fzr2;
string bz=this.richTextBox1.Text.Trim();
if(name.Equals("")||address.Equals("")||bz.Equals(""))
{
MessageBox.Show("您的公司信息填写不全,系统将不予处理!");
return;
}
if(bz.Length>200)
{
MessageBox.Show("您的备注超过了限定值!系统不予处理!");
return;
}
string insert="'"+name+"','"+type+"','"+fzr+"','"+address+"','"+phone+"','"+bz+"'";
if(_3DLib.InsertIntoCom.insertInto(insert).Equals("OK"))
{
MessageBox.Show("成功添加!");
}
else
MessageBox.Show("添加失败!");
this.dataGrid1.DataSource=_3DLib.SelectAll.getOneInfo("提供商",name,"名称");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -