//----------------------------------------------------------------------
        public static void SendActivationCodeMessage(MailListUsersEntity user)
        {
            // prepare message
            string body = string.Format(DynamicResource.GetText("MailList", "ActivationMailBody"), new string[3] {
                SitesHandler.GetSiteDomain(), Encryption.Encrypt(user.UserID.ToString()), user.Email
            });
            //string from =MailListEmailsFactory.MailFrom;
            MailListEmailsEntity mail = new MailListEmailsEntity();

            mail.Subject = DynamicResource.GetText("MailList", "ActivationMailSubject");
            mail.Body    = body;
            mail.To.Add(user.Email);
            MailListEmailsFactory.Send(mail);
        }
Beispiel #2
0
        protected override void OnPreInit(EventArgs e)
        {
            OwnerInterfaceType interFaceType = SitesHandler.GetOwnerInterfaceType();

            if (interFaceType == OwnerInterfaceType.SubSites)
            {
                this.Page.MasterPageFile = "~" + SiteDesign.MastersFolder + "GoogleSearch.master";
            }
            else
            {
                this.Page.MasterPageFile = "~" + SiteDesign.MastersFolder + "GoogleSearch.master";
            }
            //this.SmartNavigation = true;
            this.MaintainScrollPositionOnPostBack = true;
            base.OnPreInit(e);
        }
Beispiel #3
0
        //------------------------------------------
        #endregion

        #region --------------Delete--------------
        /// <summary>
        /// Deletes single UsersData object .
        /// <example>[Example]bool status=UsersDataFactory.Delete(userProfileID);.</example>
        /// </summary>
        /// <param name="userProfileID">The usersDataObject id.</param>
        /// <returns>Status of delete operation.</returns>
        public static bool Delete(Guid userID)
        {
            UsersDataEntity usersDataObject = GetUsersDataObject(userID, SitesHandler.GetOwnerIDAsGuid());
            bool            status          = UsersDataSqlDataPrvider.Instance.Delete(userID);

            if (status)
            {
                MembershipUser user = Membership.GetUser(userID);
                Membership.DeleteUser(user.UserName, true);
                //------------------------------------------------
                //DeleteFiles(usersDataObject);
                //------------------------------------------------
                UsersDataFactory.DeleteUserFolder(user, usersDataObject);
                //------------------------------------------------------------------------
            }
            return(status);
        }
Beispiel #4
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;
            }
        }
Beispiel #5
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);
        }
Beispiel #6
0
        //----------------------------------------------------------------------------------------------------------
        public static void IncreaseSubSiteVisites()
        {
            HttpContext context = HttpContext.Current;

            OwnerInterfaceType interfaceType = SitesHandler.GetOwnerInterfaceType();

            if (interfaceType == OwnerInterfaceType.SubSites)
            {
                Guid   OwnerID         = SitesHandler.GetOwnerIDAsGuid();
                string OwnerIdentifire = SitesHandler.GetOwnerIdentifire();
                //--------------------------------------
                List <string> visitorSubSites = null;
                try
                {
                    visitorSubSites = (List <string>)context.Session["VisitorSubSites"];
                }
                catch
                {
                }
                //--------------------------------------
                if (visitorSubSites == null)
                {
                    visitorSubSites = new List <string>();
                }
                //--------------------------------------
                foreach (string site in visitorSubSites)
                {
                    if (OwnerIdentifire == site)
                    {
                        return;
                    }
                }
                //--------------------------------------
                UsersDataFactory.IncreaseVisits(OwnerID);
                visitorSubSites.Add(OwnerIdentifire);
                context.Session["VisitorSubSites"] = visitorSubSites;
            }
        }
        //------------------------------------------
        #endregion

        #region --------------GetAll--------------
        public List <MailListGroupsEntity> GetAll()
        {
            using (SqlConnection myConnection = GetSqlConnection())
            {
                List <MailListGroupsEntity> mailListGroupsList = new List <MailListGroupsEntity>();
                MailListGroupsEntity        mailListGroups;
                SqlCommand myCommand = new SqlCommand("MailListGroups_GetAll", myConnection);
                //----------------------------------------------------------------------------------------------
                //OwnerID
                myCommand.Parameters.Add("@OwnerID", SqlDbType.UniqueIdentifier).Value = SitesHandler.GetOwnerIDAsGuid();
                //----------------------------------------------------------------------------------------------
                myCommand.CommandType = CommandType.StoredProcedure;
                // Execute the command
                SqlDataReader dr;
                myConnection.Open();
                dr = myCommand.ExecuteReader(CommandBehavior.CloseConnection);
                while (dr.Read())
                {
                    mailListGroups = PopulateEntity(dr);
                    mailListGroupsList.Add(mailListGroups);
                }
                dr.Close();
                myConnection.Close();
                return(mailListGroupsList);
            }
        }
        //------------------------------------------
        #endregion

        #region --------------GetMain--------------
        public VoteQuestionsEntity GetMain(Languages langID)
        {
            VoteQuestionsEntity voteQuestions = null;

            using (SqlConnection myConnection = GetSqlConnection())
            {
                SqlCommand myCommand = new SqlCommand("VoteQuestions_GetMain", myConnection);
                myCommand.CommandType = CommandType.StoredProcedure;
                // Set the parameters
                myCommand.Parameters.Add("@LangID", SqlDbType.Int, 4).Value = (int)langID;
                //----------------------------------------------------------------------------------------------
                //OwnerID
                myCommand.Parameters.Add("@OwnerID", SqlDbType.UniqueIdentifier).Value = SitesHandler.GetOwnerIDAsGuid();
                //----------------------------------------------------------------------------------------------
                // Execute the command
                myConnection.Open();
                using (SqlDataReader dr = myCommand.ExecuteReader(CommandBehavior.CloseConnection))
                {
                    if (dr.Read())
                    {
                        voteQuestions = PopulateEntity(dr);
                    }
                    dr.Close();
                }
                myConnection.Close();
                return(voteQuestions);
            }
        }
        //------------------------------------------
        #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);
            }
        }
