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

📄 usermanage.cs

📁 c#编写的汽车销售公司erp进销存系统
💻 CS
📖 第 1 页 / 共 3 页
字号:
			this.btSave.Text = "修改";
			this.btSave.Click += new System.EventHandler(this.btSave_Click);
			// 
			// btAdd
			// 
			this.btAdd.Location = new System.Drawing.Point(696, 32);
			this.btAdd.Name = "btAdd";
			this.btAdd.TabIndex = 56;
			this.btAdd.Text = "添加";
			this.btAdd.Click += new System.EventHandler(this.dtAdd_Click);
			// 
			// txtDescript
			// 
			this.txtDescript.EditValue = "";
			this.txtDescript.Location = new System.Drawing.Point(88, 136);
			this.txtDescript.Name = "txtDescript";
			// 
			// txtDescript.Properties
			// 
			this.txtDescript.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Default;
			this.txtDescript.Size = new System.Drawing.Size(576, 21);
			this.txtDescript.TabIndex = 53;
			// 
			// txtTelnumber
			// 
			this.txtTelnumber.EditValue = "";
			this.txtTelnumber.Location = new System.Drawing.Point(536, 104);
			this.txtTelnumber.Name = "txtTelnumber";
			// 
			// txtTelnumber.Properties
			// 
			this.txtTelnumber.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Default;
			this.txtTelnumber.Size = new System.Drawing.Size(128, 21);
			this.txtTelnumber.TabIndex = 52;
			// 
			// txtPwdC
			// 
			this.txtPwdC.EditValue = "";
			this.txtPwdC.Location = new System.Drawing.Point(536, 72);
			this.txtPwdC.Name = "txtPwdC";
			// 
			// txtPwdC.Properties
			// 
			this.txtPwdC.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Default;
			this.txtPwdC.Properties.PasswordChar = '*';
			this.txtPwdC.Size = new System.Drawing.Size(128, 21);
			this.txtPwdC.TabIndex = 51;
			// 
			// txtId
			// 
			this.txtId.EditValue = "";
			this.txtId.Location = new System.Drawing.Point(536, 40);
			this.txtId.Name = "txtId";
			// 
			// txtId.Properties
			// 
			this.txtId.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Default;
			this.txtId.Size = new System.Drawing.Size(128, 21);
			this.txtId.TabIndex = 50;
			// 
			// txtPwd
			// 
			this.txtPwd.EditValue = "";
			this.txtPwd.Location = new System.Drawing.Point(280, 72);
			this.txtPwd.Name = "txtPwd";
			// 
			// txtPwd.Properties
			// 
			this.txtPwd.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Default;
			this.txtPwd.Properties.PasswordChar = '*';
			this.txtPwd.Size = new System.Drawing.Size(128, 21);
			this.txtPwd.TabIndex = 49;
			// 
			// txtLogin
			// 
			this.txtLogin.EditValue = "";
			this.txtLogin.Location = new System.Drawing.Point(280, 40);
			this.txtLogin.Name = "txtLogin";
			// 
			// txtLogin.Properties
			// 
			this.txtLogin.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Default;
			this.txtLogin.Size = new System.Drawing.Size(128, 21);
			this.txtLogin.TabIndex = 48;
			// 
			// txtname
			// 
			this.txtname.EditValue = "";
			this.txtname.Location = new System.Drawing.Point(88, 40);
			this.txtname.Name = "txtname";
			// 
			// txtname.Properties
			// 
			this.txtname.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Default;
			this.txtname.Size = new System.Drawing.Size(128, 21);
			this.txtname.TabIndex = 47;
			// 
			// cobLevel
			// 
			this.cobLevel.EditValue = "";
			this.cobLevel.Location = new System.Drawing.Point(88, 72);
			this.cobLevel.Name = "cobLevel";
			// 
			// cobLevel.Properties
			// 
			this.cobLevel.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Default;
			this.cobLevel.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
																											 new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
			this.cobLevel.Properties.Items.AddRange(new object[] {
																	 "普通操作员",
																	 "系统管理员"});
			this.cobLevel.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
			this.cobLevel.Size = new System.Drawing.Size(128, 21);
			this.cobLevel.TabIndex = 46;
			// 
			// txtMenu
			// 
			this.txtMenu.EditValue = "";
			this.txtMenu.Location = new System.Drawing.Point(88, 104);
			this.txtMenu.Name = "txtMenu";
			// 
			// txtMenu.Properties
			// 
			this.txtMenu.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Default;
			this.txtMenu.Properties.ReadOnly = true;
			this.txtMenu.Size = new System.Drawing.Size(320, 21);
			this.txtMenu.TabIndex = 55;
			this.txtMenu.MouseMove += new System.Windows.Forms.MouseEventHandler(this.txtMenu_MouseMove);
			this.txtMenu.MouseLeave += new System.EventHandler(this.txtMenu_MouseLeave);
			// 
			// panelControl1
			// 
			this.panelControl1.Controls.Add(this.gridDataFilter1);
			this.panelControl1.Dock = System.Windows.Forms.DockStyle.Bottom;
			this.panelControl1.Location = new System.Drawing.Point(0, 485);
			this.panelControl1.Name = "panelControl1";
			this.panelControl1.Size = new System.Drawing.Size(808, 40);
			this.panelControl1.TabIndex = 6;
			this.panelControl1.Text = "panelControl1";
			// 
			// UserManage
			// 
			this.AutoScroll = true;
			this.Controls.Add(this.panel2);
			this.Controls.Add(this.panel1);
			this.Controls.Add(this.panelControl1);
			this.Name = "UserManage";
			this.Size = new System.Drawing.Size(808, 525);
			this.Load += new System.EventHandler(this.UserManage_Load);
			((System.ComponentModel.ISupportInitialize)(this.panel2)).EndInit();
			this.panel2.ResumeLayout(false);
			((System.ComponentModel.ISupportInitialize)(this.dgUser)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.dgMenu)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.panel1)).EndInit();
			this.panel1.ResumeLayout(false);
			((System.ComponentModel.ISupportInitialize)(this.txtDescript.Properties)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.txtTelnumber.Properties)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.txtPwdC.Properties)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.txtId.Properties)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.txtPwd.Properties)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.txtLogin.Properties)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.txtname.Properties)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.cobLevel.Properties)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.txtMenu.Properties)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.panelControl1)).EndInit();
			this.panelControl1.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion
		//插入用户皮肤样式
		private void insertXmlSkin(string loginname)
		{
			XmlDocument xmlDoc=new XmlDocument();
			xmlDoc.Load("system.xml");
			XmlNode root=xmlDoc.SelectSingleNode("system");//查找<system>
			XmlElement xe1=xmlDoc.CreateElement("user");//创建一个<user>节点
			xe1.SetAttribute("name",loginname);//设置该节点name属性

 
			XmlElement xesub1=xmlDoc.CreateElement("skin");
			xesub1.InnerText=ShareClass.skin;//设置文本节点
			xe1.AppendChild(xesub1);//添加到<user>节点中
			XmlElement xesub2=xmlDoc.CreateElement("rcolor");
			xesub2.InnerText=ShareClass.Rcolor.ToString();
			xe1.AppendChild(xesub2);
			XmlElement xesub3=xmlDoc.CreateElement("gcolor");
			xesub3.InnerText=ShareClass.Gcolor.ToString();
			xe1.AppendChild(xesub3);
			XmlElement xesub4=xmlDoc.CreateElement("bcolor");
			xesub4.InnerText=ShareClass.Bcolor.ToString();
			xe1.AppendChild(xesub4);
 
			root.AppendChild(xe1);//添加到<system>节点中
			xmlDoc.Save("system.xml");

		}

		private void dtAdd_Click(object sender, System.EventArgs e)
		{
			try
			{
				this.Cursor = Cursors.WaitCursor;
				this.btAdd.Enabled = false;
				insertXmlSkin(this.txtLogin.Text);
				insertData();
				
				this.btAdd.Enabled = true;
				this.Cursor = Cursors.Arrow;
				
			}
			catch(Exception ex)
			{
				MessageBox.Show(ex.Message);
			}
			
			
		}
		private void getDataBind()
		{
			this.dgUser.CaptionBackColor=Color.FromArgb(ShareClass.Rcolor,ShareClass.Gcolor,ShareClass.Bcolor);
			this.dgUser.BackgroundColor=Color.FromArgb(ShareClass.Rcolor,ShareClass.Gcolor,ShareClass.Bcolor);
			DataSet ds=new DataSet();
			SysoperatorBLL sysbll=new SysoperatorBLL();
			ds=sysbll.getALLSysoperator_DataSet("operator");
			this.dgUser.DataSource=ds.Tables["operator"].DefaultView;

			this.dgUser.TableStyles.Clear();
			DataGridTableStyle ts = new DataGridTableStyle();
			ts.MappingName = ds.Tables["operator"].TableName;

			ts.GridLineColor=Color.FromArgb(ShareClass.Rcolor,ShareClass.Gcolor,ShareClass.Bcolor);
			ts.HeaderBackColor=Color.FromArgb(ShareClass.Rcolor,ShareClass.Gcolor,ShareClass.Bcolor);

			DataGridColumnStyle gs0 = new DataGridTextBoxColumn();
			gs0.MappingName = "oname";
			gs0.HeaderText = "用户名";
			gs0.NullText = "";
			gs0.ReadOnly=true;
			gs0.Width=100;
			gs0.Alignment = HorizontalAlignment.Left;
			ts.GridColumnStyles.Add(gs0);

			DataGridColumnStyle gs1 = new DataGridTextBoxColumn();
			gs1.MappingName = "lname";
			gs1.HeaderText = "登陆名";
			gs1.NullText = "";
			gs1.ReadOnly=true;
			gs1.Width=100;
			gs1.Alignment = HorizontalAlignment.Left;
			ts.GridColumnStyles.Add(gs1);

			DataGridColumnStyle gs2 = new DataGridTextBoxColumn();
			gs2.MappingName = "olevel";
			gs2.HeaderText = "级别";
			gs2.NullText = "";
			gs2.ReadOnly=true;
			gs2.Width=100;
			gs2.Alignment = HorizontalAlignment.Left;
			ts.GridColumnStyles.Add(gs2);

			DataGridColumnStyle gs3 = new DataGridTextBoxColumn();
			gs3.MappingName = "omenuid";
			gs3.HeaderText = "菜单列表";
			gs3.NullText = "";
			gs3.ReadOnly=true;
			gs3.Width=100;
			gs3.Alignment = HorizontalAlignment.Left;
			ts.GridColumnStyles.Add(gs3);

			DataGridColumnStyle gs4 = new DataGridTextBoxColumn();
			gs4.MappingName = "odescription";
			gs4.HeaderText = "描述";
			gs4.NullText = "";
			gs4.ReadOnly=true;
			gs4.Width=200;
			gs4.Alignment = HorizontalAlignment.Left;
			ts.GridColumnStyles.Add(gs4);

			DataGridColumnStyle gs5 = new DataGridTextBoxColumn();
			gs5.MappingName = "oid";
			gs5.HeaderText = "坐席ID";
			gs5.NullText = "";
			gs5.ReadOnly=true;
			gs5.Width=100;
			gs5.Alignment = HorizontalAlignment.Left;
			ts.GridColumnStyles.Add(gs5);

			DataGridColumnStyle gs6 = new DataGridTextBoxColumn();
			gs6.MappingName = "otelnumber";
			gs6.HeaderText = "坐席电话";
			gs6.NullText = "";
			gs6.ReadOnly=true;
			gs6.Width=100;
			gs6.Alignment = HorizontalAlignment.Left;
			ts.GridColumnStyles.Add(gs6);

			DataGridColumnStyle gs7 = new DataGridTextBoxColumn();
			gs7.MappingName = "opassword";
			gs7.HeaderText = "password";
			gs7.NullText = "";
			gs7.ReadOnly=true;
			gs7.Width=0;
			ts.GridColumnStyles.Add(gs7);


			this.dgUser.TableStyles.Add(ts);

			//如果指定了DataGridTableStyle,则gridDataFilter1会加载它的标题
			this.gridDataFilter1.DataGridTableStyle = this.dgUser.TableStyles[0];
			

			if (this.dgUser.DataSource != null)
			{
				this.gridDataFilter1.Enabled = true;
			}
			else
			{
				this.gridDataFilter1.Enabled = false;
			}


			this.gridDataFilter1.DataSource=this.dgUser.DataSource;
			this.gridDataFilter1.Begin();
		}

		private void panel1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
		{
		
		}

		private void UserManage_Load(object sender, System.EventArgs e)
		{
			getMenu();
			this.txtMenu.Properties.ReadOnly=true;
			ClearData();
			getDataBind();
			this.txtname.Focus();
		}
		private void getMenu()
		{
			this.dgMenu.CaptionBackColor=Color.FromArgb(ShareClass.Rcolor,ShareClass.Gcolor,ShareClass.Bcolor);
			this.dgMenu.BackgroundColor=Color.FromArgb(ShareClass.Rcolor,ShareClass.Gcolor,ShareClass.Bcolor);
			this.button1.BackColor=Color.FromArgb(ShareClass.Rcolor,ShareClass.Gcolor,ShareClass.Bcolor);
			DataSet ds=new DataSet();
			SysMenuBLL sysmenu=new SysMenuBLL();
			ds=sysmenu.getSysmenu();
			this.dgMenu.DataSource=ds.Tables["sysmenu"].DefaultView;

			this.dgMenu.TableStyles.Clear();
			DataGridTableStyle ts = new DataGridTableStyle();
			ts.MappingName = ds.Tables["sysmenu"].TableName;

⌨️ 快捷键说明

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