Exemple #1
0
        //-------------------------------------------------------------
        //  Transfers all of the database value to dbAdmin class.
        //
        //-------------------------------------------------------------
        public bool bLoadData(SqlDataReader sqlReader)
        {
            //---------------------------------------------------------
            // If there are no data to be loaded we return false
            // for the condition.
            //---------------------------------------------------------
            bool bReturn = false;

            while (sqlReader.Read() == true)
            {
                bReturn = true;

                //-----------------------------------------------------
                // Creating a new data node and initializing the members.
                //-----------------------------------------------------
                DBCampaignData Data = new DBCampaignData();

                int    iCount       = sqlReader.FieldCount;
                string strFieldName = "";
                int    i            = 0;
                for (i = 0; i < iCount; i++)
                {
                    //-------------------------------------------------
                    // Since some of the stored procedures do not bring back
                    // data from all of the columns we have to protect
                    // against this situation by checking the list of
                    // field names.
                    //-------------------------------------------------
                    strFieldName = sqlReader.GetName(i).ToString();


                    if (sqlReader["DateCreated"] != DBNull.Value)
                    {
                        Data.dtDateCreated = Convert.ToDateTime(sqlReader["DateCreated"]);
                    }
                    else
                    {
                        Data.dtDateCreated = DateTime.Today;
                    }

                    if (sqlReader["DateModified"] != DBNull.Value)
                    {
                        Data.dtDateModified = Convert.ToDateTime(sqlReader["DateModified"]);
                    }
                    else
                    {
                        Data.dtDateModified = DateTime.Today;
                    }

                    if (sqlReader["StartTime"] != DBNull.Value)
                    {
                        Data.dtStartTime = Convert.ToDateTime(sqlReader["StartTime"]);
                    }
                    else
                    {
                        Data.dtStartTime = DateTime.Today;
                    }

                    if (sqlReader["StopTime"] != DBNull.Value)
                    {
                        Data.dtStopTime = Convert.ToDateTime(sqlReader["StopTime"]);
                    }
                    else
                    {
                        Data.dtStopTime = DateTime.Today;
                    }



                    if (sqlReader["Allow7DigitNums"] != DBNull.Value)
                    {
                        Data.bAllow7DigitNums = Convert.ToBoolean(sqlReader["Allow7DigitNums"]);
                    }
                    else
                    {
                        Data.bAllow7DigitNums = false;
                    }

                    if (sqlReader["AllowDuplicatePhones"] != DBNull.Value)
                    {
                        Data.bAllowDuplicatePhones = Convert.ToBoolean(sqlReader["AllowDuplicatePhones"]);
                    }
                    else
                    {
                        Data.bAllowDuplicatePhones = false;
                    }

                    if (sqlReader["DialAllNumbers"] != DBNull.Value)
                    {
                        Data.bDialAllNumbers = Convert.ToBoolean(sqlReader["DialAllNumbers"]);
                    }
                    else
                    {
                        Data.bDialAllNumbers = false;
                    }

                    if (sqlReader["EnableAgentTraining"] != DBNull.Value)
                    {
                        Data.bEnableAgentTraining = Convert.ToBoolean(sqlReader["EnableAgentTraining"]);
                    }
                    else
                    {
                        Data.bEnableAgentTraining = false;
                    }

                    if (sqlReader["FlushCallQueueOnIdle"] != DBNull.Value)
                    {
                        Data.bFlushCallQueueOnIdle = Convert.ToBoolean(sqlReader["FlushCallQueueOnIdle"]);
                    }
                    else
                    {
                        Data.bFlushCallQueueOnIdle = false;
                    }

                    if (sqlReader["FundRaiserDataTracking"] != DBNull.Value)
                    {
                        Data.bFundRaiserDataTracking = Convert.ToBoolean(sqlReader["FundRaiserDataTracking"]);
                    }
                    else
                    {
                        Data.bFundRaiserDataTracking = false;
                    }

                    if (sqlReader["IsDeleted"] != DBNull.Value)
                    {
                        Data.bIsDeleted = Convert.ToBoolean(sqlReader["IsDeleted"]);
                    }
                    else
                    {
                        Data.bIsDeleted = false;
                    }


                    if (sqlReader["RecordLevelCallHistory"] != DBNull.Value)
                    {
                        Data.bRecordLevelCallHistory = Convert.ToBoolean(sqlReader["RecordLevelCallHistory"]);
                    }
                    else
                    {
                        Data.bRecordLevelCallHistory = false;
                    }


                    if (sqlReader["CampaignDBConnString"] != DBNull.Value)
                    {
                        Data.strCampaignDBConnString = sqlReader["CampaignDBConnString"].ToString();
                    }
                    else
                    {
                        Data.strCampaignDBConnString = "";
                    }

                    if (sqlReader["Description"] != DBNull.Value)
                    {
                        Data.strDescription = sqlReader["Description"].ToString();
                    }
                    else
                    {
                        Data.strDescription = "";
                    }

                    if (sqlReader["DuplicateRule"] != DBNull.Value)
                    {
                        Data.strDuplicateRule = sqlReader["DuplicateRule"].ToString();
                    }
                    else
                    {
                        Data.strDuplicateRule = "";
                    }

                    if (sqlReader["OutboundCallerID"] != DBNull.Value)
                    {
                        Data.strOutboundCallerID = sqlReader["OutboundCallerID"].ToString();
                    }
                    else
                    {
                        Data.strOutboundCallerID = "";
                    }

                    if (sqlReader["ShortDescription"] != DBNull.Value)
                    {
                        Data.strShortDescription = sqlReader["ShortDescription"].ToString();
                    }
                    else
                    {
                        Data.strShortDescription = "";
                    }

                    if (sqlReader["Allow10DigitNums"] != DBNull.Value)
                    {
                        Data.bAllow10DigitNums = Convert.ToBoolean(sqlReader["Allow10DigitNums"]);
                    }
                    else
                    {
                        Data.bAllow10DigitNums = false;
                    }

                    if (strFieldName == "CampaignID" && sqlReader["CampaignID"] != DBNull.Value)
                    {
                        Data.iCampaignID = Convert.ToInt64(sqlReader["CampaignID"]);
                    }

                    else if (strFieldName == "StatusID" && sqlReader["StatusID"] != DBNull.Value)
                    {
                        Data.iStatusID = Convert.ToInt64(sqlReader["StatusID"]);
                    }
                }

                DataList.Add(Data);
            }

            return(bReturn);
        }