Beispiel #10
0
 //---------------------------------------------------------------------------------------
 #region --------------GetAllNumbersOnly--------------
 public List <string> GetAllNumbersOnly(int ModuleTypeID, Languages LangID, int groupID, bool isAvailableCondition, string SearchText)
 {
     using (SqlConnection myConnection = GetSqlConnection())
     {
         List <string> numbersList = new List <string>();
         string        Numbers;
         SqlCommand    myCommand = new SqlCommand("SMSNumbers_GetNumbersOnly", myConnection);
         myCommand.CommandType = CommandType.StoredProcedure;
         // Set the parameters
         myCommand.Parameters.Add("@ModuleTypeID", SqlDbType.Int, 4).Value      = (int)ModuleTypeID;
         myCommand.Parameters.Add("@LangID", SqlDbType.Int, 4).Value            = (int)LangID;
         myCommand.Parameters.Add("@GroupID", SqlDbType.Int, 4).Value           = groupID;
         myCommand.Parameters.Add("@IsAvailableCondition", SqlDbType.Bit).Value = isAvailableCondition;
         myCommand.Parameters.Add("@SearchText", SqlDbType.VarChar).Value       = SearchText;
         //----------------------------------------------------------------------------------------------
         //OwnerID
         myCommand.Parameters.Add("@OwnerID", SqlDbType.UniqueIdentifier).Value = SitesHandler.GetOwnerIDAsGuid();
         //----------------------------------------------------------------------------------------------
         // Execute the command
         SqlDataReader dr;
         myConnection.Open();
         dr = myCommand.ExecuteReader(CommandBehavior.CloseConnection);
         while (dr.Read())
         {
             Numbers = (string)dr["Numbers"];
             numbersList.Add(Numbers);
         }
         dr.Close();
         myConnection.Close();
         return(numbersList);
     }
 }
        //------------------------------------------
        #endregion

        #region -------------GetSiteDeparmentsInDataTable---------------
        public DataTable GetSiteDeparmentsInDataTable(int moduleTypeID, int parentID, Languages langID, bool isAvailableCondition)
        {
            using (SqlConnection myConnection = GetSqlConnection())
            {
                SqlCommand myCommand = new SqlCommand("SiteDeparments_GetAll", myConnection);
                myCommand.CommandType = CommandType.StoredProcedure;
                //----------------------------------------------------------------
                myCommand.Parameters.Add("@ModuleTypeID", SqlDbType.Int, 4).Value         = (int)moduleTypeID;
                myCommand.Parameters.Add("@ParentID", SqlDbType.Int, 4).Value             = parentID;
                myCommand.Parameters.Add("@LangID", SqlDbType.Int, 4).Value               = (int)langID;
                myCommand.Parameters.Add("@SiteHasMultiLanguages", SqlDbType.Bit).Value   = SiteSettings.Languages_HasMultiLanguages;
                myCommand.Parameters.Add("@IsAvailableCondition", SqlDbType.Bit, 1).Value = isAvailableCondition;
                myCommand.Parameters.Add("@pageIndex", SqlDbType.Int, 4).Value            = -1;
                myCommand.Parameters.Add("@pageSize", SqlDbType.Int, 4).Value             = -1;
                myCommand.Parameters.Add("@TotalRecords", SqlDbType.Int, 4).Direction     = ParameterDirection.Output;
                //----------------------------------------------------------------
                myCommand.Parameters.Add("@OwnerID", SqlDbType.UniqueIdentifier).Value = SitesHandler.GetOwnerIDAsGuid();
                //----------------------------------------------------------------
                // Execute the command
                SqlDataAdapter da = new SqlDataAdapter(myCommand);
                DataTable      dt = new DataTable();
                myConnection.Open();
                da.Fill(dt);
                myConnection.Close();
                return(dt);
                //----------------------------------------------------------------
            }
        }
