public BaseResponse GetUserByCode(HttpRequestMessage request, string usercode, string password) { string status = string.Empty, statusMessage = string.Empty; Status Status = Status.Success; BaseResponse response = new BaseResponse(); UserDetails objLoginModel = null; List <Order> OrderItem = null; try { objLoginModel = (new HelperManament()).GetUserByCode(usercode, password); if (objLoginModel != null) { if (objLoginModel.UserCode == "Buyer") { var Usercode = objLoginModel.UserCode; OrderItem = (new HelperManament()).GetOrderByBuyerLogin(Usercode); } else { OrderItem = new HelperManament().GetOrders(); } status = "Success"; statusMessage = "fetech orders successfully."; Status = Status.Success; } else { status = "Success"; statusMessage = "no orders ."; Status = Status.Success; } } catch (Exception ex) { status = "Failure"; statusMessage = "Oops something went wrong. Please try again.";; Status = Status.Error; } response.Data = OrderItem; response.status = status; response.statusMessage = statusMessage; response.statusCode = Status; return(response); }
public BaseResponse GetOrders(HttpRequestMessage request) { string status = string.Empty, statusMessage = string.Empty; Status Status = Status.Success; bool IsValid = true; BaseResponse response = new BaseResponse(); List <Order> OrderItem = null; try { OrderItem = new HelperManament().GetOrders(); if (OrderItem != null) { status = "Success"; statusMessage = "Get All Order successfully."; Status = Status.Success; } else { status = "Success"; statusMessage = "No Orders Available."; Status = Status.Failure; } } catch (Exception ex) { status = "Failure"; statusMessage = "Oops something went wrong. Please try again.";; Status = Status.Error; } response.Data = OrderItem; response.status = status; response.statusMessage = statusMessage; response.statusCode = Status; return(response); }
public BaseResponse DeleteOrder(HttpRequestMessage request, string OrderNO) { string status = string.Empty, statusMessage = string.Empty; Status Status = Status.Success; bool IsValid = true; bool DeleteStatus = false; BaseResponse response = new BaseResponse(); try { int Result = new HelperManament().DeleteOrder(OrderNO); if (Result > 0) { DeleteStatus = true; status = "Success"; statusMessage = "Order Deleted successfully."; Status = Status.Success; } else { DeleteStatus = false; status = "Failure"; statusMessage = "Unable to Delete the Order , Please try again."; Status = Status.Failure; } } catch (Exception ex) { status = "Failure"; statusMessage = "Oops something went wrong. Please try again.";; Status = Status.Error; } response.Data = DeleteStatus; response.status = status; response.statusMessage = statusMessage; response.statusCode = Status; return(response); }
public BaseResponse CreateOder(HttpRequestMessage request, OrderrequestDetails orderrequestDetails) { string status = string.Empty, statusMessage = string.Empty; Status Status = Status.Success; string OrderCode = ""; BaseResponse response = new BaseResponse(); try { if (orderrequestDetails != null) { OrderCode = new HelperManament().CreateOrder(orderrequestDetails); } if (OrderCode != "") { status = "Success"; statusMessage = "Create order successfully."; Status = Status.Success; } else { status = "Failure"; statusMessage = "Unable to Create order , Please try again."; Status = Status.Failure; } } catch (Exception ex) { status = "Failure"; statusMessage = "Oops something went wrong. Please try again.";; Status = Status.Error; } response.Data = OrderCode; response.status = status; response.statusMessage = statusMessage; response.statusCode = Status; return(response); }