1 Star 0 Fork 0

momoxxx/cq.Plugins

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
POSUSERedit.cs 3.37 KB
一键复制 编辑 原始数据 按行查看 历史
momoxxx 提交于 2024-01-09 14:40 . 添加项目文件。
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;
}
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/momoxxx/cq.-plugins.git
git@gitee.com:momoxxx/cq.-plugins.git
momoxxx
cq.-plugins
cq.Plugins
master

搜索帮助