//------------------------------------------
        #endregion

        #region --------------Save--------------

        public ExecuteCommandStatus Save(AdvPlacesEntity advPlaces, SPOperation operation)
        {
            using (SqlConnection myConnection = GetSqlConnection())
            {
                SqlCommand myCommand = new SqlCommand("AdvPlaces_Save", myConnection);
                myCommand.CommandType = CommandType.StoredProcedure;
                // Set the parameters
                //PlaceID
                myCommand.Parameters.Add("@SPOperation", SqlDbType.Int, 4).Value          = (int)operation;
                myCommand.Parameters.Add("@PlaceID", SqlDbType.Int, 4).Value              = advPlaces.PlaceID;
                myCommand.Parameters.Add("@PlaceIdentifier", SqlDbType.VarChar, 32).Value = advPlaces.PlaceIdentifier;
                myCommand.Parameters.Add("@Title", SqlDbType.NVarChar, 64).Value          = advPlaces.Title;
                myCommand.Parameters.Add("@Width", SqlDbType.Int, 4).Value  = advPlaces.Width;
                myCommand.Parameters.Add("@Height", SqlDbType.Int, 4).Value = advPlaces.Height;
                myCommand.Parameters.Add("@DefaultFilePath", SqlDbType.NVarChar, 128).Value = advPlaces.DefaultFilePath;
                myCommand.Parameters.Add("@DefaultFileType", SqlDbType.Int, 4).Value        = (AdsTypes)advPlaces.DefaultFileType;
                myCommand.Parameters.Add("@ActiveAdvertiseID", SqlDbType.Int, 4).Value      = advPlaces.ActiveAdvertiseID;
                myCommand.Parameters.Add("@IsRandom", SqlDbType.Bit, 1).Value             = advPlaces.IsRandom;
                myCommand.Parameters.Add("@EnableSeparatedAd", SqlDbType.Bit, 1).Value    = advPlaces.EnableSeparatedAd;
                myCommand.Parameters.Add("@EnableSeparatedCount", SqlDbType.Int, 4).Value = advPlaces.EnableSeparatedCount;
                myCommand.Parameters.Add("@PlaceType", SqlDbType.Int, 4).Value            = (int)advPlaces.PlaceType;
                // Execute the command
                myConnection.Open();
                ExecuteCommandStatus status = (ExecuteCommandStatus)myCommand.ExecuteScalar();
                myConnection.Close();
                return(status);
            }
        }
