private void btnEditPrmtrOK_Click(object sender, EventArgs e)
        {
            try
            {
                showResultBackColor(2);

                //ADD/ Edit value for TopoEquipmentParameter Table
                bool editResult = EditPrmtrInfoForDT(PNInfo.TopoToatlDS.Tables["TopoEquipmentParameter"]);
                //修改颜色还原! txt隐藏!
                txtDGVItem.Visible = false;
                if (PNInfo.currPrmtrCountExisted(PNInfo.TopoToatlDS.Tables["TopoEquipmentParameter"], "PID=" + myPrmtrPID)
                    == PNInfo.currPrmtrCountExisted(PNInfo.GlobalTotalDS.Tables["GlobalAllEquipmentParamterList"], "PID=" + +myGlobalEquipID)
                    )
                {
                    if (editResult && AddErr == false)
                    {
                        PNInfo.ISNeedUpdateflag = true; //140603_2
                        showResultBackColor(0);
                        for (int i = 0; i < dgvEquipPrmtr.Rows.Count; i++)
                        {
                            for (int j = 0; j < dgvEquipPrmtr.Columns.Count; j++)
                            {
                                if (dgvEquipPrmtr.Rows[i].Cells[j].Style.BackColor != Color.White)
                                {
                                    dgvEquipPrmtr.Rows[i].Cells[j].Style.BackColor = Color.White;
                                }
                            }
                        }

                        if (!currlst.Enabled)
                        {
                            currlst.Enabled = true;
                            currlst.Focus();
                        }

                        PNInfo.myTestEquipAddOKFlag      = true;    //140529_1
                        PNInfo.myTestEquipPrmtrAddOKFlag = true;    //140529_1
                        PNInfo.myTestEquipISNewFlag      = false;   //140530_2
                        PNInfo.myTestEquipPrmtrISNewFlag = false;   //140530_2
                        btnAdd.Enabled      = true;
                        btnNextPage.Enabled = true;
                    }
                    else
                    {
                        //blnAddNewEquip = true;
                        currlst.Enabled = false;//140604_0
                        showResultBackColor(1);
                        btnNextPage.Enabled = false;
                        if (this.blnAddNewEquip)
                        {
                            btnAdd.Enabled = false;
                        }
                    }
                }
                else
                {
                    MessageBox.Show("未发现Topo表中有当前选择Equip的参数与Global的Equip参数一致,资料丢失!不允许保存!");
                    showResultBackColor(1);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                showResultBackColor(1);
            }
        }
        private void dgvEquipPrmtr_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            try
            {
                if (dgvEquipPrmtr.CurrentRow != null && dgvEquipPrmtr.CurrentRow.Index != -1) //140714_0
                {
                    string descriptionString = PNInfo.getDTColumnInfo(PNInfo.GlobalTotalDS.Tables["GlobalAllEquipmentParamterList"]
                                                                      , "ItemDescription", "Item='" + dgvEquipPrmtr.CurrentRow.Cells["Item"].Value.ToString() + "' and PID='" + myGlobalEquipID + "'");
                    string prmtrType = PNInfo.getDTColumnInfo(PNInfo.GlobalTotalDS.Tables["GlobalAllEquipmentParamterList"]
                                                              , "ItemType", "Item='" + dgvEquipPrmtr.CurrentRow.Cells["Item"].Value.ToString() + "' and PID='" + myGlobalEquipID + "'");

                    txtSaveResult.Text = "当前单元格资料: \r\n" + dgvEquipPrmtr.CurrentCell.Value.ToString();    //140709_2

                    this.lblPrmtrType.Text = "参数类型: ";
                    this.lblMyType.Text    = prmtrType;
                    if (this.lblMyType.Text.Length == 0)
                    {
                        this.lblMyType.Text = "Not Found ParameterType";
                    }
                    this.txtDescription.Text = descriptionString;

                    if (this.txtDescription.Text.Length == 0)
                    {
                        this.txtDescription.Text = "Not Found ParameterDescription";
                    }

                    if (dgvEquipPrmtr.CurrentCell.Value.ToString().Length > 15)   //140714_1
                    {
                        dgvEquipPrmtr.Rows[dgvEquipPrmtr.CurrentRow.Index].Height = 50;
                    }

                    //获取当前的DGV.X,Y;新增txtBox
                    if (dgvEquipPrmtr.RowCount > 0 &&
                        (
                            dgvEquipPrmtr.Columns[dgvEquipPrmtr.CurrentCell.ColumnIndex].HeaderText == "ItemValue" ||
                            dgvEquipPrmtr.Columns[dgvEquipPrmtr.CurrentCell.ColumnIndex].HeaderText == "内容"
                        ))
                    {
                        showTxtItem();
                        //dgvEquipPrmtr.CurrentCell.OwningRow.Cells[e.ColumnIndex - 1].Style.BackColor = Color.Yellow;
                        txtDGVItem.Text      = dgvEquipPrmtr.CurrentCell.Value.ToString();
                        mylastDGVRowIndex    = e.RowIndex;
                        mylastDGVColumnIndex = e.ColumnIndex;
                    }
                    else
                    {
                        txtDGVItem.Visible = false;
                    }

                    if (txtDGVItem.Visible && txtDGVItem.Enabled)   //140530_1
                    {
                        txtDGVItem.Focus();
                        txtDGVItem.BackColor = Color.YellowGreen;
                        txtDGVItem.Refresh();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
        private void currlst_SelectedIndexChanged(object sender, EventArgs e)
        {
            txtDGVItem.Visible = false;
            try
            {
                if (currlst.SelectedIndex != -1)
                {
                    txtSaveResult.Text = "";
                    mylastIndex        = currlst.SelectedIndex;//140530_1

                    myEquipName = this.currlst.SelectedItem.ToString();
                    int lastChar = myEquipName.IndexOf("_");
                    myQueryEquipName = myEquipName.Substring(0, lastChar);
                    myGlobalEquipID  = Convert.ToInt64(PNInfo.getDTColumnInfo(PNInfo.GlobalTotalDS.Tables["GlobalAllEquipmentList"], "ID", "ItemName='" + myQueryEquipName + "'"));

                    DataTable myPrmtrDT = new DataTable();
                    if (!blnAddNewEquip)
                    {
                        //140529 TBD 若Global的EquipParameter参数有新增? 但是查询TopoTable无法新增资料?
                        //140529 TBD 如何处理? 删除原Equip 后新增?
                        btnEditPrmtrOK.Enabled = true;
                        getInfoFromDT(PNInfo.TopoToatlDS.Tables["TopoEquipment"], currlst.SelectedIndex);

                        PNInfo.showTablefilterStrInfo(PNInfo.TopoToatlDS.Tables["TopoEquipmentParameter"], dgvEquipPrmtr, "PID=" + myPrmtrPID);

                        //140709_3
                        if (dgvEquipPrmtr.Columns["Item"].Width + dgvEquipPrmtr.Columns["ItemValue"].Width < dgvEquipPrmtr.Size.Width)
                        {
                            dgvEquipPrmtr.Columns["ItemValue"].Width = dgvEquipPrmtr.Size.Width - dgvEquipPrmtr.Columns["Item"].Width;
                        }

                        int myTopoEquipPrmtrCount   = dgvEquipPrmtr.Rows.Count;
                        int myGlobalEquipPrmtrCount = PNInfo.currPrmtrCountExisted(PNInfo.GlobalTotalDS.Tables["GlobalAllEquipmentParamterList"], "PID=" + +myGlobalEquipID);

                        string[,] myValues = new string[myGlobalEquipPrmtrCount, 2];

                        for (int i = 0; i < myGlobalEquipPrmtrCount; i++)
                        {
                            if (i < myTopoEquipPrmtrCount)
                            {
                                myValues[i, 0] = dgvEquipPrmtr.Rows[i].Cells["Item"].Value.ToString();
                                myValues[i, 1] = dgvEquipPrmtr.Rows[i].Cells["ItemValue"].Value.ToString();
                            }
                            else   //140707_0
                            {
                                myValues[i, 0] = "";
                                myValues[i, 1] = "";
                            }
                        }

                        if (myTopoEquipPrmtrCount != myGlobalEquipPrmtrCount)
                        {
                            MessageBox.Show("发现Topo表参数数目:" + myTopoEquipPrmtrCount + " Global参数数目:" + myGlobalEquipPrmtrCount
                                            + ";\n 参数数目不一致,即将新增" + (myGlobalEquipPrmtrCount - myTopoEquipPrmtrCount) + "条仪器参数!!!");
                            PNInfo.showTablefilterStrInfo(PNInfo.GlobalTotalDS.Tables["GlobalAllEquipmentParamterList"], dgvEquipPrmtr, "PID=" + myGlobalEquipID);
                            //若Topo表中存在部分资料则需要覆盖掉此部分Global的默认参数!

                            //140709_3
                            if (dgvEquipPrmtr.Columns["Item"].Width + dgvEquipPrmtr.Columns["ItemValue"].Width < dgvEquipPrmtr.Size.Width)
                            {
                                dgvEquipPrmtr.Columns["ItemValue"].Width = dgvEquipPrmtr.Size.Width - dgvEquipPrmtr.Columns["Item"].Width;
                            }

                            for (int i = 0; i < myGlobalEquipPrmtrCount; i++)
                            {
                                if (myValues[i, 0] == dgvEquipPrmtr.Rows[i].Cells["Item"].Value.ToString())
                                {
                                    dgvEquipPrmtr.Rows[i].Cells["ItemValue"].Value = myValues[i, 1];
                                }
                            }
                        }
                    }
                    else
                    {
                        btnEditPrmtrOK.Enabled = false;

                        PNInfo.showTablefilterStrInfo(PNInfo.GlobalTotalDS.Tables["GlobalAllEquipmentParamterList"], dgvEquipPrmtr, "PID=" + myGlobalEquipID);

                        myPrmtrPID = PNInfo.mylastIDTestEquip + 1;
                    }
                    PNInfo.hideMyIDPID(dgvEquipPrmtr);
                    if (dgvEquipPrmtr.Columns.Contains("ItemDescription")) //140530_1
                    {
                        PNInfo.hideMyColumn(dgvEquipPrmtr, "ItemDescription");
                    }
                    if (dgvEquipPrmtr.Columns.Contains("ItemType")) //140530_1
                    {
                        PNInfo.hideMyColumn(dgvEquipPrmtr, "ItemType");
                    }

                    if (dgvEquipPrmtr.Columns.Contains("Item")) //140530_1
                    {
                        dgvEquipPrmtr.Columns["Item"].HeaderText = "项目";
                    }
                    if (dgvEquipPrmtr.Columns.Contains("ItemValue")) //140530_1
                    {
                        dgvEquipPrmtr.Columns["ItemValue"].HeaderText = "内容";
                    }
                }
                else
                {
                    mylastIndex = -1;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
        private void btnRemove_Click(object sender, EventArgs e)
        {
            try
            {
                DialogResult drst = new DialogResult();

                drst = (MessageBox.Show("即将进行删除资料TestEquip --> " + currlst.SelectedItem.ToString() +
                                        "\n \n 选择 'Y' (是) 继续?",
                                        "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2));

                if (drst == DialogResult.Yes)
                {
                    //若为新增的项目则必须制定当前的选择的Item
                    int    CurrIndex = currlst.SelectedIndex;
                    string sName     = currlst.Items[CurrIndex].ToString();
                    long   myPID     = PID;

                    //DataTable资料移除部分待新增!!!

                    bool result      = PNInfo.DeleteItemForDT(PNInfo.TopoToatlDS.Tables["TopoEquipment"], "PID=" + myPID + "and ItemName='" + sName + "'");
                    bool resultPrmtr = PNInfo.DeleteItemForDT(PNInfo.TopoToatlDS.Tables["TopoEquipmentParameter"], "PID=" + myPrmtrPID);
                    currlst.Items.RemoveAt(CurrIndex);
                    if (result && resultPrmtr)
                    {
                        PNInfo.ISNeedUpdateflag = true; //140603_2
                        PNInfo.myDeletedCountTestEquip++;
                        PNInfo.myDeletedCountTestEquipPrmtr++;

                        if (blnAddNewEquip)
                        {
                            PNInfo.mylastIDTestEquip--;
                            PNInfo.mynewIDTestEquip--;
                            PNInfo.myTestEquipAddOKFlag      = true;    //140529_1
                            PNInfo.myTestEquipPrmtrAddOKFlag = true;    //140529_1
                        }

                        myNewEquipcount--;
                        //this.blnAddNew = false;
                        this.blnAddNewEquip   = false;
                        this.btnAdd.Enabled   = true;
                        grpEquipPrmtr.Enabled = true;
                        btnNextPage.Enabled   = true;

                        currlst.Enabled = true;
                        currlst.Focus();

                        MessageBox.Show("项目资料 序号为: " + CurrIndex + ";Name =" + sName + "已经移除!");
                    }
                    else
                    {
                        MessageBox.Show("项目资料 序号为: " + CurrIndex + "!Name =" + sName + "移除失败!");
                    }
                }
                mylastIndex = -1;   //140603_2
                RefreshEquipInfo();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Exemple #5
0
        private void dgvTestCtrl_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            try
            {
                if (dgvTestCtrl.CurrentRow != null && dgvTestCtrl.CurrentRow.Index != -1 && e.RowIndex != -1)  //140714_0
                {
                    if (!blnAddNewCtrl)
                    {
                        currTestCtrlIndex = e.RowIndex;
                        if (dgvTestCtrl.Rows.Count > 0)
                        {
                            myModelPID = PNInfo.getNextPIDFromdgv(dgvTestCtrl, currTestCtrlIndex);
                            PNInfo.showTablefilterStrInfo(PNInfo.TopoToatlDS.Tables["TopoTestModel"], dgvTestModel, "PID=" + this.myModelPID);
                            crpTestModel.Enabled = true;
                            showBtns(0, true);
                        }
                        else
                        {
                            showBtns(0, false);
                            crpTestModel.Enabled = false;
                            grpTestPrmtr.Enabled = false;
                        }

                        if (dgvTestModel.Rows.Count > 0)
                        {
                            myPrmtrPID = Convert.ToInt64(this.dgvTestModel.Rows[0].Cells["ID"].Value);
                            PNInfo.showTablefilterStrInfo(PNInfo.TopoToatlDS.Tables["TopoTestParameter"], dgvTestPrmtr, "PID=" + this.myPrmtrPID);
                            grpTestPrmtr.Enabled = true;
                            showBtns(1, true);
                            showBtns(2, true);
                            DataGridViewCell cell = dgvTestModel.Rows[0].Cells["SEQ"];
                            dgvTestModel.CurrentCell = cell;
                        }
                        else
                        {
                            grpTestPrmtr.Enabled = false;
                            showBtns(1, false);
                            showBtns(2, false);
                            this.dgvTestPrmtr.DataSource = null;
                        }
                    }
                    else
                    {
                        if (dgvTestCtrl.Rows.Count > 0)
                        {
                            currTestCtrlIndex = dgvTestCtrl.Rows.Count - 1;
                            myModelPID        = PNInfo.getNextPIDFromdgv(dgvTestCtrl, currTestCtrlIndex);
                            PNInfo.showTablefilterStrInfo(PNInfo.TopoToatlDS.Tables["TopoTestModel"], dgvTestModel, "PID=" + this.myModelPID);
                            crpTestModel.Enabled = true;
                            showBtns(0, true);
                        }
                        else
                        {
                            crpTestModel.Enabled = false;
                            grpTestPrmtr.Enabled = false;
                            showBtns(0, false);
                        }

                        if (dgvTestModel.Rows.Count > 0)
                        {
                            myPrmtrPID = PNInfo.mylastIDTestModel + 1;
                            PNInfo.showTablefilterStrInfo(PNInfo.TopoToatlDS.Tables["TopoTestParameter"], dgvTestPrmtr, "PID=" + this.myPrmtrPID);
                            grpTestPrmtr.Enabled = true;
                            showBtns(1, true);
                            showBtns(2, true);
                        }
                        else
                        {
                            grpTestPrmtr.Enabled = false;
                            showBtns(1, false);
                            showBtns(2, false);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Exemple #6
0
        bool blnIsAddAux = false;   //140811_1

        private void CtrlInfo_Load(object sender, EventArgs e)
        {
            try
            {
                setAuxshow(false);   //140811_1
                RefreshList();
                ShowMyTip();
                this.txtTestPlanName.Text = TestPlanName;

                //140709_1>>>>>>>>>>
                this.cboDataRate.Items.Clear();
                //140811_2 this.txtAuxAttribles.Items.Clear();
                //140811_2 this.txtAuxAttribles.Items.Add("DUT_Soak_Time= 指定值; ReadTempFromXStream= 指定值"); //140606
                DataRow[] drs = PNInfo.TopoToatlDS.Tables["TopoTestControl"].Select("");

                for (int i = 0; i < drs.Length; i++)
                {
                    if (this.cboDataRate.Items.Contains(drs[i]["DataRate"]) == false)
                    {
                        this.cboDataRate.Items.Add(drs[i]["DataRate"]);
                    }

                    if (this.cboChannel.Items.Contains(drs[i]["Channel"]) == false)
                    {
                        this.cboChannel.Items.Add(drs[i]["Channel"]);
                    }

                    if (this.cboPattent.Items.Contains(drs[i]["Pattent"]) == false)
                    {
                        this.cboPattent.Items.Add(drs[i]["Pattent"]);
                    }

                    if (this.cboTemp.Items.Contains(drs[i]["Temp"]) == false)
                    {
                        this.cboTemp.Items.Add(drs[i]["Temp"]);
                    }

                    if (this.cboVcc.Items.Contains(drs[i]["Vcc"]) == false)
                    {
                        this.cboVcc.Items.Add(drs[i]["Vcc"]);
                    }
                }

                //140709_1<<<<<<<<<<

                if (blnAddNew)
                {
                    mySEQ        = (PNInfo.getMAXColumnsItem(PNInfo.TopoToatlDS.Tables["TopoTestControl"], "SEQ", "PID=" + PID) + 1).ToString();
                    myTestCtrlID = (PNInfo.mylastIDTestCtrl + 1).ToString();

                    PNInfo.myTestCtrlAddOKFlag = false;
                    cboItemName.BackColor      = Color.Yellow;
                    currlst.Enabled            = false;
                    btnOK.Enabled = true;
                    PNInfo.myTestCtrlISNewFlag = true;        //140530_2
                }
                else
                {
                    btnOK.Enabled              = false;
                    btnFinish.Enabled          = true;
                    PNInfo.myTestCtrlISNewFlag = false;        //140530_2
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Exemple #7
0
        void showAccess()
        {
            try
            {
                bool PWDOKFlag = false;

                bool blnReadable   = false;
                bool blnWritable   = false;
                bool blnAddable    = false;
                bool blnDeletable  = false;
                bool blnDuplicable = false;
                bool blnExportable = false;
                bool blnImportable = false;

                string pUserID = "";
                if (this.chkSQLlib.CheckState == CheckState.Checked)
                {
                    #region User SQL Server
                    mySQL = new SqlManager(Login.ServerName, Login.DBName, Login.DBUser, Login.DBPassword);   //140918_0 //140722_2   //140912_0
                    getLoginStutes();
                    //Username -->LoginName
                    myInfo = mySQL.GetDataTable("select * from UserInfo where LoginName='" + this.txtUserID.Text.ToString() + "'", "UserInfo");

                    DataRow[] myInfoRows = myInfo.Select("LoginName='" + this.txtUserID.Text.ToString() + "'");
                    if (myInfoRows.Length == 1)
                    {
                        //140612_2 Password-->UserPassword
                        if (myInfoRows[0]["LoginPassword"].ToString().ToUpper().Trim() == this.txtPWD.Text.ToString().ToUpper().Trim())
                        {
                            PWDOKFlag = true;
                            pUserID   = myInfoRows[0]["ID"].ToString();
                        }
                        else
                        {
                            PWDOKFlag = false;
                        }
                    }

                    if (!PWDOKFlag)
                    {
                        MessageBox.Show("用户或密码不正确!", "用户名或密码错误", MessageBoxButtons.OK);
                        return;
                    }
                    else
                    {
                        //140626 获取权限--> 正常来讲一个账号角色分配为1个...
                        string queryCMD = "select sum(FunctionCode) from functiontable where id in "
                                          + "(select RoleFunctionTable.FunctionID from RoleFunctionTable where RoleFunctionTable.RoleID  in "
                                          + "(select roleID from UserRoleTable where UserRoleTable.UserID = " + pUserID + "))";
                        //+ pUserID + "))";--> ToString+ "(select id from UserInfo	where UserInfo.LoginName='" + this.txtUserID.Text.ToString() + "')))";
                        DataTable myFunctions = mySQL.GetDataTable(queryCMD, "UserRoleFuncTable");

                        //140630_0 修改为读取sum(FunctionCode) 来体现,原为判断Title>>>>>>>>>>>>>>>>>
                        long myAccessCode = -1;
                        if (myFunctions.Rows.Count > 0)
                        {
                            myAccessCode = Convert.ToInt64(myFunctions.Rows[0][0].ToString());
                        }
                        else
                        {
                            myAccessCode = -1;
                        }
                        blnReadable   = ((myAccessCode & 0x01) == 0x01 ? true:false);
                        blnWritable   = ((myAccessCode & 0x02) == 0x02 ? true : false);
                        blnAddable    = ((myAccessCode & 0x04) == 0x04 ? true : false);
                        blnDeletable  = ((myAccessCode & 0x08) == 0x08 ? true : false);
                        blnDuplicable = ((myAccessCode & 0x10) == 0x10 ? true : false);
                        blnExportable = ((myAccessCode & 0x20) == 0x20 ? true : false);
                        blnImportable = ((myAccessCode & 0x40) == 0x40 ? true : false);
                        //TBD = ((myAccessCode & 0x80) == 0x80 ? true : false);

                        #region 原为判断Title>
                        //for (int i = 0; i < myFunctions.Rows.Count; i++)
                        //{
                        //    if (myFunctions.Rows[i]["Title"].ToString().ToUpper() == "Readable".ToUpper())
                        //    {
                        //        blnReadable = true;
                        //    }
                        //    else if (myFunctions.Rows[i]["Title"].ToString().ToUpper() == "Writable".ToUpper())
                        //    {
                        //        blnWritable = true;
                        //    }
                        //    else if (myFunctions.Rows[i]["Title"].ToString().ToUpper() == "Addable".ToUpper())
                        //    {
                        //        blnAddable = true;
                        //    }
                        //    else if (myFunctions.Rows[i]["Title"].ToString().ToUpper() == "Deletable".ToUpper())
                        //    {
                        //        blnDeletable = true;
                        //    }
                        //    else if (myFunctions.Rows[i]["Title"].ToString().ToUpper() == "Duplicable".ToUpper())
                        //    {
                        //        blnDuplicable = true;
                        //    }
                        //    else if (myFunctions.Rows[i]["Title"].ToString().ToUpper() == "Exportable".ToUpper())
                        //    {
                        //        blnExportable = true;
                        //    }
                        //    else if (myFunctions.Rows[i]["Title"].ToString().ToUpper() == "Importable".ToUpper())
                        //    {
                        //        blnImportable = true;
                        //    }
                        //}
                        #endregion

                        //140630_0 修改为读取sum(FunctionCode) 来体现,原为判断Title<<<<<<<<<<<<<<<<<<<
                        updateStutes(true, myInfo);
                    }

                    mySQL.OpenDatabase(false);
                }
                #endregion

                UserName         = this.txtUserID.Text;
                this.txtPWD.Text = "";
                this.Hide();

                PNInfo myPNInfo = new PNInfo();
                PNInfo.blnReadable   = blnReadable;
                PNInfo.blnWritable   = blnWritable;
                PNInfo.blnAddable    = blnAddable;
                PNInfo.blnDeletable  = blnDeletable;
                PNInfo.blnDuplicable = blnDuplicable;
                PNInfo.blnExportable = blnExportable;
                PNInfo.blnImportable = blnImportable;
                myPNInfo.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Exemple #8
0
        bool EditInfoForDT(DataTable mydt)
        {
            bool result = false;

            try
            {
                string    filterString = this.cboItemName.Text.ToString();
                DataRow[] myROWS       = mydt.Select("ItemName='" + filterString + "' and PID=" + PID + "");
                if (myROWS.Length == 1)
                {
                    if (this.blnAddNewModel)
                    {
                        MessageBox.Show("新增资料有误!请确认!!! 已有" + myROWS.Length + ("条记录; \n 条件--> ItemName='" + filterString + "' and PID=" + PID + ""));
                        return(result);
                    }
                    //无需编辑信息,固定值!
                    //myROWS[0]["ItemName"] = this.cboItemName.Text.ToString();
                    //myROWS[0]["AppModeID"] = this.cboAppModeID.Text.ToString();
                    myROWS[0]["EquipmentList"] = this.txtEquipLst.Text.ToString();
                    result = true;
                }
                else if (this.blnAddNewModel)
                {
                    string  MyNewSEQ = (PNInfo.getMAXColumnsItem(PNInfo.TopoToatlDS.Tables["TopoTestModel"], "SEQ", "PID=" + PID) + 1).ToString();
                    DataRow myNewRow = mydt.NewRow();
                    myNewRow.BeginEdit();
                    myNewRow["ID"]            = PNInfo.mylastIDTestModel + 1;
                    myNewRow["PID"]           = this.PID.ToString();
                    myNewRow["ItemName"]      = this.cboItemName.Text.ToString();
                    myNewRow["AppModeID"]     = this.cboAppModeID.Text.ToString();
                    myNewRow["EquipmentList"] = this.txtEquipLst.Text.ToString();
                    myNewRow["Seq"]           = MyNewSEQ;

                    mydt.Rows.Add(myNewRow);

                    myNewRow.EndEdit();
                    PNInfo.mylastIDTestModel++;
                    PNInfo.myAddCountTestModel++;

                    //RefreshList();
                    int myNewRowIndex = (currlst.Items.Count - 1);
                    if (!currlst.Enabled) //140529 新增TestModel后需要将其参数维护后才能选择!
                    {
                        currlst.Enabled = true;
                        currlst.Focus();
                        currlst.SelectedIndex = myNewRowIndex;
                    }
                    //blnAddNewModel = false;  //140530_1 //140703_2
                    result = true;
                }
                else
                {
                    MessageBox.Show("资料有误!请确认!!! 共有" + myROWS.Length + ("条记录; \n 条件--> ItemName='" + filterString + "' and PID=" + PID + ""));
                }
                return(result);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                return(result);
            }
        }
Exemple #9
0
        void getInfoFromDT(DataTable mydt, int currIndex)
        {
            try
            {
                string filterString = currlst.SelectedItem.ToString();
                long   GlobalPrmtrInfoPID;

                clearGlobalLst();
                clearCurrLst();

                string PIDString = PNInfo.getDTColumnInfo(PNInfo.GlobalTotalDS.Tables["GlobalAllTestModelList"], "ID", "ItemName='" + ItemName + "'");
                if (PIDString.Trim().Length > 0)
                {
                    GlobalPrmtrInfoPID = Convert.ToInt64(PIDString);
                    gerGlobalDTInfo("ItemName='" + filterString + "' and PID=" + GlobalPrmtrInfoPID); //先载入Global信息!
                }
                else
                {
                }

                DataRow[] myROWS = mydt.Select("ItemName='" + filterString + "' and PID=" + myPrmtrPID);
                if (myROWS.Length == 1)
                {
                    this.cboItemName.Items.Add(myROWS[0]["ItemName"].ToString());
                    this.cboItemType.Items.Add(myROWS[0]["ItemType"].ToString());
                    this.cboDirection.Items.Add(myROWS[0]["Direction"].ToString());
                    this.cboValue.Items.Add(myROWS[0]["ItemValue"].ToString());
                    this.cboLowLimit.Items.Add(myROWS[0]["DefaultLowLimit"].ToString());
                    this.cboUpperLimit.Items.Add(myROWS[0]["DefaultUpperLimit"].ToString());
                    this.cboSpecific.Items.Add(myROWS[0]["ItemSpecific"].ToString());
                    this.cboLogRecord.Items.Add(myROWS[0]["LogRecord"].ToString());
                    this.cboFailbreak.Items.Add(myROWS[0]["Failbreak"].ToString());
                    this.cboDataRecord.Items.Add(myROWS[0]["DataRecord"].ToString());
                }
                else
                {
                    if (blnAddNew)
                    {
                        //myNewID= PNInfo.mylastIDTestPrmtr + 1;
                    }
                    else
                    {
                        MessageBox.Show("未发现当前选择资料!请确认是否为新增的参数项目!!! 共有"
                                        + myROWS.Length + ("条记录; \n 条件--> ItemName='" + filterString + "' and PID=" + myPrmtrPID + ""));
                        //clearCurrLst();
                        //return;
                    }
                }
                if (this.cboItemName.Items.Count > 0)
                {
                    this.cboItemName.SelectedIndex   = this.cboItemName.Items.Count - 1;
                    this.cboItemType.SelectedIndex   = this.cboItemType.Items.Count - 1;
                    this.cboDirection.SelectedIndex  = this.cboDirection.Items.Count - 1;
                    this.cboValue.SelectedIndex      = this.cboValue.Items.Count - 1;
                    this.cboLowLimit.SelectedIndex   = this.cboLowLimit.Items.Count - 1;
                    this.cboUpperLimit.SelectedIndex = this.cboUpperLimit.Items.Count - 1;
                    this.cboSpecific.SelectedIndex   = this.cboSpecific.Items.Count - 1;
                    this.cboLogRecord.SelectedIndex  = this.cboLogRecord.Items.Count - 1;
                    this.cboFailbreak.SelectedIndex  = this.cboFailbreak.Items.Count - 1;
                    this.cboDataRecord.SelectedIndex = this.cboDataRecord.Items.Count - 1;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                clearGlobalLst();
                clearCurrLst();
                return;
            }
        }