Beispiel #1
0
        static void Main(string[] args)
        {
            Factory.CreateObject();
            UserSession us = new UserSession();

            us.UserID             = SS.DB.Query.ParameterServices.ImportSystemUserID;
            us.CurrentProgramCode = "ImageFileIO";
            LocalDataStoreSlot slot = System.Threading.Thread.AllocateNamedDataSlot(SessionEnum.WebSession.UserProfiles.ToString());

            System.Threading.Thread.SetData(slot, us);

            imagePostService   = Factory.DbDocumentImagePostingService;
            avDocumentService  = Factory.AvAdvanceDocumentService;
            expDocumentService = Factory.FnExpenseDocumentService;
            avDocumentQuery    = Factory.AvAdvanceDocumentQuery;
            expDocumentQuery   = Factory.FnExpenseDocumentQuery;
            docQuery           = Factory.SCGDocumentQuery;
            imgLogService      = Factory.SuImageToSAPLogService;
            parameterQuery     = Factory.DbParameterQuery;
            imgPostingQuery    = Factory.DbDocumentImagePostingQuery;
            fnRemittanceQuery  = Factory.FnRemittanceQuery;
            docService         = Factory.SCGDocumentService;

            Console.WriteLine("Program Export Document Image is running.");
            Factory.CreateObject();
            if (args.Length == 0)
            {
                args = new string[1];
                Console.WriteLine("Insert \"I\" or \"O\" to import / export mode");
                args[0] = Console.ReadLine();
            }


            if (args[0].ToLower() == "i")
            {
                Console.WriteLine("Import Start.");
                ImportPath = args[1];

                ReadExportImageLogfile();
            }
            if (args[0].ToLower() == "o")
            {
                Console.WriteLine("Export Start.");
                RootPath        = args[1];
                ExportImagePath = args[2];
                ExportDocumentImage();
            }



            Console.WriteLine("Program finish.");
        }
Beispiel #2
0
        private void SMSApproveProcess(string FROM, string CONTENT, string TRANSID)
        {
            IWorkFlowResponseTokenQuery WorkFlowResponseTokenQuery = (IWorkFlowResponseTokenQuery)ContextRegistry.GetContext().GetObject("WorkFlowResponseTokenQuery");

            string ReplyApproveFlag = CONTENT.Equals(string.Empty) ? "" : CONTENT.Substring(CONTENT.Length - 1, 1);
            string ReplyTokenResult = CONTENT.Equals(string.Empty) ? "" : CONTENT.TrimEnd(new Char[] { 'Y', 'N', 'y', 'n' });


            if (ReplyApproveFlag.ToUpper().Equals("Y"))
            {
                ReplyApproveFlag = "Approve"; //Accept
            }
            else if (ReplyApproveFlag.ToUpper().Equals("N"))
            {
                ReplyApproveFlag = "Reject"; //Decline
            }
            long userID = 0;
            IList <WorkFlowResponseToken> responseTokens = WorkFlowResponseTokenQuery.FindByTokenCode(ReplyTokenResult);

            foreach (WorkFlowResponseToken responseToken in responseTokens)
            {
                userID = responseToken.UserID;
                break;
            }
            //1. SignIn by UserName (From)

            if (userID == 0)
            {
                //แจ้งเตือนในกรณีที่มีการ approved ผ่านมือถือ แต่ว่า approve อีกรอบจะทำให้ tokencode หาย
                long smsLogID = AddSMSLog(DateTime.Now, FROM, "Receive", CONTENT, TRANSID);
                SCGSMSService.SendSMS08(CONTENT, FROM, true);
            }
            else
            {
                try
                {
                    UserEngine = (IUserEngine)ContextRegistry.GetContext().GetObject("UserEngine");
                    ISuUserQuery      SuUserQuery      = (ISuUserQuery)ContextRegistry.GetContext().GetObject("SuUserQuery");
                    IDbParameterQuery DbParameterQuery = (IDbParameterQuery)ContextRegistry.GetContext().GetObject("DbParameterQuery");

                    SuUser user = SuUserQuery.FindByIdentity(userID);
                    if (user != null && user.MobilePhoneNo == FROM)
                    {
                        string userName = user.UserName;

                        UserEngine.SignIn(userName);

                        UserAccount = (IUserAccount)ContextRegistry.GetContext().GetObject("UserAccount");
                        string smsDefaultLanguageID = DbParameterQuery.GetParameterByName("SMSDefaultLanguageID");
                        UserAccount.CurrentLanguageID  = string.IsNullOrEmpty(smsDefaultLanguageID) ? (short)1 : Convert.ToInt16(smsDefaultLanguageID);
                        UserAccount.CurrentProgramCode = "SmsWcfService";


                        long smsLogID = AddSMSLog(DateTime.Now, FROM, "Receive", CONTENT, TRANSID);

                        bool approveFalg = CallWorkFlow(ReplyTokenResult, ReplyApproveFlag, FROM);
                    }
                    else
                    {
                        //แจ้งเตือนในกรณีที่มีการ approved ผ่านมือถือคนอื่นที่ไม่ใช่เครื่องที่รับ message นั้น
                        long smsLogID = AddSMSLog(DateTime.Now, FROM, "Receive", CONTENT, TRANSID);
                        SCGSMSService.SendSMS10(CONTENT, FROM, true);
                    }
                }
                catch (Exception ex)
                {
                    Utilities.WriteLogs(ex.Message, "smslog", "Logs", "txt");
                    // error = ex.Message;
                }
            }
        }