Thursday 10 December 2015

Media Screens

  /*Large Screens*/
    @media only screen and (min-width : 1824px) {
    }
    /*Laptop and Desktop*/
    @media only screen and (min-width : 1224px) {
    }  
    /* iPad*/
    @media only screen and (min-device-width : 768px) and (max-device-width : 1024px) {
    }
    /*iPad landscape*/
    @media only screen and (min-device-width : 768px) and (max-device-width : 1024px) and (orientation : landscape) {
    }
    /*iPad Portrate*/
    @media only screen and (min-device-width : 768px) and (max-device-width : 1024px) and (orientation : portrait) {
    }  
    /*Smartphones Screens*/
    @media only screen and (min-device-width : 320px) and (max-device-width : 568px) {
    }
    /*Smartphones landscape*/
    @media only screen and (min-device-width : 320px) and (max-device-width : 568px) and (orientation : landscape) {
    }
     /*Smartphones Portrate*/
    @media only screen and (min-device-width : 320px) and (max-device-width : 568px) and (orientation : portrait) {
    }


....To be continue...

Wednesday 2 December 2015

Localization in DNN

string CultureCode = Thread.CurrentThread.CurrentCulture.ToString();


  <%= Localization.GetString("Actions", Localization.GetResourceFile(this, "SearchResults.ascx")) %>

Wednesday 11 November 2015

get Reourse File as JSON

string getReourseFileAsJSON(String resourceFileName)
        {
            try
            {
                string mapResString = "localizedString={'userLang':'" + m_UserInfo.UserLanguge + "',";
                ResXResourceReader rsxr = new ResXResourceReader(
                String.Format("{0}{1}\\{2}", System.AppDomain.CurrentDomain.BaseDirectory.ToString(), "App_GlobalResources", resourceFileName));
                foreach (DictionaryEntry d in rsxr)
                {
                    mapResString += "'" + d.Key.ToString() + "':'" + d.Value.ToString() + "',";
                }
                mapResString += "};";
                return mapResString;
            }
            catch
            {
                return "File Not Found";
            }

        }

Pass String Array to stored procedure

Split function to split array of integers values

if object_id('Split') is not null
    drop function split
go

create function dbo.Split
(
    @String varchar(max)
)
returns @SplittedValues table
(
    Id int primary key
)
as
begin
    declare @SplitLength int, @Delimiter varchar(5)

    set @Delimiter = ','

    while len(@String) > 0
    begin
        select @SplitLength = (case charindex(@Delimiter,@String) when 0 then
            len(@String) else charindex(@Delimiter,@String) -1 end)

        insert into @SplittedValues
        select convert(int, substring(@String,1,@SplitLength) )

        select @String = (case (len(@String) - @SplitLength) when 0 then  ''
            else right(@String, len(@String) - @SplitLength - 1) end)
    end
return 
end



Then create the  stored procedure 

CREATE PROCEDURE getLastInsertedRecods
       -- Add the parameters for the stored procedure here
       @currentDate as datetime,
       @carServiceIds as varchar
AS
BEGIN
       -- SET NOCOUNT ON added to prevent extra result sets from
       -- interfering with SELECT statements.
       SET NOCOUNT ON;

    -- Insert statements for procedure here
      
       SELECT TOP 10 carServiceId, position_x, position_y, speed, EngineOn
       FROM Vechile_track
       where dTime>=convert(date,@currentDate) and carServiceId in (select ID from dbo.Split(@carServiceIds))
       ORDER BY dTime ASC

END

Sunday 1 November 2015

mssql search in all tables in

