Exemple #1
0
 public List <ItemCategoriesEntity> GetFullPath(int categoryID, Languages langID)
 {
     using (SqlConnection myConnection = GetSqlConnection())
     {
         List <ItemCategoriesEntity> itemCategoriesList   = new List <ItemCategoriesEntity>();
         ItemCategoriesEntity        itemCategoriesObject = null;
         SqlCommand myCommand = new SqlCommand("ItemCategories_GetFullPath", myConnection);
         myCommand.CommandType = CommandType.StoredProcedure;
         // Set the parameters
         myCommand.Parameters.Add("@CategoryID", SqlDbType.Int, 4).Value = categoryID;
         myCommand.Parameters.Add("@LangID", SqlDbType.Int, 4).Value     = (int)langID;
         //----------------------------------------------------------------
         // Execute the command
         SqlDataReader dr;
         myConnection.Open();
         dr = myCommand.ExecuteReader(CommandBehavior.CloseConnection);
         while (dr.Read())
         {
             //itemCategoriesObject = PopulateItemCategoriesEntity(dr);
             itemCategoriesObject = (ItemCategoriesEntity)GetEntity(dr, typeof(ItemCategoriesEntity));
             itemCategoriesList.Add(itemCategoriesObject);
         }
         dr.Close();
         myConnection.Close();
         //Gets result rows count
         return(itemCategoriesList);
         //----------------------------------------------------------------
     }
 }
Exemple #2
0
        /// <summary>
        /// Creates ItemCategories object by calling ItemCategories data provider create method.
        /// <example>[Example]bool status=ItemCategoriesFactory.Create(itemCategoriesObject);.</example>
        /// </summary>
        /// <param name="itemCategoriesObject">The ItemCategories object.</param>
        /// <returns>Status of create operation.</returns>
        public static ExecuteCommandStatus Create(ItemCategoriesEntity category, ItemsModulesOptions currentModule)
        {
            //Insert user name------------------------------------------
            string username = "";

            if (HttpContext.Current.User.Identity.IsAuthenticated)
            {
                username = HttpContext.Current.User.Identity.Name;
                category.InsertUserName = username;
            }
            //----------------------------------------------------------
            ExecuteCommandStatus status = ItemCategoriesSqlDataPrvider.Instance.Create(category, currentModule);

            //-------------------------------------
            if (status == ExecuteCommandStatus.Done)
            {
                string folder             = DCSiteUrls.GetPath_ItemCategoriesDirectory(category.OwnerName, category.ModuleTypeID, category.CategoryID);
                string folderPhysicalPath = DCServer.MapPath(folder);
                if (!Directory.Exists(folderPhysicalPath))
                {
                    string        defaultFolder             = DCSiteUrls.GetPath_DefaultCategoryFolder();
                    string        defaultFolderPhysicalPath = DCServer.MapPath(defaultFolder);
                    DirectoryInfo diSource = new DirectoryInfo(defaultFolderPhysicalPath);
                    DirectoryInfo diTarget = new DirectoryInfo(folderPhysicalPath);
                    DcDirectoryManager.CopyAll(diSource, diTarget);
                }
            }
            //-------------------------------------
            return(status);
        }