Beispiel #12
0
        //------------------------------------------
        public SMSNumbersEntity GetSMSNumbersObjectByNumber(int ModuleTypeID, string mobileNo)
        {
            SMSNumbersEntity sMSNumbers = null;

            using (SqlConnection myConnection = GetSqlConnection())
            {
                SqlCommand myCommand = new SqlCommand("SMSNumbers_GetOneByID", myConnection);
                myCommand.CommandType = CommandType.StoredProcedure;
                // Set the parameters
                myCommand.Parameters.Add("@ModuleTypeID", SqlDbType.Int, 4).Value  = (int)ModuleTypeID;
                myCommand.Parameters.Add("@Numbers", SqlDbType.NVarChar, 20).Value = mobileNo;
                //----------------------------------------------------------------------------------------------
                //OwnerID
                myCommand.Parameters.Add("@OwnerID", SqlDbType.UniqueIdentifier).Value = SitesHandler.GetOwnerIDAsGuid();
                //----------------------------------------------------------------------------------------------
                // Execute the command
                myConnection.Open();
                using (SqlDataReader dr = myCommand.ExecuteReader(CommandBehavior.CloseConnection))
                {
                    if (dr.Read())
                    {
                        sMSNumbers = PopulateEntity(dr);
                    }
                    dr.Close();
                }
                myConnection.Close();
                return(sMSNumbers);
            }
        }
 /// <summary>
 /// Gets All SMSCredit Records.
 /// <example>[Example]DataTable dtSMSCredit=SMSCreditSqlDataPrvider.Instance.GetAllSMSCredit();.</example>
 /// </summary>
 /// <returns>The result of query.</returns>
 public DataTable GetAllSMSCredit()
 {
     using (SqlConnection myConnection = GetSqlConnection())
     {
         SqlCommand myCommand = new SqlCommand("SMSCredit_GetAll", myConnection);
         myCommand.CommandType = CommandType.StoredProcedure;
         //----------------------------------------------------------------------------------------------
         //OwnerID
         myCommand.Parameters.Add("@OwnerID", SqlDbType.UniqueIdentifier).Value = SitesHandler.GetOwnerIDAsGuid();
         //----------------------------------------------------------------------------------------------
         SqlDataAdapter da = new SqlDataAdapter(myCommand);
         DataTable      dt = new DataTable();
         // Execute the command
         myConnection.Open();
         da.Fill(dt);
         myConnection.Close();
         return(dt);
     }
 }
Beispiel #14
0
        //------------------------------------------
        #endregion

        #region --------------Delete--------------
        /// <summary>
        /// Deletes single Messages object .
        /// <example>[Example]bool status=MessagesFactory.Delete(messageID);.</example>
        /// </summary>
        /// <param name="messageID">The msg id.</param>
        /// <returns>Status of delete operation.</returns>
        public static bool Delete(int messageID)
        {
            MessagesEntity msg    = MessagesFactory.GetMessagesObject(messageID, UsersTypes.Admin, SitesHandler.GetOwnerIDAsGuid());
            bool           status = MessagesSqlDataPrvider.Instance.Delete(messageID);

            //-------------------------------------
            if (status)
            {
                //delete message folder
                //-------------------------------------
                string folder             = DCSiteUrls.GetPath_MessagesDirectory(msg.OwnerName, msg.ModuleTypeID, msg.CategoryID, msg.MessageID);
                string folderPhysicalPath = DCServer.MapPath(folder);
                if (Directory.Exists(folderPhysicalPath))
                {
                    DirectoryInfo dir = new DirectoryInfo(folderPhysicalPath);
                    DcDirectoryManager.DeletDirectory(dir);
                }
            }
            //-------------------------------------
            return(status);
        }
