Example #1
0
        /// <summary>
        /// Description  : Get the Client information from CSS1
        /// Created By   : Sudheer  
        /// Created Date : 14th Oct 2014
        /// Modified By  : 
        /// Modified Date: 
        /// </summary>   
        public static _ChoosenBillingPartyInfo GetBillingPartyInformation(string ClientName, string WOID)
        {
            var GetClientInfo = new _ChoosenBillingPartyInfo();

            System.Diagnostics.StackFrame stackFrame = new System.Diagnostics.StackFrame();
            System.Reflection.MethodBase methodBase = stackFrame.GetMethod();
            log.Debug("Start: " + methodBase.Name);
            try
            {
                SqlParameter[] sqlParams = new SqlParameter[2];
                sqlParams[0] = new SqlParameter("@WOID", WOID);
                sqlParams[1] = new SqlParameter("@ClientName", ClientName);
                var reader = SqlHelper.ExecuteReader(ConnectionUtility.GetConnectionString(), CommandType.StoredProcedure, "GetAllBillingPartyDetails", sqlParams);
                var safe = new SafeDataReader(reader);

                while (reader.Read())
                {
                    var ClientInfo = new _ChoosenClient();
                    ClientInfo.FetchBillingPartyInfo(ClientInfo, safe);
                    GetClientInfo._ChoosenBillingPartyList.Add(ClientInfo);
                }

                return GetClientInfo;
            }
            catch (Exception ex)
            {
                log.Error("Error: " + ex);
                return GetClientInfo;
            }
            finally
            {
                log.Debug("End: " + methodBase.Name);
            }
        }
Example #2
0
        public FileInfo(String fileName)
        {
            if (fileName == null)
                throw new ArgumentNullException("fileName");
            Contract.EndContractBlock();

#if FEATURE_LEGACYNETCF
            if(CompatibilitySwitches.IsAppEarlierThanWindowsPhone8)
            {
                System.Reflection.Assembly callingAssembly = System.Reflection.Assembly.GetCallingAssembly();
                if(callingAssembly != null && !callingAssembly.IsProfileAssembly)
                {
                    string caller = new System.Diagnostics.StackFrame(1).GetMethod().FullName;
                    string callee = System.Reflection.MethodBase.GetCurrentMethod().FullName;
                    throw new MethodAccessException(String.Format(
                        CultureInfo.CurrentCulture,
                        Environment.GetResourceString("Arg_MethodAccessException_WithCaller"),
                        caller,
                        callee));
                }
            }
#endif // FEATURE_LEGACYNETCF

            Init(fileName, true);
        }
 public JsonResult BindThirdPartyBillingDetails(string CompanyName, string OrderBy, int StartPage, int RowsPerPage)
 {
     System.Diagnostics.StackFrame stackFrame = new System.Diagnostics.StackFrame();
     System.Reflection.MethodBase methodBase = stackFrame.GetMethod();
     log.Debug("Start: " + methodBase.Name);
     try
     {
         int CreatedBy = UserLogin.AuthenticateRequest();
         if (CreatedBy == 0)
         {
             return Json(CreatedBy);
         }
         else
         {
             var ThirdPartyBillingData = BillingThirdParty.BindThirdPartyBillingDetails(HttpUtility.UrlDecode(CompanyName), OrderBy, StartPage + 1, StartPage + RowsPerPage);
             return Json(ThirdPartyBillingData);
         }
     }
     catch (Exception ex)
     {
         log.Error("Error: " + ex);
         return Json("");
     }
     finally
     {
         log.Debug("End: " + methodBase.Name);
     }
 }
        public JsonResult Css1InfoDetails(string WOID, string WOType)
        {
            System.Diagnostics.StackFrame stackFrame = new System.Diagnostics.StackFrame();
            System.Reflection.MethodBase methodBase = stackFrame.GetMethod();
            log.Debug("Start: " + methodBase.Name);
            try
            {
                int checkSession = UserLogin.AuthenticateRequest();
                if (checkSession == 0)
                {
                    return Json(checkSession);
                }
                else
                {
                    DataSet result = Masters.Models.Masters.Css1InfoDetail.GetCss1InfoDetails(WOID, WOType);
                    string data = JsonConvert.SerializeObject(result, Formatting.Indented);
                    return Json(data);

                }
            }
            catch (Exception ex)
            {
                log.Error("Error: " + ex);
                return Json("");
            }
            finally
            {
                log.Debug("End: " + methodBase.Name);
            }
        }
 public WatchdogTimer(int Seconds)
 {
     TimerFrame = new System.Diagnostics.StackFrame(1);
     CountownTimer = new Timer(Seconds * 1000.0);
     CountownTimer.Elapsed += Elapsed;
     CountownTimer.Start();
 }