Esempio n. 2
0
        //------------------------------------------
        #endregion

        #region --------------Save--------------
        public bool Save(AdvertismentsEntity advertisments, SPOperation operation)
        {
            using (SqlConnection myConnection = GetSqlConnection())
            {
                SqlCommand myCommand = new SqlCommand("Advertisments_Save", myConnection);
                myCommand.CommandType = CommandType.StoredProcedure;
                // Set the parameters
                myCommand.Parameters.Add("@SPOperation", SqlDbType.Int, 4).Value = (int)operation;
                if (operation == SPOperation.Insert)
                {
                    myCommand.Parameters.Add("@AdvertiseID", SqlDbType.Int, 4).Direction = ParameterDirection.Output;
                }
                else
                {
                    myCommand.Parameters.Add("@AdvertiseID", SqlDbType.Int, 4).Value = advertisments.AdvertiseID;
                }

                myCommand.Parameters.Add("@PlaceID", SqlDbType.Int, 4).Value            = advertisments.PlaceID;
                myCommand.Parameters.Add("@Url", SqlDbType.NVarChar, 256).Value         = advertisments.Url;
                myCommand.Parameters.Add("@FileExtension", SqlDbType.VarChar, 50).Value = advertisments.FileExtension;
                myCommand.Parameters.Add("@FileType", SqlDbType.Int, 4).Value           = (int)advertisments.FileType;
                myCommand.Parameters.Add("@IsActive", SqlDbType.Bit, 1).Value           = advertisments.IsActive;
                myCommand.Parameters.Add("@Weight", SqlDbType.Int, 4).Value             = advertisments.Weight;
                myCommand.Parameters.Add("@MaxApperance", SqlDbType.Int, 4).Value       = advertisments.MaxApperance;
                myCommand.Parameters.Add("@MaxClicks", SqlDbType.Int, 4).Value          = advertisments.MaxClicks;
                myCommand.Parameters.Add("@ApperanceCount", SqlDbType.Int, 4).Value     = advertisments.ApperanceCount;
                myCommand.Parameters.Add("@ClicksCount", SqlDbType.Int, 4).Value        = advertisments.ClicksCount;
                myCommand.Parameters.Add("@Title", SqlDbType.NVarChar, 256).Value       = advertisments.Title;
                myCommand.Parameters.Add("@LangID", SqlDbType.Int, 4).Value             = (int)advertisments.LangID;
                myCommand.Parameters.Add("@IsSmall", SqlDbType.Bit).Value = (bool)advertisments.IsSmall;
                //----------------------------------------------------------------------------------
                myCommand.Parameters.Add("@OwnerID", SqlDbType.UniqueIdentifier).Value = advertisments.OwnerID;
                myCommand.Parameters.Add("@OwnerName", SqlDbType.VarChar).Value        = advertisments.OwnerName;
                //----------------------------------------------------------------------------------
                // Execute the command
                bool status = false;
                myConnection.Open();
                if (myCommand.ExecuteNonQuery() > 0)
                {
                    status = true;
                    //Get ID value from database and set it in object
                    advertisments.AdvertiseID = (int)myCommand.Parameters["@AdvertiseID"].Value;
                }
                myConnection.Close();
                return(status);
            }
        }
        //------------------------------------------
        #endregion

        #region --------------Save--------------
        public bool Save(VoteQuestionsEntity voteQuestions, SPOperation operation)
        {
            using (SqlConnection myConnection = GetSqlConnection())
            {
                SqlCommand myCommand = new SqlCommand("VoteQuestions_Save", myConnection);
                myCommand.CommandType = CommandType.StoredProcedure;
                // Set the parameters
                myCommand.Parameters.Add("@SPOperation", SqlDbType.Int, 4).Value = (int)operation;
                if (operation == SPOperation.Insert)
                {
                    myCommand.Parameters.Add("@QuesID", SqlDbType.Int, 4).Direction = ParameterDirection.Output;
                }
                else
                {
                    myCommand.Parameters.Add("@QuesID", SqlDbType.Int, 4).Value = voteQuestions.QuesID;
                }

                myCommand.Parameters.Add("@QuestionText", SqlDbType.NVarChar, 128).Value = voteQuestions.QuestionText;
                myCommand.Parameters.Add("@LangID", SqlDbType.Int).Value          = (int)voteQuestions.LangID;
                myCommand.Parameters.Add("@AnswersCount", SqlDbType.Int, 4).Value = voteQuestions.AnswersCount;
                myCommand.Parameters.Add("@IsMain", SqlDbType.Bit, 1).Value       = voteQuestions.IsMain;
                myCommand.Parameters.Add("@IsClosed", SqlDbType.Bit, 1).Value     = voteQuestions.IsClosed;
                //----------------------------------------------------------------------------------------------
                //OwnerID
                myCommand.Parameters.Add("@OwnerID", SqlDbType.UniqueIdentifier).Value = SitesHandler.GetOwnerIDAsGuid();
                //----------------------------------------------------------------------------------------------
                // Execute the command
                bool status = false;
                myConnection.Open();
                if (myCommand.ExecuteNonQuery() > 0)
                {
                    status = true;
                    //Get ID value from database and set it in object
                    voteQuestions.QuesID = (int)myCommand.Parameters["@QuesID"].Value;
                }
                myConnection.Close();
                return(status);
            }
        }
        //------------------------------------------
        #endregion

        #region --------------Save--------------

        public ExecuteCommandStatus Save(MailListGroupsEntity mailListGroups, SPOperation operation)
        {
            using (SqlConnection myConnection = GetSqlConnection())
            {
                SqlCommand myCommand = new SqlCommand("MailListGroups_Save", myConnection);
                myCommand.CommandType = CommandType.StoredProcedure;
                // Set the parameters
                //GroupID
                if (operation == SPOperation.Insert)
                {
                    myCommand.Parameters.Add("@GroupID", SqlDbType.Int, 4).Direction = ParameterDirection.Output;
                }
                else
                {
                    myCommand.Parameters.Add("@GroupID", SqlDbType.Int, 4).Value = mailListGroups.GroupID;
                }
                //SPOperation
                myCommand.Parameters.Add("@SPOperation", SqlDbType.Int, 4).Value = (int)operation;
                //Name
                myCommand.Parameters.Add("@Name", SqlDbType.NVarChar, 64).Value = mailListGroups.Name;
                //----------------------------------------------------------------------------------------------
                //OwnerID
                myCommand.Parameters.Add("@OwnerID", SqlDbType.UniqueIdentifier).Value = SitesHandler.GetOwnerIDAsGuid();
                //----------------------------------------------------------------------------------------------
                // Execute the command
                myConnection.Open();
                ExecuteCommandStatus status = (ExecuteCommandStatus)myCommand.ExecuteScalar();
                if (status == ExecuteCommandStatus.Done)
                {
                    //Get ID value from database and set it in object
                    mailListGroups.GroupID = (int)myCommand.Parameters["@GroupID"].Value;
                }
                myConnection.Close();
                return(status);
            }
        }
