/// <summary> /// 界面显示初始化 /// </summary> private void InitializeDataSet() { this.dataGridView1.AutoGenerateColumns = true; this.dataGridView2.AutoGenerateColumns = true; this.dataGridView3.AutoGenerateColumns = true; this.dataGridView4.AutoGenerateColumns = true; this.dataGridView5.AutoGenerateColumns = true; this.dataGridView6.AutoGenerateColumns = true; this.dataGridView7.AutoGenerateColumns = true; SPds = SupplierAccess.Select(); DTds = DistributorAccess.Select(); ACds = AdminAccess.ShowSupperUser(); RLds = RoleAccess.ShowRole(); ASds = ApplySceneryAccess.selectForApply(); RPds = RoleProductAccess.ShowRoleProduct(); SYds = SceneryAccess.ShowSceneryForSupper(); if (SPds != null) { dataGridView1.DataSource = SPds.Tables[0]; } if (DTds != null) { dataGridView2.DataSource = DTds.Tables[0]; } if (RLds != null) { dataGridView3.DataSource = RLds.Tables[0]; } if (ACds != null) { dataGridView4.DataSource = ACds.Tables[0]; } if (RPds != null) { dataGridView5.DataSource = RPds.Tables[0]; } if (ASds != null) { dataGridView6.DataSource = ASds.Tables[0]; } if (SYds != null) { dataGridView7.DataSource = SYds.Tables[0]; } }
private void label2_Click(object sender, EventArgs e) { if (indexer != -1) { DialogResult dr = MessageBox.Show("确定删除?", "确定", MessageBoxButtons.YesNo); if (dr == DialogResult.Yes) { dataGridView1.DataSource = SPds.Tables[0]; bool isSuccess = SupplierAccess.DeleteSupplier(SPId); if (isSuccess) { MessageBox.Show("供应商删除成功"); } DataSet ds = SupplierAccess.Select(); dataGridView1.DataSource = ds.Tables[0]; if (ds != null) { this.Refresh(); } } } }
private void label14_Click(object sender, EventArgs e) { int supplierId = Convert.ToInt32(this.tbSupplierId.Text); string SupplierName = this.tbSupplierName.Text; string location = this.tbSupplierLocation.Text; string passWord = this.tbSupplierPassWord.Text; string remark = this.tbSupplierRemark.Text; Supplier supplier = new Supplier(); supplier.SPId = supplierId; supplier.SPLocation = location; supplier.SPName = SupplierName; supplier.SPRemark = remark; supplier.SPPassWord = passWord; if (SupplierAccess.AddSupplier(supplier)) { MessageBox.Show("添加成功"); } else { MessageBox.Show("添加失败!"); } }
/// <summary> /// 用户登录:普通用户,管理员,供应商,分销商 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnLogin_Click(object sender, EventArgs e) { string userName = this.tbUserName.Text; string userPassWord = this.tbPassWord.Text; string Identify = this.tbIdentify1.Text; string userType = this.comboBox1.Text; if (userType == "普通用户") { if (Identify == tbnIdentify) { if (UserAccess.Loin(userName, userPassWord)) { int USId = UserAccess.Select(userName); if (USId != 0) { this.Visible = false; Homepage homePage = new Homepage(USId); homePage.Show(); } } else { MessageBox.Show("用户名或密码不正确"); } } else { MessageBox.Show("验证码输入有误!"); } } else if (userType == "管理员") { if (Identify == tbnIdentify) { if (AdminAccess.Loin(userName, userPassWord)) { int USId = Convert.ToInt32(userName); if (USId != 0) { this.Visible = false; SupperUser supperUser = new SupperUser(USId); supperUser.Show(); } } else { MessageBox.Show("用户名或密码不正确"); } } else { MessageBox.Show("验证码输入有误!"); } } else if (userType == "供应商") { if (Identify == tbnIdentify) { if (SupplierAccess.Loin(userName, userPassWord)) { int USId = SupplierAccess.Select(userName); if (USId != 0) { this.Visible = false; SupplierUser supplierUser = new SupplierUser(USId); supplierUser.Show(); } } else { MessageBox.Show("用户名或密码不正确"); } } else { MessageBox.Show("验证码输入有误!"); } } else if (userType == "分销商") { if (Identify == tbnIdentify) { if (DistributorAccess.Loin(userName, userPassWord)) { int USId = DistributorAccess.Select(userName); if (USId != 0) { this.Visible = false; DistributorUser distributorUser = new DistributorUser(USId); distributorUser.Show(); } } else { MessageBox.Show("用户名或密码不正确"); } } else { MessageBox.Show("验证码输入有误!"); } } else { MessageBox.Show("请选择用户类型"); } }