Beispiel #15
0
 //------------------------------------------
 /// <summary>
 /// Converts the SMSNumbers object properties to SQL paramters and executes the create SMSNumbers procedure
 /// and updates the SMSNumbers object with the SQL data by reference.
 /// <example>[Example]bool result=SMSNumbersSqlDataPrvider.Instance.Create(sMSNumbers);.</example>
 /// </summary>
 /// <param name="sMSNumbers">The SMSNumbers object.</param>
 /// <returns>The result of create query.</returns>
 public ExecuteCommandStatus Create(SMSNumbersEntity sMSNumbers)
 {
     using (SqlConnection myConnection = GetSqlConnection())
     {
         SqlCommand myCommand = new SqlCommand("SMSNumbers_Create", myConnection);
         myCommand.CommandType = CommandType.StoredProcedure;
         // Set the parameters
         myCommand.Parameters.Add("@NumID", SqlDbType.BigInt, 8).Direction  = ParameterDirection.Output;
         myCommand.Parameters.Add("@Numbers", SqlDbType.NVarChar, 20).Value = sMSNumbers.Numbers;
         myCommand.Parameters.Add("@Name", SqlDbType.NVarChar, 200).Value   = sMSNumbers.Name;
         myCommand.Parameters.Add("@GroupID", SqlDbType.Int, 4).Value       = sMSNumbers.GroupID;
         //--------------------------------------------------------------------------------
         myCommand.Parameters.Add("@IsActive", SqlDbType.Bit, 1).Value = sMSNumbers.IsActive;
         //myCommand.Parameters.Add("@JoinDate", SqlDbType.DateTime,8).Value = mailListUsers.JoinDate;
         myCommand.Parameters.Add("@ModuleTypeID", SqlDbType.Int, 4).Value = (int)sMSNumbers.ModuleTypeID;
         myCommand.Parameters.Add("@LangID", SqlDbType.Int, 4).Value       = (int)sMSNumbers.LangID;
         //----------------------------------------------------------------------------------------------
         //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
             sMSNumbers.NumID = (long)myCommand.Parameters["@NumID"].Value;
         }
         myConnection.Close();
         return(status);
     }
 }
        //------------------------------------------
        #endregion
        #region --------------GetObject--------------
        public static ItemsCommentsEntity GetObject(int commentID)
        {
            ItemsCommentsEntity itemComment;
            HttpContext         context = HttpContext.Current;
            string cacheKey             = "itemComment" + commentID;

            if (context.Items[cacheKey] == null)
            {
                itemComment             = ItemsCommentsSqlDataPrvider.Instance.GetObject(commentID, SitesHandler.GetOwnerIDAsGuid());
                context.Items[cacheKey] = itemComment;
            }
            else
            {
                itemComment = (ItemsCommentsEntity)context.Items[cacheKey];
            }
            //return the object
            return(itemComment);
        }