Example #6
0
        /// <summary>
        /// Description  : Get WOAddress Details from database.
        /// Created By   : Pavan
        /// Created Date : 12 August 2014
        /// Modified By  :
        /// Modified Date:
        /// </summary>
        /// <returns></returns>
        public static List<WOAddress> GetWOAddressDetails(int PersonID, string PersonSource)
        {
            var data = new List<WOAddress>();

            System.Diagnostics.StackFrame stackFrame = new System.Diagnostics.StackFrame();
            System.Reflection.MethodBase methodBase = stackFrame.GetMethod();
            log.Debug("Start: " + methodBase.Name);
            try
            {
                SqlParameter[] sqlParams = new SqlParameter[2];
                sqlParams[0] = new SqlParameter("@PersonID", PersonID);
                sqlParams[1] = new SqlParameter("@PersonSource", PersonSource);
                var reader = SqlHelper.ExecuteReader(ConnectionUtility.GetConnectionString(), CommandType.StoredProcedure, "[SpGetWOAddressDetails]", sqlParams);
                var safe = new SafeDataReader(reader);
                while (reader.Read())
                {
                    var woaddress = new WOAddress();
                    woaddress.FetchwoaddressDetails(woaddress, safe);
                    data.Add(woaddress);
                }
                return data;
            }
            catch (Exception ex)
            {
                log.Error("Error: " + ex);
                return data;
            }
            finally
            {
                log.Debug("End: " + methodBase.Name);
            }
        }
        /// <summary>
        /// Filters and copies the specified array of .NET stack frames
        /// </summary>
        /// <param name="stackFrames"></param>
        /// <returns></returns>
        private StackFrame[] GetFilteredFrames(SysStackFrame[] stackFrames) {
            StackFrame[] result = null;

            int resultIndex = 0;
            for (int i = 0; i < stackFrames.Length; i++) {
                SysStackFrame current = stackFrames[i];

                // postpone allocating the array until we know how big it should be
                if (result == null) {
                    // filter the top irrelevant frames from the stack
                    if (!this._stackTraceFilter.IsRelevant(current)) {
                        continue;
                    }

                    result = new StackFrame[stackFrames.Length + MethodsToKeep - i];

                    // copy last frames to stack
                    for (int j = i-MethodsToKeep; j < i; j++) {
                        result[resultIndex] = StackFrame.Create(stackFrames[j]);
                        resultIndex++;
                    }

                }

                result[resultIndex] = StackFrame.Create(stackFrames[i]);
                resultIndex ++;
            }

            return result;
        }
Example #8
0
 public void SetProgress(int percent)
 {
     System.Reflection.MethodBase method = new System.Diagnostics.StackFrame(1).GetMethod();
     MethodLabel.Text = method.DeclaringType.Name + "::" + method.Name + "()";
     progressBar.Value = percent;
     Application.DoEvents();
 }
Example #9
0
        internal static void FillByUserName(User user)
        {
            // #1- Logger variables
            System.Diagnostics.StackFrame stackFrame = new System.Diagnostics.StackFrame();
            string className = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name;
            string methodName = stackFrame.GetMethod().Name;

            string query = "SELECT id, groupName,password,passwordDate,deleted,disabled,dateCreated,dateDeleted,dateDisabled FROM incuser WHERE userName = @userName";
            Hashtable param = new Hashtable();
            param.Add("@userName", user.userName);

            // #2- Logger pre query
            Logger.LogDebug("(%s) (%s) -- Ejecuta query para obtener todos los folios. QUERY: %s", className, methodName, query);

            using (DataTable dt = ExecuteDataTableQuery(query, param))
            {
                if (dt != null && dt.Rows.Count > 0)
                {
                    // #3- Logger post query
                    Logger.LogDebug("Row count: %s", dt.Rows.Count.ToString());

                    DataRow row = dt.Rows[0];
                    user.userName = user.userName;
                    user.id = (row["id"] != DBNull.Value) ? row["id"].ToString() : string.Empty;
                    user.groupName = (row["groupName"] != DBNull.Value) ? row["groupName"].ToString() : string.Empty;
                    user.password = (row["password"] != DBNull.Value) ? row["password"].ToString() : string.Empty;
                    user.passwordDate = (row["passwordDate"] != DBNull.Value) ? DateTime.Parse(row["passwordDate"].ToString()) : DateTime.Now;
                    user.deleted = (row["deleted"] != DBNull.Value) ? int.Parse(row["deleted"].ToString()) : 0;
                    user.disabled = (row["disabled"] != DBNull.Value) ? int.Parse(row["disabled"].ToString()) : 0;
                    user.dateCreated = (row["dateCreated"] != DBNull.Value) ? DateTime.Parse(row["dateCreated"].ToString()) : DateTime.Now;
                    user.dateDeleted = (row["dateDeleted"] != DBNull.Value) ? DateTime.Parse(row["dateDeleted"].ToString()) : DateTime.Now;
                    user.dateDisabled = (row["dateDisabled"] != DBNull.Value) ? DateTime.Parse(row["dateDisabled"].ToString()) : DateTime.Now;
                }
            }
        }
