コード例 #1
0
        public FinancialCustomerLiabilitySummary_Fact GetFinnancialCustomerLiabilitySummaryFact(
            Session session,
            Guid OwnerOrgId,
            Guid CustomerOrgId,
            DateTime IssueDate,
            string FinancialAccountCode)
        {
            FinancialCustomerLiabilitySummary_Fact result = null;

            try
            {
                Util                util                = new Util();
                OwnerOrgDim         ownerOrgDim         = util.GetXpoObjectByFieldName <OwnerOrgDim, Guid>(session, "RefId", OwnerOrgId, BinaryOperatorType.Equal);
                CustomerOrgDim      CustomerOrgDim      = util.GetXpoObjectByFieldName <CustomerOrgDim, Guid>(session, "RefId", CustomerOrgId, BinaryOperatorType.Equal);
                MonthDim            monthDim            = util.GetXpoObjectByFieldName <MonthDim, string>(session, "Name", IssueDate.Month.ToString(), BinaryOperatorType.Equal);
                YearDim             yearDim             = util.GetXpoObjectByFieldName <YearDim, string>(session, "Name", IssueDate.Year.ToString(), BinaryOperatorType.Equal);
                FinancialAccountDim financialAccountDim = util.GetXpoObjectByFieldName <FinancialAccountDim, string>(session, "Code", FinancialAccountCode, BinaryOperatorType.Equal);

                if (ownerOrgDim == null || CustomerOrgDim == null || monthDim == null || yearDim == null || financialAccountDim == null)
                {
                    return(null);
                }
                else
                {
                    FinancialCustomerLiabilitySummary_Fact a = null;
                    CriteriaOperator criteria_RowStatus      = new BinaryOperator("RowStatus", Constant.ROWSTATUS_ACTIVE, BinaryOperatorType.GreaterOrEqual);
                    CriteriaOperator criteria_OwnerOrg       = new BinaryOperator("OwnerOrgDimId", ownerOrgDim, BinaryOperatorType.Equal);
                    CriteriaOperator criteria_CustomerOrg    = new BinaryOperator("CustomerOrgDimId", CustomerOrgDim, BinaryOperatorType.Equal);
                    CriteriaOperator criteria_Month          = new BinaryOperator("MonthDimId", monthDim, BinaryOperatorType.Equal);
                    CriteriaOperator criteria_Year           = new BinaryOperator("YearDimId", yearDim, BinaryOperatorType.Equal);
                    CriteriaOperator criteria_AccountCode    = new BinaryOperator("FinancialAccountDimId", financialAccountDim, BinaryOperatorType.Equal);
                    CriteriaOperator criteria = CriteriaOperator.And(criteria_RowStatus, criteria_OwnerOrg, criteria_CustomerOrg, criteria_Month, criteria_Year, criteria_AccountCode);

                    FinancialCustomerLiabilitySummary_Fact fact = session.FindObject <FinancialCustomerLiabilitySummary_Fact>(criteria);

                    if (fact == null)
                    {
                        return(null);
                    }
                    {
                        result = fact;
                    }
                }
            }
            catch (Exception)
            {
                return(result);
            }
            return(result);
        }
コード例 #2
0
 public CustomerOrgDim get_CustomerOrgDimId(Session session, string Code, short RowStaus)
 {
     try
     {
         CustomerOrgDim COD_id = session.FindObject <CustomerOrgDim>(
             CriteriaOperator.And(
                 new BinaryOperator("Code", Code, BinaryOperatorType.Equal),
                 new BinaryOperator("RowStatus", RowStaus, BinaryOperatorType.Equal)
                 ));
         if (COD_id == null)
         {
             return(null);
         }
         return(COD_id);
     }
     catch (Exception) { throw; }
 }