Esempio n. 5
0
 /*
  #region --------------Create--------------
  * /// <summary>
  * /// Creates AdvPlaces object by calling AdvPlaces data provider create method.
  * /// <example>[Example]bool status=AdvPlacesFactory.Create(advPlaces);.</example>
  * /// </summary>
  * /// <param name="advPlaces">The AdvPlaces object.</param>
  * /// <returns>Status of create operation.</returns>
  * public static bool Create(AdvPlacesEntity advPlaces)
  * {
  *  return AdvPlacesSqlDataPrvider.Instance.Create(advPlaces);
  * }
  * //------------------------------------------
  #endregion
  *
  #region --------------Update--------------
  * /// <summary>
  * /// Updates AdvPlaces object by calling AdvPlaces data provider update method.
  * /// <example>[Example]bool status=AdvPlacesFactory.Update(advPlaces);.</example>
  * /// </summary>
  * /// <param name="advPlaces">The AdvPlaces object.</param>
  * /// <returns>Status of update operation.</returns>
  * public static bool Update(AdvPlacesEntity advPlaces)
  * {
  *  bool status =AdvPlacesSqlDataPrvider.Instance.Update(advPlaces);
  *  if (status)
  *  {
  *      string cacheKey = GetChacheKey(advPlaces.PlaceID);
  *      OurCache.Remove(cacheKey);
  *  }
  *  return status;
  * }
  * //------------------------------------------
  #endregion
  */
 #region --------------Save--------------
 public static ExecuteCommandStatus Save(AdvPlacesEntity advPlaces, SPOperation operation)
 {
     return(AdvPlacesSqlDataPrvider.Instance.Save(advPlaces, operation));
 }
Esempio n. 6
0
 public static bool Save(VoteQuestionsEntity voteQuestions, SPOperation operation)
 {
     return(VoteQuestionsSqlDataPrvider.Instance.Save(voteQuestions, operation));
 }
Esempio n. 7
0
 public static ExecuteCommandStatus Save(MailListGroupsEntity mailListGroups, SPOperation operation)
 {
     return(MailListGroupsSqlDataPrvider.Instance.Save(mailListGroups, operation));
 }
        //------------------------------------------
        #endregion

        #region --------------SaveDetails--------------

        public ExecuteCommandStatus SaveDetails(SiteDeparmentsEntity siteDeparmentsObject, SPOperation operation)
        {
            Hashtable            siteDepartmentDetailsCollection = siteDeparmentsObject.Details;
            ExecuteCommandStatus status = ExecuteCommandStatus.UnknownError;

            using (SqlConnection myConnection = GetSqlConnection())
            {
                SqlCommand myCommand = new SqlCommand("SiteDeparmentsDetails_Save", myConnection);
                myCommand.CommandType = CommandType.StoredProcedure;
                // Set the parameters
                myCommand.Parameters.Add("@SPOperation", SqlDbType.Int, 4).Value = (int)operation;
                myCommand.Parameters.Add("@DepartmentID", SqlDbType.Int, 4);
                myCommand.Parameters.Add("@LangID", SqlDbType.Int);
                myCommand.Parameters.Add("@Title", SqlDbType.NVarChar, 128);
                myCommand.Parameters.Add("@ShortDescription", SqlDbType.NVarChar, 512);
                myCommand.Parameters.Add("@Description", SqlDbType.NVarChar);
                //----------------------
                myCommand.Parameters.Add("@ModuleTypeID", SqlDbType.Int, 4);
                myCommand.Parameters.Add("@ParentID", SqlDbType.Int, 4);
                //--------------------------------------------------------
                myCommand.Parameters.Add("@KeyWords", SqlDbType.NVarChar, 256);
                //--------------------------------------------------------
                // Execute the command
                myConnection.Open();
                foreach (DictionaryEntry key in siteDepartmentDetailsCollection)
                {
                    SiteDeparmentsDetailsEntity itemDetails = (SiteDeparmentsDetailsEntity)key.Value;
                    myCommand.Parameters["@DepartmentID"].Value     = siteDeparmentsObject.DepartmentID;
                    myCommand.Parameters["@LangID"].Value           = (int)itemDetails.LangID;
                    myCommand.Parameters["@Title"].Value            = itemDetails.Title;
                    myCommand.Parameters["@ShortDescription"].Value = itemDetails.ShortDescription;
                    myCommand.Parameters["@Description"].Value      = itemDetails.Description;
                    //
                    myCommand.Parameters["@ModuleTypeID"].Value = (int)siteDeparmentsObject.ModuleTypeID;
                    myCommand.Parameters["@ParentID"].Value     = siteDeparmentsObject.ParentID;
                    myCommand.Parameters["@KeyWords"].Value     = itemDetails.KeyWords;

                    status = (ExecuteCommandStatus)myCommand.ExecuteScalar();
                    if (status != ExecuteCommandStatus.Done)
                    {
                        break;
                    }
                }

                myConnection.Close();
                return(status);
            }
        }
Esempio n. 9
0
 public static bool Save(AdvertismentsEntity advertisment, SPOperation operation)
 {
     return(AdvertismentsSqlDataPrvider.Instance.Save(advertisment, operation));
 }