Example #10
0
 public JsonResult DeleteNote(int ID)
 {
     System.Diagnostics.StackFrame stackFrame = new System.Diagnostics.StackFrame();
     System.Reflection.MethodBase methodBase = stackFrame.GetMethod();
     log.Debug("Start: " + methodBase.Name);
     try
     {
         int checkSession = UserLogin.AuthenticateRequest();
         if (checkSession == 0)
         {
             return Json(checkSession);
         }
         else
         {
             var data = new Note
             {
                 ID = ID,
                 CreatedBy = checkSession
             };
             int output = data.DeleteNote();
             return Json(output);
         }
     }
     catch (Exception ex)
     {
         log.Error("Error: " + ex);
         return Json("");
     }
     finally
     {
         log.Debug("End: " + methodBase.Name);
     }
 }
        public void tbl_genLog_Logger(int ID_hrStaff,int ID_reqpUserID, int ID_LogType, string RequestText = "",string SessionID = "", string LogText = "")
        {
            ServiceConfig srvcont = new ServiceConfig(_ServiceConfigParameters);
            try
            {

                    System.Diagnostics.StackFrame sf = new System.Diagnostics.StackFrame(1);
                    var method = sf.GetMethod();
                    string methodName = method.Name;
                    DateTime dNow = DateTime.Now;

                    Entities.tbl_genLog userlog = new Entities.tbl_genLog();
                    //LogType 3 = UserAction
                    userlog.ID_LogType = ID_LogType;
                    userlog.LogID = methodName;
                    userlog.ID_Staff = ID_reqpUserID;
                    userlog.SessionID = SessionID;
                    userlog.RequestText = RequestText;
                    userlog.LogText = LogText;
                    userlog.TS_CREATE = dNow;
                    userlog.VALID_FROM = dNow;
                    userlog.VALID_TO = dNow;
                    userlog.CREATED_BY = ID_hrStaff;

                    srvcont.DataContext.tbl_genLog.AddObject(userlog);

                    srvcont.DataContext.SaveChanges();
            }
            catch (Exception)
            {
                //no action

            }
        }
Example #12
0
            /// <summary>
            /// Description  : Get Auditors Details from database.
            /// Created By   : Pavan
            /// Created Date : 23 August 2014
            /// Modified By  :
            /// Modified Date:
            /// </summary>
            /// <returns></returns>
            public static List<Auditors> GetAuditorDetailsByWOID(int WOID)
            {
                var data = new List<Auditors>();

                System.Diagnostics.StackFrame stackFrame = new System.Diagnostics.StackFrame();
                System.Reflection.MethodBase methodBase = stackFrame.GetMethod();
                log.Debug("Start: " + methodBase.Name);
                try
                {
                    SqlParameter[] sqlParams = new SqlParameter[1];
                    sqlParams[0] = new SqlParameter("@WOID", WOID);
                    var reader = SqlHelper.ExecuteReader(ConnectionUtility.GetConnectionString(), CommandType.StoredProcedure, "[SpGetAuditorDetailsByWOID]", sqlParams);
                    var safe = new SafeDataReader(reader);
                    while (reader.Read())
                    {
                        var Auditors = new Auditors();
                        Auditors.FetchAuditors(Auditors, safe);
                        data.Add(Auditors);
                    }
                    return data;
                }
                catch (Exception ex)
                {
                    log.Error("Error: " + ex);
                    return data;
                }
                finally
                {
                    log.Debug("End: " + methodBase.Name);
                }
            }
