/// <summary> /// 绑定数据到lup下拉框(按账单查询的) /// </summary> private void Bindinglup() { DataTable LupDatatable = new DataTable(); BUCMS_Buffets myBUCMS_Buffets = new BUCMS_Buffets(); BUCMS_VIPType myBUCMS_VIPType = new BUCMS_VIPType(); BUCMS_VIPClient myBUCMS_VIPClient = new BUCMS_VIPClient(); BUCMS_Employee myBUCMS_Employee = new BUCMS_Employee(); BUCMS_ItemDetail myBUCMS_ItemDetail = new BUCMS_ItemDetail(); try { LupDatatable = myBUCMS_Buffets.GetOrder(false, string.Empty, string.Empty, false); ClassAssist.CommonOperator.DataBindingLookUpEdit(this.lupTableName, LupDatatable, "Name", "ID", true); LupDatatable = myBUCMS_VIPType.GetOrder(false, string.Empty, string.Empty, false); ClassAssist.CommonOperator.DataBindingLookUpEdit(lupVIPType, LupDatatable, "Name", "ID", true); LupDatatable = myBUCMS_VIPClient.GetOrder(false, string.Empty, string.Empty, false); ClassAssist.CommonOperator.DataBindingLookUpEdit(lupVIPClient, LupDatatable, "Name", "ID", true); LupDatatable = myBUCMS_Employee.GetOrder(false, string.Empty, string.Empty, false); ClassAssist.CommonOperator.DataBindingLookUpEdit(lupWaiter, LupDatatable, "Name", "ID", true); LupDatatable = myBUCMS_ItemDetail.GetItemByType(VariedItemType.PayType); ClassAssist.CommonOperator.DataBindingLookUpEdit(lupPayment, LupDatatable, "Name", "ID", true); } catch (Exception ex) { XtraMessageBox.Show(ex.ToString()); } }
/// <summary> /// Handles the Click event of the btnDel control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> /// 整理人:桂书丛 /// 整理时间:2013-02-06 private void btnDel_Click(object sender, EventArgs e) { if (this.gridViewMain.SelectedRowsCount <= 0)//如果一项都没有选中 { XtraMessageBox.Show("请选择要删除的项!", "注意:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } string VIPID = this.gridViewMain.GetFocusedRowCellValue("ID").ToString();//选中的行的ID,根据这个来删除 DialogResult myDialogResult = XtraMessageBox.Show("编号为" + VIPID + "的会员卡?", "确定删除?", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (DialogResult.Yes == myDialogResult) { BUCMS_VIPType myBUCMS_VIPType = new BUCMS_VIPType(); VariedEnum.OperatorStatus EnOperatorStatus; try { EnOperatorStatus = myBUCMS_VIPType.Delete(VIPID); if (ClassAssist.CommonOperator.HandleOperatorEnum("删除", EnOperatorStatus)) { BUT_SysLog.InsertSysLog(VariedEnum.LogType.系统事件, frmAssist.frmLogin.SysUser.UserID, "成功删除了编号为" + VIPID + "的会员卡信息"); InitializeControls(); } } catch { XtraMessageBox.Show("请确定此条数据不正在被使用后重试", "删除失败", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } }
/// <summary> /// 绑定数据到lup下拉框(按账单查询的) /// </summary> private void Bindinglup() { DataTable LupDatatable = new DataTable(); BUCMS_Buffets myBUCMS_Buffets = new BUCMS_Buffets(); BUCMS_VIPType myBUCMS_VIPType = new BUCMS_VIPType(); BUCMS_VIPClient myBUCMS_VIPClient = new BUCMS_VIPClient(); BUCMS_Employee myBUCMS_Employee = new BUCMS_Employee(); BUCMS_ItemDetail myBUCMS_ItemDetail = new BUCMS_ItemDetail(); try { LupDatatable = myBUCMS_Buffets.GetOrder(false, string.Empty, string.Empty, false); this.lupTableName.Properties.DataSource = LupDatatable; this.lupTableName.ItemIndex = 0; LupDatatable = myBUCMS_VIPType.GetOrder(false, string.Empty, string.Empty, false); this.lupVIPType.Properties.DataSource = LupDatatable; this.lupVIPType.ItemIndex = 0; LupDatatable = myBUCMS_VIPClient.GetOrder(false, string.Empty, string.Empty, false); this.lupVIPClient.Properties.DataSource = LupDatatable; this.lupVIPClient.ItemIndex = 0; LupDatatable = myBUCMS_Employee.GetOrder(false, string.Empty, string.Empty, false); this.lupWaiter.Properties.DataSource = LupDatatable; this.lupWaiter.ItemIndex = 0; LupDatatable = myBUCMS_ItemDetail.GetItemByType(VariedItemType.PayType); this.lupPayment.Properties.DataSource = LupDatatable; this.lupPayment.ItemIndex = 0; } catch (Exception ex) { throw ex; } }
/// <summary> /// 检测会员名称和折扣是否唯一 /// </summary> /// <returns></returns> private int CheckOnlyVIPDiscount(string paramFiledName, string paramVIPDiscount) { BUCMS_VIPType myBUCMS_VIPType = new BUCMS_VIPType(); DataTable myDataTable = new DataTable(); myDataTable = myBUCMS_VIPType.GetOrder(false, paramFiledName, paramVIPDiscount, false); if (myDataTable.Rows.Count > 0) { return(1);//已存在改会员卡 } return(0); }
/// <summary> /// 修改数据 /// </summary> /// <returns></returns> private VariedEnum.OperatorStatus UpdateVIP() { ModelCMS_VIPType myModelCMS_VIPType = new ModelCMS_VIPType(); myModelCMS_VIPType.Name = this.txtVIPName.Text.Trim(); myModelCMS_VIPType.Discount = Convert.ToDecimal(this.speDiscount.EditValue); myModelCMS_VIPType.Description = this.medDescription.Text.Trim(); myModelCMS_VIPType.ID = Convert.ToInt32(myUpdateVIP[0]); myModelCMS_VIPType.ModifyPerson = this.txtModifyPerson.Text.Trim(); myModelCMS_VIPType.ModifyDate = DateTime.Now; BUCMS_VIPType myBUCMS_VIPType = new BUCMS_VIPType(); return(myBUCMS_VIPType.Update(myModelCMS_VIPType)); }
/// <summary> ///绑定数据到会员级别下拉框(会员卡信息) /// </summary> public void InitializeControls() { //获取CMS_VIPType表即会员卡信息表中的数据时直接调用BUCMS_VIPType的这个方法 BUCMS_VIPType myBUCMS_VIPType = new BUCMS_VIPType(); try { DataTable myDataTable = myBUCMS_VIPType.GetOrder(false, string.Empty, string.Empty, false); //绑定到下拉框 this.lkdVIPType.Properties.DataSource = myDataTable; this.lkdVIPType.ItemIndex = 0; } catch (Exception ex) { XtraMessageBox.Show(ex.Message); } }
/// <summary> /// 添加数据 /// </summary> /// <returns></returns> private VariedEnum.OperatorStatus Add() { try { ModelCMS_VIPType myModelCMS_VIPType = new ModelCMS_VIPType(); myModelCMS_VIPType.Name = this.txtVIPName.Text.Trim(); myModelCMS_VIPType.Discount = Convert.ToDecimal(this.speDiscount.EditValue); myModelCMS_VIPType.Description = this.medDescription.Text.Trim(); myModelCMS_VIPType.ModifyPerson = this.txtModifyPerson.Text.Trim(); myModelCMS_VIPType.ModifyDate = DateTime.Now; BUCMS_VIPType myBUCMS_VIPType = new BUCMS_VIPType(); return(myBUCMS_VIPType.Insert(myModelCMS_VIPType)); } catch (Exception ex) { XtraMessageBox.Show(ex.ToString()); return(VariedEnum.OperatorStatus.Failed); } }
/// <summary> /// Handles the SelectionChanged event of the gridViewMain control.选中一项时发生 /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="DevExpress.Data.SelectionChangedEventArgs"/> instance containing the event data.</param> /// 整理人:桂书丛 /// 整理时间:2013-02-28 private void gridViewMain_SelectionChanged(object sender, DevExpress.Data.SelectionChangedEventArgs e) { DataRow tempDataRow = this.gridViewMain.GetFocusedDataRow(); //取出选中行的原始数据(在数据库中的)(数据库中的数据不一定全在控件中显示) if (tempDataRow == null) { return; } string myVIPID = tempDataRow["VIPTypeID"].ToString(); BUCMS_VIPType myBUCMS_VIPType = new BUCMS_VIPType(); try { DataTable myDataTable = myBUCMS_VIPType.GetOrder(false, "ID", myVIPID, false); this.txtVIPName.Text = myDataTable.Rows[0]["Name"].ToString(); this.txtDiscount.EditValue = myDataTable.Rows[0]["Discount"]; this.txtVIPCost.EditValue = tempDataRow["VIPCost"]; } catch (Exception ex) { XtraMessageBox.Show(ex.Message); } }
/// <summary> /// 绑定数据到查询条件的控件 /// </summary> private void BindingToSerach() { DataTable myDataTable = new DataTable(); try { //会员卡要从VIPType表中获取 BUCMS_VIPType myBUCMS_VIPType = new BUCMS_VIPType(); myDataTable = myBUCMS_VIPType.GetOrder(false, string.Empty, string.Empty, false); this.lupVIPType.Properties.DataSource = myDataTable; this.lupVIPType.ItemIndex = 0; this.lupVIPType.Properties.DisplayMember = "Name"; //创建人要到User表中获取 BUT_User myBUT_User = new BUT_User(); myDataTable = myBUT_User.GetAllUserInfo(); this.lupCreatePerson.Properties.DataSource = myDataTable; this.lupCreatePerson.ItemIndex = 0; this.lupCreatePerson.Properties.DisplayMember = "USERNAME"; } catch (Exception ex) { XtraMessageBox.Show(ex.Message); } }