Exemplo n.º 1
0
        public void AddUpdateSageFrameSearchSetting(SageFrameSearchSettingInfo objSearchSettingInfo, int PortalID, string CultureName, string AddedBy)
        {            
            
            try
            {
                string SettingKeys = string.Empty;
                string SettingValues = string.Empty;
                //Pre pare Key value for the save;
                SettingKeys = "SearchButtonType#SearchButtonText#SearchButtonImage#SearchResultPerPage#SearchResultPageName#MaxSearchChracterAllowedWithSpace";
                SettingValues = objSearchSettingInfo.SearchButtonType.ToString() + "#" + objSearchSettingInfo.SearchButtonText + "#" +
                    objSearchSettingInfo.SearchButtonImage + "#" + objSearchSettingInfo.SearchResultPerPage.ToString() + 
                    "#" + objSearchSettingInfo.SearchResultPageName +
                    "#" + objSearchSettingInfo.MaxSearchChracterAllowedWithSpace.ToString();

                List<KeyValuePair<string, string>> ParaMeterCollection = new List<KeyValuePair<string, string>>();

                ParaMeterCollection.Add(new KeyValuePair<string, string>("@SettingKeys", SettingKeys));
                ParaMeterCollection.Add(new KeyValuePair<string, string>("@SettingValues", SettingValues));

                ParaMeterCollection.Add(new KeyValuePair<string, string>("@CultureName", CultureName));
                ParaMeterCollection.Add(new KeyValuePair<string, string>("@PortalID", PortalID.ToString()));
                ParaMeterCollection.Add(new KeyValuePair<string, string>("@AddedBy", AddedBy));
                SQLHandler sagesql = new SQLHandler();
                sagesql.ExecuteNonQuery("dbo.sp_SageFrameSearchSettingValueAddUpdate", ParaMeterCollection);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
 private void SaveSearchSettings()
 {
     try
     {
         if (txtSearchResultPageName.Text.Trim() != string.Empty && txtSearchResultPerPage.Text.Trim() != string.Empty && txtMaxSearchChracterAllowedWithSpace.Text.Trim() != string.Empty)
         {
             SageFrameSearchSettingInfo objSearchSettingInfo = new SageFrameSearchSettingInfo();
             objSearchSettingInfo.SearchButtonType = Int32.Parse(rdblSearchButtonType.SelectedValue);
             objSearchSettingInfo.SearchButtonText = txtSearchButtonText.Text;
             objSearchSettingInfo.SearchButtonImage = txtSearchButtonImage.Text.Trim();
             objSearchSettingInfo.SearchResultPageName = txtSearchResultPageName.Text.Trim();
             objSearchSettingInfo.SearchResultPerPage = Int32.Parse(txtSearchResultPerPage.Text.Trim());
             objSearchSettingInfo.MaxSearchChracterAllowedWithSpace = Int32.Parse(txtMaxSearchChracterAllowedWithSpace.Text.Trim());
             objSearchSettingInfo.MaxResultChracterAllowedWithSpace = Int32.Parse(txtMaxResultCharacter.Text.Trim());
             SageFrameSearch con = new SageFrameSearch();
             con.AddUpdateSageFrameSearchSetting(objSearchSettingInfo, GetPortalID, GetCurrentCultureName, GetUsername);
             ShowMessage("", GetSageMessage("SageFrameSearch", "SearchSettingSavedSuccessfully"), "", SageMessageType.Success);
         }
         else
         {
             ShowMessage("", GetSageMessage("SageFrameSearch", "BlankValueNotAllowed"), "", SageMessageType.Alert);
         }
     }
     catch (Exception ex)
     {
         ProcessException(ex);
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Connects to database and returns search settings by portal ID and culture name.
        /// </summary>
        /// <param name="PortalID">Portal ID.</param>
        /// <param name="CultureName">Culture name.</param>
        /// <returns>List of setting values.</returns>
        public SageFrameSearchSettingInfo LoadSearchSettings(int PortalID, string CultureName)
        {
            try
            {
                List <KeyValuePair <string, string> > ParaMeterCollection = new List <KeyValuePair <string, string> >();

                ParaMeterCollection.Add(new KeyValuePair <string, string>("@CultureName", CultureName));
                ParaMeterCollection.Add(new KeyValuePair <string, string>("@PortalID", PortalID.ToString()));
                DataSet    ds      = new DataSet();
                SQLHandler sagesql = new SQLHandler();
                ds = sagesql.ExecuteAsDataSet("dbo.sp_SageFrameSearchSettingValueGet", ParaMeterCollection);
                SageFrameSearchSettingInfo objSearchSettingInfo = new SageFrameSearchSettingInfo();
                if (ds != null && ds.Tables != null && ds.Tables.Count > 0 && ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
                {
                    DataTable dt = ds.Tables[0];
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        string strKey = dt.Rows[i]["SettingKey"].ToString();
                        switch (strKey)
                        {
                        case "SearchButtonType":
                            if (dt.Rows[i]["SettingValue"].ToString() != string.Empty)
                            {
                                objSearchSettingInfo.SearchButtonType = Int32.Parse(dt.Rows[i]["SettingValue"].ToString());
                            }
                            break;

                        case "SearchButtonText":
                            objSearchSettingInfo.SearchButtonText = dt.Rows[i]["SettingValue"].ToString();
                            break;

                        case "SearchButtonImage":
                            objSearchSettingInfo.SearchButtonImage = dt.Rows[i]["SettingValue"].ToString();
                            break;

                        case "SearchResultPerPage":
                            if (dt.Rows[i]["SettingValue"].ToString() != string.Empty)
                            {
                                objSearchSettingInfo.SearchResultPerPage = Int32.Parse(dt.Rows[i]["SettingValue"].ToString());
                            }
                            break;

                        case "SearchResultPageName":
                            objSearchSettingInfo.SearchResultPageName = dt.Rows[i]["SettingValue"].ToString();
                            break;

                        case "MaxSearchChracterAllowedWithSpace":
                            if (dt.Rows[i]["SettingValue"].ToString() != string.Empty)
                            {
                                objSearchSettingInfo.MaxSearchChracterAllowedWithSpace = Int32.Parse(dt.Rows[i]["SettingValue"].ToString());
                            }
                            break;

                        case "MaxResultChracterAllowedWithSpace":
                            if (dt.Rows[i]["SettingValue"].ToString() != string.Empty)
                            {
                                objSearchSettingInfo.MaxResultChracterAllowedWithSpace = Int32.Parse(dt.Rows[i]["SettingValue"].ToString());
                            }
                            break;
                        }
                    }
                }
                return(objSearchSettingInfo);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Exemplo n.º 4
0
        public SageFrameSearchSettingInfo LoadSearchSettings(int PortalID, string CultureName)
        {
            try
            {
                List<KeyValuePair<string, string>> ParaMeterCollection = new List<KeyValuePair<string, string>>();

                ParaMeterCollection.Add(new KeyValuePair<string, string>("@CultureName", CultureName));
                ParaMeterCollection.Add(new KeyValuePair<string, string>("@PortalID", PortalID.ToString()));
                DataSet ds = new DataSet();
                SQLHandler sagesql = new SQLHandler();
                ds = sagesql.ExecuteAsDataSet("dbo.sp_SageFrameSearchSettingValueGet", ParaMeterCollection);
                SageFrameSearchSettingInfo objSearchSettingInfo = new SageFrameSearchSettingInfo();
                if (ds != null && ds.Tables != null && ds.Tables.Count > 0 && ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
                {
                    DataTable dt = ds.Tables[0];
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        string strKey = dt.Rows[i]["SettingKey"].ToString();
                        switch (strKey)
                        {
                            case "SearchButtonType":
                                if (dt.Rows[i]["SettingValue"].ToString() != string.Empty)
                                {
                                    objSearchSettingInfo.SearchButtonType = Int32.Parse(dt.Rows[i]["SettingValue"].ToString());
                                }
                                break;
                            case "SearchButtonText":
                                objSearchSettingInfo.SearchButtonText = dt.Rows[i]["SettingValue"].ToString();
                                break;
                            case "SearchButtonImage":
                                objSearchSettingInfo.SearchButtonImage = dt.Rows[i]["SettingValue"].ToString();
                                break;
                            case "SearchResultPerPage":
                                if (dt.Rows[i]["SettingValue"].ToString() != string.Empty)
                                {
                                    objSearchSettingInfo.SearchResultPerPage = Int32.Parse(dt.Rows[i]["SettingValue"].ToString());
                                }
                                break;
                            case "SearchResultPageName":
                                objSearchSettingInfo.SearchResultPageName = dt.Rows[i]["SettingValue"].ToString();
                                break;
                            case "MaxSearchChracterAllowedWithSpace":
                                if (dt.Rows[i]["SettingValue"].ToString() != string.Empty)
                                {
                                    objSearchSettingInfo.MaxSearchChracterAllowedWithSpace = Int32.Parse(dt.Rows[i]["SettingValue"].ToString());
                                }
                                break;
                        }
                    }
                }
                return objSearchSettingInfo;
               
            }
            catch (Exception e)
            {
                throw e;
            }
        }