private DeliveryFoodDTO GetDelivery(Recordset lObjRecordset) { DeliveryFoodDTO lObjDeliveryFood = new DeliveryFoodDTO(); lObjDeliveryFood.DocEntry = Convert.ToInt32(lObjRecordset.Fields.Item("DocEntry").Value.ToString()); lObjDeliveryFood.DocNum = Convert.ToInt32(lObjRecordset.Fields.Item("DocNum").Value.ToString()); lObjDeliveryFood.DocType = lObjRecordset.Fields.Item("DocType").Value.ToString(); lObjDeliveryFood.CardCode = lObjRecordset.Fields.Item("CardCode").Value.ToString(); lObjDeliveryFood.WhsCode = lObjRecordset.Fields.Item("WhsCode").Value.ToString(); lObjDeliveryFood.ItemCode = lObjRecordset.Fields.Item("ItemCode").Value.ToString(); lObjDeliveryFood.TaxCode = lObjRecordset.Fields.Item("TaxCode").Value.ToString(); lObjDeliveryFood.BatchNumber = lObjRecordset.Fields.Item("BatchNumber").Value.ToString(); lObjDeliveryFood.LineNum = Convert.ToInt32(lObjRecordset.Fields.Item("LineNum").Value.ToString()); lObjDeliveryFood.Quantity = Convert.ToDouble(lObjRecordset.Fields.Item("Quantity").Value.ToString()); lObjDeliveryFood.Price = Convert.ToDecimal(lObjRecordset.Fields.Item("Price").Value.ToString()); lObjDeliveryFood.Opened = lObjRecordset.Fields.Item("DocStatus").Value.ToString() != "O" ? false : true; string dd = lObjRecordset.Fields.Item("CreateTS").Value.ToString(); string pd = lObjRecordset.Fields.Item("UpdateTS").Value.ToString(); DateTime lObjCreationHour = DateTime.Now; DateTime lObjModificationHour = DateTime.Now; lObjCreationHour = DateTime.ParseExact(dd.PadLeft(6, '0'), "HHmmss", null); lObjModificationHour = DateTime.ParseExact(pd.PadLeft(6, '0'), "HHmmss", null); lObjDeliveryFood.CreateDate = lObjRecordset.Fields.Item("CreateDate").Value != null? Convert.ToDateTime(lObjRecordset.Fields.Item("CreateDate").Value.ToString()) : DateTime.MinValue; lObjDeliveryFood.UpdateDate = lObjRecordset.Fields.Item("UpdateDate").Value != null? Convert.ToDateTime(lObjRecordset.Fields.Item("UpdateDate").Value.ToString()) : DateTime.MinValue; lObjDeliveryFood.CreateDate = lObjDeliveryFood.CreateDate.Date.Add(lObjCreationHour.TimeOfDay); lObjDeliveryFood.UpdateDate = lObjDeliveryFood.UpdateDate.Date.Add(lObjModificationHour.TimeOfDay); return(lObjDeliveryFood); }
private bool FoodDeliveryHasChanges(DeliveryFoodDTO pObjDeliveryFood) { return(LocalDeliveryFoodService.GetList().Where(x => x.DocEntry == pObjDeliveryFood.DocEntry && (x.ModificationDate != pObjDeliveryFood.UpdateDate || x.Opened != pObjDeliveryFood.Opened)).Count() > 0 ? true : false); }