Don't wanna be here? Send us removal request.
Text
Ajax Function Loader
if ($('body').find('#resultLoading').attr('id') != 'resultLoading') { $('body').append('<div id="resultLoading" style="display:none"><div><img loader image style="width:30px;height:30px;"><div>' + text + '</div></div><div class="bg"></div></div>'); }
$('#resultLoading').css({ 'width': '100%', 'height': '100%', 'position': 'fixed', 'z-index': '10000', 'top': '0', 'left': '0', 'right': '0', 'bottom': '0', 'margin': 'auto' });
$('#resultLoading .bg').css({ 'background': '#fff', 'opacity': '0.7', 'width': '100%', 'height': '100%', 'position': 'absolute', 'top': '0' });
$('#resultLoading>div:first').css({ 'width': '250px', 'height': '75px', 'text-align': 'center', 'position': 'fixed', 'top': '0', 'left': '0', 'right': '0', 'bottom': '0', 'margin': 'auto', 'font-size': '16px', 'z-index': '10', 'color': '#fff' });
$('#resultLoading .bg').height('100%');
$('#resultLoading').fadeIn(300); $('body').css('cursor', 'wait');
}
function ajaxindicatorstop() { $('#resultLoading .bg').height('100%'); $('#resultLoading').fadeOut(300); $('body').css('cursor', 'default'); }
$(document).ajaxStart(function () { //show ajax indicator ajaxindicatorstart('loading data.. please wait..'); }).ajaxStop(function () { //hide ajax indicator ajaxindicatorstop(); });
0 notes
Text
Check IsNumeric value in Javascript
const IsNumeric = (input) => {聽 聽 聽 聽 聽 聽聽
聽 聽 聽 聽 var RE = /^-?(0|INF|(0[1-7][0-7]*)|(0x[0-9a-fA-F]+)|((0|[1-9][0-9]*|(?=[\.,]))([\.,][0-9]+)?([eE]-?\d+)?))$/;聽 聽 聽 聽 聽 聽聽
聽 聽 聽 聽 聽return (RE.test(input));聽 聽 聽 聽 聽
聽}
0 notes
Text
Export HTML table using jQuery
<script type="text/javascript">
聽 聽 聽 聽$(document).on("click", "#btnFetchData", function () {
聽 聽 聽 聽 聽 聽//console.log("start");
聽 聽 聽 聽 聽 聽//var settings = $.extend({ 聽 聽 聽 聽 聽 聽// 聽 聽filename: "test" 聽 聽 聽 聽 聽 聽//}, options); 聽 聽 聽 聽 聽 聽var clean_text = function (text) { 聽 聽 聽 聽 聽 聽 聽 聽text = $.trim(text.replace(/"/g, '""')); 聽 聽 聽 聽 聽 聽 聽 聽return '"' + text + '"'; 聽 聽 聽 聽 聽 聽};
聽 聽 聽 聽 聽 聽//$(".table-advance").tableToCSV({ 聽 聽 聽 聽 聽 聽// 聽 聽filename: 'employeelist' 聽 聽 聽 聽 聽 聽//});
聽 聽 聽 聽 聽 聽//console.log("end");
聽 聽 聽 聽 聽 聽var table = $(this); 聽 聽 聽 聽 聽 聽var caption = "ReceivingData1"; 聽 聽 聽 聽 聽 聽var title = []; 聽 聽 聽 聽 聽 聽var rows = [];
聽 聽 聽 聽 聽 聽title = ['Receiving Date', 'Supplier', 'BOL', 'Qty', 'Return Qty', 'Qty Type', 'Product', 'Lot#', 'Label', 'Unit Cost', 'Raw Weight / Each', 聽 聽 聽 聽 聽 聽 聽 聽'Raw Cost Per Lb /Each', 'Yield %', 'Estimated Lb / Each', 'Cost Per Lb/Each', 'Yield %', 'Actual Lb / Each', 'Cost Per Lb/Each', 聽 聽 聽 聽 聽 聽 聽 聽'Entered By', 'PO Date', 'PO#', '']
聽 聽 聽 聽 聽 聽$(".table-advance").find('tbody').each(function (key, TbodyVal) {
聽 聽 聽 聽 聽 聽 聽 聽var ReceivingDate = ''; 聽 聽 聽 聽 聽 聽 聽 聽var Supplier = ''; 聽 聽 聽 聽 聽 聽 聽 聽var BOL = '';
聽 聽 聽 聽 聽 聽 聽 聽$(this).find('tr').each(function (key, TrVal) { 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽//console.log(TrVal);
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽var data = [];
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽if ($(this).attr("class") != undefined) { 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽//console.log("remaining row"); 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽data.push(ReceivingDate); 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽data.push(Supplier); 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽data.push(BOL); 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽$(this).find('td').each(function () { 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽var text = clean_text($(this).text()); 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽data.push(text); 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽}); 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽} 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽else { 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽//console.log("First row");
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽//ReceivingDate = $(TrVal).find("td").eq(0).html(); 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽//Supplier = $(TrVal).find("td").eq(1).html(); 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽//BOL = $(TrVal).find("td").eq(2).html();
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽$(this).find('td').each(function () { 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽var text = clean_text($(this).text()); 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽data.push(text); 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽}); 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽}
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽data = data.join(","); 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽rows.push(data);
聽 聽 聽 聽 聽 聽 聽 聽}); 聽 聽 聽 聽 聽 聽});
聽 聽 聽 聽 聽 聽title = title.join(","); 聽 聽 聽 聽 聽 聽rows = rows.join("\n"); 聽 聽 聽 聽 聽 聽var csv = title + "\n" + rows; 聽 聽 聽 聽 聽 聽var uri = 'data:text/csv;charset=utf-8,' + encodeURIComponent(csv); 聽 聽 聽 聽 聽 聽var download_link = document.createElement('a'); 聽 聽 聽 聽 聽 聽download_link.href = uri; 聽 聽 聽 聽 聽 聽var ts = new Date().getTime(); 聽 聽 聽 聽 聽 聽if (caption == "") { 聽 聽 聽 聽 聽 聽 聽 聽download_link.download = ts + ".csv"; 聽 聽 聽 聽 聽 聽} else { 聽 聽 聽 聽 聽 聽 聽 聽download_link.download = caption + "-" + ts + ".csv"; 聽 聽 聽 聽 聽 聽} 聽 聽 聽 聽 聽 聽document.body.appendChild(download_link); 聽 聽 聽 聽 聽 聽download_link.click(); 聽 聽 聽 聽 聽 聽document.body.removeChild(download_link);
聽 聽 聽 聽}); 聽 聽</script>
0 notes
Text
Export Method in CSV in C#
聽 聽protected void ExportCSV(object sender, EventArgs e) 聽 聽{ 聽 聽 聽 聽string constr = ConfigurationManager.ConnectionStrings["constr"].ConnectionString; 聽 聽 聽 聽using (SqlConnection con = new SqlConnection(constr)) 聽 聽 聽 聽{ 聽 聽 聽 聽 聽 聽using (SqlCommand cmd = new SqlCommand("SELECT * FROM Customers")) 聽 聽 聽 聽 聽 聽{ 聽 聽 聽 聽 聽 聽 聽 聽using (SqlDataAdapter sda = new SqlDataAdapter()) 聽 聽 聽 聽 聽 聽 聽 聽{ 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽cmd.Connection = con; 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽sda.SelectCommand = cmd; 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽using (DataTable dt = new DataTable()) 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽{ 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽sda.Fill(dt);
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽//Build the CSV file data as a Comma separated string. 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽string csv = string.Empty;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽foreach (DataColumn column in dt.Columns) 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽{ 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽//Add the Header row for CSV file. 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽csv += column.ColumnName + ','; 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽}
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽//Add new line. 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽csv += "\r\n";
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽foreach (DataRow row in dt.Rows) 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽{ 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽foreach (DataColumn column in dt.Columns) 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽{ 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽//Add the Data rows. 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽csv += row[column.ColumnName].ToString().Replace(",", ";") + ','; 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽}
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽//Add new line. 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽csv += "\r\n"; 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽}
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽//Download the CSV file. 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽Response.Clear(); 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽Response.Buffer = true; 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽Response.AddHeader("content-disposition", "attachment;filename=SqlExport.csv"); 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽Response.Charset = ""; 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽Response.ContentType = "application/text"; 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽Response.Output.Write(csv); 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽Response.Flush(); 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽Response.End(); 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽} 聽 聽 聽 聽 聽 聽 聽 聽} 聽 聽 聽 聽 聽 聽} 聽 聽 聽 聽} 聽 聽}
0 notes
Text
Set Decimal Points Method
public static string SetDecimals(string Value, int Decimal) 聽 聽 聽 聽{ 聽 聽 聽 聽 聽 聽try 聽 聽 聽 聽 聽 聽{ 聽 聽 聽 聽 聽 聽 聽 聽string ObjReturn = ""; 聽 聽 聽 聽 聽 聽 聽 聽if (Value == null || Value == "") 聽 聽 聽 聽 聽 聽 聽 聽{ 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽Value = "0"; 聽 聽 聽 聽 聽 聽 聽 聽} 聽 聽 聽 聽 聽 聽 聽 聽ObjReturn = string.Format("{0:N" + Math.Abs(Decimal) + "}", Convert.ToDouble(Value)); 聽 聽 聽 聽 聽 聽 聽 聽if (ObjReturn.Contains(',')) 聽 聽 聽 聽 聽 聽 聽 聽{ 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽ObjReturn = ObjReturn.Replace(",", ""); 聽 聽 聽 聽 聽 聽 聽 聽} 聽 聽 聽 聽 聽 聽 聽 聽return ObjReturn; 聽 聽 聽 聽 聽 聽} 聽 聽 聽 聽 聽 聽catch (Exception ex) 聽 聽 聽 聽 聽 聽{ 聽 聽 聽 聽 聽 聽 聽 聽throw ex; 聽 聽 聽 聽 聽 聽} 聽 聽 聽 聽}
0 notes
Text
Get List while comparing two Comma Separated columns
/****** Object: 聽StoredProcedure [dbo].[spGetListUsingTwoDifferentCommaSeparatedColumns] 聽 聽Script Date: 30-Dec-2020 12:17:44 PM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[spGetListUsingTwoDifferentCommaSeparatedColumns] @MultipleUserID int = 2 AS BEGIN SET NOCOUNT ON
DECLARE @MultipleUser VARCHAR(max) = ( select distinct 聽 stuff(( select ',' + CONVERT(nvarchar(max), ISNULL(u.UserID, '''')) from tblFirstTable u where u.UserID = UserID and MultipleUserID like cast(@MultipleUserID as varchar(50) ) or MultipleUserID like '%,'+cast( @MultipleUserID as varchar(50) ) or MultipleUserID like '%,'+ cast( @MultipleUserID as varchar(50) ) +',%' or MultipleUserID like cast( @MultipleUserID as 聽varchar(50) )+',%' order by u.UserID for xml path('') ),1,1,'') from tblFirstTable group by MultipleUserID )
DECLARE @split TABLE (MultipleUserIDVal VARCHAR(64))
DECLARE @word VARCHAR(64),@start INT, @end INT, @stop 聽INT
-- string split in 8 lines
SELECT @MultipleUser += ',',@start = 1,@stop = Len(@MultipleUser) + 1
WHILE @start < @stop
聽BEGIN
聽SELECT @end = Charindex(',', @MultipleUser, @start),
@word = Rtrim(Ltrim(Substring(@MultipleUser, @start, @end - @start))),
@start = @end + 1
聽 INSERT @split VALUES (@word)
聽END
聽-------------------------------------------------------------------------------
--SELECT * FROM 聽 @split
SELECT * FROM tblSecondTable a WHERE active=1 and EXISTS (SELECT *
聽 FROM @split w
聽 WHERE 聽Charindex(',' + w.MultipleUserIDVal + ',', ',' + a.MultipleUserID + ',') > 0) END
Reference Link -聽https://www.c-sharpcorner.com/blogs/compare-comma-separated-value-with-comma-separated-column-in-sql-server1
0 notes
Text
User Session Timer
<div id="countdown"></div> <input type="button" value="start" onclick="start();" /> <input type="button" value="stop" onclick="stop();" /> <script src="~/Scripts/jquery-1.10.2.min.js"></script> <script> 聽 聽var days; 聽 聽var hours; 聽 聽var minutes; 聽 聽var seconds; 聽 聽function stop() { 聽 聽 聽 聽clearInterval(timer); 聽 聽 聽 聽sendAjax(days, hours, minutes, seconds); 聽 聽} 聽 聽function start() { 聽 聽 聽 聽timer = setInterval(showRemaining, 1000); 聽 聽} 聽 聽function sendAjax(day, hours, minutes, seconds) { 聽 聽 聽 聽alert(seconds); 聽 聽 聽 聽var data = JSON.stringify({ 聽 聽 聽 聽 聽 聽'day': day, 聽 聽 聽 聽 聽 聽'hours': hours, 聽 聽 聽 聽 聽 聽'minutes': minutes, 聽 聽 聽 聽 聽 聽'seconds': seconds 聽 聽 聽 聽}); 聽 聽 聽 聽$.ajax({ 聽 聽 聽 聽 聽 聽type: "POST", 聽 聽 聽 聽 聽 聽url: '@Url.Action("SaveInDB","Home")', 聽 聽 聽 聽 聽 聽data: data, 聽 聽 聽 聽 聽 聽success: function(){}, 聽 聽 聽 聽 聽 聽contentType: 'application/json' 聽 聽 聽 聽}); 聽 聽} 聽 聽var end = new Date('04/18/2018 12:00 PM'); 聽 聽var _second = 1000; 聽 聽var _minute = _second * 60; 聽 聽var _hour = _minute * 60; 聽 聽var _day = _hour * 24; 聽 聽var timer; 聽 聽function showRemaining() { 聽 聽 聽 聽var now = new Date(); 聽 聽 聽 聽var distance = end - now; 聽 聽 聽 聽if (distance < 0) { 聽 聽 聽 聽 聽 聽clearInterval(timer); 聽 聽 聽 聽 聽 聽document.getElementById('countdown').innerHTML = 'EXPIRED!'; 聽 聽 聽 聽 聽 聽return; 聽 聽 聽 聽} 聽 聽 聽 聽days = Math.floor(distance / _day); 聽 聽 聽 聽hours = Math.floor((distance % _day) / _hour); 聽 聽 聽 聽minutes = Math.floor((distance % _hour) / _minute); 聽 聽 聽 聽seconds = Math.floor((distance % _minute) / _second); 聽 聽 聽 聽document.getElementById('countdown').innerHTML = days + 'days '; 聽 聽 聽 聽document.getElementById('countdown').innerHTML += hours + 'hrs '; 聽 聽 聽 聽document.getElementById('countdown').innerHTML += minutes + 'mins '; 聽 聽 聽 聽document.getElementById('countdown').innerHTML += seconds + 'secs'; 聽 聽} </script>
0 notes
Text
Register .Net Framework in IIS
Open - Command Prompt
For聽 32bit -聽 CD C:\Windows\Microsoft.NET\Framework\v4.0.30319
For 64bit -聽 CD C:\Windows\Microsoft.NET\Framework64\v4.0.30319
Command -聽 aspnet_regiis 鈥搃
0 notes
Text
Convert Single Record from DB in Column wise Array
Dictionary<string, string> dictionaryData = new Dictionary<string, string>(); using (var db = new DbContext()) { 聽 db.Configuration.ProxyCreationEnabled = false; // disable lazy loading if require. 聽 var dataFromDB= db.TestTable.Where(x => x.ID == id).FirstOrDefault(); 聽 var props = dataFromDB.GetType().GetProperties(); // Get All properties of table class 聽 foreach (var column in props) 聽 { 聽 聽 聽string columnName = column.Name; 聽 聽 聽string columnValue = string.Empty; 聽 聽 聽if(column.GetValue(dataFromDB) != null) // check obj has value for that particular property 聽 聽 聽{ 聽 聽 聽 聽 columnValue = column.GetValue(dataFromDB).ToString(); 聽 聽 聽} 聽 聽 聽dictionaryData .Add(columnName,columnValue); // Add Column Name as key and Column Data As Value 聽 } }
0 notes
Text
Change Password Model with Regex
public class ChangePassword 聽 聽{ 聽 聽 聽 聽[Display(Name = "Old Password")] 聽 聽 聽 聽[Required(ErrorMessage = "Old Password is required.")] 聽 聽 聽 聽[DataType(DataType.Text)] 聽 聽 聽 聽public string OldPassword { get; set; }
聽 聽 聽 聽[Display(Name = "New Password")] 聽 聽 聽 聽[Required(ErrorMessage = "New Password is required.")] 聽 聽 聽 聽[DataType(DataType.Text)] 聽 聽 聽 聽[RegularExpression("^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$%^&*-]).{8,}$", ErrorMessage = "Password must contain atleast 1 number, 1 letter, and 1 special character.")] 聽 聽 聽 聽public string NewPassword { get; set; }
聽 聽 聽 聽[Display(Name = "Confirm Password")] 聽 聽 聽 聽[Required(ErrorMessage = "Confirm Password is required.")] 聽 聽 聽 聽[Compare("NewPassword", ErrorMessage = "New Password and Confirm Password must match.")] 聽 聽 聽 聽[DataType(DataType.Text)] 聽 聽 聽 聽public string ConfirmPassword { get; set; }
聽 聽 聽 聽[Display(Name = "Username")] 聽 聽 聽 聽[DataType(DataType.Text)] 聽 聽 聽 聽public string Username { get; set; } 聽 聽}
0 notes
Text
Disable right click in website
<body oncontextmenu="return false" onselectstart="return false" ondragstart="return false">
<script type="text/javascript"> 聽 聽 聽 聽 聽 聽document.addEventListener("keydown", function (e) { 聽 聽 聽 聽 聽 聽 聽 聽// "F12" key 聽 聽 聽 聽 聽 聽 聽 聽if (event.keyCode == 123) { 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽disabledEvent(e); 聽 聽 聽 聽 聽 聽 聽 聽} 聽 聽 聽 聽 聽 聽}, false);
聽 聽 聽 聽 聽 聽function disabledEvent(e) { 聽 聽 聽 聽 聽 聽 聽 聽if (e.stopPropagation) { 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽e.stopPropagation(); 聽 聽 聽 聽 聽 聽 聽 聽} else if (window.event) { 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽window.event.cancelBubble = true; 聽 聽 聽 聽 聽 聽 聽 聽} 聽 聽 聽 聽 聽 聽 聽 聽e.preventDefault(); 聽 聽 聽 聽 聽 聽 聽 聽return false; 聽 聽 聽 聽 聽 聽} </script>
0 notes
Text
Update Stored Procedure in Entity Framework
First remove聽 Complex Types,聽 Function Imports,聽 Stored Procdures/ Functions from .edmx. And the update edmx file.
0 notes
Text
Center Page onfocus of input
Element.prototype.documentOffsetTop = function () { 聽return this.offsetTop + ( this.offsetParent ? this.offsetParent.documentOffsetTop() : 0 ); }; Element.prototype.scrollIntoViewCenter = function () { 聽window.scrollTo( 0, this.documentOffsetTop() - (window.innerHeight / 2 ) ); }; window.addEventListener("keyup", myScript); function myScript(e) { 聽if ('9' == e.keyCode) { 聽// tab = 9 聽 聽//find and vertically center focused input 聽 聽document.activeElement.scrollIntoViewCenter(); 聽} }
0 notes
Text
ReactJS - Route.jsx
import React, { Component } from "react"; import { Route, Switch } from "react-router-dom";
// ------ Pages -------- import Login from '../login/login'; import Home from '../home/home'; import Users from '../users/users'; import UserDetails from '../userdetails/userdetails'; import Logout from '../logout/logout'; import NotFound from '../notfound/notfound'; // To handle 404 Error import PrivateRoute from '../app/PrivateRoute'; //Component for checking Authorize User
class Routes extends Component { 聽 聽constructor(props) { 聽 聽 聽 聽super(props); 聽 聽}
聽 聽render() {
聽 聽 聽 聽return ( 聽 聽 聽 聽 聽 聽<Switch> 聽 聽 聽 聽 聽 聽 聽 聽<Route exact path='/' component={Login} /> /* Default Page Set */ 聽 聽 聽 聽 聽 聽 聽 聽<Route exact path='/app/home' component={Home} />
聽 聽 聽 聽 聽 聽 聽 聽<PrivateRoute exact path='/app/userdetails/:userid' component={UserDetails} /> 聽 聽 聽 聽 聽 聽 聽 聽<PrivateRoute path='/app/Users' component={Users} /> 聽 聽 聽 聽 聽 聽 聽 聽<PrivateRoute path='/app/logout' component={Logout} />
聽 聽 聽 聽 聽 聽 聽 聽<Route path="*" component={NotFound} /> 聽 聽 聽 聽 聽 聽</Switch>
聽 聽 聽 聽); 聽 聽} }
export default Routes;
0 notes
Text
ReactJS-Main.jsx
import React from 'react';
// Add New code for Multiple page links import { Nav, Navbar, NavItem, NavDropdown, MenuItem } from "react-bootstrap";
// Include to redirect from one page to another without page refresh import { LinkContainer } from "react-router-bootstrap";
// Include for Routing Links import Routes from '../app/routes';
// Include for Multi Language import { renderToStaticMarkup } from "react-dom/server"; import { withLocalize, Translate } from "react-localize-redux"; import GlobalTranslations from "../translations/global.json"; import LanguageToggle from "../Languages/LanguageToggle";
import cookie from 'react-cookies';
//-------------- Bootstrap Menu --------------------
class Main extends React.Component { 聽 聽constructor(props) { 聽 聽 聽 聽super(props);
聽 聽 聽 聽// To get Active Language value from Cookie 聽 聽 聽 聽this.state = { 聽 聽 聽 聽 聽 聽lang: cookie.load('Language'), 聽 聽 聽 聽 聽 聽Token: cookie.load('Token') 聽 聽 聽 聽}; 聽 // To set Active Language 聽 聽 聽 聽this.props.initialize({ 聽 聽 聽 聽 聽 聽languages: [ 聽 聽 聽 聽 聽 聽 聽 聽{ name: "English", code: "En" }, 聽 聽 聽 聽 聽 聽 聽 聽{ name: "French", code: "Fr" } 聽 聽 聽 聽 聽 聽], 聽 聽 聽 聽 聽 聽translation: GlobalTranslations, 聽 聽 聽 聽 聽 聽options: { 聽 聽 聽 聽 聽 聽 聽 聽renderToStaticMarkup, 聽 聽 聽 聽 聽 聽 聽 聽defaultLanguage: this.state.lang //"En"-"Fr" 聽 聽 聽 聽 聽 聽} 聽 聽 聽 聽}); 聽 聽}
聽 聽render() {
聽 聽 聽 聽 聽 聽return ( 聽 聽 聽 聽 聽 聽 聽 聽<div> 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽<LanguageToggle /> 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽<div className="App">
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽<Navbar fluid collapseOnSelect> 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽<Navbar.Header> 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽<Navbar.Toggle /> 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽</Navbar.Header> 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽<Navbar.Collapse> 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽<Nav> 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽<LinkContainer to="/app/home"> 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽<NavItem><Translate id="home" /></NavItem> 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽</LinkContainer> 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽<LinkContainer to="/app/users"> 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽<NavItem><Translate id="users" /></NavItem> 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽</LinkContainer> 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽<LinkContainer to="/app/categories"> 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽<NavItem><Translate id="categories" /></NavItem> 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽</LinkContainer> 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽<LinkContainer to="#!" activeClassName="active"> 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽<NavDropdown title="Elements" id="Elements-dropdown"> 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽<LinkContainer to="/app/form" activeClassName="active"><MenuItem>Form</MenuItem></LinkContainer> 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽<LinkContainer to="/app/messageboxpage" activeClassName="active"><MenuItem>Message Box</MenuItem></LinkContainer> 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 锟斤拷 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽<LinkContainer to="/app/datepickerpage" activeClassName="active"><MenuItem>Datepicker</MenuItem></LinkContainer> 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽<LinkContainer to="/app/dropdownlist" activeClassName="active"><MenuItem>Dropdownlist</MenuItem></LinkContainer> 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽<LinkContainer to="/app/tabs" activeClassName="active"><MenuItem>Tabs</MenuItem></LinkContainer> 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽{/* 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 * <MenuItem divider /> 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 * <LinkContainer to="/element/major" activeClassName="active"><MenuItem>Element After Divider</MenuItem></LinkContainer> 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 */} 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽</NavDropdown> 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽</LinkContainer> 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽</Nav>
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽<ul className="nav navbar-nav navbar-right"> 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽<li><a href="/home/about"><Translate id="aboutus" /></a></li> 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽<li><a href="/home/contact"><Translate id="contactus" /></a></li> 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽<LinkContainer to="/app/logout"> 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽<NavItem>Logout</NavItem> 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽</LinkContainer> 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽</ul> 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽</Navbar.Collapse> 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽</Navbar> 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽<Routes /> 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽</div> 聽 聽 聽 聽 聽 聽 聽 聽</div> 聽 聽 聽 聽 聽 聽);
聽 聽} }
export default withLocalize(Main);
0 notes
Text
ReactJS startup App.js
import React from 'react'; import ReactDOM from 'react-dom'; import Main from '../main/main';
import { LocalizeProvider } from "react-localize-redux"; // For Multi Language
// Add code for Router setting import { BrowserRouter as Router } from "react-router-dom";
class App extends React.Component { 聽 聽render() { 聽 聽 聽 聽return ( 聽 聽 聽 聽 聽 聽<LocalizeProvider> 聽 聽 聽 聽 聽 聽 聽 聽<Router> 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽<Main /> 聽 聽 聽 聽 聽 聽 聽 聽</Router> 聽 聽 聽 聽 聽 聽</LocalizeProvider> 聽 聽 聽 聽); 聽 聽} }
ReactDOM.render(<App />, document.getElementById('app'));
0 notes
Text
Guid formats
Guid guid = Guid.NewGuid();
Console.WriteLine(guid.ToString("N")) 63be6f7e4e564f0580229f958f492077
Console.WriteLine(guid.ToString("D")) 63be6f7e-4e56-4f05-8022-9f958f492077
Console.WriteLine(guid.ToString("B")) {63be6f7e-4e56-4f05-8022-9f958f492077}
Console.WriteLine(guid.ToString("P")) (63be6f7e-4e56-4f05-8022-9f958f492077)
0 notes