Example #13
0
        /// <summary>
        /// Description  : Get the Group information from CSS1
        /// Created By   : Shiva
        /// Created Date : 10 July 2014
        /// Modified By  :
        /// Modified Date:
        /// </summary>
        /// <returns></returns>
        public static GroupInfo GetCSS1GroupDetails()
        {
            var data = new GroupInfo();

            System.Diagnostics.StackFrame stackFrame = new System.Diagnostics.StackFrame();
            System.Reflection.MethodBase methodBase = stackFrame.GetMethod();
            log.Debug("Start: " + methodBase.Name);
            try
            {
                var lstGroupInfo = new List<GroupInfo>();
                var reader = SqlHelper.ExecuteReader(ConnectionUtility.GetConnectionString(), CommandType.StoredProcedure, "SpGetCSS1GroupDetails");
                var safe = new SafeDataReader(reader);
                while (reader.Read())
                {
                    var getGroupInfo = new GroupInfo();
                    getGroupInfo.FetchGroupInfo(getGroupInfo, safe);
                    lstGroupInfo.Add(getGroupInfo);
                }
                data.GroupInfoList = lstGroupInfo;
                return data;
            }
            catch (Exception ex)
            {
                log.Error("Error: " + ex);
                return data;
            }
            finally
            {
                log.Debug("End: " + methodBase.Name);
            }
        }
Example #14
0
        /// <summary>
        /// Created By    : hussain
        /// Created Date  : 15 May 2014
        /// Modified By   : Shiva 
        /// Modified Date : 16 Sep 2014
        /// AuthenticateRequest 
        /// </summary>
        /// <param name="Token">SessionToken</param>
        /// <returns>Active Session:0 InActive Session: UserID</returns>
        public static int AuthenticateRequest()
        {
            System.Diagnostics.StackFrame stackFrame = new System.Diagnostics.StackFrame();
            System.Reflection.MethodBase methodBase = stackFrame.GetMethod();
            log.Debug("Start: " + methodBase.Name);
            int userId = 0; ;
            try
            {

                string SessionToken = Convert.ToString(HttpContext.Current.Session["CSS2SessionID"]);
                if (!string.IsNullOrEmpty(SessionToken) ? true : false)
                {
                    // User session is Active Session it returns users id else returns 0
                    userId = UserLogin.CheckUserSessionToken(SessionToken);

                }
            }
            catch (Exception ex)
            {
                log.Error("Error: " + ex);
            }

            log.Debug("End: " + methodBase.Name);
            return userId;
        }
Example #15
0
 public void TestContext ()
 {
    var queue = new Loggers.Queue();
    var log = new Log(this);
    using (Log.RegisterInstance(
          new Instance()
          {
             Properties = new[]
             {
                "StackFrame.File",
                "StackFrame.Line",
                "StackFrame.Type",
                "StackFrame.Method"
             },
             Logger = queue,
             Buffer = 0,
             Synchronous = true
          }
       )
    )
    {
       var frame = new System.Diagnostics.StackFrame(0, true);
       log.Info("test");
       var evt = queue.Dequeue().Single();
       Assert.AreEqual(evt["StackFrame.File"], frame.GetFileName());
       Assert.AreEqual(evt["StackFrame.Line"], frame.GetFileLineNumber() + 1);
       Assert.AreEqual(evt["StackFrame.Type"], frame.GetMethod().DeclaringType.FullName);
       Assert.AreEqual(evt["StackFrame.Method"], frame.GetMethod().Name);
    }
 }
Example #16
0
 /// <summary>
 /// Logs an error using log4net
 /// </summary>
 /// <param name="ex">The error to log</param>
 internal static void LogError(Exception ex)
 {
     MethodBase callingMethod = new System.Diagnostics.StackFrame(1, false).GetMethod();
     ILog logger = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
     MDC.Set("requestinfo", String.Empty);
     logger.Error(GetErrorMessageTitle(callingMethod.Name), ex);
 }
