public IActionResult RegisterMatTransType([FromBody] MatTranTypes mattrantypes)
        {
            if (mattrantypes == null)
            {
                return(Ok(new APIResponse()
                {
                    status = APIStatus.FAIL.ToString(), response = $"{nameof(mattrantypes)} cannot be null"
                }));
            }
            try
            {
                var response = BillingHelpers.RegisterMatTransType(mattrantypes);
                if (response != null)
                {
                    return(Ok(new APIResponse()
                    {
                        status = APIStatus.PASS.ToString(), response = response
                    }));
                }

                return(Ok(new APIResponse()
                {
                    status = APIStatus.FAIL.ToString(), response = " Registration Failed."
                }));
            }
            catch (Exception ex)
            {
                return(Ok(new APIResponse()
                {
                    status = APIStatus.FAIL.ToString(), response = ex.Message
                }));
            }
        }
Exemplo n.º 2
0
        public IActionResult GetFinanceList()
        {
            APIResponse apiResponse;

            try
            {
                var financeList = BillingHelpers.GetFinances();
                if (financeList.Count > 0)
                {
                    dynamic expando = new ExpandoObject();
                    expando.financeslist = financeList;
                    return(Ok(apiResponse = new APIResponse()
                    {
                        status = APIStatus.PASS.ToString(), response = expando
                    }));
                }
                else
                {
                    return(Ok(apiResponse = new APIResponse()
                    {
                        status = APIStatus.FAIL.ToString(), response = "No Data Found."
                    }));
                }
            }
            catch (Exception ex)
            {
                return(Ok(apiResponse = new APIResponse()
                {
                    status = APIStatus.FAIL.ToString(), response = ex.Message
                }));
            }
        }
Exemplo n.º 3
0
        public IActionResult RegisterCardType([FromBody] CardType cardType)
        {
            if (cardType == null)
            {
                return(Ok(new APIResponse()
                {
                    status = APIStatus.FAIL.ToString(), response = $"{nameof(cardType)} cannot be null"
                }));
            }
            try
            {
                var reponse = BillingHelpers.RegisterCardType(cardType);
                if (reponse != null)
                {
                    return(Ok(new APIResponse()
                    {
                        status = APIStatus.PASS.ToString(), response = reponse
                    }));
                }

                return(Ok(new APIResponse()
                {
                    status = APIStatus.FAIL.ToString(), response = "Registration Failed"
                }));
            }
            catch (Exception ex)
            {
                return(Ok(new APIResponse()
                {
                    status = APIStatus.FAIL.ToString(), response = ex.Message
                }));
            }
        }
 public IActionResult DeleteMatTranTypes(string seqid)
 {
     if (seqid == null)
     {
         return(Ok(new APIResponse()
         {
             status = APIStatus.FAIL.ToString(), response = $"{nameof(seqid)}can not be null"
         }));
     }
     try
     {
         var result = BillingHelpers.DeleteMatTransType(Convert.ToInt32(seqid));
         if (result != null)
         {
             return(Ok(new APIResponse()
             {
                 status = APIStatus.PASS.ToString(), response = result
             }));
         }
         return(Ok(new APIResponse()
         {
             status = APIStatus.PASS.ToString(), response = "Deletion Failed."
         }));
     }
     catch (Exception ex)
     {
         return(Ok(new APIResponse()
         {
             status = APIStatus.PASS.ToString(), response = ex.Message
         }));
     }
 }
Exemplo n.º 5
0
 public IActionResult GetcardtypeList()
 {
     try
     {
         var cardTypeList = BillingHelpers.GetCardTypeList();
         if (cardTypeList.Count > 0)
         {
             dynamic expando = new ExpandoObject();
             expando.cardtype = BillingHelpers.GetCardTypeList();
             return(Ok(new APIResponse()
             {
                 status = APIStatus.PASS.ToString(), response = expando
             }));
         }
         else
         {
             return(Ok(new APIResponse()
             {
                 status = APIStatus.FAIL.ToString(), response = "No Data Found."
             }));
         }
     }
     catch (Exception ex)
     {
         return(Ok(new APIResponse()
         {
             status = APIStatus.FAIL.ToString(), response = ex.Message
         }));
     }
 }
