Ejemplo n.º 1
0
        public DataSet dal_ErrorLogDetail(bel_ErrorLog obj_bel_Error)
        {
            DataSet ds = new DataSet();
               try
               {
               SqlCommand sqlcmd = new SqlCommand("spu_ErrorLog");
               sqlcmd.CommandTimeout = 0;
               sqlcmd.CommandType = CommandType.StoredProcedure;
               sqlcmd.Parameters.Clear();
               sqlcmd.Parameters.AddWithValue("@ErrorlogDate", obj_bel_Error._ErrorlogDate);
               sqlcmd.Parameters.AddWithValue("@ErrorMessage", obj_bel_Error._ErrorMessage);
               sqlcmd.Parameters.AddWithValue("@FunctionName", obj_bel_Error._FunctionName);
               sqlcmd.Parameters.AddWithValue("@ErrorLIne", obj_bel_Error._ErrorLIne);
               sqlcmd.Parameters.AddWithValue("@PageName", obj_bel_Error._PageName);
               sqlcmd.Parameters.AddWithValue("@CreatedBy", Convert.ToInt32(HttpContext.Current.Session["UserID"]));
               sqlcmd.Parameters.AddWithValue("@FromDate", obj_bel_Error._FromDate);
               sqlcmd.Parameters.AddWithValue("@ToDate", obj_bel_Error._ToDate);
               sqlcmd.Parameters.AddWithValue("@iMode", obj_bel_Error._iMode);
               sqlcmd.Parameters.AddWithValue("@BranchID",  Convert.ToInt32(HttpContext.Current.Session["BranchID"]));
               sqlcmd.Parameters.AddWithValue("@CompanyID", Convert.ToInt32(HttpContext.Current.Session["CompanyID"]));
               ds = DataFunctions.GetDataSet(sqlcmd);
               }
               catch (Exception ex)
               {

               }
               return ds;
        }
Ejemplo n.º 2
0
        public void LogFile(string sExceptionName, string sEventName, int nErrorLineNo, string sFormName)
        {
            bel_ErrorLog obj_Error = new bel_ErrorLog();
            dal_Errorlog obj_dal_error = new dal_Errorlog();
            try
            {
                obj_Error._ErrorlogDate = System.DateTime.Now;
                obj_Error._ErrorMessage = sExceptionName;
                obj_Error._FunctionName = sEventName;
                obj_Error._ErrorLIne = nErrorLineNo;
                obj_Error._PageName = sFormName;
                obj_Error._iMode = "Insert";
                using (DataSet ds = obj_dal_error.dal_ErrorLogDetail(obj_Error))
                {

                }
            }
            catch (Exception exe)
            {
                // LogFile(exe.Message, "Common:LogFile", Convert.ToInt32(exe.StackTrace.Substring(exe.StackTrace.LastIndexOf(":line") + 5)), this.Page.ToString());
            }

            //// HttpContext CurrentHTTPcontext = HttpContext.Current;
            //StreamWriter log;
            //string path = string.Empty;
            //path = HttpContext.Current.Server.MapPath("~/Barcode INI/logfile.txt");
            //if (!File.Exists(path))
            //{

            //    log = new StreamWriter(path);

            //}
            //   // Common.CommonVariablesandmsg.UserName

            //else
            //{

            //    log = File.AppendText(path);

            //}

            //// Write to the file:

            //log.WriteLine("Data Time:" + DateTime.Now);

            //log.WriteLine("Exception Name:" + sExceptionName);

            //log.WriteLine("Event Name:" + sEventName);

            //log.WriteLine("Error Line No.:" + nErrorLineNo);

            //log.WriteLine("Form Name:" + sFormName);

            //// Close the stream:

            //log.Close();
        }