DECLARE @SearchStr nvarchar(100)
SET @SearchStr = 'moheportal_uptodate'


    -- Copyright © 2002 Narayana Vyas Kondreddi. All rights reserved.
    -- Purpose: To search all columns of all tables for a given search string
    -- Written by: Narayana Vyas Kondreddi
    -- Site: http://vyaskn.tripod.com
    -- Updated and tested by Tim Gaunt
    -- http://www.thesitedoctor.co.uk
    -- http://blogs.thesitedoctor.co.uk/tim/2010/02/19/Search+Every+Table+And+Field+In+A+SQL+Server+Database+Updated.aspx
    -- Tested on: SQL Server 7.0, SQL Server 2000, SQL Server 2005 and SQL Server 2010
    -- Date modified: 03rd March 2011 19:00 GMT
    CREATE TABLE #Results (ColumnName nvarchar(370), ColumnValue nvarchar(3630))

    SET NOCOUNT ON

    DECLARE @TableName nvarchar(256), @ColumnName nvarchar(128), @SearchStr2 nvarchar(110)
    SET  @TableName = ''
    SET @SearchStr2 = QUOTENAME('%' + @SearchStr + '%','''')

    WHILE @TableName IS NOT NULL
   
    BEGIN
        SET @ColumnName = ''
        SET @TableName =
        (
            SELECT MIN(QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME))
            FROM     INFORMATION_SCHEMA.TABLES
            WHERE         TABLE_TYPE = 'BASE TABLE'
                AND    QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME) > @TableName
                AND    OBJECTPROPERTY(
                        OBJECT_ID(
                            QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME)
                             ), 'IsMSShipped'
                               ) = 0
        )

        WHILE (@TableName IS NOT NULL) AND (@ColumnName IS NOT NULL)
           
        BEGIN
            SET @ColumnName =
            (
                SELECT MIN(QUOTENAME(COLUMN_NAME))
                FROM     INFORMATION_SCHEMA.COLUMNS
                WHERE         TABLE_SCHEMA    = PARSENAME(@TableName, 2)
                    AND    TABLE_NAME    = PARSENAME(@TableName, 1)
                    AND    DATA_TYPE IN ('char', 'varchar', 'nchar', 'nvarchar', 'int', 'decimal')
                    AND    QUOTENAME(COLUMN_NAME) > @ColumnName
            )
   
            IF @ColumnName IS NOT NULL
           
            BEGIN
                INSERT INTO #Results
                EXEC
                (
                    'SELECT ''' + @TableName + '.' + @ColumnName + ''', LEFT(' + @ColumnName + ', 3630) FROM ' + @TableName + ' (NOLOCK) ' +
                    ' WHERE ' + @ColumnName + ' LIKE ' + @SearchStr2
                )
            END
        END  
    END

    SELECT ColumnName, ColumnValue FROM #Results

DROP TABLE #Results

Wednesday 21 October 2015

Edit map using Oracle Map Editor


  1. Installing the USER_SDO_EDIT_SESSIONS View
  2. Making a MapViewer Data Source Editable
  3. Launching the MapViewer Editor and Logging In
  4. Selecting a Data Source and Creating a New Session
  5. Adding Data Layers to a Session

Wednesday 14 October 2015

RadGrid Reduce the Filter Menu Options

protected void RadGrid1_Init(object sender, System.EventArgs e) { GridFilterMenu menu = RadGrid1.FilterMenu; int i = 0; while (i < menu.Items.Count) { if (menu.Items[i].Text == "NoFilter" ||
menu.Items[i].Text == "Contains" || menu.Items[i].Text == "EqualTo"
|| menu.Items[i].Text == "GreaterThan" ||
menu.Items[i].Text == "LessThan") { i++; } else { menu.Items.RemoveAt(i); } } }

Localizing GridFilterMenu to Arabic

protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                Telerik.Web.UI.GridFilterMenu menu = RadGrid1.FilterMenu;
                foreach (Telerik.Web.UI.RadMenuItem item in menu.Items)
                {
                    switch (item.Text)
                    {
                        case "NoFilter":
                            item.Text = "بدون فلترة"; break;
                        case "Contains":
                            item.Text = "يحتوي على"; break;
                        case "DoesNotContain":
                            item.Text = "لا يحتوي على"; break;
                        case "StartsWith":
                            item.Text = "يبدأ بـ"; break;
                        case "EndsWith":
                            item.Text = "ينتهي بـ"; break;
                        case "EqualTo":
                            item.Text = "يساوي"; break;
                        case "NotEqualTo":
                            item.Text = "لا يساوي"; break;
                        case "GreaterThan":
                            item.Text = "أكبر من"; break;
                        case "LessThan":
                            item.Text = "أقل من"; break;
                        case "GreaterThanOrEqualTo":
                            item.Text = "أكبر من أو يساوي"; break;
                        case "LessThanOrEqualTo":
                            item.Text = "أقل من أو يساوي"; break;
                        case "Between":
                            item.Text = "بين"; break;
                        case "NotBetween":
                            item.Text = "ليس من بين"; break;
                        case "IsEmpty":
                            item.Text = "فارغ"; break;
                        case "NotIsEmpty":
                            item.Text = "غير فارغ"; break;
                        case "IsNull":
                            item.Text = "لا شيء"; break;
                        case "NotIsNull":
                            item.Text = "بلا لا شيء"; break;
                        case "Custom":
                            item.Text = "مخصص"; break;
                    }
                }
            }

        }

Wednesday 7 October 2015

general insert into geom

INSERT INTO user_sdo_geom_metadata
    (TABLE_NAME,
     COLUMN_NAME,
     DIMINFO,
     SRID)
  VALUES (
  'spatialTableOrViewName',
  'SHAPE',

(
select diminfo from user_sdo_geom_metadata where table_name = upper('LB_INTERNATIAL_BORDERS_GIS')
)

,
  28191   -- SRID
);
commit;


Update

update user_sdo_geom_metadata
    set DIMINFO=
  (
select diminfo from user_sdo_geom_metadata where table_name = upper('BACKGROUND')
)
where table_name like 'MB_%' or table_name like 'MP_%';

Monday 5 October 2015

DNN Spot rotator

DNN spot rotator  is a DNN module which enables you to create slider and customize it's template

To use it, download it, and create a new template, inside the template body past the following


<style type="text/css">
    .sliderContainer {
        direction: rtl;
        text-align: right;
    }

        .sliderContainer .nextBtn a {
            color: rgba(255, 255, 255, 0.00);
            width: 27px;
            height: 27px;
            position: absolute;
            top: 50%;
            right: 0;
            z-index: 999;
            padding-top: 10px;
            padding-bottom: 10px;
            cursor: pointer;
            background-color: rgba(255, 255, 255, 0.42);
            background: center url('/images/next.png') no-repeat;
            opacity: 0.5;
            -moz-transition: opacity ease-in-out 500ms;
            -o-transition: opacity ease-in-out 500ms;
            -webkit-transition: opacity ease-in-out 500ms;
            transition: opacity ease-in-out 500ms;
        }

        .sliderContainer .prevBtn a {
            color: rgba(255, 255, 255, 0.00);
            width: 27px;
            height: 27px;
            position: absolute;
            top: 50%;
            left: 0;
            z-index: 999;
            padding-top: 10px;
            padding-bottom: 10px;
            cursor: pointer;
            background-color: rgba(255, 255, 255, 0.42);
            background: center url('/images/prev.png') no-repeat;
            opacity: 0.5;
            -moz-transition: opacity ease-in-out 500ms;
            -o-transition: opacity ease-in-out 500ms;
            -webkit-transition: opacity ease-in-out 500ms;
            transition: opacity ease-in-out 500ms;
        }

        .sliderContainer .nextBtn:hover, .sliderContainer .prevBtn:hover {
            opacity: 1;
        }

        .sliderContainer .slides {
            float: right;
        }

            .sliderContainer .slides img {
                border: 1px solid #D7D7D7;
            }

        .sliderContainer .slidePager {
            float: right;
        }

            .sliderContainer .slidePager ul {
                position: relative;
                display: inline-block;
                width: 100%;
            }

                .sliderContainer .slidePager ul li {
                    display: block;
                    padding: 2px;
                    padding-right: 5px;
                    line-height: 1.6em;
                    border-bottom: 1px solid #D7D7D7;
                }

                    .sliderContainer .slidePager ul li a {
                        color: black;
                    }

            .sliderContainer .slidePager .activeSlide {
                background-color: antiquewhite;
            }
</style>
<div class="sliderContainer">
    <div class="slides">
        [SLIDES]
        <div class="nextBtn">
            [NEXT]
        </div>
        <div class="prevBtn">
            [PREV]
        </div>
    </div>
    <div class="slidePager">
        [PAGER]
    </div>

</div>