Exemple #1
0
        private void PurchaseTaskUpdateMethod(new_aprove_price _proxyentity, List <new_port> _portList, OrganizationServiceContext orgContext, IOrganizationService service)
        {
            List <new_purchase_task> _taskListForUpdate = (from i in orgContext.CreateQuery <new_purchase_task>()
                                                           where i.new_product.Id == _proxyentity.new_cropid.Id &&
                                                           i.new_status == new OptionSetValue(100000000)
                                                           select i).ToList();

            foreach (var item in _taskListForUpdate)
            {
                new_purchase_task _updateTask = new new_purchase_task();
                _updateTask.Id = item.Id;
                if (item.new_port == null)
                {
                    continue;
                }
                if (_portList.Where(x => x.Id == item.new_port.Id).FirstOrDefault().new_name == "Одеса")
                {
                    _updateTask.new_aprove_purchase_price = _proxyentity.new_recom_purchase_price_odessa;
                }
                else if (_portList.Where(x => x.Id == item.new_port.Id).FirstOrDefault().new_name == "Миколаїв")
                {
                    _updateTask.new_aprove_purchase_price = _proxyentity.new_recom_purchase_price_nikolaev;
                }
                service.Update(_updateTask);
            }
        }
Exemple #2
0
        private void PurchaseTaskUpdateMethod(new_aprove_price _proxyentity, List<new_port> _portList, OrganizationServiceContext orgContext, IOrganizationService service)
        {
            List<new_purchase_task> _taskListForUpdate = (from i in orgContext.CreateQuery<new_purchase_task>()
                                                          where i.new_product.Id == _proxyentity.new_cropid.Id &&
                                                          i.new_status == new OptionSetValue(100000000)
                                                          select i).ToList();

            foreach ( var item in _taskListForUpdate )
            {
                new_purchase_task _updateTask = new new_purchase_task();
                _updateTask.Id = item.Id;
                if ( item.new_port == null )
                    continue;
                if ( _portList.Where(x => x.Id == item.new_port.Id).FirstOrDefault().new_name == "Одеса" )
                {
                    _updateTask.new_aprove_purchase_price = _proxyentity.new_recom_purchase_price_odessa;
                }
                else if ( _portList.Where(x => x.Id == item.new_port.Id).FirstOrDefault().new_name == "Миколаїв" )
                {
                    _updateTask.new_aprove_purchase_price = _proxyentity.new_recom_purchase_price_nikolaev;
                }
                service.Update(_updateTask);
            }
        }