Example #17
0
        /// <summary>
        /// Description  : To Update Receive Status For Invoice From ACCPAC
        /// Created By   : Pavan
        /// Created Date : 29 Oct 2014
        /// Modified By  :
        /// Modified Date:
        /// </summary>
        public static int CABUpdateReceiveStatus(DataTable dtINVOICE_FROM_CSS2, DataTable dtINVOICE_DETAILS_FROM_CSS2)
        {
            int UpdateStatus = -2;

            System.Diagnostics.StackFrame stackFrame = new System.Diagnostics.StackFrame();
            System.Reflection.MethodBase methodBase = stackFrame.GetMethod();
            log.Debug("Start: " + methodBase.Name);
            try
            {
                SqlParameter[] sqlParams = new SqlParameter[2];
                sqlParams[0] = new SqlParameter("@dtINVOICE_FROM_ACCPAC", dtINVOICE_FROM_CSS2);
                sqlParams[0].SqlDbType = SqlDbType.Structured;
                sqlParams[1] = new SqlParameter("@dtINVOICE_DETAILS_FROM_ACCPAC", dtINVOICE_DETAILS_FROM_CSS2);
                sqlParams[1].SqlDbType = SqlDbType.Structured;
                DataSet ds = SqlHelper.ExecuteDataset(ConnectionUtility.GetConnectionString(), CommandType.StoredProcedure, "SpCABUpdateReceiveStatus", sqlParams);
                return UpdateStatus;
            }
            catch (Exception ex)
            {
                log.Error("Error: " + ex);
                return UpdateStatus;
            }
            finally
            {
                log.Debug("End: " + methodBase.Name);
            }
        }
        public static bool CreateSegment(NetManager _this, out ushort segmentID, ref Randomizer randomizer, NetInfo info, ushort startNode, ushort endNode, Vector3 startDirection, Vector3 endDirection, uint buildIndex, uint modifiedIndex, bool invert)
        {
            var ai = info.m_netAI as RoadAI;
            if (ai != null && ai.m_enableZoning)
            {
                var caller = new System.Diagnostics.StackFrame(1).GetMethod().Name;

                switch (caller)
                {
                    case "MoveMiddleNode": // segment that was modified because user added network, apply style of previous segment
                        newBlockColumnCount = MoveMiddleNode_releasedColumnCount >= 0 ?
                            MoveMiddleNode_releasedColumnCount : InputThreadingExtension.userSelectedColumnCount;
                        break;

                    case "SplitSegment": // segment that was split by new node, apply style of previous segment
                        newBlockColumnCount = SplitSegment_releasedColumnCount >= 0 ?
                            SplitSegment_releasedColumnCount : InputThreadingExtension.userSelectedColumnCount;
                        break;

                    default: // unknown caller (e.g. new road placed), set to depth selected by user
                        newBlockColumnCount = InputThreadingExtension.userSelectedColumnCount;
                        SplitSegment_releasedColumnCount = -1;
                        MoveMiddleNode_releasedColumnCount = -1;
                        break;
                }
            }

            // Call original method
            CreateSegmentRedirector.Revert();
            var success = _this.CreateSegment(out segmentID, ref randomizer, info, startNode, endNode, startDirection, endDirection, buildIndex, modifiedIndex, invert);
            CreateSegmentRedirector.Apply();

            return success;
        }
Example #19
0
        /// <summary>
        /// 保存当前组用户
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                UpdateTempUser();
                string users = "-1,";

                if (ViewState["hdnRowValue"].ToString().Length > 0)
                    users += ViewState["hdnRowValue"].ToString().Replace("'", "");

                users += "-1";

                BLL.BLLBase bll = new BLL.BLLBase();
                bll.ExecNonQuery("Security.UpdateUserGroup", new DataParameter[] { new DataParameter("@GroupID", GroupID), new DataParameter("{0}", users) });

                ScriptManager.RegisterClientScriptBlock(this.UpdatePanel1, this.UpdatePanel1.GetType(), "Resize", "Close('1');", true);

            }
            catch(Exception ex)
            {
                System.Diagnostics.StackFrame frame = new System.Diagnostics.StackFrame(0);
                Session["ModuleName"] = this.Page.Title;
                Session["FunctionName"] = frame.GetMethod().Name;
                Session["ExceptionalType"] = ex.GetType().FullName;
                Session["ExceptionalDescription"] = ex.Message;
                Response.Redirect("../../../Common/MistakesPage.aspx");

            }
        }
