예제 #1
0
        public string ErrorLog(string RecordID, string RecordID2, string RecordID3, string Section, string Section2, string Section3, string Description, string Verbose, int Status)
        {
            try
            {
                int iS1 = Section.Length;
                int iS2 = Section2.Length;
                int iS3 = Section3.Length;
                int iD  = Description.Length;
                int iV  = Verbose.Length;

                if (iS1 > 300)
                {
                    iS1 = 300;
                }
                if (iS2 > 50)
                {
                    iS2 = 50;
                }
                if (iS3 > 50)
                {
                    iS3 = 50;
                }
                if (iD > 300)
                {
                    iD = 300;
                }
                if (iV > 300)
                {
                    iV = 300;
                }

                string retVal = "";
                try
                {
                    //call logerror API here
                    Employer.Employer employer = new Employer.Employer();
                    retVal = employer.LogError(RecordID, RecordID2, RecordID3,
                                               Section.Substring(0, iS1),
                                               Section2.Substring(0, iS2),
                                               Section3.Substring(0, iS3),
                                               Description.Substring(0, iD),
                                               Verbose.Substring(0, iV),
                                               Status);
                }
                catch (Exception ex)
                {
                    LogWorker logworker = new LogWorker("ErrorLog", "ErrorLog", ex.Message.ToString());
                }

                string[] retValParser;
                retValParser = retVal.Split('~');
                if (retValParser.GetUpperBound(0) > 0)
                {
                    if (retValParser[0] != "0")
                    {
                        return(retValParser[1]);
                    }
                    else
                    {
                        //UserID | ClientID | EntityID
                        this.WriteToLog(RecordID + "|" + RecordID2 + "|" + RecordID3 + "\t" + Section + "\t" + Section2 + "\t" + Section3 + "\t" + Description + "\t" + Verbose);
                        return(retValParser[1]);
                    }
                }
                else
                {
                    return(retVal);
                }
            }
            catch (Exception ex)
            {
                try
                {
                    this.WriteToLog(RecordID + "\t" + Section + "\t" + Section2 + "\t" + Section3 + "\t" + Description + "\t" + Verbose);
                }catch (Exception exx) {
                    LogWorker logworker = new LogWorker("LogError", "ErrorLog", exx.Message.ToString());
                }
            }
            return("");
        }