Exemple #3
0
        //------------------------------------------
        #endregion

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

        public ExecuteCommandStatus SaveDetails(ItemCategoriesEntity itemCategoriesObject, bool AllowDublicateTitlesInCategories, SPOperation operation)
        {
            Hashtable            categoryDetailsCollection = itemCategoriesObject.Details;
            ExecuteCommandStatus status = ExecuteCommandStatus.UnknownError;

            using (SqlConnection myConnection = GetSqlConnection())
            {
                SqlCommand myCommand = new SqlCommand("ItemCategoriesDetails_Save", myConnection);
                myCommand.CommandType = CommandType.StoredProcedure;
                // Set the parameters
                myCommand.Parameters.Add("@SPOperation", SqlDbType.Int, 4).Value = (int)operation;
                myCommand.Parameters.Add("@CategoryID", 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("@AllowDublicateTitlesInCategories", SqlDbType.Bit, 1);
                //--------------------------------------------------------
                myCommand.Parameters.Add("@KeyWords", SqlDbType.NVarChar, 256);
                //--------------------------------------------------------
                // Execute the command
                myConnection.Open();
                foreach (DictionaryEntry key in categoryDetailsCollection)
                {
                    ItemCategoriesDetailsEntity itemDetails = (ItemCategoriesDetailsEntity)key.Value;
                    myCommand.Parameters["@CategoryID"].Value       = itemCategoriesObject.CategoryID;
                    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)itemCategoriesObject.ModuleTypeID;
                    myCommand.Parameters["@ParentID"].Value     = itemCategoriesObject.ParentID;
                    myCommand.Parameters["@AllowDublicateTitlesInCategories"].Value = AllowDublicateTitlesInCategories;
                    //--------------------------------------------------------
                    myCommand.Parameters["@KeyWords"].Value = itemDetails.KeyWords;
                    //--------------------------------------------------------
                    status = (ExecuteCommandStatus)myCommand.ExecuteScalar();
                    if (status != ExecuteCommandStatus.Done)
                    {
                        break;
                    }
                }

                myConnection.Close();
                return(status);
            }
        }
Exemple #4
0
        //------------------------------------------
        #endregion

        #region --------------Update--------------
        /// <summary>
        /// Updates ItemCategories object by calling ItemCategories data provider update method.
        /// <example>[Example]bool status=ItemCategoriesFactory.Update(itemCategoriesObject);.</example>
        /// </summary>
        /// <param name="itemCategoriesObject">The ItemCategories object.</param>
        /// <returns>Status of update operation.</returns>
        public static ExecuteCommandStatus Update(ItemCategoriesEntity category, ItemsModulesOptions currentModule)
        {
            //Update user name------------------------------------------
            string username = "";

            if (HttpContext.Current.User.Identity.IsAuthenticated)
            {
                username = HttpContext.Current.User.Identity.Name;
                category.LastUpdateUserName = username;
            }
            //----------------------------------------------------------
            ExecuteCommandStatus status = ItemCategoriesSqlDataPrvider.Instance.Update(category, currentModule);

            return(status);
        }
Exemple #5
0
        public static void AddToCart(int itemID, ref ItemsEntity item, ref ItemCategoriesEntity category)
        {
            Guid OwnerID = SitesHandler.GetOwnerIDAsGuid();
            //---------------------------------------------------------
            Languages langID = SiteSettings.GetCurrentLanguage();

            if (item == null)
            {
                item = ItemsFactory.GetObject(itemID, langID, UsersTypes.User, OwnerID);
            }
            if (category == null)
            {
                category = ItemCategoriesFactory.GetObject(item.CategoryID, langID, OwnerID);
            }

            if (item != null && category != null)
            {
                List <ItemsOrdersDetailsModel> CartList = GetCartList();
                //---------------------------------------------------------
                bool existIntoCart = false;
                foreach (ItemsOrdersDetailsModel p in CartList)
                {
                    if (p.ItemID == itemID)
                    {
                        p.Quantity   += 1;
                        existIntoCart = true;
                        break;
                    }
                }
                if (!existIntoCart)
                {
                    ItemsOrdersDetailsModel newP = new ItemsOrdersDetailsModel();
                    newP.ItemID   = itemID;
                    newP.Quantity = 1;
                    CartList.Add(newP);
                }
                //---------------------------------------------------------
                //Session["Cart"] = CartList;
            }
        }
Exemple #6
0
        //----------------------------------------------------------------------------
        #endregion



        #region --------------------------SetMetaTags----------------------------
        //----------------------------------------------------------------------------
        //SetMetaTags
        //----------------------------------------------------------------------------
        public static void SetMetaTags(ItemCategoriesEntity category)
        {
            DCMetaBuilder metaBuilder = DCMetaBuilder.Instance;

            //------------------------------------------------------------
            metaBuilder.Title = category.Title;
            //------------------------------------------------------------
            if (!string.IsNullOrEmpty(category.KeyWords))
            {
                metaBuilder.Keywords = category.KeyWords;
            }
            //------------------------------------------------------------
            if (!string.IsNullOrEmpty(category.ShortDescription))
            {
                metaBuilder.Description = category.ShortDescription;
            }
            //------------------------------------------------------------
            metaBuilder.SubSection = category.Title;
            //------------------------------------------------------------
            metaBuilder.LastModification = category.LastModification.ToUniversalTime().ToString();
            //------------------------------------------------------------
        }
