Exemple #1
0
        /// <summary>
        /// 窗体加载绑定数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FrmCarModel_Oper_Load(object sender, EventArgs e)
        {
            label_warn.ForeColor = Color.Red;

            this.CmcsCarModel = Dbers.GetInstance().SelfDber.Get <CmcsCarModel>(this.PId);
            if (this.CmcsCarModel != null)
            {
                txt_ModelName.Text              = CmcsCarModel.ModelName;
                dbi_LeftObstacle1.Value         = this.CmcsCarModel.LeftObstacle1;
                dbi_LeftObstacle2.Value         = this.CmcsCarModel.LeftObstacle2;
                dbi_LeftObstacle3.Value         = this.CmcsCarModel.LeftObstacle3;
                dbi_LeftObstacle4.Value         = this.CmcsCarModel.LeftObstacle4;
                dbi_LeftObstacle5.Value         = this.CmcsCarModel.LeftObstacle5;
                dbi_LeftObstacle6.Value         = this.CmcsCarModel.LeftObstacle6;
                dbi_RightObstacle1.Value        = this.CmcsCarModel.RightObstacle1;
                dbi_RightObstacle2.Value        = this.CmcsCarModel.RightObstacle2;
                dbi_RightObstacle3.Value        = this.CmcsCarModel.RightObstacle3;
                dbi_RightObstacle4.Value        = this.CmcsCarModel.RightObstacle4;
                dbi_RightObstacle5.Value        = this.CmcsCarModel.RightObstacle5;
                dbi_RightObstacle6.Value        = this.CmcsCarModel.RightObstacle6;
                dbi_CarriageLength.Value        = this.CmcsCarModel.CarriageLength;
                dbi_CarriageWidth.Value         = this.CmcsCarModel.CarriageWidth;
                dbi_CarriageBottomToFloor.Value = this.CmcsCarModel.CarriageBottomToFloor;
                txt_ReMark.Text = CmcsCarModel.ReMark;
            }

            if (this.EditMode == eEditMode.查看)
            {
                btnSubmit.Enabled = false;
                HelperUtil.ControlReadOnly(panelEx2, true);
            }
        }
 private void FrmCarModel_Oper_Load(object sender, EventArgs e)
 {
     if (!String.IsNullOrEmpty(id))
     {
         this.cmcsCarModel               = Dbers.GetInstance().SelfDber.Get <CmcsCarModel>(this.id);
         txt_ModelName.Text              = cmcsCarModel.ModelName;
         dbi_LeftObstacle1.Value         = cmcsCarModel.LeftObstacle1;
         dbi_LeftObstacle2.Value         = cmcsCarModel.LeftObstacle2;
         dbi_LeftObstacle3.Value         = cmcsCarModel.LeftObstacle3;
         dbi_LeftObstacle4.Value         = cmcsCarModel.LeftObstacle4;
         dbi_LeftObstacle5.Value         = cmcsCarModel.LeftObstacle5;
         dbi_LeftObstacle6.Value         = cmcsCarModel.LeftObstacle6;
         dbi_RightObstacle1.Value        = cmcsCarModel.RightObstacle1;
         dbi_RightObstacle2.Value        = cmcsCarModel.RightObstacle2;
         dbi_RightObstacle3.Value        = cmcsCarModel.RightObstacle3;
         dbi_RightObstacle4.Value        = cmcsCarModel.RightObstacle4;
         dbi_RightObstacle5.Value        = cmcsCarModel.RightObstacle5;
         dbi_RightObstacle6.Value        = cmcsCarModel.RightObstacle6;
         dbi_CarriageLength.Value        = cmcsCarModel.CarriageLength;
         dbi_CarriageWidth.Value         = cmcsCarModel.CarriageWidth;
         dbi_CarriageBottomToFloor.Value = cmcsCarModel.CarriageBottomToFloor;
         txt_ReMark.Text = cmcsCarModel.ReMark;
     }
     if (!edit)
     {
         btnSubmit.Enabled = false;
         CMCS.CarTransport.Queue.Utilities.Helper.ControlReadOnly(panelEx2);
     }
     label_warn.ForeColor = Color.Red;
 }