Exemplo n.º 6
0
        public async Task <string> AdjustStorageAsync(User user, short storageAdjustmentGb)
        {
            if (user == null)
            {
                throw new ArgumentNullException(nameof(user));
            }

            if (!user.Premium)
            {
                throw new BadRequestException("Not a premium user.");
            }

            var secret = await BillingHelpers.AdjustStorageAsync(_paymentService, user, storageAdjustmentGb,
                                                                 StoragePlanId);

            await _referenceEventService.RaiseEventAsync(
                new ReferenceEvent(ReferenceEventType.AdjustStorage, user)
            {
                Storage  = storageAdjustmentGb,
                PlanName = StoragePlanId,
            });

            await SaveUserAsync(user);

            return(secret);
        }
Exemplo n.º 7
0
        public IActionResult DeleteCardType(string code)
        {
            if (code == null)
            {
                return(Ok(new APIResponse()
                {
                    status = APIStatus.FAIL.ToString(), response = $"{nameof(code)}can not be null"
                }));
            }
            try
            {
                var response = BillingHelpers.DeleteCardType(code);
                if (response != null)
                {
                    return(Ok(new APIResponse()
                    {
                        status = APIStatus.PASS.ToString(), response = response
                    }));
                }

                return(Ok(new APIResponse()
                {
                    status = APIStatus.FAIL.ToString(), response = "Deletion Failed"
                }));
            }
            catch (Exception ex)
            {
                return(Ok(new APIResponse()
                {
                    status = APIStatus.FAIL.ToString(), response = ex.Message
                }));
            }
        }
Exemplo n.º 8
0
        public IActionResult GetBillingList(string branchCode)
        {
            try
            {
                var billingList = BillingHelpers.GetBillings(branchCode);
                if (billingList.Count > 0)
                {
                    dynamic expando = new ExpandoObject();
                    expando.BillingList = billingList;
                    return(Ok(new APIResponse()
                    {
                        status = APIStatus.PASS.ToString(), response = expando
                    }));
                }

                return(Ok(new APIResponse()
                {
                    status = APIStatus.FAIL.ToString(), response = "No billing records Found."
                }));
            }
            catch (Exception ex)
            {
                return(Ok(new APIResponse()
                {
                    status = APIStatus.FAIL.ToString(), response = ex.Message
                }));
            }
        }
Exemplo n.º 9
0
        public IActionResult UpdateFinance([FromBody] Finance finances)
        {
            if (finances == null)
            {
                return(Ok(new APIResponse()
                {
                    status = APIStatus.FAIL.ToString(), response = $"{nameof(finances)} cannot be null"
                }));
            }

            try
            {
                var response = BillingHelpers.UpdateFinance(finances);
                if (response != null)
                {
                    return(Ok(new APIResponse()
                    {
                        status = APIStatus.PASS.ToString(), response = response
                    }));
                }
            }
            catch (Exception)
            {
            }

            return(Ok(new APIResponse()
            {
                status = APIStatus.FAIL.ToString(), response = "Updation Failed."
            }));
        }
Exemplo n.º 10
0
        public IActionResult DeleteCustomerReceipt(string seqID)
        {
            if (seqID == null)
            {
                return(BadRequest($"{nameof(seqID)}can not be null"));
            }

            try
            {
                var cardtype = BillingHelpers.DeleteCustomerReceipt(Convert.ToInt32(seqID));
                if (cardtype != null)
                {
                    return(Ok(new APIResponse()
                    {
                        status = APIStatus.PASS.ToString(), response = cardtype
                    }));
                }

                return(Ok(new APIResponse()
                {
                    status = APIStatus.PASS.ToString(), response = "Deletion Failed."
                }));
            }
            catch (Exception ex)
            {
                return(Ok(new APIResponse()
                {
                    status = APIStatus.PASS.ToString(), response = ex.Message
                }));
            }
        }