Exemple #7
0
        //------------------------------------------
        #endregion

        #region --------------Delete--------------
        /// <summary>
        /// Deletes single ItemCategories object .
        /// <example>[Example]bool status=ItemCategoriesFactory.Delete(categoryID);.</example>
        /// </summary>
        /// <param name="categoryID">The itemCategoriesObject id.</param>
        /// <returns>Status of delete operation.</returns>
        public static bool Delete(int CategoryID)
        {
            Languages            langID   = SiteSettings.GetCurrentLanguage();
            ItemCategoriesEntity category = GetObject(CategoryID, langID, SitesHandler.GetOwnerIDAsGuid());
            bool status = ItemCategoriesSqlDataPrvider.Instance.Delete(CategoryID);

            if (status)
            {
                //-------------------------------------
                //delete category folder
                //-------------------------------------
                string folder             = DCSiteUrls.GetPath_ItemCategoriesDirectory(category.OwnerName, category.ModuleTypeID, category.CategoryID);
                string folderPhysicalPath = DCServer.MapPath(folder);
                if (Directory.Exists(folderPhysicalPath))
                {
                    DirectoryInfo dir = new DirectoryInfo(folderPhysicalPath);
                    DcDirectoryManager.DeletDirectory(dir);
                }
                //-------------------------------------
            }
            return(status);
        }
Exemple #8
0
        public ItemCategoriesEntity GetItemCategoriesObject(int categoryID, Languages langID, Guid OwnerID)
        {
            ItemCategoriesEntity itemCategoriesObject = null;

            using (SqlConnection myConnection = GetSqlConnection())
            {
                SqlCommand myCommand = new SqlCommand("ItemCategories_GetOneByID", myConnection);
                myCommand.CommandType = CommandType.StoredProcedure;
                // Set the parameters
                myCommand.Parameters.Add("@CategoryID", SqlDbType.Int, 4).Value = categoryID;
                myCommand.Parameters.Add("@LangID", SqlDbType.Int, 4).Value     = (int)langID;
                //---------------------------------------------------------------------
                myCommand.Parameters.Add("@OwnerID", SqlDbType.UniqueIdentifier).Value = OwnerID;
                //---------------------------------------------------------------------
                // Execute the command
                myConnection.Open();
                using (SqlDataReader dr = myCommand.ExecuteReader(CommandBehavior.CloseConnection))
                {
                    while (dr.Read())
                    {
                        if (itemCategoriesObject == null)
                        {
                            itemCategoriesObject = (ItemCategoriesEntity)GetEntity(dr, typeof(ItemCategoriesEntity));
                            ItemCategoriesDetailsEntity pd = (ItemCategoriesDetailsEntity)GetEntity(dr, typeof(ItemCategoriesDetailsEntity));
                            itemCategoriesObject.Details[pd.LangID] = pd;
                        }
                        else
                        {
                            ItemCategoriesDetailsEntity pd = (ItemCategoriesDetailsEntity)GetEntity(dr, typeof(ItemCategoriesDetailsEntity));
                            itemCategoriesObject.Details[pd.LangID] = pd;
                        }
                    }
                    dr.Close();
                }

                myConnection.Close();
                return(itemCategoriesObject);
            }
        }
