9 Aralık 2015 Çarşamba

CRM 2011 QueryExpresison - Sipariş Ürünü Çekme (Get OrderDetail)

public static SalesOrderDetail GetOrderDetail(IOrganizationService ser, Guid orderdetailid, ColumnSet columnset)
        {
            try
            {
                QueryExpression query = GetQueryExpressionSingle("salesorderdetail", "salesorderdetailid", orderdetailid, columnset);
                EntityCollection ec = ser.RetrieveMultiple(query);
                if (ec != null && ec.Entities.Count == 1)
                    return (SalesOrderDetail)ec.Entities[0];
                else
                    return new SalesOrderDetail();
            }
            catch (Exception ex)
            {
               FileLogHelper.LoggEx(ex, typeof(CrmManagerStatic), "public static SalesOrderDetail GetQuoteDetail(IOrganizationService ser, Guid orderdetailid, ColumnSet columnset)" + Environment.NewLine +
                                                                    "SalesOrderDetailId :" + CommonFunction.ToString(orderdetailid));
                throw ex;
            }
        }

GetQueryExpressionSingle metodu


Metot Kullanımı

SalesOrderDetail orderDetail = CrmManagerStatic.GetOrderDetail(crmService, orderDetailId, new ColumnSet("manualdiscountamount", "salesorderdetailid", "priceperunit", "quantity", "ite_isinvoice", "salesrepid", "ite_newdiscountpercent"));
                                     

Hiç yorum yok:

Yorum Gönder