public bool SaveMasterCommissionLodgementTransaction(commission_lodgement_reimbursment newmlr, commission_transaction newmastertransaction, commission_balance commissionbalance) { try { using (TransactionScope scope = new TransactionScope()) { newmastertransaction.app_id = Application().app_id; newmlr.app_id = Application().app_id; db.commission_transactions.InsertOnSubmit(newmastertransaction); db.SubmitChanges(); newmlr.transaction = new CRUD.commission_transaction_crud().find_commission_transaction_By_AppId(newmastertransaction.app_id).id; newmlr.transaction_type = (newmastertransaction.transaction_category.type == true) ? 1 : 0; newmlr.transaction_category = newmastertransaction.trans_category; db.commission_lodgement_reimbursments.InsertOnSubmit(newmlr); commission_balance prev_master_balance_sheet = db.commission_balances.SingleOrDefault(a => a.id == commissionbalance.id); prev_master_balance_sheet.balance = commissionbalance.balance; db.SubmitChanges(); scope.Complete(); } return(true); } catch (Exception) { return(false); } }
public bool initializeParameters(shop shop, string message, commission_lodgement_reimbursment trans) { if (message.Contains("{lodgement_analysis}")) { string lodgementstring = ""; lodgementstring = "NGN" + trans.amount.ToString("#,0.00") + " to our " + trans.bank1.code + " A/C"; message = message.Replace("{lodgement_analysis}", lodgementstring); } if (message.Contains("{reimbursment_analysis}")) { string reimbursmentstring = ""; reimbursmentstring = "NGN" + trans.amount.ToString("#,0.00"); message = message.Replace("{reimbursment_analysis}", reimbursmentstring); } if (message.Contains("{sales_bal}")) { string salesbalstring = ""; salesbalstring = "NGN" + new CRUD.commission_balance_crud().find_commission_balance_By_ShopId(shop.id).balance.Value.ToString("#,0.00"); message = message.Replace("{sales_bal}", salesbalstring); } messages = message; return(initializeParameters(shop, message, new object())); }