private FreightTotal GetTotalAmount(string strTotalAmount, string strFreightAmount, string strTaxAmount) { Decimal FinalTotal = 0, DecTotalAmount = 0, DecFreightAmount = 0, DecAmount = 0; FreightTotal freightTotal = new FreightTotal(); int intTaxPer = 0; if (!string.IsNullOrEmpty(strTotalAmount)) { DecTotalAmount = Convert.ToDecimal(strTotalAmount); } if (!string.IsNullOrEmpty(strFreightAmount)) { DecFreightAmount = Convert.ToDecimal(strFreightAmount); freightTotal.Freight = DecFreightAmount; } if (!string.IsNullOrEmpty(strTaxAmount)) { intTaxPer = Convert.ToInt32(strTaxAmount); } DecAmount = DecTotalAmount; if (DecAmount != 0) { Decimal result = ((DecAmount / 100) * intTaxPer); freightTotal.TaxAmount = result; FinalTotal = DecAmount + result + DecFreightAmount; freightTotal.TotalAmount = FinalTotal; } return(freightTotal); }
public List <dynamic> AddCustDataFreight(FreightDetails FreightDetails) { List <dynamic> objDynamic = new List <dynamic>(); FreightTotal freightTotal = new FreightTotal(); var Data = JsonConvert.DeserializeObject <List <CustFreightTitle> >(FreightDetails.FreightData); CustFreightTitle CustFreightTitle = new CustFreightTitle(); string strFreightAmount = string.Empty, strTaxAmount = string.Empty, strLeadTime = string.Empty; Decimal FinalAmount = 0; Int64 OrderID = 0, intLeadTime = 0; if (!string.IsNullOrEmpty(securityHelper.Decrypt(FreightDetails.strOrderID, false))) { OrderID = Convert.ToInt64(securityHelper.Decrypt(FreightDetails.strOrderID, false)); } for (int i = 0; i < Data.Count; i++) { CustFreightTitle = Data[i]; if (CustFreightTitle.isFreightAmount == true) { strFreightAmount = CustFreightTitle.Data; } if (CustFreightTitle.isTaxApplicable == true) { strTaxAmount = CustFreightTitle.Data; } if (CustFreightTitle.isLeadTime == true) { strLeadTime = CustFreightTitle.Data; if (!string.IsNullOrEmpty(strLeadTime)) { intLeadTime = Convert.ToInt64(strLeadTime); } } AddFreightTitleDetail(OrderID, CustFreightTitle.FreightTitleId, CustFreightTitle.Data); } freightTotal = GetTotalAmount(FreightDetails.TotalAmount, strFreightAmount, strTaxAmount); int count = UpdateOrderDetail(OrderID, Convert.ToInt64(UserID), freightTotal.TotalAmount, freightTotal.Freight, freightTotal.TaxAmount, intLeadTime); EmailTemplate emailTemplate = new EmailTemplate(); CustRequestData custRequestData = new CustRequestData(); custRequestData.GetEmailDetails(OrderID.ToString(), string.Empty, string.Empty); objDynamic.Add(count); objDynamic.Add(FinalAmount); return(objDynamic); }