public static Boolean cekDebetAcc(ISession session, Transaction trx, ILog log) { Boolean result = false; //get trxpayrolls object XmlDocument doc = new XmlDocument(); XmlSerializer ser = new XmlSerializer(typeof(TrxPayroll)); doc.LoadXml(trx.TObject); XmlNodeReader reader = new XmlNodeReader(doc.DocumentElement); object obj = ser.Deserialize(reader); TrxPayroll ObjPayroll = (TrxPayroll)obj; TrxPayroll payroll = session.Load <TrxPayroll>(ObjPayroll.Id); string dbAcc = payroll.DebitAccount; //dsini update Debet account jika beda (Khusu ftp jane) - denny #region update Debet Account tabel Transactions try { if (ObjPayroll.DebitAccount.Equals(payroll.DebitAccount)) { //Ya udah oke no problem log.Info("Transaksi Payroll ID transactions : " + trx.Id + " :: Debet Transactions is Match "); result = true; } else { //Rubah biar samaan log.Info("FTP Payroll ID transactions : " + trx.Id + " is Detected :: Debet Transactions is not Match "); ObjPayroll.DebitAccount = dbAcc; string hasilAkhir = ObjPayroll.ToString(); trx.TObject = hasilAkhir; session.Update(trx); session.Flush(); result = true; } #endregion update Debet Account tabel Transactions } catch (Exception ex) { log.Error("Ada exception, Trxid : " + trx.Id + "gagal cek atau update debit account"); result = false; } return(result); }
private bool saveTransaction(ISession session, String filename, TrxPayroll trx, int cid, ILog log, out int IDTrxs, UserMap umap) { IDTrxs = 0; Boolean isTrue = true; try { String[] tmpfileInfo = filename.Split('!'); Transaction tx = new Transaction(); tx.Handle = "ADD PAYROLLBRI"; tx.TransactionId = 101; //tx.CreatedTime = DateTime.ParseExact(tmpfileInfo[0], "ddMMyyhhmmss", System.Globalization.CultureInfo.InvariantCulture);// Dari Split tx.CreatedTime = DateTime.Now; tx.VerifiedTime = DateTime.Now; tx.ApprovedTime = DateTime.Now; tx.TObject = trx.ToString(); tx.ClientId = cid; tx.Status = 1; tx.Action = "ADD"; tx.Maker = umap.UserHandle + " - " + DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss"); Console.WriteLine("AA => " + umap.UserHandle + " - " + DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss")); Console.WriteLine("BB => " + tx.Maker); tx.Checker = ""; tx.Approver = ""; tx.Checker = ""; tx.Approver = ""; tx.CheckWork = 0; tx.CheckTotal = 0; tx.ApproveWork = 0; tx.CheckTotal = 0; ClientWorkflow cm = session.CreateCriteria(typeof(ClientWorkflow)) .Add(Expression.Eq("Id", cid)) .UniqueResult <ClientWorkflow>(); WorkflowHelper wh = new WorkflowHelper(cm.Workflow); if (!(null == wh)) { Workflow flow = wh.GetWorkflow(100); if (!(null == flow)) { //tx.Maker = ""; tx.Approver = ""; tx.CheckTotal = flow.TotalVerifier; tx.ApproveTotal = flow.TotalApprover; } else { throw new Exception("Matrix PAYROLL is Null for this Client"); } } IDTrxs = (int)session.Save(tx); session.Flush(); isTrue = true; } catch (Exception ex) { isTrue = false; log.Error("== " + SchedulllerCode + " = Scheduller GetFilePayrollKai Failed to Start => Exception Message =" + " " + ex.Message); log.Error("== " + SchedulllerCode + " = Scheduller GetFilePayrollKai Failed to Start => Exception InnerMessage =" + " " + ex.InnerException); log.Error("== " + SchedulllerCode + " = Scheduller GetFilePayrollKai Failed to Start => Exception StackTrace =" + " " + ex.StackTrace); } return(isTrue); }