コード例 #3
0
 public CustomerOrgDim GetCustomerOrgDim(Session session, Guid RefId)
 {
     try
     {
         CriteriaOperator criteria_RowStaus = new BinaryOperator("RowStatus", Constant.ROWSTATUS_ACTIVE, BinaryOperatorType.Equal);
         CriteriaOperator criteria_RefId    = new BinaryOperator("RefId", RefId, BinaryOperatorType.Equal);
         CriteriaOperator criteria          = CriteriaOperator.And(criteria_RefId, criteria_RowStaus);
         CustomerOrgDim   CustomerOrgDim    = session.FindObject <CustomerOrgDim>(criteria);
         if (CustomerOrgDim == null)
         {
             return(CreateCustomerOrgDim(session, RefId));
         }
         return(CustomerOrgDim);
     }
     catch
     {
         return(null);
     }
 }
コード例 #4
0
 public CustomerOrgDim CreateCustomerOrgDim(Session session, Guid RefId)
 {
     try
     {
         Organization supplierOrg = session.GetObjectByKey <Organization>(RefId);
         if (supplierOrg == null)
         {
             return(null);
         }
         CustomerOrgDim customerOrgDim = new CustomerOrgDim(session);
         customerOrgDim.Code        = supplierOrg.Code;
         customerOrgDim.Description = supplierOrg.Description;
         customerOrgDim.RefId       = RefId;
         customerOrgDim.Name        = supplierOrg.Name;
         customerOrgDim.RowStatus   = Constant.ROWSTATUS_ACTIVE;
         customerOrgDim.Save();
         return(customerOrgDim);
     }
     catch (Exception)
     {
         return(null);
     }
 }