Exemple #2
0
        //-------------------------------------------------------------
        //  Updates the Campaign table data.
        //
        //
        //-------------------------------------------------------------
        public bool bUpdate(DBCampaignData dbCampaignData)
        {
            bool     bReturn  = true;
            DBAccess dbAccess = Global.dbAccess;

            //----------------------------------------------------------
            // Create the Command and the Connection.
            //----------------------------------------------------------
            string strConnString = WebConfigurationManager.ConnectionStrings["RainmakerMasterConnectionString"].ConnectionString;

            SqlConnection con = new SqlConnection(strConnString);

            string strSQL = "pCampaign_Update ";

            strSQL = dbAccess.AddParamToSQLCmd(strSQL, "@CampaignDBConnString ", dbCampaignData.strCampaignDBConnString, SqlDbType.VarChar, false, null);
            strSQL = dbAccess.AddParamToSQLCmd(strSQL, "@Description          ", dbCampaignData.strDescription, SqlDbType.VarChar, false, null);
            strSQL = dbAccess.AddParamToSQLCmd(strSQL, "@DuplicateRule        ", dbCampaignData.strDuplicateRule, SqlDbType.VarChar, false, null);
            strSQL = dbAccess.AddParamToSQLCmd(strSQL, "@OutboundCallerID     ", dbCampaignData.strOutboundCallerID, SqlDbType.VarChar, false, null);
            strSQL = dbAccess.AddParamToSQLCmd(strSQL, "@ShortDescription     ", dbCampaignData.strShortDescription, SqlDbType.VarChar, false, null);

            strSQL = dbAccess.AddParamToSQLCmd(strSQL, "@iCampaignID          ", dbCampaignData.iCampaignID, SqlDbType.Int, false, null);
            strSQL = dbAccess.AddParamToSQLCmd(strSQL, "@iStatusID            ", dbCampaignData.iStatusID, SqlDbType.Int, false, null);

            if (dbCampaignData.bAllow7DigitNums == false)
            {
                strSQL = dbAccess.AddParamToSQLCmd(strSQL, "@Allow7DigitNums   ", 1, SqlDbType.Bit, false, null);
            }
            else
            {
                strSQL = dbAccess.AddParamToSQLCmd(strSQL, "@Allow7DigitNums   ", 0, SqlDbType.Bit, false, null);
            }


            if (dbCampaignData.bAllowDuplicatePhones == false)
            {
                strSQL = dbAccess.AddParamToSQLCmd(strSQL, "@AllowDuplicatePhones   ", 1, SqlDbType.Bit, false, null);
            }
            else
            {
                strSQL = dbAccess.AddParamToSQLCmd(strSQL, "@AllowDuplicatePhones   ", 0, SqlDbType.Bit, false, null);
            }

            if (dbCampaignData.bDialAllNumbers == false)
            {
                strSQL = dbAccess.AddParamToSQLCmd(strSQL, "@DialAllNumbers   ", 1, SqlDbType.Bit, false, null);
            }
            else
            {
                strSQL = dbAccess.AddParamToSQLCmd(strSQL, "@DialAllNumbers   ", 0, SqlDbType.Bit, false, null);
            }

            if (dbCampaignData.bEnableAgentTraining == false)
            {
                strSQL = dbAccess.AddParamToSQLCmd(strSQL, "@EnableAgentTraining   ", 1, SqlDbType.Bit, false, null);
            }
            else
            {
                strSQL = dbAccess.AddParamToSQLCmd(strSQL, "@EnableAgentTraining   ", 0, SqlDbType.Bit, false, null);
            }

            if (dbCampaignData.bFlushCallQueueOnIdle == false)
            {
                strSQL = dbAccess.AddParamToSQLCmd(strSQL, "@FlushCallQueueOnIdle   ", 1, SqlDbType.Bit, false, null);
            }
            else
            {
                strSQL = dbAccess.AddParamToSQLCmd(strSQL, "@FlushCallQueueOnIdle   ", 0, SqlDbType.Bit, false, null);
            }

            if (dbCampaignData.bFundRaiserDataTracking == false)
            {
                strSQL = dbAccess.AddParamToSQLCmd(strSQL, "@FundRaiserDataTracking   ", 1, SqlDbType.Bit, false, null);
            }
            else
            {
                strSQL = dbAccess.AddParamToSQLCmd(strSQL, "@FundRaiserDataTracking   ", 0, SqlDbType.Bit, false, null);
            }

            if (dbCampaignData.bIsDeleted == false)
            {
                strSQL = dbAccess.AddParamToSQLCmd(strSQL, "@IsDeleted   ", 1, SqlDbType.Bit, false, null);
            }
            else
            {
                strSQL = dbAccess.AddParamToSQLCmd(strSQL, "@IsDeleted   ", 0, SqlDbType.Bit, false, null);
            }

            if (dbCampaignData.bOnsiteTransfer == false)
            {
                strSQL = dbAccess.AddParamToSQLCmd(strSQL, "@OnsiteTransfer   ", 1, SqlDbType.Bit, false, null);
            }
            else
            {
                strSQL = dbAccess.AddParamToSQLCmd(strSQL, "@OnsiteTransfer   ", 0, SqlDbType.Bit, false, null);
            }

            if (dbCampaignData.bRecordLevelCallHistory == false)
            {
                strSQL = dbAccess.AddParamToSQLCmd(strSQL, "@RecordLevelCallHistory   ", 1, SqlDbType.Bit, false, null);
            }
            else
            {
                strSQL = dbAccess.AddParamToSQLCmd(strSQL, "@RecordLevelCallHistory   ", 0, SqlDbType.Bit, false, null);
            }

            if (dbCampaignData.bAllow10DigitNums == false)
            {
                strSQL = dbAccess.AddParamToSQLCmd(strSQL, "@Allow10DigitNums   ", 1, SqlDbType.Bit, false, null);
            }
            else
            {
                strSQL = dbAccess.AddParamToSQLCmd(strSQL, "@Allow10DigitNums   ", 0, SqlDbType.Bit, false, null);
            }

            strSQL = dbAccess.AddParamToSQLCmd(strSQL, "@DateCreated", dbCampaignData.dtDateCreated, SqlDbType.DateTime, false, null);
            strSQL = dbAccess.AddParamToSQLCmd(strSQL, "@DateModified", dbCampaignData.dtDateModified, SqlDbType.DateTime, false, null);
            strSQL = dbAccess.AddParamToSQLCmd(strSQL, "@StartTime", dbCampaignData.dtStartTime, SqlDbType.DateTime, false, null);
            strSQL = dbAccess.AddParamToSQLCmd(strSQL, "@StopTime", dbCampaignData.dtStopTime, SqlDbType.DateTime, true, null);

            try
            {
                SqlCommand cmd = new SqlCommand(strSQL, con);

                //-------------------------------------------------------
                // Open the Connection and get the DataReader.
                //-------------------------------------------------------
                con.Open();
                cmd.ExecuteNonQuery();
            }
            catch
            {
                bReturn = false;
            };

            con.Close();

            return(bReturn);
        }