Beispiel #17
0
        public static void AddTitlePath(PathLinksClass pc, Label lblTitle)
        {
            if (MoversFW.Components.UrlManager.ChechIsValidIntegerParameter("id"))
            {
                int            messageID = Convert.ToInt32(HttpContext.Current.Request.QueryString["id"]);
                Languages      lang      = SiteSettings.GetCurrentLanguage();
                MessagesEntity msg       = MessagesFactory.GetMessagesObject(messageID, UsersTypes.Admin, SitesHandler.GetOwnerIDAsGuid());

                if (msg != null)
                {
                    if (pc != null)
                    {
                        pc.AddLink(msg.Title, null);
                    }
                    if (lblTitle != null)
                    {
                        lblTitle.Text = msg.Title;
                    }
                }
            }
        }
        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);
            }
        }
 public List <SiteDeparmentsEntity> GetFullPathByRelatedPageID(int RelatedPageID, Languages langID)
 {
     using (SqlConnection myConnection = GetSqlConnection())
     {
         List <SiteDeparmentsEntity> siteDeparmentsList   = new List <SiteDeparmentsEntity>();
         SiteDeparmentsEntity        siteDeparmentsObject = null;
         SqlCommand myCommand = new SqlCommand("SiteDeparments_GetFullPathByRelatedPageID", myConnection);
         myCommand.CommandType = CommandType.StoredProcedure;
         // Set the parameters
         myCommand.Parameters.Add("@RelatedPageID", SqlDbType.Int, 4).Value = RelatedPageID;
         myCommand.Parameters.Add("@LangID", SqlDbType.Int, 4).Value        = (int)langID;
         //----------------------------------------------------------------
         myCommand.Parameters.Add("@OwnerID", SqlDbType.UniqueIdentifier).Value = SitesHandler.GetOwnerIDAsGuid();
         //----------------------------------------------------------------
         // Execute the command
         SqlDataReader dr;
         myConnection.Open();
         dr = myCommand.ExecuteReader(CommandBehavior.CloseConnection);
         while (dr.Read())
         {
             //siteDeparmentsObject = PopulateSiteDeparmentsEntity(dr);
             siteDeparmentsObject = (SiteDeparmentsEntity)GetEntity(dr, typeof(SiteDeparmentsEntity));
             siteDeparmentsList.Add(siteDeparmentsObject);
         }
         dr.Close();
         myConnection.Close();
         //Gets result rows count
         return(siteDeparmentsList);
         //----------------------------------------------------------------
     }
 }
 public List <SiteDeparmentsEntity> GetAll(int moduleTypeID, int parentID, Languages langID, bool isAvailableCondition, int pageIndex, int pageSize, out int totalRecords)
 {
     using (SqlConnection myConnection = GetSqlConnection())
     {
         List <SiteDeparmentsEntity> siteDeparmentsList = new List <SiteDeparmentsEntity>();
         SiteDeparmentsEntity        siteDeparmentsObject;
         //Hashtable temp = new Hashtable();
         SqlCommand myCommand = new SqlCommand("SiteDeparments_GetAll", myConnection);
         myCommand.CommandType = CommandType.StoredProcedure;
         // Set the parameters
         myCommand.Parameters.Add("@ModuleTypeID", SqlDbType.Int, 4).Value         = (int)moduleTypeID;
         myCommand.Parameters.Add("@ParentID", SqlDbType.Int, 4).Value             = parentID;
         myCommand.Parameters.Add("@LangID", SqlDbType.Int, 4).Value               = (int)langID;
         myCommand.Parameters.Add("@SiteHasMultiLanguages", SqlDbType.Bit).Value   = SiteSettings.Languages_HasMultiLanguages;
         myCommand.Parameters.Add("@IsAvailableCondition", SqlDbType.Bit, 1).Value = isAvailableCondition;
         myCommand.Parameters.Add("@pageIndex", SqlDbType.Int, 4).Value            = pageIndex;
         myCommand.Parameters.Add("@pageSize", SqlDbType.Int, 4).Value             = pageSize;
         myCommand.Parameters.Add("@TotalRecords", SqlDbType.Int, 4).Direction     = ParameterDirection.Output;
         //----------------------------------------------------------------
         myCommand.Parameters.Add("@OwnerID", SqlDbType.UniqueIdentifier).Value = SitesHandler.GetOwnerIDAsGuid();
         //----------------------------------------------------------------
         // Execute the command
         SqlDataReader dr;
         myConnection.Open();
         dr = myCommand.ExecuteReader(CommandBehavior.CloseConnection);
         while (dr.Read())
         {
             //siteDeparmentsObject = PopulateSiteDeparmentsEntity(dr);
             //if (!temp.Contains(siteDeparmentsObject.DepartmentID))
             //{
             //    siteDeparmentsList.Add(siteDeparmentsObject);
             //    temp.Add(siteDeparmentsObject.DepartmentID, null);
             //}
             siteDeparmentsObject = (SiteDeparmentsEntity)GetEntity(dr, typeof(SiteDeparmentsEntity));
             siteDeparmentsList.Add(siteDeparmentsObject);
         }
         dr.Close();
         myConnection.Close();
         //Gets result rows count
         totalRecords = (int)myCommand.Parameters["@TotalRecords"].Value;
         if (totalRecords < 0)
         {
             totalRecords = siteDeparmentsList.Count;
         }
         return(siteDeparmentsList);
         //----------------------------------------------------------------
     }
 }
        public MailListGroupsEntity GetObject(int groupID)
        {
            MailListGroupsEntity mailListGroups = null;

            using (SqlConnection myConnection = GetSqlConnection())
            {
                SqlCommand myCommand = new SqlCommand("MailListGroups_GetOneByID", myConnection);
                myCommand.CommandType = CommandType.StoredProcedure;
                // Set the parameters
                myCommand.Parameters.Add("@GroupID", SqlDbType.Int, 4).Value = groupID;
                //----------------------------------------------------------------------------------------------
                //OwnerID
                myCommand.Parameters.Add("@OwnerID", SqlDbType.UniqueIdentifier).Value = SitesHandler.GetOwnerIDAsGuid();
                //----------------------------------------------------------------------------------------------
                // Execute the command
                myConnection.Open();
                using (SqlDataReader dr = myCommand.ExecuteReader(CommandBehavior.CloseConnection))
                {
                    if (dr.Read())
                    {
                        mailListGroups = PopulateEntity(dr);
                    }
                    dr.Close();
                }
                myConnection.Close();
                return(mailListGroups);
            }
        }
