Windows Users List in Asp.Net c#

using System.Management; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { SelectQuery query = new SelectQuery(“Win32_UserAccount”); ManagementObjectSearcher searcher = new ManagementObjectSearcher(query); foreach (ManagementObject envVar in searcher.Get()) { Console.WriteLine(“Username : {0}”, envVar[“Name”]); } Console.ReadLine(); } } }

create xml file dynamically

try { if (System.Web.HttpContext.Current.Session[“UserId”] != null && System.Web.HttpContext.Current.Session[“EventId”] != null && System.Web.HttpContext.Current.Session[“EventConfiguration”] != null) { Logger.Write(LogType.INFO, ModuleToLog.EventInformation, “WriteEventHistory”, “EventHistory”, HttpContext.Current.Session[“UserName”].ToString()); string pageName = System.IO.Path.GetFileName(System.Web.HttpContext.Current.Request.ServerVariables[“SCRIPT_NAME”]); UserService.UserClient proxyFind = new ePlannerPro2Client.UserService.UserClient(); epp2ClientPL.UsersProperties result = proxyFind.LoadById(new Guid(Convert.ToString(System.Web.HttpContext.Current.Session[“UserId”])), new Guid(Convert.ToString(System.Web.HttpContext.Current.Session[“EventId”]))); if (result == null) { return; } //epp2ClientPL.UsersProperties result = proxyFind.LoadUsersByEventId(new Guid(Convert.ToString(Convert.ToString(System.Web.HttpContext.Current.Session[“EventId”])))).Where(u => u.UserId.Equals(new Guid(Convert.ToString(System.Web.HttpContext.Current.Session[“UserId”])))).SingleOrDefault(); epp2ClientPL.EventConfigurationProperties files = (epp2ClientPL.EventConfigurationProperties)System.Web.HttpContext.Current.Session[“EventConfiguration”]; …

Client System TimeZone Offset

The getTimezoneOffset method returns an integer value representing the number of minutes between the time on the current machine and UTC. These values are appropriate to the computer the script is executed on. If it is called from a server script, the return value is appropriate to the server. If it is called from a …

Convert DateTime into Specific TimeZone wise with DayLightSavingTime Changes

DateTime date1 = Convert.ToDateTime(“15-03-2010 3:30:00 AM”); //start day of daylighttime //DateTime date1 = Convert.ToDateTime(“07-11-2010 3:30:00 AM”); //DateTime date1 = Convert.ToDateTime(“08-11-2010 3:30:00 AM”); // end day of daylighttime //set local timezone TimeZoneInfo sourceTimeZone = TimeZoneInfo.Local; //get system timezones list System.Collections.ObjectModel.ReadOnlyCollection timeZone = TimeZoneInfo.GetSystemTimeZones(); List tz = timeZone.ToList(); //get event time zone standard name epp2ClientPL.EventConfigurationProperties result = …

Datatable.Copy() & DataTable.Clone() ???

DataTable dtCopy = table.Copy(); it will create “dtCopy” datatable with the records from “table”, DataTable dtClone = table.Clone(); it will create “dtClone” datatable without any records. it only copy structure of “table” datatable. DataTable dtCopy = dataViewTable.ToTable().copy(); it will create “dtCopy” datatablw with records only contains in DataView.

TimeZone : Get the date and time as per time zone

//Get the Collection of System’s Time Zones. System.Collections.ObjectModel.ReadOnlyCollection timeZone = TimeZoneInfo.GetSystemTimeZones(); //Convert time zone collection to LIST List tz = timeZone.ToList(); string strZone=””; try { strZone = tz.AsEnumerable().Where(u => u.DisplayName == “(UTC+01:00) West Central Africa”).SingleOrDefault().StandardName.ToString(); } catch (Exception ex) { Console.WriteLine(ex.Message.ToString()); } TimeZoneInfo timeZone1 = TimeZoneInfo.Local; TimeZoneInfo timeZone2 = TimeZoneInfo.FindSystemTimeZoneById(strZone.ToString()); Console.WriteLine(“================= Time Zone =============”); Console.WriteLine(timeZone1.DisplayName); …

Insert Current DateTime Into SQL Using Asp.Net

Aspx Form Javascript Function For Check validate time inserted or not function CheckTime(Control) { var txtBreakdownTime = document.getElementById(“”); var ddlAMPM = document.getElementById(“”); if (txtBreakdownTime != null && ddlAMPM != null) { var BreakdownTime = txtBreakdownTime.value; var HourNMinute = new Array(); HourNMinute = BreakdownTime.split(‘:’); if (parseInt(HourNMinute[0]) > 12) { alert(“Invalid Time Entry.”); Control.focus(); } if (parseInt(HourNMinute[1]) …

Sort on Gridview

Default.aspx.cs page: Delcare Object DAL objDal = new DAL(); string SORT_DESC = “Desc”; string SORT_ASC = “Asc”; Page Load Event protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { BindCountryGrid(); if (!String.IsNullOrEmpty(Request.QueryString[“Result”])) { DisplayMessage(); } } } Bind Grid Code private void BindCountryGrid() { DataTable dtCountry = new DataTable(); dtCountry = objDal.GetDataTable(“spGetCountry”); if (dtCountry …