private void label6_Click(object sender, EventArgs e) { int distributeId = Convert.ToInt32(this.tbDistributeId.Text); // string account = this.tbAccount.Text; string distributeName = this.tbDistributeName.Text; string passWord = this.tbPassWord.Text; int roleId = Convert.ToInt32(this.cbRoleId.SelectedValue); string remark = this.tbRemark.Text; Distributor distribute = new Distributor(); distribute.DTId = distributeId; // distribute.DTAccount = account; distribute.DTRoleId = roleId; distribute.DTName = distributeName; distribute.DTPassWord = passWord; distribute.DTRemark = remark; if (DistributorAccess.AddDistribute(distribute)) { MessageBox.Show("添加成功"); } else { MessageBox.Show("添加失败!"); } }
/// <summary> /// 对返回按钮执行的动作进行判断:是用户预订还是分销商预订 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btReturn_Click(object sender, EventArgs e) { if (DistributorAccess.SelectById(UserId)) { this.Visible = false; DistributorUser distributorUser = new DistributorUser(UserId); distributorUser.Show(); } else { this.Visible = false; Homepage homePage = new Homepage(UserId); homePage.Show(); } }
/// <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 lbCancleDistribute_Click(object sender, EventArgs e) { if (indexer != -1) { DialogResult dr = MessageBox.Show("确定删除?", "确定", MessageBoxButtons.YesNo); if (dr == DialogResult.Yes) { dataGridView1.DataSource = DTds.Tables[0]; bool isSuccess = DistributorAccess.DeleteDistribute(DTId); if (isSuccess) { MessageBox.Show("分销商删除成功"); } DataSet ds = DistributorAccess.Select(); if (ds != null) { dataGridView2.DataSource = ds.Tables[0]; this.Refresh(); } } } }
/// <summary> /// 门票预订 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btBook_Click(object sender, EventArgs e) { if (scenery.SYUseNum >= scenery.SYTotal) { MessageBox.Show("当前时间的门票已售罄!"); } else { Oreder order = new Oreder(); order.TKType = this.cbTicketType.SelectedIndex; order.TKReserveTime = DateTime.Now; order.TKUseTime = Convert.ToDateTime(this.dtpUseTime.Text); order.TKNum = Convert.ToInt32(this.nudTicketNum.Value); order.TKUserId = UserId; order.TKSupplier = scenery.SYSupplier; order.TKImagSrc = scenery.SYImagSrc; order.TKPrice = Convert.ToInt32(this.lbPrice2.Text); order.TKSYId = scenery.SYId; #region 订票验证 if (order.TKNum != 0) { if (UserId != -1) { if (SceneryAccess.ShowSceneryByUseTime(order.TKUseTime)) { if (this.cbTicketType.SelectedIndex != -1) { if (OrderAccess.AddOrder(order)) { #region MyRegion if (DistributorAccess.SelectById(UserId)) { this.Visible = false; DistributorUser distributorUser = new DistributorUser(UserId); distributorUser.Show(); } else { MessageBox.Show("预订成功!"); this.Visible = false; Homepage homePage = new Homepage(UserId); homePage.Show(); } } else { MessageBox.Show("订票失败!"); } #endregion } else { MessageBox.Show("请选择票型"); } } else { MessageBox.Show("当前门票暂时没有上线,请晚些时候再来!"); } } else { MessageBox.Show("请登录后再订票!"); } #endregion } 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("请选择用户类型"); } }