private void superGridControl1_CellMouseDown(object sender, DevComponents.DotNetBar.SuperGrid.GridCellMouseEventArgs e)
        {
            CmcsSaleFuelTransport entity = Dbers.GetInstance().SelfDber.Get <CmcsSaleFuelTransport>(superGridControl1.PrimaryGrid.GetCell(e.GridCell.GridRow.Index, superGridControl1.PrimaryGrid.Columns["clmId"].ColumnIndex).Value.ToString());

            switch (superGridControl1.PrimaryGrid.Columns[e.GridCell.ColumnIndex].Name)
            {
            case "clmShow":
                FrmSaleFuelTransport_Oper frmShow = new FrmSaleFuelTransport_Oper(entity.Id, eEditMode.查看);
                if (frmShow.ShowDialog() == DialogResult.OK)
                {
                    BindData();
                }
                break;

            case "clmEdit":
                FrmSaleFuelTransport_Oper frmEdit = new FrmSaleFuelTransport_Oper(entity.Id, eEditMode.修改);
                if (frmEdit.ShowDialog() == DialogResult.OK)
                {
                    BindData();
                }
                break;

            case "clmDelete":
                // 查询正在使用该记录的车数
                if (MessageBoxEx.Show("确定要删除该记录?", "操作提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    try
                    {
                        Dbers.GetInstance().SelfDber.Delete <CmcsSaleFuelTransport>(entity.Id);

                        //删除临时运输记录
                        Dbers.GetInstance().SelfDber.DeleteBySQL <CmcsUnFinishTransport>("where TransportId=:TransportId", new { TransportId = entity.Id });
                    }
                    catch (Exception)
                    {
                        MessageBoxEx.Show("该记录正在使用中,禁止删除!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }

                    BindData();
                }
                break;

            case "clmPic":

                if (Dbers.GetInstance().SelfDber.Entities <CmcsTransportPicture>(String.Format(" where TransportId='{0}'", entity.Id)).Count > 0)
                {
                    FrmTransportPicture frmPic = new FrmTransportPicture(entity.Id, entity.CarNumber);
                    if (frmPic.ShowDialog() == DialogResult.OK)
                    {
                        BindData();
                    }
                }
                else
                {
                    MessageBoxEx.Show("暂无抓拍图片!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                break;
            }
        }
Exemple #2
0
        private void btnInStore_Click(object sender, EventArgs e)
        {
            FrmSaleFuelTransport_Oper frm = new FrmSaleFuelTransport_Oper();

            frm.ShowDialog();

            BindData();
        }
Exemple #3
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            FrmSaleFuelTransport_Oper frmEdit = new FrmSaleFuelTransport_Oper(String.Empty, true);

            if (frmEdit.ShowDialog() == DialogResult.OK)
            {
                BindData();
            }
        }
        private void superGridControl1_CellMouseDown(object sender, DevComponents.DotNetBar.SuperGrid.GridCellMouseEventArgs e)
        {
            CmcsSaleFuelTransport entity = Dbers.GetInstance().SelfDber.Get <CmcsSaleFuelTransport>(superGridControl1.PrimaryGrid.GetCell(e.GridCell.GridRow.Index, superGridControl1.PrimaryGrid.Columns["clmId"].ColumnIndex).Value.ToString());

            switch (superGridControl1.PrimaryGrid.Columns[e.GridCell.ColumnIndex].Name)
            {
            case "clmShow":
                FrmSaleFuelTransport_Oper frmShow = new FrmSaleFuelTransport_Oper(entity.Id, false);
                if (frmShow.ShowDialog() == DialogResult.OK)
                {
                    BindData();
                }
                break;

            case "clmEdit":
                FrmSaleFuelTransport_Oper frmEdit = new FrmSaleFuelTransport_Oper(entity.Id, true);
                if (frmEdit.ShowDialog() == DialogResult.OK)
                {
                    BindData();
                }
                break;

            case "clmDelete":
                // 查询正在使用该记录的车数
                if (entity.GrossWeight > 0 || entity.TareWeight > 0)
                {
                    MessageBoxEx.Show("该记录已有重量,禁止删除!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                if (MessageBoxEx.Show("确定要删除该记录?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    try
                    {
                        CommonDAO.GetInstance().SaveAppletLog(eAppletLogLevel.Warn, "删除出场煤运输记录:", string.Format("车号:{0};毛重:{1};皮重:{2};矿点:{3};操作人:{4}", entity.CarNumber, entity.GrossWeight, entity.TareWeight, entity.SupplierName, SelfVars.LoginUser.UserName));

                        if (QueuerDAO.GetInstance().DeleteSaleTransport(entity.Id))
                        {
                            CommonDAO.GetInstance().InsertWaitForHandleEvent("汽车智能化_删除出厂煤运输记录", entity.Id);
                        }
                    }
                    catch (Exception)
                    {
                        MessageBoxEx.Show("该记录正在使用中,禁止删除!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }

                    BindData();
                }
                break;

            case "clmPic":

                if (Dbers.GetInstance().SelfDber.Entities <CmcsTransportPicture>(String.Format(" where TransportId='{0}'", entity.Id)).Count > 0)
                {
                    FrmTransportPicture frmPic = new FrmTransportPicture(entity.Id, entity.CarNumber);
                    if (frmPic.ShowDialog() == DialogResult.OK)
                    {
                        BindData();
                    }
                }
                else
                {
                    MessageBoxEx.Show("暂无抓拍图片!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                break;
            }
        }