Ejemplo n.º 1
0
        public HttpResponseMessage InsertPurchaseInvoiceItems([FromBody] clspurchaseInvoiceItems request)
        {
            LoggerFactory.LoggerInstance.LogDebug("Request Started for : " + request.InvoiceItemID);
            HttpResponseMessage response = new HttpResponseMessage();

            try
            {
                purchase_invoice_itemsService objComService = new purchase_invoice_itemsService();
                var objResponse = objComService.InsertPurchaseInvoiceItems(request);
                if (objResponse != null && objResponse.ToString() != "")
                {
                    response = Request.CreateResponse(HttpStatusCode.OK, objResponse);
                    LoggerFactory.LoggerInstance.LogDebug("Request End for : " + request.InvoiceItemID);
                }
                else
                {
                    response = Request.CreateErrorResponse(HttpStatusCode.NotFound, "No detail found  for   ID : " + request.InvoiceItemID + ".");
                }
            }
            catch (Exception ex)
            {
                LoggerFactory.LoggerInstance.LogException(ex);
                response = Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Error occured while getting  ID " + request.InvoiceItemID + ".");
            }
            return(response);
        }
        public virtual int DeletePurchaseInvoiceItems(clspurchaseInvoiceItems obj)
        {
            int result = 0;

            try
            {
                result = (int)db.SP_purchase_invoice_items_Delete(obj.InvoiceItemID);
            }
            catch (Exception ex)
            {
                LoggerFactory.LoggerInstance.LogException(ex);
                throw ex;
            }

            return(result);
        }
        public virtual int UpdatePurchaseInvoiceItems(clspurchaseInvoiceItems obj)
        {
            int result = 0;

            try
            {
                result = (int)db.SP_purchase_invoice_items_Update(obj.InvoiceItemID, obj.InvoiceID, obj.PurchaseItemID, obj.Quantity, obj.Rate, obj.Amount, obj.Description);
            }
            catch (Exception ex)
            {
                LoggerFactory.LoggerInstance.LogException(ex);
                throw ex;
            }

            return(result);
        }
        public virtual long InsertPurchaseInvoiceItems(clspurchaseInvoiceItems obj)
        {
            long result   = 0;
            long?resultID = 0;

            try
            {
                result = (long)db.SP_purchase_invoice_items_Insert(ref resultID, obj.InvoiceID, obj.PurchaseItemID, obj.Quantity, obj.Rate, obj.Amount, obj.Description);
            }
            catch (Exception ex)
            {
                LoggerFactory.LoggerInstance.LogException(ex);
                throw ex;
            }

            return(result);
        }
        public virtual SP_purchase_invoice_items_SelectOneResult GetPurchaseInvoiceItemsDetailById(clspurchaseInvoiceItems obj)
        {
            SP_purchase_invoice_items_SelectOneResult objResult = new SP_purchase_invoice_items_SelectOneResult();

            try
            {
                objResult = (SP_purchase_invoice_items_SelectOneResult)db.SP_purchase_invoice_items_SelectOne(obj.InvoiceItemID);
            }
            catch (Exception ex)
            {
                LoggerFactory.LoggerInstance.LogException(ex);
                throw ex;
            }
            return(objResult);
        }