Example #20
0
 public JsonResult AdhocActionOnDisbursementItems(string DisbursementIds, int Adhoc, string ForState)
 {
     System.Diagnostics.StackFrame stackFrame = new System.Diagnostics.StackFrame();
     System.Reflection.MethodBase methodBase = stackFrame.GetMethod();
     log.Debug("Start: " + methodBase.Name);
     try
     {
         int checkSession = UserLogin.AuthenticateRequest();
         if (checkSession == 0)
         {
             return Json(checkSession);
         }
         else
         {
             DisbursementItem objDisbursementItem = new DisbursementItem();
             int result = objDisbursementItem.AdhocActionOnDisbursementItems(DisbursementIds, Adhoc, ForState, checkSession);
             return Json(result);
         }
     }
     catch (Exception ex)
     {
         log.Error("Error: " + ex);
         return Json("");
     }
     finally
     {
         log.Debug("End: " + methodBase.Name);
     }
 }
Example #21
0
 public static string GetPath()
 {
     var filename = "XmlDocument.xml";
     var currentDir = new System.Diagnostics.StackFrame(true).GetFileName();
     var workingFile = new FileInfo(currentDir);
     var pathToFile = string.Format("{0}\\App_Data\\{1}", workingFile.Directory.Parent.FullName, filename);
     return pathToFile;
 }
 public WatchdogTimer(int Seconds)
 {
     TimerFrame = new System.Diagnostics.StackFrame(1);
     CountownTimer = new Timer(Seconds * 1000.0);
     CountownTimer.Elapsed += Elapsed;
     CountownTimer.Start();
     bTicking = true;
     ProcessManager.AddProcess(this);
 }
 public ArrayAttribute(NsNode parent, XmlNode xml)
     : this(parent, null, null)
 {
     if (!FromXml(xml))
     {
         System.Diagnostics.StackFrame stackFrame = new System.Diagnostics.StackFrame(1, true);
         throw new AttributeXmlFormatException(this, xml, "Failed to read xml (" + stackFrame.GetMethod() + " ln: " + stackFrame.GetFileLineNumber() +")");
     }
 }
Example #24
0
        public ActionResult ActiveUsersList(string command, FormCollection fc)
        {
            System.Diagnostics.StackFrame stackFrame = new System.Diagnostics.StackFrame();
            System.Reflection.MethodBase methodBase = stackFrame.GetMethod();
            log.Debug("Start: " + methodBase.Name);

            if (command == "Download Logs")
            {
                #region Download as ZIP
                try
                {
                    string zipFloderName = "CSS2Logs";
                    string[] Files = Directory.GetFiles(System.Web.HttpContext.Current.Server.MapPath("~/Logs/"));
                    ZipFile createZipFile = new ZipFile();
                    string timestamp = DateTime.Now.ToString("yyyy-MMM-dd-HHmmss");
                    createZipFile.AddFiles(Files, zipFloderName + "_" + timestamp);
                    System.Web.HttpContext.Current.Response.Clear();
                    System.Web.HttpContext.Current.Response.BufferOutput = false;
                    string zipName = String.Format(zipFloderName + "_{0}.zip", timestamp);
                    System.Web.HttpContext.Current.Response.ContentType = "application/zip";
                    System.Web.HttpContext.Current.Response.AddHeader("content-disposition", "attachment; filename=" + zipName);
                    createZipFile.Save(System.Web.HttpContext.Current.Response.OutputStream);
                    System.Web.HttpContext.Current.Response.End();
                }
                catch (Exception ex)
                {
                    log.Error("Error: " + ex);
                }

                #endregion
            }
            else if (command == "Download")
            {
                #region Download TableData

                try
                {
                    DataSet dsTableData = UserLogin.GetTableDataByTableName(fc["ddlTableName"]);
                    if (dsTableData.Tables.Count > 0)
                    {
                        dsTableData.Tables[0].TableName = fc["ddlTableName"];
                    }
                    HelperClasses.DownloadSystemReport(dsTableData, fc["ddlTableName"]);
                }
                catch (Exception ex)
                {
                    log.Error("Error: " + ex);
                }

                #endregion
            }

            log.Debug("End: " + methodBase.Name);

            return View();
        }
Example #25
0
		public static void If(bool cond)
		{
			if (!cond)
			{
				/*System.Diagnostics.Debugger.Break();*/
				System.Diagnostics.StackFrame st = new System.Diagnostics.StackFrame(1, true);
				throw new ExceptionLog("Assertion!{0}'{1}':{2} @ {3}", Program.NewLine,
					st.GetFileName(), st.GetMethod(), st.GetFileLineNumber());
			}
		}
