Exemplo n.º 1
0
        /// <summary>
        /// 填充下拉框:经手人
        /// </summary>
        private void FillIssuedByList()
        {
            cbIssuedBy.DisplayMember = "UserName";
            cbIssuedBy.ValueMember   = "UserId";

            cbIssuedBy.DataSource = VoucherBatchManage.DirectGetIssued();
        }
Exemplo n.º 2
0
        /// <summary>
        /// 填充下拉框:客户
        /// </summary>
        private void FillCustomerList()
        {
            cbCustomerName.DisplayMember = "CustomerName";
            cbCustomerName.ValueMember   = "CustomerId";

            cbCustomerName.DataSource = VoucherBatchManage.DirectGetCustomer();
        }
Exemplo n.º 3
0
        /// <summary>
        /// 填充下拉框:票券类型
        /// </summary>
        private void FillVoucherTypeByList()
        {
            cbVoucherTypeId.DisplayMember = "VoucherTypeName";
            cbVoucherTypeId.ValueMember   = "VoucherTypeId";

            cbVoucherTypeId.DataSource = VoucherBatchManage.DirectGetVoucherType();
        }
Exemplo n.º 4
0
        /// <summary>
        /// 数据显示格式处理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgvList_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
        {
            DataGridView dgv = (DataGridView)sender;

            if (dgv.Columns[e.ColumnIndex].Name.Contains("Quantity"))
            {
                try
                {
                    e.Value = decimal.Round(Convert.ToDecimal(e.Value)).ToString() + "张";
                }
                catch
                {
                }
            }
            if (dgv.Columns[e.ColumnIndex].Name.Contains("Price"))
            {
                try
                {
                    e.Value = decimal.Round(Convert.ToDecimal(e.Value), 2).ToString("0.00") + "元";
                }
                catch
                {
                }
            }
            if (dgv.Columns[e.ColumnIndex].Name == "VoucherTypeId")
            {
                int?nId;
                nId = Convert.ToInt32(e.Value);
                try
                {
                    e.Value = VoucherBatchManage.GetVoucherTypeName(Convert.ToInt32(nId));
                }
                catch { }
            }
            if (dgvList.Columns[e.ColumnIndex].Name == "CustomerId")
            {
                int?nId;
                nId = Convert.ToInt32(e.Value);
                try
                {
                    e.Value = VoucherBatchManage.GetCustomerName(Convert.ToInt32(nId));
                }
                catch { }
            }
            if (dgvList.Columns[e.ColumnIndex].Name == "IssuedBy")
            {
                int?nId;
                nId = Convert.ToInt32(e.Value);
                try
                {
                    e.Value = VoucherBatchManage.GetSueName(Convert.ToInt32(nId));
                }
                catch { }
            }
        }
Exemplo n.º 5
0
        public frmVoucherBatchManage()
        {
            InitializeComponent();

            dataManager       = new VoucherBatchManage();
            dataBindingSource = new BindingSource();

            this.dataGridViewColumnInfoList = dataManager.ColumnInfoList;
            dgvList.CellFormatting         += new DataGridViewCellFormattingEventHandler(DataGridView_CellFormatting);
            this.Load += new EventHandler(frmFilmInfoManage_Load);
        }
Exemplo n.º 6
0
        /// <summary>
        /// 填充下拉框:票券类型
        /// </summary>
        private void FillVoucherTypeByList()
        {
            List <VoucherType> voucherTypeList = new List <VoucherType>();

            cbVoucherTypeId.DisplayMember = "VoucherTypeName";
            cbVoucherTypeId.ValueMember   = "VoucherTypeId";

            voucherTypeList = VoucherBatchManage.DirectGetVoucherType();
            if (voucherTypeList != null || voucherTypeList.Count <= 0)
            {
                VoucherType vt = new VoucherType();
                vt.VoucherTypeName = "全部";
                vt.VoucherTypeId   = 10000;
                voucherTypeList.Add(vt);
            }
            cbVoucherTypeId.DataSource = voucherTypeList;
        }
Exemplo n.º 7
0
        /// <summary>
        /// 填充下拉框cbVoucherId
        /// </summary>
        public void FillcbVoucherId()
        {
            List <VoucherBatch> voucherBatchList = new List <VoucherBatch>();

            cbVoucherId.DisplayMember = "VoucherBatchId";
            cbVoucherId.ValueMember   = "VoucherBatchId";

            VoucherBatchManage dataManager = new VoucherBatchManage();

            voucherBatchList = dataManager.GetDataList();
            if (voucherBatchList.Count > 0 || voucherBatchList != null)
            {
                VoucherBatch vBatch = new VoucherBatch();
                vBatch.VoucherName    = "全部";
                vBatch.VoucherBatchId = "全部";
                voucherBatchList.Add(vBatch);
                cbVoucherId.DataSource = voucherBatchList;
            }
        }
