Posts

Showing posts from July, 2020

Accessing URL from Browsers like Google ,Firefox, Edge , Explorer,opera

#region Windows API Functions Declarations //This Function is used to get Active Window Title... [System.Runtime.InteropServices.DllImport("user32.dll",CharSet=System.Runtime.InteropServices.CharSet.Auto)] public static extern int GetWindowText(IntPtr hwnd,string lpString, int cch); //This Function is used to get Handle for Active Window... [System.Runtime.InteropServices.DllImport("user32.dll", CharSet=System.Runtime.InteropServices.CharSet.Auto)] private static extern IntPtr GetForegroundWindow(); //This Function is used to get Active process ID... [System.Runtime.InteropServices.DllImport("user32.dll", CharSet=System.Runtime.InteropServices.CharSet.Auto)] private static extern Int32 GetWindowThreadProcessId(IntPtr hWnd,out Int32 lpdwProcessId);         #endregion    public static  Int32 GetWindowProcessID(IntPtr hwnd) { //This Function is used to get Active process ID... Int32 pid; GetWindowThreadProcess

Error while accessing Httpcontext.current.Session in DAL (Httpcontext doesnot exist) even after adding System.web

First of all Data Access layer is for accessing the data that is why it is named as data access layer but not the session access layer so try to use session value in an hierarchical manner from upper layer to lower layer by making it as a data For eg.  Session["server_id"] = "12";  /* In controller action method */ here server_id is a property stored as session now send this value from controller to BAL or your lower layer through function as  sendId(Convert.ToString(Session["server_id"])); as parameter in function and access this as a data function  sendId(string server_id) {     string my_server_id = server_id; }      

Inserting specific parameters through Npgsql rather than inserting it in single line query with all the parameters which are declared inside a PostgreSQL.

 DataSet dsdata = new DataSet();             string sqlQuery = "select * from systemtracker_dbo.sp_grp_comp_unit_data(par_p_oprtype:=" + opr_type;             sqlQuery = sqlQuery + " ,par_p_user_id:='" + user_id + "'";             sqlQuery = sqlQuery + " ,par_p_group_id:='" + group_id + "'";             sqlQuery = sqlQuery + " ,par_p_comp_id:='" + comp_id + "'";             sqlQuery = sqlQuery + " ,par_p_unit_id:='" + unit_id + "'";             sqlQuery = sqlQuery + " ,p_refcur:='t1'";             sqlQuery = sqlQuery + " );FETCH ALL IN t1;";             dbHelper = new AI_Portal_Cloud.DAL.clsPSQLHelper();             NpgsqlCommand sc = dbHelper.GetSqlQueryCommand(sqlQuery);             dsdata = dbHelper.RemovePostGresRefCursor(dbHelper.LoadDataSet(sc)); Here the Parameters are only inserted which have their values from fron