代码拉取完成,页面将自动刷新
using Kingdee.BOS;
using Kingdee.BOS.App.Core.Utils;
using Kingdee.BOS.Core.Bill.PlugIn;
using Kingdee.BOS.Core.DynamicForm;
using Kingdee.BOS.Core.DynamicForm.Operation;
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
using Kingdee.BOS.Core.List;
using Kingdee.BOS.Core.Metadata;
using Kingdee.BOS.Core.Metadata.ConvertElement.ServiceArgs;
using Kingdee.BOS.Core.Metadata.FieldElement;
using Kingdee.BOS.Orm;
using Kingdee.BOS.Orm.DataEntity;
using Kingdee.BOS.Resource;
using Kingdee.BOS.ServiceHelper;
using Kingdee.BOS.Util;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Linq;
using Kingdee.K3.BD.BarCode.ServiceHelper;
using Kingdee.K3.BD.BarCode.Core.DataModel.Service;
using JMANT.Plugins;
using Kingdee.BOS.Core.Bill.PlugIn.Args;
using Kingdee.BOS.App.Data;
/// <summary>
///
/// 宇祥 2019.04.12
/// </summary>
namespace JMANT.Plugins
{
[Kingdee.BOS.Util.HotUpdate]
[Description("终端用户 编辑界面插件")]
public class POSUSERedit : AbstractBillPlugIn
{
public override void BeforeSave(BeforeSaveEventArgs e)
{
base.BeforeSave(e);
if (chkUserCount())
{
e.Cancel = true;
this.View.ShowErrMessage("终端用户超过200个,请联系服务厂商!");
}
if (!chkPwd())
e.Cancel = true;
}
public override void DataChanged(DataChangedEventArgs e)
{
base.DataChanged(e);
if (e.Field.Key.Equals("Fpwd") || e.Field.Key.Equals("Fpwd2"))
{
chkPwd();
}
}
public bool chkPwd()
{
var Fpwd = Convert.ToString(this.View.Model.GetValue("Fpwd"));
var Fpwd2 = Convert.ToString( this.View.Model.GetValue("Fpwd2"));
if (!Fpwd.Equals(Fpwd2))
{
this.View.ShowErrMessage("2次密码不一致,请确认");
return false;
}
else
return true;
}
/// <summary>
/// 不能超过200个用户
/// </summary>
/// <returns></returns>
private bool chkUserCount()
{
var sql = "select count(1) cnt from PAEZ_t_POSUSER";
var cnt = GetFirstColResult<int>(sql);
if (cnt > 200)
return true;
else
return false;
}
/// <summary>
/// 获取第一行第一列的值
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="sql"></param>
/// <returns></returns>
private T GetFirstColResult<T>(string sql)
{
//string sql = string.Format("/*dialect*/select sum(f_piqe_needqty) from PIQE_t_SCM_PreProentry where fid={0} and F_PIQE_MATERIALID={1}", pkId, mid);
if (sql.IsNullOrEmptyOrWhiteSpace())
return default(T);
var exp = from p
in DBUtils.ExecuteEnumerable(this.Context, sql)
select new
{
value = p.GetValue<T>(0)
};
T result = default(T);
var data = exp.FirstOrDefault();
if (data != null)
{
result = data.value;
}
return result;
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。