Exemple #9
0
        //---------------------------------------------------------
        //BuildCategoriesPathLinksInSubFolder
        //---------------------------------------------------------
        public bool BuildCategoriesPathLinksInSubFolder(int categoryID, bool lastLink, bool setTags)
        {
            bool hasLinks = false;

            if (categoryID > 0)
            {
                List <ItemCategoriesEntity> cdp = ItemCategoriesFactory.GetFullPath(categoryID);
                if (cdp.Count > 0)
                {
                    hasLinks = true;
                    ItemCategoriesEntity lastCat       = null;
                    ItemsModulesOptions  currentModule = ItemsModulesOptions.GetType(cdp[0].ModuleTypeID);
                    string url = "";
                    for (int i = 0; i < cdp.Count; i++)
                    {
                        if (lastLink && i == cdp.Count - 1)
                        {
                            lastCat = cdp[i];
                            _PathControl.AddLink(lastCat.Title, null);
                            if (setTags)
                            {
                                DCMetaBuilder metaBuilder = DCMetaBuilder.Instance;
                                metaBuilder.SubSection = lastCat.Title;
                                metaBuilder.Title      = lastCat.Title;
                            }
                        }
                        else
                        {
                            //url = "../default.aspx?id=" + cdp[i].CategoryID;
                            DCSiteUrls.Instance.BuildItemCategoriesLink(cdp[i].CategoryID, cdp[i].Title, currentModule);
                            _PathControl.AddLink(cdp[i].Title, url);
                        }
                    }
                }
            }
            return(hasLinks);
        }
