private void Bind() { tm_Payment entity = Core.Container.Instance.Resolve <IServicePayment>().GetEntity(_id); txbPaymentName.Text = entity.PaymentName; numProportion.Text = entity.Proportion.ToString(); numSort.Text = entity.Sort.ToString(); radioIsVip.SelectedValue = entity.IsVip; radioIsIntegral.SelectedValue = entity.IsIntegral; radioIsUsed.SelectedValue = entity.IsUsed; rbtnRecord.SelectedValue = entity.Proportion.ToString(); }
private void SetSelectedUsersEnableStatus(bool enabled) { string isUsed = enabled ? "1" : "2"; // 从每个选中的行中获取ID(在Grid1中定义的DataKeyNames) List <int> ids = GetSelectedDataKeyIDs(Grid1); // 执行数据库操作 foreach (int ID in ids) { tm_Payment entity = Core.Container.Instance.Resolve <IServicePayment>().GetEntity(ID); entity.IsUsed = isUsed; Core.Container.Instance.Resolve <IServicePayment>().Update(entity); } // 重新绑定表格 BindGrid(); }
protected void btnSaveClose_Click(object sender, EventArgs e) { if (action == "add") { string paymentName = txbPaymentName.Text.Trim(); int sort = Int32.Parse(numSort.Text); IList <ICriterion> qryList = new List <ICriterion>(); qryList.Add(Expression.Disjunction() .Add(Expression.Eq("PaymentName", paymentName)) ); tm_Payment entity = Core.Container.Instance.Resolve <IServicePayment>().GetEntityByFields(qryList); if (entity != null) { Alert.ShowInTop("已存在支付方式名为[ " + entity.PaymentName + " ]的记录!保存失败", MessageBoxIcon.Warning); return; } } SaveItem(); PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); }
private void SaveItem() { tm_Payment entity = new tm_Payment(); if (action == "edit") { entity = Core.Container.Instance.Resolve <IServicePayment>().GetEntity(_id);; } entity.PaymentName = txbPaymentName.Text.Trim(); entity.IsUsed = radioIsUsed.SelectedValue; entity.IsVip = radioIsVip.SelectedValue; entity.IsIntegral = radioIsIntegral.SelectedValue; entity.Proportion = int.Parse(rbtnRecord.SelectedValue); entity.Sort = Int32.Parse(numSort.Text); if (action == "edit") { Core.Container.Instance.Resolve <IServicePayment>().Update(entity); } else { Core.Container.Instance.Resolve <IServicePayment>().Create(entity); } }