Exemplo n.º 1
0
        private void toolStripEdit_Click(object sender, EventArgs e)
        {
            if (BillState == State.New || BillState == State.Edit)
            {
                if (!SaveCurrentOk())
                {
                    return;
                }
            }

            if (billNo == string.Empty)
            {
                DialogBox.ShowError("无单号");
                return;
            }

            string errorMessage = "";

            if (!CanEdit(ref errorMessage))
            {
                DialogBox.ShowError(errorMessage);
                return;
            }

            BillState = State.Edit;
            RefreshTool();
        }
Exemplo n.º 2
0
        private void toolStripButtonDelete_Click(object sender, EventArgs e)
        {
            DataGridViewRow currentRow = this.dgvHasRowNumDetl.CurrentRow;

            if (currentRow == null)
            {
                DialogBox.ShowError("请选择要删除的行!");
            }
            else
            {
                string str = "";
                str = currentRow.Cells[0].Value.ToString();
                if (DialogBox.ShowQuestion("你真的要删除当前记录!") == DialogResult.Yes)
                {
                    if (this._iDelete.Delete(Convert.ToInt32(str)))
                    {
                        DialogBox.ShowInfo("删除成功!");
                        this.dgvHasRowNumDetl.Rows.Remove(currentRow);
                    }
                    else
                    {
                        DialogBox.ShowError("删除失败!");
                    }
                }
            }
        }
Exemplo n.º 3
0
 private void toolStripButtonNormal_Click(object sender, EventArgs e)
 {
     if (this.dgvHasRowNumDetl.DataSource == null)
     {
         DialogBox.ShowError("请先查询");
         return;
     }
     PrintDGV.Print_DataGridView(this.dgvHasRowNumDetl);
 }
Exemplo n.º 4
0
 protected virtual void BindData()
 {
     if (this._AutoNo == 0)
     {
         DialogBox.ShowError("初始数据出错!");
     }
     this._BillState = State.Query;
     this.RefreshTool();
     this.ClearControls();
 }
Exemplo n.º 5
0
        /// <summary>
        /// 按单号,初始化各控件的数据绑定
        /// </summary>
        protected virtual void BindData()
        {
            //MCT.CommonTool.Error_m(Common.IniFile.Segments[ERROR_MESSAGE].Items[SYSTEM].Value + "BindData(string BillNo)");
            if (BillNo == null || BillNo == string.Empty)
            {
                DialogBox.ShowError("初始数据出错!");
            }
            this.BillState = State.Query;
            RefreshTool();

            //绑定之前先清空
            ClearControls();
        }
Exemplo n.º 6
0
        private void toolStripQuery_Click(object sender, EventArgs e)
        {
            string whereText = "";

            if (!CheckExpression(ref whereText, false))
            {
                DialogBox.ShowError(whereText);
                return;
            }

            this.result[0] = whereText;
            this.Close();
        }
Exemplo n.º 7
0
        private void 格式ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (this.dgvHasRowNumDetl.DataSource == null)
            {
                DialogBox.ShowError("请先查询");
                return;
            }
            //old
            //ExportToExcel();

            VBprinter.VB2008Print printControl = new VBprinter.VB2008Print();
            printControl.ExportDGVToExcel(dgvHasRowNumDetl, this.Text);
        }
Exemplo n.º 8
0
 protected virtual bool BillDelete()
 {
     try
     {
         if (!this._dal.Delete(this._AutoNo))
         {
             throw new Exception("操作失败,无出错信息,可能是因为数据库已无此记录!");
         }
     }
     catch (Exception exception)
     {
         DialogBox.ShowError("操作数据库失败!原因是:" + exception.Message);
         return(false);
     }
     return(true);
 }
Exemplo n.º 9
0
        private void toolStripButtonEdit_Click(object sender, EventArgs e)
        {
            DataGridViewRow currentRow = this.dgvHasRowNumDetl.CurrentRow;

            if (currentRow == null)
            {
                DialogBox.ShowError("请选择要编辑的行!");
            }
            else
            {
                int pAutoID = Convert.ToInt32(currentRow.Cells[0].Value.ToString());
                this._form.BindData(pAutoID, true);
                Form form = this._form as Form;
                form.MdiParent = base.MdiParent;
                form.Show();
            }
        }
Exemplo n.º 10
0
        private void toolStripDelete_Click(object sender, EventArgs e)
        {
            if (billNo == string.Empty)
            {
                DialogBox.ShowInfo("无此单号");
                return;
            }

            if (MessageBox.Show("是否删除?",
                                "系统询问", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
                == DialogResult.No)
            {
                return;
            }


            string errorMessage = "";

            if (!CanDelete(ref errorMessage))
            {
                DialogBox.ShowInfo(errorMessage);
                return;
            }

            if (BillDelete())
            {
                //保存成功
                DialogBox.ShowInfo("删除成功!");
                BillState = State.None;

                //写日志
                this.BillNo = null;
                ClearControls();
            }
            else
            {
                //保存失败
                DialogBox.ShowError("删除失败");
                BillState = State.Query;
            }

            RefreshTool();
        }
Exemplo n.º 11
0
 private void toolStripEdit_Click(object sender, EventArgs e)
 {
     if (((this._BillState != State.New) && (this._BillState != State.Edit)) || this.SaveCurrentOk())
     {
         if (this._AutoNo == 0)
         {
             DialogBox.ShowInfo("无单号");
         }
         else
         {
             string errorMessage = "";
             if (!this.CanEdit(ref errorMessage))
             {
                 DialogBox.ShowError(errorMessage);
             }
             else
             {
                 this._BillState = State.Edit;
                 this.RefreshTool();
             }
         }
     }
 }
Exemplo n.º 12
0
 /// <summary>
 /// 反审核单据过程,包括各项合法性验证,
 /// 注意:如果反审核是否成功都在重载时弹出提示对话窗口,主调用不对信息显示。
 /// </summary>
 /// <returns></returns>
 protected virtual bool ReApproveBill()
 {
     DialogBox.ShowError("未重载方法" + " ReApproveBill()");
     return(false);
 }
Exemplo n.º 13
0
 /// <summary>
 /// 保存单据过程,包括各项合法性验证,
 /// 注意:如果保存是否成功都在重载时弹出提示对话窗口,主调用不对信息显示。
 /// </summary>
 /// <returns></returns>
 protected virtual bool SaveBill(ref string pbillNo)
 {
     DialogBox.ShowError("未实现方法:" + "SaveBill()");
     return(false);
 }
Exemplo n.º 14
0
 /// <summary>
 /// 清空控件值
 /// </summary>
 protected virtual void ClearControls()
 {
     DialogBox.ShowError("未实现方法:" + "ClearControls()");
 }
Exemplo n.º 15
0
 protected virtual bool SaveBill(ref int pAutoNo)
 {
     DialogBox.ShowError("未实现方法:SaveBill()");
     return(false);
 }