Esempio n. 1
0
 /// <summary>
 /// Before Save
 /// </summary>
 /// <param name="newRecord">new</param>
 /// <returns>true</returns>
 protected override bool BeforeSave(bool newRecord)
 {
     if (newRecord && GetAD_Session_ID() == 0)
     {
         MSession session       = MSession.Get(GetCtx(), true);
         int      AD_Session_ID = session.GetAD_Session_ID();
         SetAD_Session_ID(AD_Session_ID);
     }
     return(true);
 }
Esempio n. 2
0
        /// <summary>
        /// Function will check if Action need to save or not.
        /// If Yes, then save information in table.
        /// </summary>
        /// <param name="ctx"></param>
        /// <param name="ActionOrigin">Action Origin(Menu, Window, Form)</param>
        /// <param name="OriginName">(Form name or window name)</param>
        /// <param name="AD_Table_ID">AD_Table_ID of table from where action intiated</param>
        /// <param name="Record_ID">Selected Record_ID</param>
        /// <param name="Process_ID">AD_Process_ID with which report is linked</param>
        /// <param name="ProcessName">Name of Process</param>
        /// <param name="fileType">Requested file type(PDF, CSV, RTF)</param>
        /// <param name="description">Desciption like filename or anything else</param>
        /// <param name="ActionType">Action type.(Viewed Or Downloaded)</param>
        public static void SaveActionLog(Ctx ctx, string ActionOrigin, string OriginName, int AD_Table_ID, int Record_ID,
                                         int processID, string ProcessName, string fileType, string description, string ActionType)
        {
            //Save Action Log key is fetched from System Config window
            string canSave = Util.GetValueOfString(ctx.GetContext("#SAVE_ACTION_LOG"));

            if (!canSave.Equals("Y"))
            {
                return;
            }

            string reportTypeForLog = MActionLog.ACTIONTYPE_View;
            string descriptonForLog = "Report Viewed";

            if (!string.IsNullOrEmpty(description))
            {
                descriptonForLog = description;
            }
            if (!string.IsNullOrEmpty(ActionType))
            {
                reportTypeForLog = ActionType;
            }
            // As PDF viewed in Browser, so PDF report Viewed message will be saved.
            else if (fileType.Equals(ProcessCtl.ReportType_PDF))
            {
                reportTypeForLog = MActionLog.ACTIONTYPE_View;
                descriptonForLog = "PDF Report Viewed";
            }
            else if (fileType.Equals(ProcessCtl.ReportType_CSV))
            {
                reportTypeForLog = MActionLog.ACTIONTYPE_Download;
                descriptonForLog = "CSV Report Downloaded";
            }
            else if (fileType.Equals(ProcessCtl.ReportType_RTF))
            {
                reportTypeForLog = MActionLog.ACTIONTYPE_Download;
                descriptonForLog = "RTF Report Downloaded";
            }
            else if (fileType.Equals(ProcessCtl.ReportType_HTML))
            {
                reportTypeForLog = MActionLog.ACTIONTYPE_View;
                descriptonForLog = "Report Viewed";
            }
            if (processID > 0)
            {
                descriptonForLog += ", Process Name:->" + ProcessName;
            }

            MSession sess = MSession.Get(ctx);

            sess.ActionLog(ctx, sess.GetAD_Session_ID(), ctx.GetAD_Client_ID(), ctx.GetAD_Org_ID(),
                           ActionOrigin, reportTypeForLog, OriginName, descriptonForLog, AD_Table_ID, Record_ID);
        }