public static bool IsActiveSuperAccount(string seller, string desc = null) { var isSuperAccount = false; string mainPart = TbNickHelper.GetMainPart(seller); if (seller == mainPart) { isSuperAccount = true; } else { var superAccounts = Auth.GetSuperAccounts(mainPart); var activeNicks = Detected.GetLatest5SecDetectedNicksNotNull(); foreach (var acc in superAccounts) { if (activeNicks.Contains(acc)) { isSuperAccount = true; break; } } } if (!isSuperAccount && !string.IsNullOrEmpty(desc)) { var msg = string.Format("【{0}】没有【{1}】的权限\r\n\r\n需要在电脑上登录【{2}】店铺的主账号或者特权子账号才能{1}!\r\n\r\n是否查看如何设置特权子账号?", seller, desc , mainPart); MsgBox.ShowTip(msg, showHelp => { if (showHelp) { } }, "提示"); } return(isSuperAccount); }
private static List <string> GetFirstLoginNicks(List <string> lst) { var mainAccounts = TbNickHelper.GetMainAccounts(lst); mainAccounts.RemoveWhere((string x) => !Params.IsFirstLogin(x)); return(mainAccounts.ToList()); }
public WndShortcutImporter(string seller) { this.InitializeComponent(); this.Seller = seller; this._sellerMain = TbNickHelper.GetMainPart(seller); if (LocalParams.IsReplace) { this.rbtReplace.IsChecked = new bool?(true); this.rbtAppend.IsChecked = new bool?(false); } else { this.rbtReplace.IsChecked = new bool?(false); this.rbtAppend.IsChecked = new bool?(true); } if (LocalParams.IsPub) { this.rbtPub.IsChecked = new bool?(true); } else { LocalParams.IsPub = false; this.rbtPub.Content = "导入成:全店通用短语(没有权限,需要主号或特权子号)"; this.rbtPub.IsEnabled = false; this.rbtPrv.IsChecked = new bool?(true); } this.SelectFile(null); }
public static HashSet <string> GetSuperAccounts(string mainNick) { Util.Assert(TbNickHelper.IsMainAccount(mainNick)); var subAccs = Params.Auth.GetSuperAccounts(mainNick) ?? new HashSet <string>(); var superAccs = HashSetEx.Create <string>(subAccs.Select(k => mainNick + ":" + k)); superAccs.Add(mainNick); return(superAccs); }
private void InitShortcuts() { string mainNick = TbNickHelper.GetWwMainNickFromPubOrPrvDbAccount(_dbAccount); var ses = ShortcutHelper.GetShopShortcuts(mainNick); foreach (var et in ses) { AddOrUpdateInputPromptWordCite(et); } }
private void ImportOtherNickDataTip(string dbAccount) { var mainNick = TbNickHelper.GetWwMainNickFromPubOrPrvDbAccount(dbAccount); if (mainNick != this._sellerMain) { var msg = string.Format("注意:确定要导入其它店铺的短语?打开的文件是【{0}】店铺的短语", mainNick); MsgBox.ShowDialog(msg, null, "提示"); } }
private void SetImportDataType(string dbAccount) { if (TbNickHelper.IsPubDbAccount(dbAccount)) { this.rbtPub.IsChecked = true; } else { this.rbtPrv.IsChecked = true; } }
public void InitUI(string seller) { _seller = seller; _sellerMain = TbNickHelper.GetMainPart(seller); cboxCancelAutoOnReset.IsChecked = Params.Robot.CancelAutoOnReset; tboxNoAnswerTip.Text = Params.Robot.GetAutoModeNoAnswerTip(_seller); tboxAutoDelay.Text = Params.Robot.GetAutoModeReplyDelaySec(_seller).ToString(); tboxSendDelay.Text = Params.Robot.GetSendModeReplyDelaySec(_seller).ToString(); cboxAlwaysSend.IsChecked = Params.Robot.GetQuoteModeSendAnswerWhenFullMatch(_seller); cboxKeyExclude.IsChecked = Params.Robot.GetRuleIncludeExcept(_sellerMain); }
public static T GetMainNickSameWindow <T>(string seller) where T : EtWindow { List <T> appWindows = WindowEx.GetAppWindows <T>(); foreach (T t in appWindows.xSafeForEach <T>()) { if (TbNickHelper.IsSameShopAccount(t.Seller, seller)) { return(t); } } return(default(T)); }
public static HashSet <string> ConvertNicksToDbAccount(string[] nicks) { var set = new HashSet <string>(); foreach (var nick in nicks.xSafeForEach()) { set.Add(AccountHelper.GetPubDbAccount(nick)); set.Add(AccountHelper.GetPrvDbAccount(nick)); set.Add(nick); set.Add(TbNickHelper.GetMainPart(nick)); set.Add(AccountHelper.GetShopDbAccount(nick)); } return(set); }
public void InitUI(string seller) { _seller = seller; _sellerMain = TbNickHelper.GetMainPart(seller); tbkTip.Text = string.Format("请输入【{0}】店铺的【特权子账号(权限与主账号一样)】:(输入子账号部分即可,多个账号用逗号分隔)", _sellerMain); var superAccounts = Params.Auth.GetSuperAccounts(_sellerMain); tboxNicks.Text = superAccounts.xToString(" ,"); if (Params.Auth.GetIsAllAccountEditKnowledge(seller)) { rbtKnAll.IsChecked = true; rbtKnSuper.IsChecked = false; } else { rbtKnAll.IsChecked = false; rbtKnSuper.IsChecked = true; } if (Params.Auth.GetIsAllAccountEditRobot(seller)) { rbtRobotAll.IsChecked = true; rbtRobotSuper.IsChecked = false; } else { rbtRobotAll.IsChecked = false; rbtRobotSuper.IsChecked = true; } if (Params.Auth.GetIsAllAccountEditShortCut(seller)) { rbtScAll.IsChecked = true; rbtScSuper.IsChecked = false; } else { rbtScAll.IsChecked = false; rbtScSuper.IsChecked = true; } }
public static void ReadDataFromDb(string sellerName) { CiteTableManagerV2.InitCiteTables(TbNickHelper.ConvertNickToPubDbAccount(sellerName)); CiteTableManagerV2.InitCiteTables(TbNickHelper.ConvertNickToPrvDbAccount(sellerName)); }
public static bool IsSuperAccount(string seller) { var mainPart = TbNickHelper.GetMainPart(seller); return(mainPart == seller || QnHelper.Auth.GetSuperAccounts(mainPart).Contains(seller)); }
private void mExport_Click(object sender, RoutedEventArgs e) { string mainPart = TbNickHelper.GetMainPart(this._seller); TreeDbAccessor pubDbAccessor = (_pubTvController != null) ? _pubTvController.DbAccessor : null; //Exporter.Export(mainPart, pubDbAccessor, (_prvTvController != null) ? _prvTvController.DbAccessor : null); }
public static string GetMainPart(string seller) { return(TbNickHelper.GetMainPart(seller)); }
public static string GetShopDbAccount(string seller) { return(TbNickHelper.ConvertNickToShopDbAccount(seller)); }
public static string GetWwMainNick(string seller) { string pubDba = AccountHelper.GetPubDbAccount(seller); return(TbNickHelper.GetWwMainNickFromPubDbAccount(pubDba)); }
public static string GetPrvDbAccount(string seller) { return(HybridHelper.GetValue <string>(seller, HybridKey.PrvDbAccount.ToString(), TbNickHelper.ConvertNickToPrvDbAccount(seller))); }