Example #26
0
        public static void Test_StackFrame()
        {
            System.Diagnostics.StackFrame stackFrame = new System.Diagnostics.StackFrame(skipFrames: 1, fNeedFileInfo: true);

            Trace.WriteLine("create StackFrame(skipFrames: 1, fNeedFileInfo: true) :");
            Trace.WriteLine("  GetMethod().DeclaringType : \"{0}\"", stackFrame.GetMethod().DeclaringType.zGetTypeName());
            Trace.WriteLine("  GetFileName()             : \"{0}\"", stackFrame.GetFileName());
            Trace.WriteLine("  GetFileLineNumber()       : {0}", stackFrame.GetFileLineNumber());
            Trace.WriteLine("  GetFileColumnNumber()     : {0}", stackFrame.GetFileColumnNumber());
        }
Example #27
0
 public void log(LogLevel logLevel, String message, params Object[] objs)
 {
     if (!isOutput(logLevel))
     {
         return;
     }
     const int callerFrameIndex = 2;
     System.Diagnostics.StackFrame callerFrame = new System.Diagnostics.StackFrame(callerFrameIndex);
     System.Reflection.MethodBase callerMethod = callerFrame.GetMethod();
     this.writeLog(DateTime.Now, logLevel, callerMethod.Name, message, objs);
 }
