122 lines
4.0 KiB
C#
122 lines
4.0 KiB
C#
using AllBase.Helper;
|
|
using AllBase.Model.Result;
|
|
using LittleRabbit.LittleRabbitForms.BaseForms;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
namespace LittleRabbit.LittleRabbitForms.ShopForms
|
|
{
|
|
public partial class ShopAddEditForm : LRBaseForm
|
|
{
|
|
DouShopLoginInfo shopLoginInfo = null;
|
|
bool isAdd = true;
|
|
|
|
public ShopAddEditForm(DouShopLoginInfo shop = null)
|
|
{
|
|
InitializeComponent();
|
|
shopLoginInfo = shop;
|
|
if (shopLoginInfo != null)
|
|
isAdd = false;
|
|
}
|
|
|
|
private void btnOk_Click(object sender, EventArgs e)
|
|
{
|
|
if (string.IsNullOrEmpty(this.txtLoginName.Text.Trim()))
|
|
{
|
|
BaseMsgForm.ShowError("用户名不能为空!");
|
|
return;
|
|
}
|
|
if (shopLoginInfo == null && string.IsNullOrEmpty(this.txtShopPassword.Text.Trim()))
|
|
{
|
|
BaseMsgForm.ShowError("密码不能为空!");
|
|
return;
|
|
}
|
|
|
|
if (shopLoginInfo == null)
|
|
shopLoginInfo = new DouShopLoginInfo();
|
|
|
|
shopLoginInfo.LoginName = this.txtLoginName.Text.Trim();
|
|
if (!string.IsNullOrEmpty(this.txtShopPassword.Text.Trim()))
|
|
shopLoginInfo.Password = DataOpenSSL.EncryptString(this.txtShopPassword.Text.Trim());
|
|
shopLoginInfo.Group = this.cmbGroup.Text;
|
|
this.OnSaveComplete(shopLoginInfo, isAdd);
|
|
this.Close();
|
|
}
|
|
|
|
private void panel2_Paint(object sender, PaintEventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void ShopAddEditForm_Load(object sender, EventArgs e)
|
|
{
|
|
this.cmbGroup.Items.Clear();
|
|
this.cmbGroup.Items.Add(string.Empty);
|
|
foreach (var shop in GlobalConfig.DouShopLoginList)
|
|
{
|
|
if (!string.IsNullOrEmpty(shop.Group) && !this.cmbGroup.Items.Contains(shop.Group))
|
|
this.cmbGroup.Items.Add(shop.Group);
|
|
}
|
|
if (shopLoginInfo != null)
|
|
{
|
|
this.txtLoginName.Text = shopLoginInfo.LoginName;
|
|
this.cmbGroup.Text = shopLoginInfo.Group;
|
|
this.btnOk.Text = "更新";
|
|
this.TitleText = "编辑店铺 - " + shopLoginInfo.ShopAccount;
|
|
this.txtBuyAccount.Text = shopLoginInfo.BuyAccount;
|
|
this.txtChatAccount.Text = shopLoginInfo.ChatAccount;
|
|
this.txtUploadAccount.Text = shopLoginInfo.UploadAccount;
|
|
this.label7.Visible = true;
|
|
this.txtLoginName.Enabled = false;
|
|
}
|
|
else
|
|
{
|
|
this.txtBuyAccount.Enabled = false;
|
|
this.txtChatAccount.Enabled = false;
|
|
this.txtUploadAccount.Enabled = false;
|
|
this.txtBuyAccount.Text = this.txtChatAccount.Text = this.txtUploadAccount.Text = "请在编辑账户时修改子账户";
|
|
}
|
|
}
|
|
|
|
private void txtUploadAccount_TextChanged(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void txtChat_TextChanged(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void txtBuyAccount_TextChanged(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void txt_Click(object sender, EventArgs e)
|
|
{
|
|
SubAccountShopEditForm f = new SubAccountShopEditForm(shopLoginInfo);
|
|
f.SaveComplete += F_SaveComplete;
|
|
f.ShowDialog();
|
|
}
|
|
|
|
private void F_SaveComplete(object obj)
|
|
{
|
|
var shop = obj as DouShopLoginInfo;
|
|
if (shop != null)
|
|
{
|
|
this.txtBuyAccount.Text = shop.BuyAccount;
|
|
this.txtChatAccount.Text = shop.ChatAccount;
|
|
this.txtUploadAccount.Text = shop.UploadAccount;
|
|
}
|
|
}
|
|
}
|
|
}
|