Ejemplo n.º 1
0
        public static void UpdateSAPLog(int TranId, string REMRefID, string SAPRefID, string SAPRefNo, string SAPRefGLNo, int APIResponseCode,
                                        string APIErrorMessage, string SAPStatusCode, string SAPErrorMessage, List <SAP_Interface_Log_Detail> LogDetail)
        {
            SAP_Interface_Log Log = new SAP_Interface_Log(ICON.Configuration.Database.REM_ConnectionString, TranId);

            Log.REMRefID        = !string.IsNullOrEmpty(REMRefID) ? REMRefID : Log.REMRefID;
            Log.SAPRefID        = !string.IsNullOrEmpty(SAPRefID) ? SAPRefID : Log.SAPRefID;
            Log.SAPRefNo        = !string.IsNullOrEmpty(SAPRefNo) ? SAPRefNo : Log.SAPRefNo;
            Log.SAPRefGLNo      = !string.IsNullOrEmpty(SAPRefGLNo) ? SAPRefGLNo : Log.SAPRefGLNo;
            Log.APIResponseCode = APIResponseCode;
            Log.APIErrorMessage = !string.IsNullOrEmpty(APIErrorMessage) ? APIErrorMessage : Log.APIErrorMessage;
            Log.SAPStatusCode   = !string.IsNullOrEmpty(SAPStatusCode) ? SAPStatusCode : Log.SAPStatusCode;
            Log.SAPErrorMessage = !string.IsNullOrEmpty(SAPErrorMessage) ? SAPErrorMessage : Log.SAPErrorMessage;
            Log.RetryCount      = (Log.RetryCount == null ? 0 : Log.RetryCount + 1);

            Log.ExecCommand.Update();

            foreach (SAP_Interface_Log_Detail Item in LogDetail)
            {
                Item.InitCommand(ICON.Configuration.Database.REM_ConnectionString);
                Item.Module            = Log.Module;
                Item.MethodName        = Log.MethodName;
                Item.REMRefID          = Log.REMRefID;
                Item.REMRefDescription = Log.REMRefDescription;
                Item.SAPRefDescription = Log.SAPRefDescription;
                Item.CreateBy          = Log.UpdateBy;
                Item.CreateDate        = Log.UpdateDate;
                Item.ModifyBy          = Log.UpdateBy;
                Item.ModifyDate        = Log.UpdateDate;
                Item.ExecCommand.Insert();
            }
        }
Ejemplo n.º 2
0
        public static void UpdateSAPLog(int TranId, string APIResponseData, int APIResponseCode, string APIErrorMessage)
        {
            SAP_Interface_Log Log = new SAP_Interface_Log(ICON.Configuration.Database.REM_ConnectionString, TranId);

            Log.APIResponseData = !string.IsNullOrEmpty(APIResponseData) ? APIResponseData : Log.APIResponseData;
            Log.APIResponseCode = APIResponseCode;
            Log.APIErrorMessage = !string.IsNullOrEmpty(APIErrorMessage) ? APIErrorMessage : Log.APIErrorMessage;

            Log.ExecCommand.Update();
        }
Ejemplo n.º 3
0
        public static SAP_Interface_Log CreateSAPLog(
            string Module,
            string MethodName,
            string REMRefID,
            string REMRefDescription,
            string SAPRefID,
            string SAPRefDescription,
            string APIRequestData,
            string TranBy
            )
        {
            SAP_Interface_Log Log = new SAP_Interface_Log(ICON.Configuration.Database.REM_ConnectionString);

            DBHelper dbHelp = new DBHelper(ICON.Configuration.Database.REM_ConnectionString, null);
            string   Sql    = $"select * from SAP_Interface_Log  where Module = '{Module}' and MethodName = '{MethodName}' and REMRefID = '{REMRefID}'";

            System.Data.DataTable DT = dbHelp.ExecuteDataTable(Sql);

            if (DT.Rows.Count > 0)
            {
                Log.ExecCommand.Load(DT.Rows[0]);
                Log.UpdateDate = DateTime.Now;
                Log.UpdateBy   = Log.CreateBy;
                Log.ExecCommand.Update();
            }
            else
            {
                Log.Module            = Module;
                Log.MethodName        = MethodName;
                Log.REMRefID          = REMRefID;
                Log.REMRefDescription = REMRefDescription;
                Log.SAPRefID          = SAPRefID;
                Log.SAPRefDescription = SAPRefDescription;
                Log.APIRequestData    = APIRequestData;
                Log.APIResponseCode   = 500;
                Log.SAPStatusCode     = null;
                Log.CreateDate        = DateTime.Now;
                Log.CreateBy          = TranBy;
                Log.UpdateDate        = DateTime.Now;
                Log.UpdateBy          = Log.CreateBy;
                Log.RetryCount        = null;
                Log.ExecCommand.Insert();
            }

            return(Log);
        }
Ejemplo n.º 4
0
        public List <SAP_Interface_Log> SelectAll(int start, int length, List <WhereClause> Where, List <OrderByClause> OrderBy)
        {
            SelectQueryBuilder Sqb = new SelectQueryBuilder();

            Sqb.SelectAllColumns();
            if (start > 0 || length > 0)
            {
                if (start == 0)
                {
                    Sqb.TopRecords = length;
                }
                else
                {
                    Sqb.LimitRecords(start, length);
                }
            }
            Sqb.SelectFromTable("SAP_Interface_Log");
            if (Where != null)
            {
                foreach (WhereClause Item in Where)
                {
                    Sqb.AddWhere(Item);
                }
            }
            if (OrderBy != null)
            {
                foreach (OrderByClause Item in OrderBy)
                {
                    Sqb.AddOrderBy(Item);
                }
            }

            DataTable dt = LoadByQueryBuilder(Sqb);
            List <SAP_Interface_Log> Res = new List <SAP_Interface_Log>();

            foreach (DataRow Dr in dt.Rows)
            {
                SAP_Interface_Log Item = new SAP_Interface_Log();
                Item.ExecCommand.Load(Dr);
                Res.Add(Item);
            }

            return(Res);
        }
Ejemplo n.º 5
0
 internal SAP_Interface_Log_Command(string ConnectionStr, SAP_Interface_Log obj_SAP_Interface_Log)
 {
     this._SAP_Interface_Log = obj_SAP_Interface_Log;
     this._DBHelper          = new DBHelper(ConnectionStr, null);
 }
Ejemplo n.º 6
0
 internal SAP_Interface_Log_Command(SAP_Interface_Log obj_SAP_Interface_Log)
 {
     this._SAP_Interface_Log = obj_SAP_Interface_Log;
     this._DBHelper          = new DBHelper();
 }