Exemplo n.º 1
0
        private void btnInitInfo_Click(object sender, EventArgs e)
        {
            try
            {
                InitInfoForm myInitInfoForm = new InitInfoForm();

                myInitInfoForm.PNName = currlst.SelectedItem.ToString();
                myInitInfoForm.PID    = MainForm.getDTColumnInfo(MainForm.GlobalDS.Tables["GlobalProductionName"], "ID", "PN='" + this.currlst.SelectedItem.ToString() + "'");
                myInitInfoForm.ShowDialog();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Exemplo n.º 2
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            try
            {
                if (MainForm.checkItemLength("PN", this.txtPN.Text, 35) ||
                    MainForm.checkItemLength("ItemName", this.txtItemName.Text, 200))
                {
                    return;
                }

                if (this.cboAPCStyle.Text.Trim().Length == 0 ||
                    this.cboAPC_Type.Text.Trim().Length == 0 ||
                    this.cboBER.Text.Trim().Length == 0 ||
                    this.cboCouple_Type.Text.Trim().Length == 0 ||
                    this.cboMaxRate.Text.Trim().Length == 0 ||
                    this.cboNickName.Text.Trim().Length == 0 ||
                    this.cboOldDriver.Text.Trim().Length == 0 ||
                    this.cboPublish_PN.Text.Trim().Length == 0 ||
                    this.cboTEC_Present.Text.Trim().Length == 0 ||

                    this.txtPN.Text.ToString().Trim().Length == 0 ||
                    this.txtItemName.Text.ToString().Trim().Length == 0 ||
                    this.cboVoltages.Text.ToString().Trim().Length == 0 ||
                    this.cboTsensors.Text.ToString().Trim().Length == 0 ||
                    this.cboMGroup.Text.ToString().Trim().Length == 0 ||
                    this.cboChannels.Text.ToString().Trim().Length == 0
                    ) //140630_1
                {
                    MessageBox.Show("Data is incomplete,Pls confirm again?");
                    return;
                }

                if (blnAddNew || (tempPN.Length > 0 && tempPN.ToUpper() != txtPN.Text.ToString().ToUpper().Trim()))
                {
                    if (MainForm.currPrmtrCountExisted(MainForm.GlobalDS.Tables["GlobalProductionName"], "PID=" + PID + " and PN ='" + this.txtPN.Text.ToString() + "'") > 0)
                    {   //140704_1
                        MessageBox.Show("The data of PN has existed! <Violate unique rule>");
                        return;
                    }
                }

                bool result = EditInfoForDT(MainForm.GlobalDS.Tables["GlobalProductionName"]);

                if (result)
                {
                    MainForm.ISNeedUpdateflag = true; //140603_2
                    cboChannels.Enabled       = true;
                    txtPN.Enabled             = false;
                    if (MainForm.myGlobalPNISNewFlag)
                    {
                        //140704_2>>>>>>>>>
                        InitInfoForm myInitInfoForm = new InitInfoForm();
                        myInitInfoForm.PID    = MainForm.getDTColumnInfo(MainForm.GlobalDS.Tables["GlobalProductionName"], "ID", "PN='" + txtPN.Text.ToString() + "'");
                        myInitInfoForm.PNName = txtPN.Text.ToString();
                        myInitInfoForm.ShowDialog();
                        //140704_2<<<<<<<<<

                        //myEquip.ShowDialog();   //show NextForm...
                        blnAddNew = false;
                        MainForm.myGlobalPNAddOKFlag = true; //140530_0
                        this.Close();                        //140530_4
                    }
                    else
                    {
                        MainForm.myGlobalPNAddOKFlag = true; //140530_0
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Exemplo n.º 3
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            try
            {
                if (MainForm.checkItemLength("AuxAttribles", this.txtAuxAttribles.Text, 255) ||
                    MainForm.checkItemLength("PN", this.txtPN.Text, 35) ||
                    MainForm.checkItemLength("ItemName", this.txtItemName.Text, 35))
                {
                    return;
                }

                if (
                    this.txtPN.Text.ToString().Trim().Length == 0 ||
                    this.txtItemName.Text.ToString().Trim().Length == 0 ||
                    this.cboVoltages.Text.ToString().Trim().Length == 0 ||
                    this.cboTsensors.Text.ToString().Trim().Length == 0 ||
                    this.cboMGroup.ToString().Trim().Length == 0 ||
                    this.cboChannels.Text.ToString().Trim().Length == 0
                    ) //140630_1
                {
                    MessageBox.Show("Data is incomplete,Pls confirm again?");
                    return;
                }

                if (blnAddNew)
                {
                    if (MainForm.currPrmtrCountExisted(MainForm.GlobalDS.Tables["GlobalProductionName"], "PID=" + PID + " and PN ='" + this.txtPN.Text.ToString() + "'") > 0)
                    {   //140704_1
                        MessageBox.Show("The new data of PN has existed! <Violate unique rule>");
                        return;
                    }
                }

                bool result = EditInfoForDT(MainForm.GlobalDS.Tables["GlobalProductionName"]);

                if (result)
                {
                    MainForm.ISNeedUpdateflag = true; //140603_2
                    cboChannels.Enabled       = true;
                    txtPN.Enabled             = false;
                    if (MainForm.myGlobalPNISNewFlag)
                    {
                        //140704_2>>>>>>>>>
                        InitInfoForm myInitInfoForm = new InitInfoForm();
                        myInitInfoForm.PNName = currlst.SelectedItem.ToString();
                        myInitInfoForm.ShowDialog();
                        //140704_2<<<<<<<<<

                        //myEquip.ShowDialog();   //show NextForm...
                        blnAddNew = false;
                        MainForm.myGlobalPNAddOKFlag = true; //140530_0
                        this.Close();                        //140530_4
                    }
                    else
                    {
                        MainForm.myGlobalPNAddOKFlag = true; //140530_0
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }