using DevExpress.CodeParser;
|
|
namespace HStation.WinFrmUI.Organize
|
{
|
public partial class LoginUserInfoCtrl : DevExpress.XtraEditors.XtraUserControl
|
{
|
public LoginUserInfoCtrl()
|
{
|
InitializeComponent();
|
}
|
|
Vmo.UserLoginAccount _LoginAccount;
|
public HStation.Vmo.UserLoginAccount NewBindingData(HStation.Vmo.UserLoginAccount LoginAccount, out string error)//新建用户
|
{
|
error = "";
|
if(LoginAccount == null)//新建一个用户
|
{
|
_LoginAccount = new Vmo.UserLoginAccount();
|
}
|
else
|
{
|
error = "用户已经存在,不能再次创建!";
|
return null;
|
}
|
IsNoValid(out error);
|
if (!string.IsNullOrEmpty(error))
|
{
|
return null;
|
}
|
_LoginAccount.LoginName= TextEditLoginName.Text;
|
_LoginAccount.PassWord = TextEditPassWord.Text;
|
return _LoginAccount;
|
}
|
public bool ShowLoginName(HStation.Vmo.UserLoginAccount LoginAccount, out string error)//展示用户名
|
{
|
error = "";
|
if (LoginAccount == null)//判断目前是否需要修改用户信息
|
{
|
error = "用户不存在,请选择新建用户!";
|
return false;
|
}
|
TextEditLoginName.Text = LoginAccount.LoginName;//展示登录用户名
|
return true;
|
}
|
//public HStation.Vmo.UserLoginAccount UpdateBindingData(HStation.Vmo.UserLoginAccount LoginAccount, out string error)//修改用户
|
//{
|
// error = "";
|
// if(!ShowLoginName(LoginAccount, out error))//判断目前是否需要修改用户信息
|
// {
|
// error = "用户不存在,请选择新建用户!";
|
// return null;
|
// }
|
// if(LoginAccount.LoginName == null || LoginAccount.PassWord ==null)//判断传入的值是否有误
|
// {
|
// error = "用户存在,但传入用户名或传入密码为空!";
|
// return null;
|
// }
|
// IsNoValid(out error);
|
// if (string.IsNullOrEmpty(error))
|
// {
|
// return null;
|
// }
|
// _LoginAccount.LoginName = TextEditLoginName.Text;
|
// _LoginAccount.PassWord = TextEditPassWord.Text;
|
// return _LoginAccount;
|
//}
|
public void IsNoValid(out string error)//判断控件必填项
|
{
|
error = "";
|
dxValidationProviderLoginUser.Validate();
|
|
|
if (String.IsNullOrEmpty(TextEditLoginName.Text))
|
{
|
error = "用户名信息为空!";
|
return;
|
}
|
if (String.IsNullOrEmpty(TextEditPassWord.Text))
|
{
|
error = "密码为空!";
|
return;
|
}
|
if (String.IsNullOrEmpty(TextEditValidPassWord.Text))
|
{
|
error = "确认密码为空!";
|
return;
|
}
|
if (TextEditPassWord.Text != TextEditValidPassWord.Text)
|
{
|
error = "两次输入密码不一致!请重新输入!";
|
return;
|
}
|
}
|
|
public void SetNoInput()
|
{
|
TextEditLoginName.Enabled = false;
|
TextEditPassWord.Enabled = false;
|
TextEditValidPassWord.Enabled = false;
|
}
|
public void SetOffInput()
|
{
|
TextEditLoginName.Enabled = true;
|
TextEditPassWord.Enabled = true;
|
TextEditValidPassWord.Enabled = true;
|
}
|
|
}
|
}
|