Example #28
0
        /// <summary>
        /// Our LogWrapper...used to log things so that they have our prefix prepended and logged either to custom file or not.
        /// </summary>
        /// <param name="sText">Text to log</param>
        /// <param name="ex">An Exception - if not null it's basic data will be printed.</param>
        /// <param name="bDumpStack">If an Exception was passed do you want the full stack trace?</param>
        /// <param name="bNoIncMethod">If for some reason you don't want the method name prefaced with the log line.</param>
        public static void dbgLog(string sText, Exception ex = null, bool bDumpStack = false, bool bNoIncMethod = false)
        {
            try
            {
                logSB.Length = 0; //clear the existing log data.
                //now go get our prefix if needed and add it to the stringbuilder.
                string sPrefix = string.Concat("[", SomeModName.MY_MODS_LOG_PREFIX);
                if (bNoIncMethod) { string.Concat(sPrefix, "] "); }
                else
                {
                    // Here we step back a 1 frame in the stack(current frame would be logger), and add that method name
                    // to our prefix so you know wtf method triggered your error. ie "[ModPrefixname:SomeModClassName.TheMethodThatCausedError]:"
                    // Saves you from having to add that to your debug messages manually and is very handy i find.
                    System.Diagnostics.StackFrame oStack = new System.Diagnostics.StackFrame(1); //pop back one frame, ie our caller.
                    sPrefix = string.Concat(sPrefix, ":", oStack.GetMethod().DeclaringType.Name, ".", oStack.GetMethod().Name, "] ");
                }
                logSB.Append(string.Concat(sPrefix, sText));

                //Were we sent and exception object? If so let's log it's top level error message.
                if (ex != null)
                {
                    logSB.Append(string.Concat("\r\nException: ", ex.Message.ToString()));
                }
                //Were we asked to log the stacktrace with that exception?
                if (bDumpStack & ex !=null)
                {
                    logSB.Append(string.Concat("\r\nStackTrace: ", ex.ToString()));  //ex.tostring will return more data then ex.stracktrace.tostring
                }
                //If we have configuration data does it tell use to use a custom log file?
                //if it does let's go use the specified full path to the custom log or use the default file name in the root of CSL folder.
                if (SomeModName.config != null && SomeModName.config.UseCustomLogFile == true)
                {
                    string strPath = System.IO.Directory.Exists(Path.GetDirectoryName(SomeModName.config.CustomLogFilePath)) ? SomeModName.config.CustomLogFilePath.ToString() : Path.Combine(DataLocation.executableDirectory.ToString(), SomeModName.config.CustomLogFilePath);
                    using (StreamWriter streamWriter = new StreamWriter(strPath, true))
                    {
                        streamWriter.WriteLine(logSB.ToString());
                    }
                }
                else
                {
                    Debug.Log(logSB.ToString());
                }
            }
            catch (Exception Exp)
            {
                // Well shit! even our logger errored, lets try to log in CSL log about it.
                Debug.Log(string.Concat(SomeMod.SomeModName.MY_MODS_LOG_PREFIX + " Error in log attempt!  ", Exp.Message.ToString()));
            }
            logSB.Length = 0;
            if (logSB.Capacity > 16384) { logSB.Capacity = 2048;} //shrink outselves if we've grown way to large.
        }
        private void Perform_login(string username, string password, bool isPasswordInput_hashed = false, bool isTokenLogin = false)
        {
            if (!string.IsNullOrWhiteSpace(username) || !string.IsNullOrWhiteSpace(password))
            {
                // #1- Logger variables
                System.Diagnostics.StackFrame stackFrame = new System.Diagnostics.StackFrame();
                string className = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name;
                string methodName = stackFrame.GetMethod().Name;

                bool ok = false;
                try
                {
                    string userID = Global.GlobalMethods.CheckLogin(username, password, isPasswordInput_hashed, isTokenLogin);
                    if (!string.IsNullOrWhiteSpace(userID))
                    {
                        User user = new User(userID, "");
                        if (user != null)
                        {
                            ok = true;
                            Session["UserID"] = user.id;
                            Session["UserName"] = user.userName;

                            string returnURL = "Dashboard.aspx";
                            string query_string = Request.QueryString["folioID"];
                            if (!string.IsNullOrWhiteSpace(query_string))
                            {
                                returnURL = "Dashboard.aspx?folioID=" + query_string;
                            }

                            Response.Redirect(returnURL, false);
                        }
                    }
                    if (!ok)
                    {
                        ScriptManager.RegisterStartupScript(this, typeof(Page), "ShowErrorMessage", "ShowErrorMessage('" + 2 + "');", true);
                    }
                }
                catch (Exception e)
                {
                    ScriptManager.RegisterStartupScript(this, typeof(Page), "ShowErrorMessage", "ShowErrorMessage('" + 3 + "');", true);

                    // #2- Logger exception
                    Logger.LogError("(%s) (%s) -- Excepcion. Haciendo login. ERROR: %s", className, methodName, e.Message);
                }
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, typeof(Page), "ShowErrorMessage", "ShowErrorMessage('" + 1 + "');", true);
            }
        }
 public JsonResult CreateCorporation(Corporation Corporation)
 {
     System.Diagnostics.StackFrame stackFrame = new System.Diagnostics.StackFrame();
     System.Reflection.MethodBase methodBase = stackFrame.GetMethod();
     log.Debug("Start: " + methodBase.Name);
     try
     {
         Int32 returnValue = 0;
         int checkSession = UserLogin.AuthenticateRequest();
         if (checkSession == 0)
         {
             return Json(returnValue);
         }
         else
         {
             int createdBy = Convert.ToInt32(Session["UserID"]);
             //var data = new Corporation
             //{
             //    ID = ID,
             //    NameOfCompany = NameOfCompany,
             //    CountryOfIncorporation = CountryOfIncorporation,
             //    DateOfIncorporation = DateOfIncorporation,
             //    RegistrationNo = RegistrationNo,
             //    AccPacCode = AccPacCode,
             //    AddressLine1 = AdderessLine1,
             //    AddressLine2 = AddressLine2,
             //    AddressLine3 = AddressLine3,
             //    Country = Country,
             //    PostalCode = PostalCode,
             //    Email = Email,
             //    ContactNo = ContactNo,
             //    Fax = Fax,
             //    createdBy = createdBy
             //};
             Corporation.createdBy = createdBy;
             int result = Corporation.InsertCorporation();
             return Json(result);
         }
     }
     catch (Exception ex)
     {
         log.Error("Error: " + ex);
         return Json("");
     }
     finally
     {
         log.Debug("End: " + methodBase.Name);
     }
 }
 public static bool HasILOffset(this System.Diagnostics.StackFrame stackFrame)
 {
     throw null;
 }
 public static bool HasNativeImage(this System.Diagnostics.StackFrame stackFrame)
 {
     throw null;
 }
 public static bool HasSource(this System.Diagnostics.StackFrame stackFrame)
 {
     throw null;
 }
 public static System.IntPtr GetNativeIP(this System.Diagnostics.StackFrame stackFrame)
 {
     throw null;
 }
 public static bool HasMethod(this System.Diagnostics.StackFrame stackFrame)
 {
     throw null;
 }