Exemple #10
0
        //-------------------------------------------------------

        public void InitializeAllOpjects()
        {
            #region Initial lItem
            InitialItem = new ItemsEntity();
            //InitialItem.CategoryID = xxxx;
            //InitialItem.ItemID
            //InitialItem.CategoryID
            //InitialItem.ModuleTypeID = moduleType;
            //InitialItem.PhotoExtension
            InitialItem.Url             = Url;
            InitialItem.Email           = Email;
            InitialItem.MailBox         = MailBox;
            InitialItem.ZipCode         = ZipCode;
            InitialItem.Tels            = Tels;
            InitialItem.Fax             = Fax;
            InitialItem.Mobile          = Mobile;
            InitialItem.ItemDate        = ItemDate;
            InitialItem.ItemEndDate     = ItemEndDate;
            InitialItem.IsAvailable     = IsAvailable;
            InitialItem.YoutubeCode     = YoutubeCode;
            InitialItem.GoogleLatitude  = GoogleLatitude;
            InitialItem.GoogleLongitude = GoogleLongitude;
            InitialItem.Price           = Price;

            /*
             * InitialItem.SenderName
             * InitialItem.SenderEMail
             * InitialItem.SenderCountryID
             * InitialItem.Reply
             * InitialItem.ReplyDate
             * InitialItem.IsSeen
             * InitialItem.IsReplied
             * InitialItem.IsReviewed
             * InitialItem.ToUserID
             * InitialItem.ActivatedBy
             * InitialItem.ReviewedBy
             * InitialItem.OwnerID	*/
            InitialItem.Type = Type;
            #endregion
            #region InitialItemArDetails
            InitialItemArDetails = new ItemsDetailsEntity();
            //InitialItemArDetails.ItemID = InitialItem.ItemID;
            InitialItemArDetails.LangID           = Languages.Ar;
            InitialItemArDetails.Title            = ArItemTitle;
            InitialItemArDetails.ShortDescription = ArItemShortDescrpyion;
            InitialItemArDetails.Description      = ArItemDetails;
            InitialItemArDetails.KeyWords         = ArItemSeoKeyWords;
            InitialItemArDetails.Address          = ArItemAddress;
            InitialItemArDetails.AuthorName       = ArItemAuthorName;
            #endregion
            #region InitialItemArDetails

            InitialItemEnDetails = new ItemsDetailsEntity();
            //InitialItemEnDetails.ItemID = InitialItem.ItemID;
            InitialItemEnDetails.LangID           = Languages.En;
            InitialItemEnDetails.Title            = EnItemTitle;
            InitialItemEnDetails.ShortDescription = EnItemShortDescrpyion;
            InitialItemEnDetails.Description      = EnItemDetails;
            InitialItemEnDetails.KeyWords         = EnItemSeoKeyWords;
            InitialItemEnDetails.Address          = EnItemAddress;
            InitialItemEnDetails.AuthorName       = EnItemAuthorName;
            #endregion



            #region Initial Category
            InitialCategory = new ItemCategoriesEntity();
            //InitialCategory.CategoryID;
            //InitialCategory.PhotoExtension;
            //InitialCategory.ModuleTypeID;
            //InitialCategory.ParentID;
            //InitialCategory.TypeID	=Type;
            InitialCategory.ItemDate        = ItemDate;
            InitialCategory.IsAvailable     = IsAvailable;
            InitialCategory.YoutubeCode     = YoutubeCode;
            InitialCategory.GoogleLatitude  = GoogleLatitude;
            InitialCategory.GoogleLongitude = GoogleLongitude;
            #endregion
            #region Initial Category Parent
            InitialCategoryParent = new ItemCategoriesEntity();
            //InitialCategoryParent.CategoryID;
            //InitialCategoryParent.PhotoExtension;
            //InitialCategoryParent.ModuleTypeID;
            //InitialCategoryParent.ParentID;
            //InitialCategoryParent.TypeID	=Type;
            InitialCategoryParent.ItemDate        = ItemDate;
            InitialCategoryParent.IsAvailable     = IsAvailable;
            InitialCategoryParent.YoutubeCode     = YoutubeCode;
            InitialCategoryParent.GoogleLatitude  = GoogleLatitude;
            InitialCategoryParent.GoogleLongitude = GoogleLongitude;
            #endregion

            #region InitialCategoryArDetails
            InitialCategoryArDetails = new ItemCategoriesDetailsEntity();
            //InitialCategoryArDetails.CategoryID = InitialCategory.CategoryID;
            InitialCategoryArDetails.LangID           = Languages.Ar;
            InitialCategoryArDetails.Title            = ArCategoryTitle;
            InitialCategoryArDetails.ShortDescription = ArItemShortDescrpyion;
            InitialCategoryArDetails.Description      = ArItemDetails;
            InitialCategoryArDetails.KeyWords         = ArItemSeoKeyWords;
            #endregion
            #region InitialCategoryEnDetails

            InitialCategoryEnDetails = new ItemCategoriesDetailsEntity();
            //InitialCategoryEnDetails.CategoryID = InitialCategory.CategoryID;
            InitialCategoryEnDetails.LangID           = Languages.En;
            InitialCategoryEnDetails.Title            = EnCategoryTitle;
            InitialCategoryEnDetails.ShortDescription = EnItemShortDescrpyion;
            InitialCategoryEnDetails.Description      = EnItemDetails;
            InitialCategoryEnDetails.KeyWords         = EnItemSeoKeyWords;
            #endregion

            #region InitialArComment
            InitialArComment = new ItemsCommentsEntity();
            //InitialArComment.CommentID
            //InitialArComment.ItemID
            InitialArComment.LangID = Languages.Ar;
            //InitialArComment.ModuleTypeID
            //InitialArComment.BaseModuleType
            InitialArComment.SenderName = ArSenderName;
            InitialArComment.CountryID  = SenderCountryID;
            //InitialArComment.CtryShort
            InitialArComment.SendingDate  = DateTime.Now;
            InitialArComment.SenderEmail  = SenderEMail;
            InitialArComment.CommentTitle = ArCommentTitle;
            InitialArComment.CommentText  = ArItemDetails;
            InitialArComment.IsActive     = IsAvailable;
            InitialArComment.IsSeen       = IsSeen;
            #endregion
            #region InitialEnComment
            InitialEnComment = new ItemsCommentsEntity();
            //InitialEnComment.CommentID
            //InitialEnComment.ItemID
            InitialEnComment.LangID = Languages.En;
            //InitialEnComment.ModuleTypeID
            //InitialEnComment.BaseModuleType
            InitialEnComment.SenderName = EnSenderName;
            InitialEnComment.CountryID  = SenderCountryID;
            //InitialEnComment.CtryShort
            InitialEnComment.SendingDate  = DateTime.Now;
            InitialEnComment.SenderEmail  = SenderEMail;
            InitialEnComment.CommentTitle = EnCommentTitle;
            InitialEnComment.CommentText  = EnItemDetails;
            InitialArComment.IsActive     = IsAvailable;
            InitialArComment.IsSeen       = IsSeen;
            #endregion

            #region InitialArMessages
            InitialArMessages = new MessagesEntity();
            //InitialArMessages.MessageID=;
            //InitialArMessages.ModuleTypeID
            //InitialArMessages.CategoryID	;
            InitialArMessages.Name             = ArSenderName;
            InitialArMessages.Mobile           = Mobile;
            InitialArMessages.EMail            = Email;
            InitialArMessages.NationalityID    = SiteSettings.Admininstration_SiteDefaultCountryID;
            InitialArMessages.CountryID        = SiteSettings.Admininstration_SiteDefaultCountryID;
            InitialArMessages.Address          = ArItemAddress;
            InitialArMessages.JobTel           = JobTel;
            InitialArMessages.Type             = Type;
            InitialArMessages.Title            = ArMessageTitle;
            InitialArMessages.Details          = ArItemDetails;
            InitialArMessages.ShortDescription = ArItemShortDescrpyion;
            InitialArMessages.Reply            = ArItemDetails;
            InitialArMessages.ReplyDate        = DateTime.Now;
            InitialArMessages.IsAvailable      = IsAvailable;
            InitialArMessages.IsSeen           = IsSeen;
            InitialArMessages.IsReplied        = IsReplied;
            InitialArMessages.LangID           = Languages.Ar;
            InitialArMessages.Gender           = Gender.Male;
            InitialArMessages.BirthDate        = BirthDate;
            InitialArMessages.CityID           = CityID;
            InitialArMessages.UserCityName     = UserCityNameAr;
            InitialArMessages.Tel          = Tels;
            InitialArMessages.Fax          = Fax;
            InitialArMessages.MailBox      = MailBox;
            InitialArMessages.ZipCode      = ZipCode;
            InitialArMessages.JobID        = JobID;
            InitialArMessages.JobText      = JobTextAr;
            InitialArMessages.Company      = CompanyAr;
            InitialArMessages.ActivitiesID = ActivitiesID;
            InitialArMessages.Url          = Url;
            //InitialArMessages.PhotoExtension
            InitialArMessages.SocialStatus    = SocialStatus;
            InitialArMessages.EducationLevel  = EducationLevel;
            InitialArMessages.EmpNo           = EmpNo;
            InitialArMessages.HasSmsService   = HasSmsService;
            InitialArMessages.HasEmailService = HasEmailService;
            //InitialArMessages.Notes1
            //InitialArMessages.Notes2
            InitialArMessages.AgeRang          = AgeRang;
            InitialArMessages.ItemDate         = ItemDate;
            InitialArMessages.YoutubeCode      = YoutubeCode;
            InitialArMessages.GoogleLatitude   = GoogleLatitude.ToString();
            InitialArMessages.GoogleLongitude  = GoogleLongitude.ToString();
            InitialArMessages.Price            = Price;
            InitialArMessages.KeyWords         = ArItemSeoKeyWords;
            InitialArMessages.LastModification = DateTime.Now;
            #endregion

            #region InitialEnMessages
            InitialEnMessages = new MessagesEntity();
            //InitialEnMessages.MessageID=;
            //InitialEnMessages.ModuleTypeID
            //InitialEnMessages.CategoryID	;
            InitialEnMessages.Name             = EnSenderName;
            InitialEnMessages.Mobile           = Mobile;
            InitialEnMessages.EMail            = Email;
            InitialEnMessages.NationalityID    = SiteSettings.Admininstration_SiteDefaultCountryID;
            InitialEnMessages.CountryID        = SiteSettings.Admininstration_SiteDefaultCountryID;
            InitialEnMessages.Address          = EnItemAddress;
            InitialEnMessages.JobTel           = JobTel;
            InitialEnMessages.Type             = Type;
            InitialEnMessages.Title            = EnMessageTitle;
            InitialEnMessages.Details          = EnItemDetails;
            InitialEnMessages.ShortDescription = EnItemShortDescrpyion;
            InitialEnMessages.Reply            = EnItemDetails;
            InitialEnMessages.ReplyDate        = DateTime.Now;
            InitialEnMessages.IsAvailable      = IsAvailable;
            InitialEnMessages.IsSeen           = IsSeen;
            InitialEnMessages.IsReplied        = IsReplied;
            InitialEnMessages.LangID           = Languages.En;
            InitialEnMessages.Gender           = Gender.Male;
            InitialEnMessages.BirthDate        = BirthDate;
            InitialEnMessages.CityID           = CityID;
            InitialEnMessages.UserCityName     = UserCityNameEn;
            InitialEnMessages.Tel          = Tels;
            InitialEnMessages.Fax          = Fax;
            InitialEnMessages.MailBox      = MailBox;
            InitialEnMessages.ZipCode      = ZipCode;
            InitialEnMessages.JobID        = JobID;
            InitialEnMessages.JobText      = JobTextEn;
            InitialEnMessages.Company      = CompanyEn;
            InitialEnMessages.ActivitiesID = ActivitiesID;
            InitialEnMessages.Url          = Url;
            //InitialEnMessages.PhotoExtension
            InitialEnMessages.SocialStatus    = SocialStatus;
            InitialEnMessages.EducationLevel  = EducationLevel;
            InitialEnMessages.EmpNo           = EmpNo;
            InitialEnMessages.HasSmsService   = HasSmsService;
            InitialEnMessages.HasEmailService = HasEmailService;
            //InitialEnMessages.Notes1
            //InitialEnMessages.Notes2
            InitialEnMessages.AgeRang          = AgeRang;
            InitialEnMessages.ItemDate         = ItemDate;
            InitialEnMessages.YoutubeCode      = YoutubeCode;
            InitialEnMessages.GoogleLatitude   = GoogleLatitude.ToString();
            InitialEnMessages.GoogleLongitude  = GoogleLongitude.ToString();
            InitialEnMessages.Price            = Price;
            InitialEnMessages.KeyWords         = EnItemSeoKeyWords;
            InitialEnMessages.LastModification = DateTime.Now;
            #endregion
        }
