/// <summary> /// Parses the specified bounds. /// </summary> /// <param name="bounds">The bounds.</param> /// <returns></returns> public static Bounds Parse(string bounds) { double swlat = 0D; double swlng = 0D; double nelat = 0D; double nelng = 0D; if (!string.IsNullOrEmpty(bounds)) { bounds = bounds.Trim('(', ')'); string[] pair = bounds.Split(':'); if (pair.Length == 2) { string[] p = pair[0].Split(','); if (p.Length == 2) { swlat = JsUtility.ToDouble(p[0]); swlng = JsUtility.ToDouble(p[1]); } p = pair[1].Split(','); if (p.Length == 2) { nelat = JsUtility.ToDouble(p[0]); nelng = JsUtility.ToDouble(p[1]); } } } return(new Bounds { SouthWest = new LatLng(swlat, swlng), NorthEast = new LatLng(nelat, nelng) }); }
/// <summary> /// Parses the specified value. /// </summary> /// <param name="value">The value.</param> /// <returns></returns> public static Point Parse(string value) { int x = 0; int y = 0; if (!string.IsNullOrEmpty(value)) { string[] pair = value.Split(','); if (pair.Length >= 2) { x = JsUtility.ToInt(pair[0]); y = JsUtility.ToInt(pair[1]); } } return(new Point(x, y)); }
// GET: CorpBill public ActionResult CorpBillAdd() { int id = 0; if (string.IsNullOrEmpty(Request.QueryString["id"]) || !int.TryParse(Request.QueryString["id"], out id) || id <= 0) { return(Content(JsUtility.WarmAlert("客户不存在", redirectUrl))); } CorpBillBLL corpBillBLL = new CorpBillBLL(); ResultModel <CorpBill> corpBillResult = corpBillBLL.LoadCorpBills(id); if (corpBillResult.ResultStatus != 0) { return(Json(ResultModel.GenericResult <CorpBill>(corpBillResult))); } List <CorpBill> rtnCorpBill = corpBillResult.ReturnValues; if (rtnCorpBill == null) { return(Json(new ResultModel("获取账单列表失败"))); } int corpBillCount = rtnCorpBill.Count(); if (corpBillCount > 0) { return(Content(JsUtility.WarmAlert("客户本月账单已生成", redirectUrl))); } ResultModel result = corpBillBLL.LoadCorpEmployeeList(0, 500, null, id); if (result.ResultStatus != 0) { return(Content(JsUtility.WarmAlert("获取错误", redirectUrl))); } System.Data.DataTable dt = result.ReturnValue as System.Data.DataTable; if (dt == null) { return(Content(JsUtility.WarmAlert("获取错误", redirectUrl))); } string optJsonStr = Newtonsoft.Json.JsonConvert.SerializeObject(dt, new Newtonsoft.Json.Converters.DataTableConverter()); ViewData["JsonOptData"] = optJsonStr; return(View()); }
/// <summary> /// Parses the specified value. /// </summary> /// <param name="value">The value.</param> /// <returns></returns> public static Size Parse(string value) { int width = 0; int height = 0; if (!string.IsNullOrEmpty(value)) { string[] pair = value.Split(','); if (pair.Length >= 2) { width = JsUtility.ToInt(pair[0]); height = JsUtility.ToInt(pair[1]); } } return(new Size(width, height)); }
/// <summary> /// Parses the specified pair. /// </summary> /// <param name="point">The point.</param> /// <returns></returns> public static LatLng Parse(string point) { double lat = 0D; double lng = 0D; if (!string.IsNullOrEmpty(point)) { point = point.Trim('(', ')'); string[] pair = point.Split(','); if (pair.Length >= 2) { lat = JsUtility.ToDouble(pair[0]); lng = JsUtility.ToDouble(pair[1]); } } return(new LatLng(lat, lng)); }
/// <summary> /// Returns a <see cref="System.String"/> that represents this instance. /// </summary> /// <returns> /// A <see cref="System.String"/> that represents this instance. /// </returns> public override string ToString() { return(string.Format("{0},{1}:{2},{3}", JsUtility.Encode(SouthWest.Latitude), JsUtility.Encode(SouthWest.Longitude), JsUtility.Encode(NorthEast.Latitude), JsUtility.Encode(NorthEast.Longitude))); }
/// <summary> /// Returns a <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>. /// </summary> /// <returns> /// A <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>. /// </returns> public override string ToString() { return((_point != null) ? string.Format("{0},{1}", JsUtility.Encode(_point.Latitude), JsUtility.Encode(_point.Longitude)) : Address); }
/// <summary> /// Returns a <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>. /// </summary> /// <returns> /// A <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>. /// </returns> public override string ToString() { return(string.Format("{0},{1}", JsUtility.Encode(Latitude), JsUtility.Encode(Longitude))); }
public ActionResult Insert(CorpBill corpBill, CorpBillDetail[] details) { corpBill.CorpBillStatus = (int)StatusEnum.已完成; //string json = Newtonsoft.Json.JsonConvert.SerializeObject(employee); CorpBillBLL corpBillBLL = new CorpBillBLL(); CorpBillDetailBLL detailBLL = new CorpBillDetailBLL(); //获取企业账单 ResultModel <CorpBill> corpBillResult = corpBillBLL.LoadCorpBills(corpBill.CorpId); if (corpBillResult.ResultStatus != 0) { return(Json(new ResultModel("获取账单列表失败"))); } List <CorpBill> rtnCorpBill = corpBillResult.ReturnValues; if (rtnCorpBill == null) { return(Json(new ResultModel("获取账单列表失败"))); } int corpBillCount = rtnCorpBill.Count(); if (corpBillCount > 0) { return(Content(JsUtility.WarmAlert("客户本月账单已生成", redirectUrl))); } //新增账单 ResultModel result = corpBillBLL.Insert(corpBill); if (result.ResultStatus != 0) { return(Json(result)); } int corpBillId = 0; if (result.ReturnValue == null || !int.TryParse(result.ReturnValue.ToString(), out corpBillId) || corpBillId <= 0) { return(Content("账单新增失败")); } //新增制单明细 foreach (CorpBillDetail detail in details) { detail.CorpBillId = corpBillId; detail.DetailStatus = (int)StatusEnum.已完成; result = detailBLL.Insert(detail); if (result.ResultStatus != 0) { return(Json(result)); } } result.Message = "账单新增成功"; result.ReturnValue = ""; result.ResultStatus = 0; return(Json(result)); }
public ActionResult Insert(SupBill supBill, SupBillDetail[] details) { supBill.SupBillStatus = (int)StatusEnum.已完成; //string json = Newtonsoft.Json.JsonConvert.SerializeObject(employee); SupBillBLL supBillBLL = new SupBillBLL(); SupBillDetailBLL detailBLL = new SupBillDetailBLL(); //获取企业账单 ResultModel <SupBill> supBillResult = supBillBLL.LoadSupBills(supBill.SupId); if (supBillResult.ResultStatus != 0) { return(Json(ResultModel.GenericResult <SupBill>(supBillResult))); } List <SupBill> rtnSupBill = supBillResult.ReturnValues; if (rtnSupBill == null) { return(Json(new ResultModel("获取账单列表失败"))); } int supBillCount = rtnSupBill.Count(); if (supBillCount > 0) { return(Content(JsUtility.WarmAlert("供应商本月账单已生成", redirectUrl))); } //新增账单 ResultModel result = supBillBLL.Insert(supBill); if (result.ResultStatus != 0) { return(Json(result)); } int supBillId = 0; if (result.ReturnValue == null || !int.TryParse(result.ReturnValue.ToString(), out supBillId) || supBillId <= 0) { return(Content("账单新增失败")); } //新增制单明细 foreach (SupBillDetail detail in details) { detail.SupBillId = supBillId; detail.DetailStatus = (int)StatusEnum.已完成; result = detailBLL.Insert(detail); if (result.ResultStatus != 0) { return(Json(result)); } } result.Message = "账单新增成功"; result.ReturnValue = ""; result.ResultStatus = 0; return(Json(result)); }