示例#1
0
        private bool EditPhase()
        {
            bool bResult = false;

            Int32 iChangeStatusResult = 0;

            iChangeStatusResult = OVRDataBaseUtils.ChangePhaseStatus(m_iPhaseID, ConvertStrToInt(CmbStatus.SelectedValue.ToString()), m_DatabaseConnection, m_Module);
            if (iChangeStatusResult != 1)
            {
                switch (iChangeStatusResult)
                {
                case -1:
                    DevComponents.DotNetBar.MessageBoxEx.Show(LocalizationRecourceManager.GetString(m_strSectionName, "MsgEditPhaseStatus2"));
                    break;

                case -2:
                    DevComponents.DotNetBar.MessageBoxEx.Show(LocalizationRecourceManager.GetString(m_strSectionName, "MsgEditPhaseStatus3"));
                    break;

                default:    //其余的需要为修改失败!
                    DevComponents.DotNetBar.MessageBoxEx.Show(LocalizationRecourceManager.GetString(m_strSectionName, "MsgEditPhaseStatus1"));
                    break;
                }
                return(bResult);
            }

            try
            {
                Int32      iOperateResult;
                SqlCommand oneSqlCommand = new SqlCommand();
                oneSqlCommand.Connection  = m_DatabaseConnection;
                oneSqlCommand.CommandText = "Proc_EditPhase";
                oneSqlCommand.CommandType = CommandType.StoredProcedure;

                SqlParameter cmdParameter0 = new SqlParameter(
                    "@PhaseID", SqlDbType.Int, 4,
                    ParameterDirection.Input, true, 0, 0, "",
                    DataRowVersion.Current, m_iPhaseID);
                oneSqlCommand.Parameters.Add(cmdParameter0);

                SqlParameter cmdParameter1 = new SqlParameter(
                    "@EventID", SqlDbType.Int, 4,
                    ParameterDirection.Input, true, 0, 0, "",
                    DataRowVersion.Current, m_iEventID);
                oneSqlCommand.Parameters.Add(cmdParameter1);

                SqlParameter cmdParameter2 = new SqlParameter(
                    "@FatherPhaseID", SqlDbType.Int, 4,
                    ParameterDirection.Input, true, 0, 0, "",
                    DataRowVersion.Current, m_iFatherPhaseID);
                oneSqlCommand.Parameters.Add(cmdParameter2);

                SqlParameter cmdParameter3 = new SqlParameter(
                    "@PhaseCode", SqlDbType.NVarChar, 10,
                    ParameterDirection.Input, true, 0, 0, "",
                    DataRowVersion.Current, TextCode.Text);
                oneSqlCommand.Parameters.Add(cmdParameter3);

                SqlParameter cmdParameter4 = new SqlParameter(
                    "@OpenDate", SqlDbType.NVarChar, 16,
                    ParameterDirection.Input, true, 0, 0, "",
                    DataRowVersion.Current, DateStart.Text);
                oneSqlCommand.Parameters.Add(cmdParameter4);

                SqlParameter cmdParameter5 = new SqlParameter(
                    "@CloseDate", SqlDbType.NVarChar, 16,
                    ParameterDirection.Input, true, 0, 0, "",
                    DataRowVersion.Current, DateEnd.Text);
                oneSqlCommand.Parameters.Add(cmdParameter5);

                SqlParameter cmdParameter8 = new SqlParameter(
                    "@Order", SqlDbType.Int, 4,
                    ParameterDirection.Input, true, 0, 0, "",
                    DataRowVersion.Current, ConvertStrToInt(TextOrder.Text));
                oneSqlCommand.Parameters.Add(cmdParameter8);

                SqlParameter cmdParameter9 = new SqlParameter(
                    "@IsPool", SqlDbType.Int, 4,
                    ParameterDirection.Input, true, 0, 0, "",
                    DataRowVersion.Current, ConvertStrToInt(textIsPool.Text));
                oneSqlCommand.Parameters.Add(cmdParameter9);

                SqlParameter cmdParameter10 = new SqlParameter(
                    "@HasPools", SqlDbType.Int, 4,
                    ParameterDirection.Input, true, 0, 0, "",
                    DataRowVersion.Current, ConvertStrToInt(textHasPools.Text));
                oneSqlCommand.Parameters.Add(cmdParameter10);

                SqlParameter cmdParameter11 = new SqlParameter(
                    "@StatusID", SqlDbType.Int, 4,
                    ParameterDirection.Input, true, 0, 0, "",
                    DataRowVersion.Current, ConvertStrToInt(CmbStatus.SelectedValue.ToString()));
                oneSqlCommand.Parameters.Add(cmdParameter11);

                SqlParameter cmdParameter13 = new SqlParameter(
                    "@PhaseInfo", SqlDbType.NVarChar, 50,
                    ParameterDirection.Input, true, 0, 0, "",
                    DataRowVersion.Current, "");
                oneSqlCommand.Parameters.Add(cmdParameter13);

                SqlParameter cmdParameter14 = new SqlParameter(
                    "@languageCode", SqlDbType.Char, 3,
                    ParameterDirection.Input, true, 0, 0, "",
                    DataRowVersion.Current, m_strLanguageCode);
                oneSqlCommand.Parameters.Add(cmdParameter14);

                SqlParameter cmdParameter15 = new SqlParameter(
                    "@PhaseLongName", SqlDbType.NVarChar, 100,
                    ParameterDirection.Input, true, 0, 0, "",
                    DataRowVersion.Current, TextLongName.Text);
                oneSqlCommand.Parameters.Add(cmdParameter15);

                SqlParameter cmdParameter16 = new SqlParameter(
                    "@PhaseShortName", SqlDbType.NVarChar, 50,
                    ParameterDirection.Input, true, 0, 0, "",
                    DataRowVersion.Current, TextShortName.Text);
                oneSqlCommand.Parameters.Add(cmdParameter16);

                SqlParameter cmdParameter17 = new SqlParameter(
                    "@PhaseComment", SqlDbType.NVarChar, 100,
                    ParameterDirection.Input, true, 0, 0, "",
                    DataRowVersion.Current, TextComment.Text);
                oneSqlCommand.Parameters.Add(cmdParameter17);

                SqlParameter cmdParameterResult = new SqlParameter(
                    "@Result", SqlDbType.Int, 4,
                    ParameterDirection.Output, true, 0, 0, "",
                    DataRowVersion.Current, 0);

                oneSqlCommand.Parameters.Add(cmdParameterResult);

                if (m_DatabaseConnection.State == System.Data.ConnectionState.Closed)
                {
                    m_DatabaseConnection.Open();
                }

                if (oneSqlCommand.ExecuteNonQuery() != 0)
                {
                    iOperateResult = (Int32)cmdParameterResult.Value;
                    switch (iOperateResult)
                    {
                    case 0:
                        DevComponents.DotNetBar.MessageBoxEx.Show(LocalizationRecourceManager.GetString(m_strSectionName, "MsgEditPhase1"));
                        bResult = false;
                        break;

                    case 1:    //修改成功!
                        if (m_strIniPhaseCode != TextCode.Text || m_strIniDateStart != DateStart.Text ||
                            m_strIniDateEnd != DateEnd.Text || m_strIniOrder != TextOrder.Text ||
                            m_strIniIsPool != textIsPool.Text || m_strIniHasPool != textHasPools.Text ||
                            m_strIniLongName != TextLongName.Text || m_strIniShortName != TextShortName.Text ||
                            m_strIniComment != TextComment.Text)
                        {
                            m_bIsInfoChanged = true;
                        }

                        if (m_strSectionName != CmbStatus.SelectedValue.ToString())
                        {
                            m_bIsStatusChanged = true;
                        }
                        bResult = true;
                        break;

                    case -1:
                        DevComponents.DotNetBar.MessageBoxEx.Show(LocalizationRecourceManager.GetString(m_strSectionName, "MsgEditPhase2"));
                        bResult = false;
                        break;

                    default:    //其余的需要为修改失败!
                        bResult = false;
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                DevComponents.DotNetBar.MessageBoxEx.Show(ex.Message);
            }

            return(bResult);
        }