Exemplo n.º 8
0
 private void txtQuantity_Validating(object sender, CancelEventArgs e)
 {
     if (txtQuantity.Text != "")
     {
         txtQuantity.Text = (txtQuantity.Text).Replace("张", string.Empty);
         if (VoucherBatchManage.IsIntegerNumber(txtQuantity.Text) == false)
         {
             MessageBox.Show("请输入整数", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
             txtQuantity.DataBindings.Clear();
             txtQuantity.DataBindings.Add("Text", dataBindingSource, "Quantity", true);
             txtQuantity.DataBindings["Text"].Format += TextBox_Currency_Format;
             txtQuantity.DataBindings["Text"].Parse  += TextBox_Currency_Parse;
             txtQuantity.Clear();
             txtQuantity.Focus();
             return;
         }
     }
     else
     {
         txtQuantity.Text = "0";
     }
 }
Exemplo n.º 9
0
 private void txtTotalPrice_Validating(object sender, CancelEventArgs e)
 {
     if (txtTotalPrice.Text != "")
     {
         txtTotalPrice.Text = txtTotalPrice.Text.Replace("元", string.Empty);
         if (VoucherBatchManage.IsNumber(txtTotalPrice.Text) == false)
         {
             MessageBox.Show("请输入符合的数字", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
             txtTotalPrice.DataBindings.Clear();
             txtTotalPrice.DataBindings.Add("Text", dataBindingSource, "TotalPrice", true);
             txtTotalPrice.DataBindings["Text"].Format += TextBox_Currency_Format1;
             txtTotalPrice.DataBindings["Text"].Parse  += TextBox_Currency_Parse1;
             txtTotalPrice.Clear();
             txtTotalPrice.Focus();
             return;
         }
     }
     else
     {
         txtTotalPrice.Text = "0";
     }
 }
Exemplo n.º 10
0
        private void btnEnter_Click(object sender, EventArgs e)
        {
            try
            {
                List <VoucherBatch> voucherBatchList        = new List <VoucherBatch>();
                VoucherBatchManage  voucherBatchDataManager = new VoucherBatchManage();

                if (chbSearchByNo.Checked && cbVoucherId.SelectedValue != null)
                {
                    if (cbVoucherId.SelectedValue.ToString() == "全部")
                    {
                        //var obj = voucherBatchDataManager.GetDataList();
                        var tmp = voucherBatchDataManager.GetDataList();
                        if (tmp != null || tmp.Count > 0)
                        {
                            foreach (var tmpobj in tmp)
                            {
                                var objList = voucherBatchDataManager.GetSearchList("VoucherBatchId", tmpobj.VoucherBatchId);

                                VoucherBatch obj;

                                if (dataManage.IsSale(tmpobj.VoucherBatchId.ToString()))
                                {
                                    obj = objList.Find(p => p.VoucherBatchId == tmpobj.VoucherBatchId);
                                    if (obj != null)
                                    {
                                        obj.Description = "是";
                                    }
                                }
                                else
                                {
                                    obj = objList.Find(p => p.VoucherBatchId == tmpobj.VoucherBatchId);

                                    if (obj != null)
                                    {
                                        obj.Description = "否";
                                    }
                                }

                                if (objList != null && objList.Count > 0)
                                {
                                    voucherBatchList.AddRange(objList);
                                }
                            }
                            dgvList.DataSource = voucherBatchList;
                        }
                    }
                    else
                    {
                        var objList = voucherBatchDataManager.GetSearchList("VoucherBatchId", cbVoucherId.SelectedValue.ToString());
                        if (objList != null && objList.Count > 0)
                        {
                            VoucherBatch obj;

                            if (dataManage.IsSale(cbVoucherId.SelectedValue.ToString()))
                            {
                                obj = objList.Find(p => p.VoucherBatchId == cbVoucherId.SelectedValue.ToString());
                                if (obj != null)
                                {
                                    obj.Description = "是";
                                }
                            }
                            else
                            {
                                obj = objList.Find(p => p.VoucherBatchId == cbVoucherId.SelectedValue.ToString());
                                if (obj != null)
                                {
                                    obj.Description = "否";
                                }
                            }
                        }
                        if (objList != null && objList.Count > 0)
                        {
                            voucherBatchList.AddRange(objList);
                        }
                        dgvList.DataSource = voucherBatchList;
                    }
                }
                else
                {
                    if (cbVoucherTypeId.SelectedValue.ToString() == "10000")
                    {
                        dgvList.DataSource = dataManage.dgvSearch(dateTimeFrom.Value, dateTimeTo.Value);
                    }
                    else
                    {
                        dgvList.DataSource = dataManage.dgvSearch(dateTimeFrom.Value, dateTimeTo.Value, Convert.ToInt32(cbVoucherTypeId.SelectedValue));
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("没有您要查询的数据!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }