9 Aralık 2015 Çarşamba

CRM 2011 QueryExpression - Sipariş Çekme (Get Order)

 public static SalesOrder GetOrder(IOrganizationService ser, Guid orderid, ColumnSet columnset)
        {
            try
            {
                QueryExpression query = GetQueryExpressionSingle("salesorder", "salesorderid", orderid, columnset);
                EntityCollection ec = ser.RetrieveMultiple(query);
                if (ec != null && ec.Entities.Count == 1)
                    return (SalesOrder)ec.Entities[0];
                else
                    return new SalesOrder();
            }
            catch (Exception ex)
            {
               FileLogHelper.LoggEx(ex, typeof(CrmManagerStatic), "public static SalesOrder GetOrder(IOrganizationService ser, Guid orderid, ColumnSet columnset)" + Environment.NewLine +
                                                                    "SalesOrderId :" + CommonFunction.ToString(orderid));
                throw ex;
            }
        }

GetQueryExpressionSingle metodu


Metot Kullanımı

string[] columns = new string[] { "salesorderid", "ite_ps1paymentterm1", "ite_ps1percentage1","ite_ps1amount1",
                                                      "ite_ps2paymentterm1","ite_ps2percentage1","ite_ps2amount1",
                                                      "ite_ps2paymentterm2","ite_ps2percentage2","ite_ps2amount2",
                                                      "ite_ps3paymentterm1","ite_ps3percentage1","ite_ps3amount1",
                                                      "ite_ps3paymenterm2","ite_ps3percentage2","ite_ps3amount2",
                                                      "ite_ps3paymentterm3","ite_ps3percentage3","ite_ps3amount3",
                                                      "ite_paymentschedule", "ite_project","transactioncurrencyid" };

  SalesOrder order = CrmManagerStatic.GetOrder(crmService, salesorderid, new                       ColumnSet(columns));

Hiç yorum yok:

Yorum Gönder