/// <summary> /// Delete Area by area code /// </summary> /// <param name="PAreaCode"></param> /// <returns></returns> public static bool Delete(string pOrderID) { using (NetworkEntities context = new NetworkEntities()) { FFModal.Order objOrder = context.Orders.FirstOrDefault(x => x.OrderID == pOrderID); if (objOrder == null) return false; else { context.Orders.DeleteObject(objOrder); context.SaveChanges(); return true; } } }
/// <summary> /// Insert new record on Order tabel /// </summary> /// <param name="pMemberID">String</param> /// <param name="pAmount">Decimal</param> /// <param name="pDescription">String</param> /// <param name="pRemarks">Remarks</param> /// <returns></returns> public static bool Add(string pOrderId,string pMemberID, decimal pAmount, string pDescription, string pRemarks, DateTime pOrderDate, bool pIsDelivered, bool pIsPaid, DateTime? pDeliveredDate,DateTime? pPaidDate) { using (NetworkEntities context = new NetworkEntities()) { Order objOder = new Order(); objOder.OrderID = pOrderId; objOder.MembershipID = pMemberID; objOder.OrderDate = Convert.ToDateTime(pOrderDate); objOder.Amount = pAmount; objOder.IsDelivered = false; objOder.Description = pDescription; objOder.Remarks = pRemarks; objOder.IsDelivered = pIsDelivered; objOder.DeliveredDate = pDeliveredDate; objOder.IsPaid = pIsPaid; objOder.PaidDate = pPaidDate; context.Orders.AddObject(objOder); int status = context.SaveChanges(); return true; } }
/// <summary> /// Edit record on Order table /// </summary> /// <param name="pOrderID"></param> /// <param name="pTaxRatpTaxIDe"></param> /// <returns></returns> public static bool Edit(string pOrderID,string pMemberID, decimal pAmount, string pDescription, string pRemarks, DateTime pOrderDate, bool pIsDelivered, bool pIsPaid, DateTime? pDeliveredDate,DateTime? pPaidDate) { using (NetworkEntities context = new NetworkEntities()) { Order objOrder = context.Orders.FirstOrDefault(x => x.OrderID == pOrderID); objOrder.MembershipID = pMemberID; objOrder.OrderDate = pOrderDate; objOrder.Amount = pAmount; objOrder.Description = pDescription; objOrder.Remarks = pRemarks; objOrder.OrderDate = pOrderDate; objOrder.IsDelivered = pIsDelivered; objOrder.DeliveredDate = pDeliveredDate; objOrder.IsPaid = pIsPaid; objOrder.PaidDate = pPaidDate; context.SaveChanges(); return true; } }