//------------------------------------------
        #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);
            }
        }
        public SiteDeparmentsEntity GetSiteDeparmentsObject(int departmentID, Languages langID)
        {
            SiteDeparmentsEntity siteDeparmentsObject = null;

            using (SqlConnection myConnection = GetSqlConnection())
            {
                SqlCommand myCommand = new SqlCommand("SiteDeparments_GetOneByID", myConnection);
                myCommand.CommandType = CommandType.StoredProcedure;
                // Set the parameters
                myCommand.Parameters.Add("@DepartmentID", SqlDbType.Int, 4).Value = departmentID;
                myCommand.Parameters.Add("@LangID", SqlDbType.Int, 4).Value       = (int)langID;
                //----------------------------------------------------------------
                myCommand.Parameters.Add("@OwnerID", SqlDbType.UniqueIdentifier).Value = SitesHandler.GetOwnerIDAsGuid();
                //----------------------------------------------------------------
                // Execute the command
                myConnection.Open();
                using (SqlDataReader dr = myCommand.ExecuteReader(CommandBehavior.CloseConnection))
                {
                    while (dr.Read())
                    {
                        if (siteDeparmentsObject == null)
                        {
                            /* siteDeparmentsObject = PopulateSiteDeparmentsEntity(dr);
                             * SiteDeparmentsDetailsEntity pd = PopulateSiteDeparmentsDetailsEntity(dr);
                             */
                            siteDeparmentsObject = (SiteDeparmentsEntity)GetEntity(dr, typeof(SiteDeparmentsEntity));
                            SiteDeparmentsDetailsEntity pd = (SiteDeparmentsDetailsEntity)GetEntity(dr, typeof(SiteDeparmentsDetailsEntity));
                            siteDeparmentsObject.Details[pd.LangID] = pd;
                        }
                        else
                        {
                            //SiteDeparmentsDetailsEntity pd = PopulateSiteDeparmentsDetailsEntity(dr);
                            SiteDeparmentsDetailsEntity pd = (SiteDeparmentsDetailsEntity)GetEntity(dr, typeof(SiteDeparmentsDetailsEntity));
                            siteDeparmentsObject.Details[pd.LangID] = pd;
                        }
                    }
                    dr.Close();
                }

                myConnection.Close();
                return(siteDeparmentsObject);
            }
        }