private void LoadData() { int id = GetInt("id"); if (id > 0) { CurrentPaymentWay = PaymentWays.Instance.GetModel(id); if (CurrentPaymentWay == null) { WriteMessage("/message.aspx", "系统提示", "无效支付方式!", "", "/index.aspx"); } else { if (!Admin.Administrator && Admin.CorporationID != CurrentPaymentWay.CorporationID) { WriteMessage("/message.aspx", "系统提示", "没有权限!", "", "/index.aspx"); } if (!Admin.Administrator && CurrentPaymentWay.DataLevel == 0) { WriteMessage("/message.aspx", "系统提示", "没有权限!", "", "/index.aspx"); } txtName.Value = CurrentPaymentWay.Name; } } }
protected void btnSubmit_Click(object sender, EventArgs e) { PaymentWayInfo entity = new PaymentWayInfo(); int id = GetInt("id"); if (id > 0) { entity = PaymentWays.Instance.GetModel(id, true); FillData(entity); PaymentWays.Instance.Update(entity); } else { FillData(entity); entity.DataLevel = GetInt("corpid") == 0 ? 0 : 1; PaymentWays.Instance.Add(entity); } PaymentWays.Instance.ReloadPaymentWayListCache(); Response.Redirect(string.IsNullOrEmpty(FromUrl) ? "paymentwaymg.aspx" : FromUrl); }
private void FillData(PaymentWayInfo entity) { entity.Name = txtName.Value; entity.CorporationID = GetInt("corpid"); }