public JsonResult SetCustomerManualAnnualRevenue(int nCustomerID, decimal nRevenue, string sComment) { CustomerManualAnnualizedRevenueActionResult cmarar = null; Customer customer = _customers.ReallyTryGet(nCustomerID); if (customer == null) { Log.Alert("Failed to set manual annual revenue for customer {0}: no customer found.", nCustomerID); return(Json(new { success = false, })); } // if Log.Debug("Setting customer manual annual revenue for customer {0} to be {1} ({2})...", nCustomerID, nRevenue, sComment); if (string.IsNullOrWhiteSpace(sComment)) { Log.Alert("Failed to set manual annual revenue for customer {0}: no comment provided.", nCustomerID); return(Json(new { success = false, })); } // if try { cmarar = m_oServiceClient.Instance.SetCustomerManualAnnualizedRevenue(nCustomerID, nRevenue, sComment); } catch (Exception e) { Log.Warn(e, "Failed to set customer manual annual revenue for customer {0} to be {1} ({2})...", nCustomerID, nRevenue, sComment); return(Json(new { success = false, })); } // try if (!cmarar.Value.Revenue.HasValue) { Log.Warn("Failed to set customer manual annual revenue for customer {0} to be {1} ({2})...", nCustomerID, nRevenue, sComment); return(Json(new { success = false, })); } // try Log.Debug("Setting customer manual annual revenue for customer {0} to be {1} ({2}) complete.", nCustomerID, nRevenue, sComment); return(Json(new { success = true, has_value = true, is_alibaba = customer.IsAlibaba, value = cmarar.Value, })); } // SetCustomerManualAnnualRevenue
public JsonResult GetCustomerManualAnnualRevenue(int nCustomerID) { CustomerManualAnnualizedRevenueActionResult cmarar = null; Customer customer = _customers.ReallyTryGet(nCustomerID); if (customer == null) { Log.Alert("Failed to load manual annual revenue for customer {0}: no customer found.", nCustomerID); return(Json(new { success = false, }, JsonRequestBehavior.AllowGet)); } // if Log.Debug("Loading customer manual annual revenue for customer {0}...", nCustomerID); try { cmarar = m_oServiceClient.Instance.GetCustomerManualAnnualizedRevenue(nCustomerID); } catch (Exception e) { Log.Warn(e, "Failed to load manual annual revenue for customer {0}.", nCustomerID); return(Json(new { success = false, }, JsonRequestBehavior.AllowGet)); } // try Log.Debug( "Loading customer manual annual revenue for customer {0} complete, result: has value: {1}, value: {2}, set time: {3}, comment: {4}.", nCustomerID, cmarar.Value.Revenue.HasValue ? "yes" : "no", cmarar.Value.Revenue, cmarar.Value.EntryTime, cmarar.Value.Comment ); return(Json(new { success = true, has_value = cmarar.Value.Revenue.HasValue, is_alibaba = customer.IsAlibaba, value = cmarar.Value, }, JsonRequestBehavior.AllowGet)); } // GetCustomerManualAnnualRevenue