Beispiel #1
0
        private void PurchaseDealUpdateMethod(new_aprove_price _proxyentity, List <new_port> _portList, OrganizationServiceContext orgContext, IOrganizationService service)
        {
            List <new_purchase_deal> _cdealListForUpdate = (from i in orgContext.CreateQuery <new_purchase_deal>()
                                                            where i.new_cropid.Id == _proxyentity.new_cropid.Id &&
                                                            (i.new_purchase_deal_stage == new OptionSetValue(100000000) ||
                                                             i.new_purchase_deal_stage == new OptionSetValue(100000002) ||
                                                             i.new_purchase_deal_stage == new OptionSetValue(100000001)) &&
                                                            i.new_opportunity_status == new OptionSetValue(100000000)
                                                            select i).ToList();

            foreach (var item in _cdealListForUpdate)
            {
                new_purchase_deal _updateDeal = new new_purchase_deal();
                _updateDeal.Id = item.Id;
                if (item.new_ship_portid == null)
                {
                    continue;
                }
                if (_portList.Where(x => x.Id == item.new_ship_portid.Id)?.FirstOrDefault()?.new_name == "Одеса")
                {
                    _updateDeal.new_recommended_price = _proxyentity.new_recom_purchase_price_odessa;
                }
                else if (_portList.Where(x => x.Id == item.new_ship_portid.Id)?.FirstOrDefault()?.new_name == "Миколаїв")
                {
                    _updateDeal.new_recommended_price = _proxyentity.new_recom_purchase_price_nikolaev;
                }
                service.Update(_updateDeal);
            }
        }
Beispiel #2
0
        private void PurchaseDealUpdateMethod(new_aprove_price _proxyentity, List<new_port> _portList, OrganizationServiceContext orgContext, IOrganizationService service)
        {
            List<new_purchase_deal> _cdealListForUpdate = (from i in orgContext.CreateQuery<new_purchase_deal>()
                                                           where i.new_cropid.Id == _proxyentity.new_cropid.Id &&
                                                           (i.new_purchase_deal_stage == new OptionSetValue(100000000) ||
                                                           i.new_purchase_deal_stage == new OptionSetValue(100000002) ||
                                                           i.new_purchase_deal_stage == new OptionSetValue(100000001)) &&
                                                           i.new_opportunity_status == new OptionSetValue(100000000)
                                                           select i).ToList();

            foreach ( var item in _cdealListForUpdate )
            {
                new_purchase_deal _updateDeal = new new_purchase_deal();
                _updateDeal.Id = item.Id;
                if ( item.new_ship_portid == null )
                    continue;
                if ( _portList.Where(x => x.Id == item.new_ship_portid.Id)?.FirstOrDefault()?.new_name == "Одеса" )
                {
                    _updateDeal.new_recommended_price = _proxyentity.new_recom_purchase_price_odessa;
                }
                else if ( _portList.Where(x => x.Id == item.new_ship_portid.Id)?.FirstOrDefault()?.new_name == "Миколаїв" )
                {
                    _updateDeal.new_recommended_price = _proxyentity.new_recom_purchase_price_nikolaev;
                }
                service.Update(_updateDeal);
            }
        }