コード例 #1
0
    private Boolean ValidateSaveField()
    {
        ISatellite SatelliteMgr = (ISatellite)ObjectFactory.CreateInstance("BusinessProcess.Administration.BSatellite, BusinessProcess.Administration");
        DataTable  theDT        = SatelliteMgr.GetSatelliteByID_Name(txtSatelliteID.Text, txtSatelliteName.Text);

        if (txtSatelliteID.Text == "")
        {
            MsgBuilder theBuilder = new MsgBuilder();
            theBuilder.DataElements["Control"] = "Satellite ID";
            IQCareMsgBox.Show("BlankTextBox", theBuilder, this);
            txtSatelliteID.Focus();
            return(false);
        }
        else if (txtSatelliteName.Text == "")
        {
            MsgBuilder theBuilder = new MsgBuilder();
            theBuilder.DataElements["Control"] = "Satellite Name";
            IQCareMsgBox.Show("BlankTextBox", theBuilder, this);
            txtSatelliteName.Focus();
            return(false);
        }
        else if (txtPriority.Text == "")
        {
            MsgBuilder theBuilder = new MsgBuilder();
            theBuilder.DataElements["Control"] = "Priority";
            IQCareMsgBox.Show("BlankTextBox", theBuilder, this);
            txtPriority.Focus();
            return(false);
        }
        if (theDT.Rows[0]["Exist"].ToString() == "1")
        {
            if ((txtSatelliteID.Text == theDT.Rows[0]["SatelliteID"].ToString()) && (txtSatelliteName.Text == theDT.Rows[0]["Name"].ToString()))
            {
                IQCareMsgBox.Show("SatelliteIDName", this);
                txtSatelliteID.Focus();
                return(false);
            }
            else if (txtSatelliteID.Text == theDT.Rows[0]["SatelliteID"].ToString())
            {
                IQCareMsgBox.Show("SatelliteID", this);
                txtSatelliteID.Focus();
                return(false);
            }
            else if (txtSatelliteName.Text == theDT.Rows[0]["Name"].ToString())
            {
                IQCareMsgBox.Show("SatelliteName", this);
                txtSatelliteName.Focus();
                return(false);
            }
        }
        return(true);
    }