Beispiel #22
0
 //------------------------------------------
 public List <SMSNumbersEntity> GetAll(int ModuleTypeID, Languages LangID, int GroupID, bool isAvailableCondition, string searchText, int pageIndex, int pageSize, out int totalRecords)
 {
     using (SqlConnection myConnection = GetSqlConnection())
     {
         List <SMSNumbersEntity> smsUsersList = new List <SMSNumbersEntity>();
         SMSNumbersEntity        smsUser;
         SqlCommand myCommand = new SqlCommand("SMSNumbers_GetAll", myConnection);
         myCommand.CommandType = CommandType.StoredProcedure;
         // Set the parameters
         myCommand.Parameters.Add("@ModuleTypeID", SqlDbType.Int, 4).Value      = (int)ModuleTypeID;
         myCommand.Parameters.Add("@LangID", SqlDbType.Int, 4).Value            = (int)LangID;
         myCommand.Parameters.Add("@GroupID", SqlDbType.Int, 4).Value           = GroupID;
         myCommand.Parameters.Add("@IsAvailableCondition", SqlDbType.Bit).Value = isAvailableCondition;
         myCommand.Parameters.Add("@SearchText", SqlDbType.VarChar).Value       = searchText;
         myCommand.Parameters.Add("@pageIndex", SqlDbType.Int, 4).Value         = pageIndex;
         myCommand.Parameters.Add("@pageSize", SqlDbType.Int, 4).Value          = pageSize;
         myCommand.Parameters.Add("@TotalRecords", SqlDbType.Int, 4).Direction  = ParameterDirection.Output;
         //----------------------------------------------------------------------------------------------
         //OwnerID
         myCommand.Parameters.Add("@OwnerID", SqlDbType.UniqueIdentifier).Value = SitesHandler.GetOwnerIDAsGuid();
         //----------------------------------------------------------------------------------------------
         // Execute the command
         SqlDataReader dr;
         myConnection.Open();
         dr = myCommand.ExecuteReader(CommandBehavior.CloseConnection);
         while (dr.Read())
         {
             (smsUser) = PopulateEntity(dr);
             smsUsersList.Add(smsUser);
         }
         dr.Close();
         myConnection.Close();
         //Gets result rows count
         totalRecords = (int)myCommand.Parameters["@TotalRecords"].Value;
         return(smsUsersList);
     }
 }
        //------------------------------------------
        #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);
            }
        }
        //------------------------------------------
        /// <summary>
        /// Gets single SMSArchive object .
        /// <example>[Example]SMSArchiveEntity sMSArchive=SMSArchiveSqlDataPrvider.Instance.GetSMSArchiveObject(id);.</example>
        /// </summary>
        /// <param name="id">The sMSArchive id.</param>
        /// <returns>SMSArchive object.</returns>
        public SMSArchiveEntity GetSMSArchiveObject(int id)
        {
            SMSArchiveEntity sMSArchive = null;

            using (SqlConnection myConnection = GetSqlConnection())
            {
                SqlCommand myCommand = new SqlCommand("SMSArchive_GetOneByID", myConnection);
                myCommand.CommandType = CommandType.StoredProcedure;
                // Set the parameters
                myCommand.Parameters.Add("@ID", SqlDbType.Int, 4).Value = id;
                //----------------------------------------------------------------------------------------------
                //OwnerID
                myCommand.Parameters.Add("@OwnerID", SqlDbType.UniqueIdentifier).Value = SitesHandler.GetOwnerIDAsGuid();
                //----------------------------------------------------------------------------------------------
                // Execute the command
                myConnection.Open();
                using (SqlDataReader dr = myCommand.ExecuteReader(CommandBehavior.CloseConnection))
                {
                    if (dr.Read())
                    {
                        sMSArchive = PopulateSMSArchiveEntityFromIDataReader(dr);
                    }
                    dr.Close();
                }
                myConnection.Close();
                return(sMSArchive);
            }
        }