Exemple #3
0
        private void btnSelectedCarModel_Click(object sender, EventArgs e)
        {
            FrmCarModel_Select Frm = new FrmCarModel_Select();

            Frm.ShowDialog();
            if (Frm.DialogResult == DialogResult.OK)
            {
                CmcsCarModel item = Frm.Output;
                dbi_LeftObstacle1.Value         = item.LeftObstacle1;
                dbi_LeftObstacle2.Value         = item.LeftObstacle2;
                dbi_LeftObstacle3.Value         = item.LeftObstacle3;
                dbi_LeftObstacle4.Value         = item.LeftObstacle4;
                dbi_LeftObstacle5.Value         = item.LeftObstacle5;
                dbi_LeftObstacle6.Value         = item.LeftObstacle6;
                dbi_RightObstacle1.Value        = item.RightObstacle1;
                dbi_RightObstacle2.Value        = item.RightObstacle2;
                dbi_RightObstacle3.Value        = item.RightObstacle3;
                dbi_RightObstacle4.Value        = item.RightObstacle4;
                dbi_RightObstacle5.Value        = item.RightObstacle5;
                dbi_RightObstacle6.Value        = item.RightObstacle6;
                dbi_CarriageLength.Value        = item.CarriageLength;
                dbi_CarriageWidth.Value         = item.CarriageWidth;
                dbi_CarriageBottomToFloor.Value = item.CarriageBottomToFloor;
            }
        }
        private void dataGridViewX1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == -1 || e.RowIndex == -1)
            {
                return;
            }

            CmcsCarModel entity = Dbers.GetInstance().SelfDber.Get <CmcsCarModel>(superGridControl1.PrimaryGrid.GetCell(e.ColumnIndex, superGridControl1.PrimaryGrid.Columns["clmId"].ColumnIndex).Value.ToString());

            if (entity == null)
            {
                return;
            }

            switch (superGridControl1.PrimaryGrid.Columns[e.ColumnIndex].Name)
            {
            case "clmDelete":
                // 查询正在使用该车型的车数
                if (MessageBoxEx.Show("确定要删除该车型?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    Dbers.GetInstance().SelfDber.Delete <CmcsCarModel>(entity.Id);

                    BindData();
                }
                else
                {
                    MessageBoxEx.Show("该车型正在使用中,禁止删除!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                break;
            }
        }
Exemple #5
0
 private void FrmCarModel_Select_KeyUp(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Escape)
     {
         this.Output       = null;
         this.DialogResult = DialogResult.Cancel;
         this.Close();
     }
 }
Exemple #6
0
        void Return()
        {
            GridRow gridRow = superGridControl1.PrimaryGrid.ActiveRow as GridRow;

            if (gridRow == null)
            {
                return;
            }

            this.Output       = (gridRow.DataItem as CmcsCarModel);
            this.DialogResult = DialogResult.OK;
            this.Close();
        }
        private void superGridControl1_DataBindingComplete(object sender, DevComponents.DotNetBar.SuperGrid.GridDataBindingCompleteEventArgs e)
        {
            foreach (GridRow gridRow in e.GridPanel.Rows)
            {
                CmcsCarModel entity = gridRow.DataItem as CmcsCarModel;
                if (entity == null)
                {
                    return;
                }

                gridRow.Cells["Obstacle1"].Value = entity.LeftObstacle1 + "|" + entity.RightObstacle1;
                gridRow.Cells["Obstacle2"].Value = entity.LeftObstacle2 + "|" + entity.RightObstacle2;
                gridRow.Cells["Obstacle3"].Value = entity.LeftObstacle3 + "|" + entity.RightObstacle3;
                gridRow.Cells["Obstacle4"].Value = entity.LeftObstacle4 + "|" + entity.RightObstacle4;
                gridRow.Cells["Obstacle5"].Value = entity.LeftObstacle5 + "|" + entity.RightObstacle5;
                gridRow.Cells["Obstacle6"].Value = entity.LeftObstacle6 + "|" + entity.RightObstacle6;
            }
        }
        private void superGridControl1_CellMouseDown(object sender, DevComponents.DotNetBar.SuperGrid.GridCellMouseEventArgs e)
        {
            CmcsCarModel entity = Dbers.GetInstance().SelfDber.Get <CmcsCarModel>(superGridControl1.PrimaryGrid.GetCell(e.GridCell.GridRow.Index, superGridControl1.PrimaryGrid.Columns["clmId"].ColumnIndex).Value.ToString());

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

            case "clmEdit":
                FrmCarModel_Oper frmEdit = new FrmCarModel_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 <CmcsCarModel>(entity.Id);
                    }
                    catch (Exception)
                    {
                        MessageBoxEx.Show("该车型正在使用中,禁止删除!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }

                    BindData();
                }
                break;
            }
        }
