Ejemplo n.º 1
0
        public static void UpdateSumOfDebit(Guid receiptVouchesId)
        {
            Session session = null;

            try
            {
                session = XpoHelper.GetNewSession();
                ReceiptVouches receiptVouches =
                    session.GetObjectByKey <ReceiptVouches>(receiptVouchesId);
                double sumOfDebit = 0;
                foreach (var item in receiptVouches.VouchesAmounts)
                {
                    sumOfDebit += item.Debit * item.ExchangeRate;
                }
                receiptVouches.SumOfDebit = sumOfDebit;
                receiptVouches.Save();
            }
            catch (Exception ex)
            {
                throw;
            }
            finally
            {
                if (session != null)
                {
                    session.Dispose();
                }
            }
        }
Ejemplo n.º 2
0
        public ReceiptVouches CreateNewObject(Session session)
        {
            try
            {
                ReceiptVouches receiptVouches = new ReceiptVouches(session)
                {
                    VouchesId = Guid.NewGuid(),
                    RowStatus = Utility.Constant.ROWSTATUS_TEMP
                };
                receiptVouches.Save();

                ObjectBO objectBO = new ObjectBO();

                NAS.DAL.CMS.ObjectDocument.Object CMSObject = objectBO.CreateCMSObject(session,
                                                                                       DAL.CMS.ObjectDocument.ObjectTypeEnum.VOUCHER_RECEIPT);

                VoucherObject voucherObject = new VoucherObject(session)
                {
                    ObjectId  = CMSObject,
                    VoucherId = receiptVouches
                };
                voucherObject.Save();

                VoucherCustomType voucherCustomType = new VoucherCustomType(session)
                {
                    VoucherId    = receiptVouches,
                    ObjectTypeId = ObjectType.GetDefault(session, ObjectTypeEnum.VOUCHER_RECEIPT)
                };
                voucherCustomType.Save();

                return(receiptVouches);
            }
            catch (Exception ex)
            {
                throw;
            }
            finally
            {
            }
        }