Beispiel #25
0
        //----------------------------------------------------------------------------
        /// <summary>
        /// Gets single SMSNumbers object .
        /// <example>[Example]SMSNumbersEntity sMSNumbers=SMSNumbersSqlDataPrvider.Instance.GetObject(numID);.</example>
        /// </summary>
        /// <param name="numID">The sMSNumbers id.</param>
        /// <returns>SMSNumbers object.</returns>
        public SMSNumbersEntity GetObject(long numID)
        {
            SMSNumbersEntity sMSNumbers = null;

            using (SqlConnection myConnection = GetSqlConnection())
            {
                SqlCommand myCommand = new SqlCommand("SMSNumbers_GetOneByID", myConnection);
                myCommand.CommandType = CommandType.StoredProcedure;
                // Set the parameters
                myCommand.Parameters.Add("@NumID", SqlDbType.BigInt, 8).Value = numID;
                //----------------------------------------------------------------------------------------------
                //OwnerID
                myCommand.Parameters.Add("@OwnerID", SqlDbType.UniqueIdentifier).Value = SitesHandler.GetOwnerIDAsGuid();
                //----------------------------------------------------------------------------------------------
                // Execute the command
                myConnection.Open();
                using (SqlDataReader dr = myCommand.ExecuteReader(CommandBehavior.CloseConnection))
                {
                    if (dr.Read())
                    {
                        sMSNumbers = PopulateEntity(dr);
                    }
                    dr.Close();
                }
                myConnection.Close();
                return(sMSNumbers);
            }
        }
        //------------------------------------------
        /// <summary>
        /// Converts the SMSArchive object properties to SQL paramters and executes the create SMSArchive procedure
        /// and updates the SMSArchive object with the SQL data by reference.
        /// <example>[Example]bool result=SMSArchiveSqlDataPrvider.Instance.Create(sMSArchive);.</example>
        /// </summary>
        /// <param name="sMSArchive">The SMSArchive object.</param>
        /// <returns>The result of create query.</returns>
        public bool Create(SMSArchiveEntity sMSArchive)
        {
            bool result = false;

            using (SqlConnection myConnection = GetSqlConnection())
            {
                SqlCommand myCommand = new SqlCommand("SMSArchive_Create", myConnection);
                myCommand.CommandType = CommandType.StoredProcedure;
                // Set the parameters
                myCommand.Parameters.Add("@ID", SqlDbType.Int, 4).Direction               = ParameterDirection.Output;
                myCommand.Parameters.Add("@Sender", SqlDbType.NVarChar, 20).Value         = sMSArchive.Sender;
                myCommand.Parameters.Add("@RecieverMobile", SqlDbType.NVarChar, 20).Value = sMSArchive.RecieverMobile;
                myCommand.Parameters.Add("@Message", SqlDbType.NVarChar, 500).Value       = sMSArchive.Message;
                myCommand.Parameters.Add("@LangID", SqlDbType.Int, 4).Value               = (int)sMSArchive.LangID;
                //----------------------------------------------------------------------------------------------
                //OwnerID
                myCommand.Parameters.Add("@OwnerID", SqlDbType.UniqueIdentifier).Value = SitesHandler.GetOwnerIDAsGuid();
                //----------------------------------------------------------------------------------------------
                // Execute the command
                myConnection.Open();
                if (myCommand.ExecuteNonQuery() > 0)
                {
                    result = true;
                    //Get ID value from database and set it in object
                    sMSArchive.ID = (int)myCommand.Parameters["@ID"].Value;
                }
                myConnection.Close();
                return(result);
            }
        }
 public void Decrease()
 {
     using (SqlConnection myConnection = GetSqlConnection())
     {
         SqlCommand myCommand = new SqlCommand("SMSCredit_Decrease", myConnection);
         myCommand.CommandType = CommandType.StoredProcedure;
         //----------------------------------------------------------------------------------------------
         //OwnerID
         myCommand.Parameters.Add("@OwnerID", SqlDbType.UniqueIdentifier).Value = SitesHandler.GetOwnerIDAsGuid();
         //----------------------------------------------------------------------------------------------
         // Execute the command
         myConnection.Open();
         int x = myCommand.ExecuteNonQuery();
         myConnection.Close();
     }
 }
        //------------------------------------------
        #endregion

        #region --------------GetAll--------------
        public List <VoteQuestionsEntity> GetAll(bool olnyPreviousVotes, Languages langID, int pageIndex, int pageSize, out int totalRecords)
        {
            using (SqlConnection myConnection = GetSqlConnection())
            {
                List <VoteQuestionsEntity> voteQuestionsList = new List <VoteQuestionsEntity>();
                VoteQuestionsEntity        voteQuestions;
                SqlCommand myCommand = new SqlCommand("VoteQuestions_GetAll", myConnection);
                myCommand.CommandType = CommandType.StoredProcedure;
                // Set the parameters
                myCommand.Parameters.Add("@PreviousVotes", SqlDbType.Bit, 1).Value    = olnyPreviousVotes;
                myCommand.Parameters.Add("@LangID", SqlDbType.Int, 8).Value           = (int)langID;
                myCommand.Parameters.Add("@pageIndex", SqlDbType.Int, 4).Value        = pageIndex;
                myCommand.Parameters.Add("@pageSize", SqlDbType.Int, 4).Value         = pageSize;
                myCommand.Parameters.Add("@TotalRecords", SqlDbType.Int, 4).Direction = ParameterDirection.Output;
                //----------------------------------------------------------------------------------------------
                //OwnerID
                myCommand.Parameters.Add("@OwnerID", SqlDbType.UniqueIdentifier).Value = SitesHandler.GetOwnerIDAsGuid();
                //----------------------------------------------------------------------------------------------
                // Execute the command
                SqlDataReader dr;
                myConnection.Open();
                dr = myCommand.ExecuteReader(CommandBehavior.CloseConnection);
                while (dr.Read())
                {
                    (voteQuestions) = PopulateEntity(dr);
                    voteQuestionsList.Add(voteQuestions);
                }
                dr.Close();
                myConnection.Close();
                //Gets result rows count
                totalRecords = (int)myCommand.Parameters["@TotalRecords"].Value;
                return(voteQuestionsList);
            }
        }
        public bool DeleteAll()
        {
            bool result = false;

            using (SqlConnection myConnection = GetSqlConnection())
            {
                SqlCommand myCommand = new SqlCommand("SMSArchive_Delete_all", myConnection);
                myCommand.CommandType = CommandType.StoredProcedure;

                // Set the parameters
                //----------------------------------------------------------------------------------------------
                //OwnerID
                myCommand.Parameters.Add("@OwnerID", SqlDbType.UniqueIdentifier).Value = SitesHandler.GetOwnerIDAsGuid();
                //----------------------------------------------------------------------------------------------
                // Execute the command
                myConnection.Open();
                if (myCommand.ExecuteNonQuery() > 0)
                {
                    result = true;
                }
                myConnection.Close();
                return(result);
            }
        }