Exemple #9
0
        /// <summary>
        /// 保存数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            if (txt_ModelName.Text.Length == 0)
            {
                MessageBoxEx.Show("该标车型不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            if ((CmcsCarModel == null || CmcsCarModel.ModelName != txt_ModelName.Text) && Dbers.GetInstance().SelfDber.Entities <CmcsCarModel>(" where ModelName=:ModelName", new { ModelName = txt_ModelName.Text }).Count > 0)
            {
                MessageBoxEx.Show("该标车型不可重复!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.EditMode == eEditMode.修改)
            {
                if (dbi_CarriageLength.Value <= 0)
                {
                    MessageBoxEx.Show("该车型长不能为0!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                if (dbi_CarriageWidth.Value <= 0)
                {
                    MessageBoxEx.Show("该车型宽不能为0!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                if (dbi_CarriageBottomToFloor.Value <= 0)
                {
                    MessageBoxEx.Show("该车型车厢底部到地面高不能为0!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                if ((dbi_LeftObstacle6.Value > 0 || dbi_RightObstacle6.Value > 0) && (dbi_LeftObstacle5.Value <= 0 && dbi_RightObstacle5.Value <= 0))
                {
                    MessageBoxEx.Show("已有拉筋六信息必须有拉筋五信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                if ((dbi_LeftObstacle5.Value > 0 || dbi_RightObstacle5.Value > 0) && (dbi_LeftObstacle4.Value <= 0 && dbi_RightObstacle4.Value <= 0))
                {
                    MessageBoxEx.Show("已有拉筋五信息必须有拉筋四信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                if ((dbi_LeftObstacle4.Value > 0 || dbi_RightObstacle4.Value > 0) && (dbi_LeftObstacle3.Value <= 0 && dbi_RightObstacle3.Value <= 0))
                {
                    MessageBoxEx.Show("已有拉筋四信息必须有拉筋三信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                if ((dbi_LeftObstacle3.Value > 0 || dbi_RightObstacle3.Value > 0) && (dbi_LeftObstacle2.Value <= 0 && dbi_RightObstacle2.Value <= 0))
                {
                    MessageBoxEx.Show("已有拉筋三信息必须有拉筋二信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                if ((dbi_LeftObstacle2.Value > 0 || dbi_RightObstacle2.Value > 0) && (dbi_LeftObstacle1.Value <= 0 && dbi_RightObstacle1.Value <= 0))
                {
                    MessageBoxEx.Show("已有拉筋二信息必须有拉筋一信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                CmcsCarModel.ModelName             = txt_ModelName.Text;
                CmcsCarModel.LeftObstacle1         = (int)dbi_LeftObstacle1.Value;
                CmcsCarModel.LeftObstacle2         = (int)dbi_LeftObstacle2.Value;
                CmcsCarModel.LeftObstacle3         = (int)dbi_LeftObstacle3.Value;
                CmcsCarModel.LeftObstacle4         = (int)dbi_LeftObstacle4.Value;
                CmcsCarModel.LeftObstacle5         = (int)dbi_LeftObstacle5.Value;
                CmcsCarModel.LeftObstacle6         = (int)dbi_LeftObstacle6.Value;
                CmcsCarModel.RightObstacle1        = (int)dbi_RightObstacle1.Value;
                CmcsCarModel.RightObstacle2        = (int)dbi_RightObstacle2.Value;
                CmcsCarModel.RightObstacle3        = (int)dbi_RightObstacle3.Value;
                CmcsCarModel.RightObstacle4        = (int)dbi_RightObstacle4.Value;
                CmcsCarModel.RightObstacle5        = (int)dbi_RightObstacle5.Value;
                CmcsCarModel.RightObstacle6        = (int)dbi_RightObstacle6.Value;
                CmcsCarModel.CarriageLength        = (int)dbi_CarriageLength.Value;
                CmcsCarModel.CarriageWidth         = (int)dbi_CarriageWidth.Value;
                CmcsCarModel.CarriageBottomToFloor = (int)dbi_CarriageBottomToFloor.Value;
                CmcsCarModel.ReMark = txt_ReMark.Text;
                Dbers.GetInstance().SelfDber.Update(CmcsCarModel);
            }
            else if (this.EditMode == eEditMode.新增)
            {
                CmcsCarModel                       = new CmcsCarModel();
                CmcsCarModel.ModelName             = txt_ModelName.Text;
                CmcsCarModel.LeftObstacle1         = (int)dbi_LeftObstacle1.Value;
                CmcsCarModel.LeftObstacle2         = (int)dbi_LeftObstacle2.Value;
                CmcsCarModel.LeftObstacle3         = (int)dbi_LeftObstacle3.Value;
                CmcsCarModel.LeftObstacle4         = (int)dbi_LeftObstacle4.Value;
                CmcsCarModel.LeftObstacle5         = (int)dbi_LeftObstacle5.Value;
                CmcsCarModel.LeftObstacle6         = (int)dbi_LeftObstacle6.Value;
                CmcsCarModel.RightObstacle1        = (int)dbi_RightObstacle1.Value;
                CmcsCarModel.RightObstacle2        = (int)dbi_RightObstacle2.Value;
                CmcsCarModel.RightObstacle3        = (int)dbi_RightObstacle3.Value;
                CmcsCarModel.RightObstacle4        = (int)dbi_RightObstacle4.Value;
                CmcsCarModel.RightObstacle5        = (int)dbi_RightObstacle5.Value;
                CmcsCarModel.RightObstacle6        = (int)dbi_RightObstacle6.Value;
                CmcsCarModel.CarriageLength        = (int)dbi_CarriageLength.Value;
                CmcsCarModel.CarriageWidth         = (int)dbi_CarriageWidth.Value;
                CmcsCarModel.CarriageBottomToFloor = (int)dbi_CarriageBottomToFloor.Value;
                CmcsCarModel.ReMark                = txt_ReMark.Text;
                Dbers.GetInstance().SelfDber.Insert(CmcsCarModel);
            }

            this.DialogResult = DialogResult.OK;
            this.Close();
        }