店铺备注批量编辑
This commit is contained in:
1 parent
679bae7c42
commit
79ff7217d4
7 files changed
+447
-154
No files matched your search
@@ -15,15 +15,19 @@ namespace TemuKJD.WXForms.ShopForms
|
||||
{
|
||||
public partial class WXShopAddEditForm : BaseGeneralForm
|
||||
{
|
||||
ShopLoginInfo shopLoginInfo = null;
|
||||
List<ShopLoginInfo> lstShopLoginInfo = null;
|
||||
ShopLoginInfo shop = null;
|
||||
bool isAdd = true;
|
||||
|
||||
public WXShopAddEditForm(ShopLoginInfo shop = null)
|
||||
public WXShopAddEditForm(List<ShopLoginInfo> shopLst = null)
|
||||
{
|
||||
InitializeComponent();
|
||||
shopLoginInfo = shop;
|
||||
if (shopLoginInfo != null)
|
||||
lstShopLoginInfo = shopLst;
|
||||
if (lstShopLoginInfo != null && lstShopLoginInfo.Count > 0)
|
||||
{
|
||||
shop = lstShopLoginInfo.FirstOrDefault();
|
||||
isAdd = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void btnOk_Click(object sender, EventArgs e)
|
||||
@@ -33,31 +37,44 @@ namespace TemuKJD.WXForms.ShopForms
|
||||
BaseMsgForm.ShowError("用户名不能为空!");
|
||||
return;
|
||||
}
|
||||
if (shopLoginInfo == null && string.IsNullOrEmpty(this.txtShopPassword.Text.Trim()))
|
||||
if (lstShopLoginInfo == null && string.IsNullOrEmpty(this.txtShopPassword.Text.Trim()))
|
||||
{
|
||||
BaseMsgForm.ShowError("密码不能为空!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (shopLoginInfo == null)
|
||||
shopLoginInfo = new ShopLoginInfo();
|
||||
if (lstShopLoginInfo == null || lstShopLoginInfo.Count == 0)
|
||||
{
|
||||
lstShopLoginInfo = new List<ShopLoginInfo>();
|
||||
shop = new ShopLoginInfo();
|
||||
}
|
||||
|
||||
shopLoginInfo.LoginName = this.txtLoginName.Text.Trim();
|
||||
shop.LoginName = this.txtLoginName.Text.Trim();
|
||||
if (!string.IsNullOrEmpty(this.txtShopPassword.Text.Trim()))
|
||||
shopLoginInfo.Password = DataOpenSSL.EncryptString(this.txtShopPassword.Text.Trim());
|
||||
shopLoginInfo.GroupName = this.cmbGroup.Text;
|
||||
shopLoginInfo.Notes = this.txtNotes.Text;
|
||||
shopLoginInfo.CompanyName = AllBase.BaseClass.CompanyName;
|
||||
shop.Password = DataOpenSSL.EncryptString(this.txtShopPassword.Text.Trim());
|
||||
shop.GroupName = this.cmbGroup.Text;
|
||||
shop.Notes = this.txtNotes.Text;
|
||||
shop.CompanyName = AllBase.BaseClass.CompanyName;
|
||||
|
||||
// 同一个登录账号下的店铺使用同样的groupName和Notes
|
||||
var shopLst = GlobalConfig.ShopLoginList.Where(s => s.LoginName == shopLoginInfo.LoginName && s.ShopId != shopLoginInfo.ShopId).ToList();
|
||||
var shopLst = GlobalConfig.ShopLoginList.Where(s => s.LoginName == shop.LoginName && s.ShopId != shop.ShopId).ToList();
|
||||
foreach (var shop in shopLst)
|
||||
{
|
||||
shop.GroupName = shopLoginInfo.GroupName;
|
||||
shop.Notes = shopLoginInfo.Notes;
|
||||
shop.GroupName = shop.GroupName;
|
||||
shop.Notes = shop.Notes;
|
||||
}
|
||||
|
||||
var shopSubAccountLstTmp = shop.ShopSubAccountList;
|
||||
foreach (var sp in lstShopLoginInfo)
|
||||
{
|
||||
sp.GroupName = this.cmbGroup.Text;
|
||||
sp.Notes = this.txtNotes.Text;
|
||||
sp.CompanyName = AllBase.BaseClass.CompanyName;
|
||||
sp.ShopSubAccountList.Clear();
|
||||
sp.ShopSubAccountList.AddRange(shopSubAccountLstTmp);
|
||||
}
|
||||
|
||||
this.OnSaveComplete(shopLoginInfo, isAdd);
|
||||
this.OnSaveComplete(lstShopLoginInfo, isAdd);
|
||||
this.Close();
|
||||
}
|
||||
|
||||
@@ -75,19 +92,19 @@ namespace TemuKJD.WXForms.ShopForms
|
||||
if (!string.IsNullOrEmpty(shop.GroupName) && !this.cmbGroup.Items.Contains(shop.GroupName))
|
||||
this.cmbGroup.Items.Add(shop.GroupName);
|
||||
}
|
||||
if (shopLoginInfo != null)
|
||||
if (lstShopLoginInfo != null && lstShopLoginInfo.Count > 0 && shop != null)
|
||||
{
|
||||
this.txtLoginName.Text = shopLoginInfo.LoginName;
|
||||
this.cmbGroup.Text = shopLoginInfo.GroupName;
|
||||
this.txtNotes.Text = shopLoginInfo.Notes;
|
||||
this.txtLoginName.Text = shop.LoginName;
|
||||
this.cmbGroup.Text = shop.GroupName;
|
||||
this.txtNotes.Text = shop.Notes;
|
||||
this.btnOk.Text = "更新";
|
||||
this.TitleText = "编辑店铺 - " + shopLoginInfo.ShopAccount;
|
||||
this.txtBuyAccount.Text = shopLoginInfo.BuyAccount;
|
||||
//this.txtChatAccount.Text = shopLoginInfo.ChatAccount;
|
||||
this.txtChatAccount.Text = shopLoginInfo.SubUserName;
|
||||
this.txtUploadAccount.Text = shopLoginInfo.UploadAccount;
|
||||
this.label7.Visible = true;
|
||||
this.TitleText = "编辑店铺 - " + shop.ShopAccount;
|
||||
this.txtBuyAccount.Text = shop.BuyAccount;
|
||||
this.txtChatAccount.Text = shop.ChatAccount;
|
||||
this.txtUploadAccount.Text = shop.UploadAccount;
|
||||
this.txtChatAccount.Text = shop.SubUserName;
|
||||
this.txtLoginName.Enabled = false;
|
||||
//this.lblAttention.Visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -115,7 +132,7 @@ namespace TemuKJD.WXForms.ShopForms
|
||||
|
||||
private void txt_Click(object sender, EventArgs e)
|
||||
{
|
||||
WXSubAccountShopEditForm f = new WXSubAccountShopEditForm(shopLoginInfo);
|
||||
WXSubAccountShopEditForm f = new WXSubAccountShopEditForm(shop);
|
||||
f.SaveComplete += F_SaveComplete;
|
||||
f.ShowDialog();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user