Exemple #11
0
        //------------------------------------------
        #endregion

        #region --------------Create--------------
        /// <summary>
        /// Converts the ItemCategories object properties to SQL paramters and executes the create ItemCategories procedure
        /// and updates the ItemCategories object with the SQL data by reference.
        /// <example>[Example]bool status=ItemCategoriesSqlDataPrvider.Instance.Create(itemCategoriesObject);.</example>
        /// </summary>
        /// <param name="itemCategoriesObject">The ItemCategories object.</param>
        /// <returns>The status of create query.</returns>
        public ExecuteCommandStatus Create(ItemCategoriesEntity itemCategoriesObject, ItemsModulesOptions currentModule)
        {
            using (SqlConnection myConnection = GetSqlConnection())
            {
                SqlCommand myCommand = new SqlCommand("ItemCategories_Create", myConnection);
                myCommand.CommandType = CommandType.StoredProcedure;
                // Set the parameters
                myCommand.Parameters.Add("@CategoryID", SqlDbType.Int, 4).Direction     = ParameterDirection.Output;
                myCommand.Parameters.Add("@PhotoExtension", SqlDbType.VarChar, 5).Value = itemCategoriesObject.PhotoExtension;
                myCommand.Parameters.Add("@IsAvailable", SqlDbType.Bit, 1).Value        = itemCategoriesObject.IsAvailable;
                myCommand.Parameters.Add("@ModuleTypeID", SqlDbType.Int, 4).Value       = (int)itemCategoriesObject.ModuleTypeID;
                myCommand.Parameters.Add("@ParentID", SqlDbType.Int, 4).Value           = (int)itemCategoriesObject.ParentID;
                //----------------------------------------------------------------------------------
                myCommand.Parameters.Add("@InsertUserName", SqlDbType.NVarChar, 64).Value = (string)itemCategoriesObject.InsertUserName;
                //----------------------------------------------------------------------------------
                myCommand.Parameters.Add("@TypeID", SqlDbType.Int, 4).Value = itemCategoriesObject.TypeID;
                //----------------------------------------------------------------------------------
                //New Columns
                //--------------------------------------
                //-----------------------------
                if (itemCategoriesObject.ItemDate != DateTime.MinValue)
                {
                    myCommand.Parameters.Add("@ItemDate", SqlDbType.DateTime).Value = (DateTime)itemCategoriesObject.ItemDate;
                }
                else
                {
                    myCommand.Parameters.Add("@ItemDate", SqlDbType.DateTime).Value = DBNull.Value;
                }
                //-----------------------------
                myCommand.Parameters.Add("@IsMain", SqlDbType.Bit, 1).Value              = itemCategoriesObject.IsMain;
                myCommand.Parameters.Add("@Priority", SqlDbType.Int, 4).Value            = (int)itemCategoriesObject.Priority;
                myCommand.Parameters.Add("@Photo2Extension", SqlDbType.VarChar, 5).Value = itemCategoriesObject.Photo2Extension;
                myCommand.Parameters.Add("@VideoExtension", SqlDbType.VarChar, 5).Value  = itemCategoriesObject.VideoExtension;
                myCommand.Parameters.Add("@AudioExtension", SqlDbType.VarChar, 5).Value  = itemCategoriesObject.AudioExtension;
                myCommand.Parameters.Add("@FileExtension", SqlDbType.VarChar, 5).Value   = itemCategoriesObject.FileExtension;
                myCommand.Parameters.Add("@Height", SqlDbType.Int, 4).Value              = (int)itemCategoriesObject.Height;
                myCommand.Parameters.Add("@Width", SqlDbType.Int, 4).Value        = (int)itemCategoriesObject.Width;
                myCommand.Parameters.Add("@YoutubeCode", SqlDbType.VarChar).Value = (string)itemCategoriesObject.YoutubeCode;
                //----------------------------------------------------------------------------------
                myCommand.Parameters.Add("@GoogleLatitude", SqlDbType.Float).Value  = itemCategoriesObject.GoogleLatitude;
                myCommand.Parameters.Add("@GoogleLongitude", SqlDbType.Float).Value = itemCategoriesObject.GoogleLongitude;
                myCommand.Parameters.Add("@OnlyForRegisered", SqlDbType.Bit).Value  = itemCategoriesObject.OnlyForRegisered;
                //-------------------------------------
                myCommand.Parameters.Add("@PublishPhoto", SqlDbType.Bit).Value  = itemCategoriesObject.PublishPhoto;
                myCommand.Parameters.Add("@PublishPhoto2", SqlDbType.Bit).Value = itemCategoriesObject.PublishPhoto2;
                myCommand.Parameters.Add("@PublishFile", SqlDbType.Bit).Value   = itemCategoriesObject.PublishFile;
                myCommand.Parameters.Add("@PublishAudio", SqlDbType.Bit).Value  = itemCategoriesObject.PublishAudio;
                myCommand.Parameters.Add("@PublishVideo", SqlDbType.Bit).Value  = itemCategoriesObject.PublishVideo;
                myCommand.Parameters.Add("@PublishYoutbe", SqlDbType.Bit).Value = itemCategoriesObject.PublishYoutbe;
                //----------------------------------------------------------------------------------
                myCommand.Parameters.Add("@OwnerID", SqlDbType.UniqueIdentifier).Value = itemCategoriesObject.OwnerID;
                myCommand.Parameters.Add("@OwnerName", SqlDbType.VarChar).Value        = itemCategoriesObject.OwnerName;
                //----------------------------------------------------------------------------------

                // Execute the command
                myConnection.Open();
                ExecuteCommandStatus status = (ExecuteCommandStatus)myCommand.ExecuteScalar();
                if (status == ExecuteCommandStatus.Done)
                {
                    itemCategoriesObject.CategoryID = (int)myCommand.Parameters["@CategoryID"].Value;
                    status = SaveDetails(itemCategoriesObject, currentModule.AllowDublicateTitlesInCategories, SPOperation.Insert);
                }
                myConnection.Close();
                return(status);
                //----------------------------------------------------------------------------------
            }
        }