Beispiel #30
0
 //------------------------------------------
 /// <summary>
 /// Converts the SMSNumbers object properties to SQL paramters and executes the update SMSNumbers procedure.
 /// <example>[Example]bool result=SMSNumbersSqlDataPrvider.Instance.Update(sMSNumbers);.</example>
 /// </summary>
 /// <param name="sMSNumbers">The SMSNumbers object.</param>
 /// <returns>The result of update query.</returns>
 public ExecuteCommandStatus Update(SMSNumbersEntity sMSNumbers)
 {
     using (SqlConnection myConnection = GetSqlConnection())
     {
         SqlCommand myCommand = new SqlCommand("SMSNumbers_Update", myConnection);
         myCommand.CommandType = CommandType.StoredProcedure;
         // Set the parameters
         myCommand.Parameters.Add("@NumID", SqlDbType.BigInt, 8).Value      = sMSNumbers.NumID;
         myCommand.Parameters.Add("@Numbers", SqlDbType.NVarChar, 20).Value = sMSNumbers.Numbers;
         myCommand.Parameters.Add("@GroupID", SqlDbType.Int, 4).Value       = sMSNumbers.GroupID;
         myCommand.Parameters.Add("@Name", SqlDbType.NVarChar, 200).Value   = sMSNumbers.Name;
         myCommand.Parameters.Add("@IsActive", SqlDbType.Bit, 1).Value      = sMSNumbers.IsActive;
         myCommand.Parameters.Add("@ModuleTypeID", SqlDbType.Int, 4).Value  = (int)sMSNumbers.ModuleTypeID;
         //----------------------------------------------------------------------------------------------
         //OwnerID
         myCommand.Parameters.Add("@OwnerID", SqlDbType.UniqueIdentifier).Value = SitesHandler.GetOwnerIDAsGuid();
         //----------------------------------------------------------------------------------------------
         // Execute the command
         myConnection.Open();
         ExecuteCommandStatus status = (ExecuteCommandStatus)myCommand.ExecuteScalar();
         myConnection.Close();
         return(status);
     }
 }