/// <summary> /// 创建订单号,在外部初始化 /// </summary> /// <returns></returns> public tbl_api_orderItem InitUserInfo(int poolId) { _poolInfo = LightDataModel.tbl_cp_poolItem.GetRowById(dBase, poolId); if (_orderInfo != null) { return(_orderInfo); } return(_orderInfo = new tbl_api_orderItem() { cp_pool_id = poolId, IgnoreEquals = true }); }
protected void Page_Load(object sender, EventArgs e) { int.TryParse(Request["id"], out poolId); _poolModel = LightDataModel.tbl_cp_poolItem.GetRowById(dBase, poolId); if (_poolModel == null) { RedirectFromPage("参数无效"); return; } if (Request.HttpMethod == "POST") { SaveData(); return; } var models = n8wan.codepool.Dao.PoolSet.QueryPoolSetInfoById(dBase, poolId); rplst.DataSource = models; rplst.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (Request.HttpMethod != "POST") { return; } var model = new LightDataModel.tbl_cp_poolItem(); var s = Request["name"]; model.name = s; int i; int.TryParse(Request["price"], out i); model.fee = i * 100; s = Request["cpid"]; i = s.IndexOf(','); if (i != -1) { s = s.Substring(0, i); } int.TryParse(s, out i); model.cp_id = i; model.status = true; if (model.cp_id == 0 || model.fee == 0 || string.IsNullOrEmpty(model.name)) { Static.alert("所有功均为必填项"); return; } model.SaveToDatabase(dBase); Static.ClientRedirect("PoolSetEditor.aspx?returnUrl=./poolsetlist.aspx&id=" + model.id, "创建成功"); }
/// <summary> /// 用于填充订单基础信息 /// </summary> /// <param name="request"></param> /// <returns></returns> public override bool Init(HttpRequest request) { if (_orderInfo != null) { return(SetSuccess()); } var str = request["poolid"] ?? request["feecode"]; int i; if (string.IsNullOrEmpty(str)) { return(SetErrorMesage(codepool.ErrorCode.Paycode_Error, "poolid 错误")); } if (str.StartsWith("1") && str.Length == 6) { if (!int.TryParse(str.Substring(1), out i)) { return(SetErrorMesage(codepool.ErrorCode.Paycode_Error, "poolid 错误")); } _poolInfo = new tbl_cp_poolItem() { name = "feecode to poolset", status = true, fee = i }; } else { if (str.Length == 6) { str = str.Substring(1); } if (!int.TryParse(str, out i)) { return(SetErrorMesage(codepool.ErrorCode.Paycode_Error, "poolid 错误")); } _poolInfo = LightDataModel.tbl_cp_poolItem.GetRowById(dBase, i); } if (_poolInfo == null) { return(SetErrorMesage(codepool.ErrorCode.Paycode_Error, "无效poolid")); } _orderInfo = new LightDataModel.tbl_api_orderItem(); _orderInfo.IgnoreEquals = true; _orderInfo.cp_pool_id = _poolInfo.id; if (_poolInfo.id == 0) { _orderInfo.trone_order_id = _poolInfo.fee; _poolInfo.fee = 0; } _orderInfo.imei = request["imei"]; _orderInfo.imsi = request["imsi"]; _orderInfo.clientip = request["clientip"] ?? request["ip"] ?? "0.0.0.0"; if (int.TryParse(request["lac"], out i)) { _orderInfo.lac = i; } if (int.TryParse(request["cid"], out i)) { _orderInfo.cid = i; } _orderInfo.user_agent = request["useragent"]; _orderInfo.iccid = request["iccid"]; _orderInfo.packagename = request["package"]; _orderInfo.mobile = request["phone"] ?? request["mobile"]; _orderInfo.ExtrData = request["cpparams"]; _orderInfo.ip = request.UserHostAddress; if (string.IsNullOrEmpty(_orderInfo.mobile)) { if (string.IsNullOrEmpty(_orderInfo.imsi)) { return(SetErrorMesage(codepool.ErrorCode.Parameter_Miss, "imsi 或 phone 不能为空")); } } else if (_orderInfo.mobile.Length != 11) { return(SetErrorMesage(ErrorCode.Invalid_Parameter, "手机号码长度错误")); } InitUserExtrInfo(); return(SetSuccess()); }