예제 #1
0
        //选择记录
        public override bool SelectRecord()
        {
            try
            {
                pecls = new ProcessEquipmentCls();

                int[] rows = gridView1.GetSelectedRows();
                pecls = (ProcessEquipmentCls)gridView1.GetRow(rows[0]);

                textEquipmentName.Text = pecls.ProcessEquipmentName;
                txtDriveMode.Text      = pecls.DirverMode;
                txtPressureSize.Text   = pecls.PressureHeadLength.ToString();
                txtDownCount.Text      = pecls.DownDieHeadNumber.ToString();
                txtUpCount.Text        = pecls.UpDieHeadNumber.ToString();

                return(true);
            }
            catch (System.Exception ex)
            {
                return(false);
            }
        }
예제 #2
0
        //保存
        public override bool SaveDataA()
        {
            try
            {
                if (AddorModify == AddOrModifyEnum.Add)
                {
                    pecls = new ProcessEquipmentCls();

                    pecls.ProcessEquipmentName = this.textEquipmentName.Text.ToString();
                    pecls.DirverMode           = this.txtDriveMode.Text.ToString();
                    pecls.PressureHeadLength   = Convert.ToInt32(this.txtPressureSize.Text.ToString());
                    pecls.UpDieHeadNumber      = Convert.ToInt32(this.txtUpCount.Text.ToString());
                    pecls.DownDieHeadNumber    = Convert.ToInt32(this.txtDownCount.Text.ToString());

                    int re = ProcessEquipmentDAL.AddProcessEquipment(pecls);

                    if (re > 0)
                    {
                        ProcessEquipmentBindingSource.DataSource = pecls;
                        this.gridControl1.DataSource             = ProcessEquipmentBindingSource;

                        this.layoutControlGroup1.Enabled = false;

                        this.textEquipmentName.Text = "";
                        this.txtDriveMode.Text      = "";
                        this.txtPressureSize.Text   = "";
                        this.txtUpCount.Text        = "";
                        this.txtDownCount.Text      = "";

                        init_cmbBox();

                        MessageBox.Show("加工设备信息增加成功!");

                        return(true);
                    }
                    else
                    {
                        MessageBox.Show("加工设备增加失败!");

                        return(false);
                    }
                }
                else if (AddorModify == AddOrModifyEnum.Modify)
                {
                    pecls.ProcessEquipmentName = this.textEquipmentName.Text.ToString();
                    pecls.DirverMode           = this.txtDriveMode.Text.ToString();
                    pecls.PressureHeadLength   = Convert.ToInt32(this.txtPressureSize.Text.ToString());
                    pecls.UpDieHeadNumber      = Convert.ToInt32(this.txtUpCount.Text.ToString());
                    pecls.DownDieHeadNumber    = Convert.ToInt32(this.txtDownCount.Text.ToString());

                    ProcessEquipmentDAL.ModifyProcessEquipmentById(pecls);

                    this.layoutControlGroup1.Enabled = false;

                    init_cmbBox();


                    return(true);
                }
                else
                {
                    MessageBox.Show("加工设备添加/修改失败!");
                    return(false);
                }
            }
            catch (System.Exception ex)
            {
                MessageBox.Show("加工设备添加失败:{0}!", ex.Message.ToString());
                return(false);
            }
        }