コード例 #5
0
        public void CreateFinancialRevenueByItem(Session session,
                                                 Guid _BillId,
                                                 Guid _CustomerOrgId,
                                                 Guid _OwnerOrgId,
                                                 Item _Item,
                                                 Unit _Unit,
                                                 int Day,
                                                 int Month,
                                                 int Year,
                                                 string _AssetDim)
        {
            FinancialRevenueByItem_Fact result = new FinancialRevenueByItem_Fact(session);

            try
            {
                SalesInvoice invoice = session.GetObjectByKey <SalesInvoice>(_BillId);
                if (!Util.IsExistXpoObject <InvoiceDim>(session, "RefId", _BillId))
                {
                    InvoiceDim invoiceDim = new InvoiceDim(session);
                    invoiceDim.RefId       = _BillId;
                    invoiceDim.Code        = invoice.Code;
                    invoiceDim.Name        = "";
                    invoiceDim.Description = "";
                    invoiceDim.IssueDate   = invoice.IssuedDate;
                    invoiceDim.RowStatus   = Constant.ROWSTATUS_ACTIVE;
                    invoiceDim.Save();
                }
                if (!Util.IsExistXpoObject <DayDim>(session, "Name", Day.ToString()))
                {
                    DayDim dayDim = new DayDim(session);
                    dayDim.Description = Day.ToString();
                    dayDim.Name        = Day.ToString();
                    dayDim.RowStatus   = Constant.ROWSTATUS_ACTIVE;
                    dayDim.Save();
                }
                if (!Util.IsExistXpoObject <MonthDim>(session, "Name", Month.ToString()))
                {
                    MonthDim MonthDim = new MonthDim(session);
                    MonthDim.Description = Month.ToString();
                    MonthDim.Name        = Month.ToString();
                    MonthDim.RowStatus   = Constant.ROWSTATUS_ACTIVE;
                    MonthDim.Save();
                }
                if (!Util.IsExistXpoObject <YearDim>(session, "Name", Year.ToString()))
                {
                    YearDim YearDim = new YearDim(session);
                    YearDim.Description = Year.ToString();
                    YearDim.Name        = Year.ToString();
                    YearDim.RowStatus   = Constant.ROWSTATUS_ACTIVE;
                    YearDim.Save();
                }
                if (!Util.IsExistXpoObject <FinancialAssetDim>(session, "Name", _AssetDim))
                {
                    FinancialAssetDim assetDim = new FinancialAssetDim(session);
                    assetDim.Name        = _AssetDim;
                    assetDim.Description = _AssetDim;
                    assetDim.RowStatus   = Constant.ROWSTATUS_ACTIVE;
                    assetDim.Save();
                }

                if (!Util.IsExistXpoObject <ItemDim>(session, "RefId", _Item.ItemId))
                {
                    ItemDim itemDim = new ItemDim(session);
                    itemDim.RefId       = _Item.ItemId;
                    itemDim.Code        = _Item.Code;
                    itemDim.Name        = _Item.Name;
                    itemDim.Description = _Item.Description;
                    itemDim.RowStatus   = Constant.ROWSTATUS_ACTIVE;
                    itemDim.Save();
                }
                if (!Util.IsExistXpoObject <UnitDim>(session, "RefId", _Unit.UnitId))
                {
                    UnitDim unitDim = new UnitDim(session);
                    unitDim.RefId       = _Unit.UnitId;
                    unitDim.Code        = _Unit.Code;
                    unitDim.Name        = _Unit.Name;
                    unitDim.Description = _Unit.Description;
                    unitDim.RowStatus   = Constant.ROWSTATUS_ACTIVE;
                    unitDim.Save();
                }
                if (!Util.IsExistXpoObject <CustomerOrgDim>(session, "RefId", _CustomerOrgId))
                {
                    Organization customerOrg = session.GetObjectByKey <Organization>(_CustomerOrgId);
                    if (customerOrg != null)
                    {
                        CustomerOrgDim customerOrgDim = new CustomerOrgDim(session);
                        customerOrgDim.RefId       = _CustomerOrgId;
                        customerOrgDim.Code        = customerOrg.Code;
                        customerOrgDim.Name        = customerOrg.Name;
                        customerOrgDim.Description = customerOrg.Description;
                        customerOrgDim.RowStatus   = Constant.ROWSTATUS_ACTIVE;
                        customerOrgDim.Save();
                    }
                }
                if (!Util.IsExistXpoObject <OwnerOrgDim>(session, "RefId", _OwnerOrgId))
                {
                    Organization ownerOrg = session.GetObjectByKey <Organization>(_OwnerOrgId);
                    if (ownerOrg != null)
                    {
                        OwnerOrgDim ownerOrgDim = new OwnerOrgDim(session);
                        ownerOrgDim.RefId       = _OwnerOrgId;
                        ownerOrgDim.Code        = ownerOrg.Code;
                        ownerOrgDim.Name        = ownerOrg.Name;
                        ownerOrgDim.Description = ownerOrg.Description;
                        ownerOrgDim.RowStatus   = Constant.ROWSTATUS_ACTIVE;
                        ownerOrgDim.Save();
                    }
                }
                Util util = new Util();

                result.InvoiceDimId        = util.GetXpoObjectByFieldName <InvoiceDim, Guid>(session, "RefId", _BillId, DevExpress.Data.Filtering.BinaryOperatorType.Equal);
                result.FinancialAssetDimId = Util.getXpoObjectByName <FinancialAssetDim>(session, _AssetDim);
                result.DayDimId            = Util.getXpoObjectByName <DayDim>(session, Day.ToString());
                result.MonthDimId          = Util.getXpoObjectByName <MonthDim>(session, Month.ToString());
                result.YearDimId           = Util.getXpoObjectByName <YearDim>(session, Year.ToString());
                result.ItemDimId           = util.GetXpoObjectByFieldName <ItemDim, string>(session, "Code", _Item.Code, DevExpress.Data.Filtering.BinaryOperatorType.Equal);
                result.UnitDimId           = util.GetXpoObjectByFieldName <UnitDim, string>(session, "Code", _Unit.Code, DevExpress.Data.Filtering.BinaryOperatorType.Equal);
                result.CustomerOrgDimId    = util.GetXpoObjectByFieldName <CustomerOrgDim, Guid>(session, "RefId", _CustomerOrgId, DevExpress.Data.Filtering.BinaryOperatorType.Equal);
                result.OwnerOrgDimId       = util.GetXpoObjectByFieldName <OwnerOrgDim, Guid>(session, "RefId", _OwnerOrgId, DevExpress.Data.Filtering.BinaryOperatorType.Equal);
                result.Save();
            }
            catch (Exception)
            {
            }
        }