Exemplo n.º 11
0
        public IActionResult UpdateCustomerReceipt([FromBody] CustomerReceipts customerReceipts)
        {
            if (customerReceipts == null)
            {
                return(Ok(new APIResponse()
                {
                    status = APIStatus.FAIL.ToString(), response = $"{nameof(customerReceipts)} cannot be null"
                }));
            }

            try
            {
                var result = BillingHelpers.UpdateCustomerReceipt(customerReceipts);
                if (result != null)
                {
                    return(Ok(new APIResponse()
                    {
                        status = APIStatus.PASS.ToString(), response = result
                    }));
                }

                return(Ok(new APIResponse()
                {
                    status = APIStatus.PASS.ToString(), response = " Updation Failed"
                }));
            }
            catch (Exception ex)
            {
                return(Ok(new APIResponse()
                {
                    status = APIStatus.PASS.ToString(), response = ex.Message
                }));
            }
        }
Exemplo n.º 12
0
        public async Task AdjustStorageAsync(User user, short storageAdjustmentGb)
        {
            if (user == null)
            {
                throw new ArgumentNullException(nameof(user));
            }

            if (!user.Premium)
            {
                throw new BadRequestException("Not a premium user.");
            }

            await BillingHelpers.AdjustStorageAsync(_paymentService, user, storageAdjustmentGb, StoragePlanId);

            await SaveUserAsync(user);
        }
Exemplo n.º 13
0
 public IActionResult GetVoucherTypeList()
 {
     try
     {
         dynamic expando = new ExpandoObject();
         expando.VoucherTypesList = BillingHelpers.GetVoucherTypesList().Select(x => new { ID = x, TEXT = x });
         return(Ok(new APIResponse {
             status = APIStatus.PASS.ToString(), response = expando
         }));
     }
     catch (Exception ex)
     {
         return(Ok(new APIResponse {
             status = APIStatus.FAIL.ToString(), response = ex.Message
         }));
     }
 }
Exemplo n.º 14
0
 public IActionResult GetAsigAcctobranchGlAcc()
 {
     try
     {
         dynamic expando = new ExpandoObject();
         expando.AsigAcctobranchGlAccList = BillingHelpers.GetAsigAcctobranchGlAcc();
         return(Ok(new APIResponse {
             status = APIStatus.FAIL.ToString(), response = expando
         }));
     }
     catch (Exception ex)
     {
         return(Ok(new APIResponse {
             status = APIStatus.FAIL.ToString(), response = ex.Message
         }));
     }
 }
Exemplo n.º 15
0
 public IActionResult GetGLAccountsList(string accountType)
 {
     try
     {
         dynamic expando = new ExpandoObject();
         expando.accounts = BillingHelpers.GetGlAccountsDRCR(accountType).Select(gl => new { ID = gl.Glcode, Text = gl.GlaccountName });
         return(Ok(new APIResponse()
         {
             status = APIStatus.PASS.ToString(), response = expando
         }));
     }
     catch (Exception ex)
     {
         return(Ok(new APIResponse()
         {
             status = APIStatus.FAIL.ToString(), response = ex.Message
         }));
     }
 }
Exemplo n.º 16
0
 public IActionResult GetFinancesCutomerGLAccounts()
 {
     try
     {
         dynamic expando = new ExpandoObject();
         expando.glaccts = BillingHelpers.GetFinancesCutomerGLAccounts();
         return(Ok(new APIResponse()
         {
             status = APIStatus.PASS.ToString(), response = expando
         }));
     }
     catch (Exception ex)
     {
         return(Ok(new APIResponse()
         {
             status = APIStatus.FAIL.ToString(), response = ex.Message
         }));
     }
 }
 public IActionResult GetMatTranTypesList()
 {
     try
     {
         dynamic expando = new ExpandoObject();
         expando.materialtratypes = BillingHelpers.GetMatTranTypesList();
         return(Ok(new APIResponse()
         {
             status = APIStatus.PASS.ToString(), response = expando
         }));
     }
     catch (Exception ex)
     {
         return(Ok(new APIResponse()
         {
             status = APIStatus.FAIL.ToString(), response = ex.Message
         }));
     }
 }