⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 customersmanage.cs

📁 c#编写的汽车销售公司erp进销存系统
💻 CS
📖 第 1 页 / 共 3 页
字号:
			// 
			this.txtCtelnumber.EditValue = "";
			this.txtCtelnumber.Location = new System.Drawing.Point(96, 48);
			this.txtCtelnumber.Name = "txtCtelnumber";
			// 
			// txtCtelnumber.Properties
			// 
			this.txtCtelnumber.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Default;
			this.txtCtelnumber.Size = new System.Drawing.Size(272, 21);
			this.txtCtelnumber.TabIndex = 38;
			// 
			// txtname
			// 
			this.txtname.EditValue = "";
			this.txtname.Location = new System.Drawing.Point(96, 24);
			this.txtname.Name = "txtname";
			// 
			// txtname.Properties
			// 
			this.txtname.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Default;
			this.txtname.Size = new System.Drawing.Size(272, 21);
			this.txtname.TabIndex = 37;
			// 
			// label9
			// 
			this.label9.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.label9.Location = new System.Drawing.Point(32, 48);
			this.label9.Name = "label9";
			this.label9.Size = new System.Drawing.Size(72, 23);
			this.label9.TabIndex = 30;
			this.label9.Text = "客户来电";
			this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
			// 
			// label8
			// 
			this.label8.BackColor = System.Drawing.Color.Transparent;
			this.label8.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.label8.Location = new System.Drawing.Point(32, 96);
			this.label8.Name = "label8";
			this.label8.Size = new System.Drawing.Size(72, 23);
			this.label8.TabIndex = 36;
			this.label8.Text = "客户地址";
			this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
			// 
			// label7
			// 
			this.label7.BackColor = System.Drawing.Color.Transparent;
			this.label7.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.label7.Location = new System.Drawing.Point(392, 24);
			this.label7.Name = "label7";
			this.label7.Size = new System.Drawing.Size(72, 23);
			this.label7.TabIndex = 34;
			this.label7.Text = "客户性别";
			this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
			// 
			// cbCType
			// 
			this.cbCType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
			this.cbCType.Location = new System.Drawing.Point(472, 48);
			this.cbCType.Name = "cbCType";
			this.cbCType.Size = new System.Drawing.Size(216, 20);
			this.cbCType.TabIndex = 3;
			this.cbCType.SelectedIndexChanged += new System.EventHandler(this.cbCType_SelectedIndexChanged_1);
			// 
			// label3
			// 
			this.label3.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.label3.Location = new System.Drawing.Point(392, 96);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(72, 23);
			this.label3.TabIndex = 21;
			this.label3.Text = "联系方式";
			this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
			// 
			// label1
			// 
			this.label1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.label1.Location = new System.Drawing.Point(32, 128);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(72, 23);
			this.label1.TabIndex = 20;
			this.label1.Text = "备注信息";
			this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
			// 
			// label4
			// 
			this.label4.BackColor = System.Drawing.Color.Transparent;
			this.label4.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.label4.Location = new System.Drawing.Point(392, 48);
			this.label4.Name = "label4";
			this.label4.Size = new System.Drawing.Size(72, 23);
			this.label4.TabIndex = 22;
			this.label4.Text = "客户类别";
			this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
			// 
			// label2
			// 
			this.label2.BackColor = System.Drawing.Color.Transparent;
			this.label2.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.label2.Location = new System.Drawing.Point(32, 24);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(72, 23);
			this.label2.TabIndex = 19;
			this.label2.Text = "客户姓名";
			this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
			// 
			// label6
			// 
			this.label6.BackColor = System.Drawing.Color.Transparent;
			this.label6.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.label6.Location = new System.Drawing.Point(32, 72);
			this.label6.Name = "label6";
			this.label6.Size = new System.Drawing.Size(72, 23);
			this.label6.TabIndex = 24;
			this.label6.Text = "传真号码";
			this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
			// 
			// label5
			// 
			this.label5.BackColor = System.Drawing.Color.Transparent;
			this.label5.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.label5.Location = new System.Drawing.Point(392, 72);
			this.label5.Name = "label5";
			this.label5.Size = new System.Drawing.Size(72, 23);
			this.label5.TabIndex = 23;
			this.label5.Text = "E-mail";
			this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
			// 
			// CustomersManage
			// 
			this.AutoScroll = true;
			this.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(141)), ((System.Byte)(193)), ((System.Byte)(230)));
			this.Controls.Add(this.panel2);
			this.Controls.Add(this.panel1);
			this.Name = "CustomersManage";
			this.Size = new System.Drawing.Size(860, 493);
			this.Load += new System.EventHandler(this.CustomersManage_Load);
			((System.ComponentModel.ISupportInitialize)(this.panel2)).EndInit();
			this.panel2.ResumeLayout(false);
			((System.ComponentModel.ISupportInitialize)(this.dgCustomer)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.panel1)).EndInit();
			this.panel1.ResumeLayout(false);
			((System.ComponentModel.ISupportInitialize)(this.cbSex.Properties)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.txtMemo.Properties)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.txtRelation.Properties)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.txtEmail.Properties)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.txtAddr.Properties)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.txtFax.Properties)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.txtCtelnumber.Properties)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.txtname.Properties)).EndInit();
			this.ResumeLayout(false);

		}
		#endregion

		private void btAdd_Click(object sender, System.EventArgs e)
		{
			try
			{
				insertData();
				
			}
			catch(Exception ex)
			{
				MessageBox.Show(ex.Message);
			}
		}
		private void insertData()
		{			
			if(!this.validate())
			{
				return;
			}
			CustomerInfo cinfo=new CustomerInfo();
			cinfo=setData("增加");
			CustomerBLL cbll=new CustomerBLL();
			if(cbll.addCustomer(cinfo).ToString()!=null)
			{
				MessageBox.Show(this,"添加成功!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
				getDataBind();
				ClearData();
			}
			else
			{
				MessageBox.Show(this,"添加失败!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
			}
			
		}
		private CustomerInfo setData(string tag)
		{
			CustomerInfo cinfo=new CustomerInfo();
			if(tag=="修改")
			{
				cinfo.id=Convert.ToInt32(this.dgCustomer[this.dgCustomer.CurrentCell.RowNumber,1]);
			
			}
			cinfo.cname=this.txtname.Text;
			cinfo.csex=this.cbSex.Text.ToString();
			cinfo.ctelnumber=this.txtCtelnumber.Text.ToString();
			cinfo.ccontact=this.txtRelation.Text;
			cinfo.ctype=Convert.ToInt32(this.cbCType.SelectedText);
			cinfo.cfax=this.txtFax.Text;
			cinfo.cemail=this.txtEmail.Text;
			cinfo.caddress=this.txtAddr.Text;
			cinfo.ccomment=this.txtMemo.Text;
			return cinfo;
		}
		private void getDataBind()
		{	
			this.dgCustomer.CaptionBackColor=Color.FromArgb(ShareClass.Rcolor,ShareClass.Gcolor,ShareClass.Bcolor);
			this.dgCustomer.BackgroundColor=Color.FromArgb(ShareClass.Rcolor,ShareClass.Gcolor,ShareClass.Bcolor);
			this.checkBox1.BackColor=Color.FromArgb(ShareClass.Rcolor,ShareClass.Gcolor,ShareClass.Bcolor);
			
			this.checkBox1.Checked=false;
			dscustomers=new DataSet();
			CustomerBLL cbll=new CustomerBLL();
			CustomerInfo cinfo=new CustomerInfo();
			dscustomers=cbll.queryCustomer_DataSet(cinfo,"customers");


			System.Type myDataType;
			myDataType = System.Type.GetType("System.Boolean");
			System.Data.DataColumn myColumn = new System.Data.DataColumn("check");
			// Set various properties.
			myColumn.AutoIncrement = false;
			myColumn.ReadOnly = false;
			myColumn.ColumnMapping = System.Data.MappingType.Attribute;
			myColumn.Caption = "check";
			myColumn.DefaultValue = "false";
			myColumn.DataType = myDataType;
			
			
			
			dscustomers.Tables["customers"].Columns.Add(myColumn);

			DataView dv=new DataView();
			dv=dscustomers.Tables["customers"].DefaultView;
			dv.AllowNew=false;


			this.dgCustomer.DataSource=dv;//dscustomers.Tables["customers"].DefaultView;
			

			this.dgCustomer.TableStyles.Clear();
			DataGridTableStyle ts = new DataGridTableStyle();
			ts.MappingName = dscustomers.Tables["customers"].TableName;
			ts.GridLineColor=Color.FromArgb(ShareClass.Rcolor,ShareClass.Gcolor,ShareClass.Bcolor);
			ts.HeaderBackColor=Color.FromArgb(ShareClass.Rcolor,ShareClass.Gcolor,ShareClass.Bcolor);

			DataGridColumnStyle gsc = new DataGridBoolColumn();
			gsc.MappingName = "check";
			gsc.HeaderText = "选择";
			gsc.Width=40;
			ts.GridColumnStyles.Add(gsc);


			DataGridColumnStyle gs0 = new DataGridTextBoxColumn();
			gs0.MappingName = "id";
			gs0.HeaderText = "编号";
			gs0.Width=0;
			gs0.ReadOnly=true;
			ts.GridColumnStyles.Add(gs0);

			DataGridColumnStyle gs1 = new DataGridTextBoxColumn();
			gs1.MappingName = "cname";
			gs1.HeaderText = "姓名";
			gs1.NullText = "";
			gs1.Width=60;
			gs1.ReadOnly=true;
			gs1.Alignment = HorizontalAlignment.Left;
			ts.GridColumnStyles.Add(gs1);

			DataGridColumnStyle gs2 = new DataGridTextBoxColumn();
			gs2.MappingName = "csex";
			gs2.HeaderText = "性别";
			gs2.NullText = "";
			gs2.Width=40;
			gs2.ReadOnly=true;
			gs2.Alignment = HorizontalAlignment.Left;
			ts.GridColumnStyles.Add(gs2);

			DataGridColumnStyle gsc2 = new DataGridTextBoxColumn();
			gsc2.MappingName = "telnumber";
			gsc2.HeaderText = "客户来电";
			gsc2.NullText = "";
			gs2.Width=100;
			gsc2.ReadOnly=true;
			gsc2.Alignment = HorizontalAlignment.Left;
			ts.GridColumnStyles.Add(gsc2);

			DataGridColumnStyle gst2 = new DataGridTextBoxColumn();
			gst2.MappingName = "tname";
			gst2.HeaderText = "类别";
			gst2.NullText = "";
			gst2.Width=100;
			gst2.ReadOnly=true;
			gst2.Alignment = HorizontalAlignment.Left;
			ts.GridColumnStyles.Add(gst2);

			DataGridColumnStyle gs3 = new DataGridTextBoxColumn();
			gs3.MappingName = "cemail";
			gs3.HeaderText = "email";
			gs3.NullText = "";
			gs3.Width=200;
			gs3.ReadOnly=true;
			gs3.Alignment = HorizontalAlignment.Left;
			ts.GridColumnStyles.Add(gs3);

			DataGridColumnStyle gs4 = new DataGridTextBoxColumn();
			gs4.MappingName = "cfax";
			gs4.HeaderText = "传真";
			gs4.NullText = "";
			gs4.Width=100;
			gs4.ReadOnly=true;
			gs4.Alignment = HorizontalAlignment.Left;
			ts.GridColumnStyles.Add(gs4);

			DataGridColumnStyle gs5 = new DataGridTextBoxColumn();
			gs5.MappingName = "ccontact";
			gs5.HeaderText = "联系方式";
			gs5.NullText = "";

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -