private async Task SendNoticeToAuthor() { TaskClaim taskClaim = await TaskClaim.Get(TaskClaimId); string hostname = ConfigurationManager.AppSettings["hostname"]; string body = $"Новый комментарий по задаче \"{taskClaim.Name}\" в проекте {taskClaim.Project.Name}.<br />{AdHelper.GetUserBySid(CreatorSid).DisplayName} пишет:<br />{Text}<p>Ссылка - <a href='{hostname}/Task/Card/{taskClaim.TaskId}'>{hostname}/Task/Card/{taskClaim.TaskId}</a></p>"; string mailToSid = null; if (taskClaim.CreatorSid.Equals(CreatorSid)) { if (String.IsNullOrEmpty(taskClaim.SpecialistSid)) { mailToSid = taskClaim.Project.ManagerSid; } else { mailToSid = taskClaim.SpecialistSid; } } else { mailToSid = taskClaim.CreatorSid; } MailAddress to = new MailAddress(AdHelper.GetUserBySid(mailToSid).Email); MessageHelper.SendNotice($"Новый комментарий", body, true, null, to); }
public AccountController(PassWordContext context, IConfiguration Configuration) { _context = context; _Configuration = Configuration; adHelper = new AdHelper(_Configuration); }
public void AdHelperConstructorTest() { AdHelper target = new AdHelper(); Assert.IsNotNull(target); Assert.IsInstanceOfType(target, typeof(AdHelper)); }
protected override void OnPanelShowBegin() { base.OnPanelShowBegin(); #if !UNITY_EDITOR && (UNITY_IOS || UNITY_ANDROID) AdHelper.HideBanner(); #endif }
public void GetGroupMembershipsTest_PassWithGroupList() { string userName = "******"; IList <string> actual; actual = AdHelper.GetGroupMemberships(userName); Assert.IsTrue(actual.Count > 0, "Expected groups to be returned. If this test failed, check the userName value and make sure you are connected to a domain."); }
public void GetGroupMembershipsTest_PassWithNoGroupsInList() { string userName = "******"; IList <string> actual; actual = AdHelper.GetGroupMemberships(userName); Assert.IsTrue(actual.Count == 0, "No groups were expected to be returned"); }
public void GetDistinguishedNameTest_PassWithGoodDn() { string userName = "******"; string expected = string.Empty; string actual; actual = AdHelper.GetDistinguishedName(userName); Assert.IsTrue(actual.Length > 0, "Expected a DN back. If this test failed, check the userName value and make sure you are connected to a domain."); }
public void GetDistinguishedNameTest_PassWithNoDnReturned() { string userName = "******"; string expected = string.Empty; string actual; actual = AdHelper.GetDistinguishedName(userName); Assert.IsTrue(actual.Length == 0, "No DN was expected a back."); }
public void SyncOuAndUsers() { AdHelper adHelper = new AdHelper(config, exconfig); var depts = GetDepts(); var users = GetUsers(); Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(depts)); Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(users)); adHelper.SyncOuAndUsers(depts, users, "离职员工"); }
private void GetKol_ShareAd() { try { DBEntity.Tab_Advertisement ent = AdHelper.GetAd("Kol_ShareAd"); string str = string.Format(" <a href='{0}'><img src='upload/Advertisement/{1}' width='108' height='147' alt='' /></a>", ent.Links, ent.AdImg); this.ltlKol_Share.Text = str.ToString(); } catch { } }
protected override void OnPanelHideCompleted() { base.OnPanelHideCompleted(); #if !UNITY_EDITOR && (UNITY_IOS || UNITY_ANDROID) if (!GameData.AdsRemoved && UncleBear.GameUtilities.GetParam("isBannerOpened", "close") == "open") { AdHelper.ShowBanner(); } #endif }
public bool HasAccess(params AdGroup[] groups) { bool result = false; if (String.IsNullOrEmpty(Sid)) { return(false); } if (AdHelper.UserInGroup(Sid, AdGroup.SuperAdmin)) { return(true); } result = AdHelper.UserInGroup(Sid, groups); return(result); }
//public List<AdGroup> AdGroups { get; set; } //private static string GetShortName(string name) //{ // if (String.IsNullOrEmpty(name)) return "Имя отсутствует"; // var shortName = new StringBuilder(); // string res = String.Empty; // var partNames = name.Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries); // if (partNames.Count() > 2) // { // shortName.Append(partNames[0]); // shortName.Append(" "); // shortName.Append(partNames[1].Substring(0, 1)); // shortName.Append("."); // shortName.Append(partNames[2].Substring(0, 1)); // shortName.Append("."); // res = shortName.ToString(); // } // else if (partNames.Count() == 2) // { // shortName.Append(partNames[0]); // shortName.Append(" "); // shortName.Append(partNames[1].Substring(0, 1)); // shortName.Append("."); // res = shortName.ToString(); // } // else // { // res = name; // } // return res; //} public bool Is(params AdGroup[] groups) { bool result = false; if (String.IsNullOrEmpty(Sid)) { return(false); } result = AdHelper.UserInGroup(Sid, groups); //foreach (AdGroup group in groups) //{ // result = AdGroups.Contains(group); // if (result) break; //} return(result); }
protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { try { DBEntity.Tab_Advertisement ent = AdHelper.GetAd("Ad_rule1"); DBEntity.Tab_Advertisement ent2 = AdHelper.GetAd("Ad_rule2"); this.Ad_rule1.Text = string.Format(" <a href='{0}' target='_blank'><img src='upload/Advertisement/{1}' width='448' height='254' /></a>", ent.Links, ent.AdImg); this.Ad_rule2.Text = string.Format(" <a href='{0}' target='_blank'><img src='upload/Advertisement/{1}' width='448' height='254' /></a>", ent2.Links, ent2.AdImg); } catch (Exception ex) { Cmn.Log.Write(ex.ToString()); } } }
private BllPost GetAd(ref int imagesOnPage) { BllPost ad; AdHelper.Initialize(_postService.GetAllWithAd()); if (User.Identity.IsAuthenticated) { var user = _accountService.GetUserByLogin(User.Identity.Name); var disabledAds = _postService.GetDisabledAds(user.UserId).ToList(); ad = AdHelper.GetAd(disabledAds, user.AgeId, user.SexId, user.CountryId, user.LanguageId); imagesOnPage -= 1; } else { ad = AdHelper.GetRandomAd(); } return(ad); }
void btnLogin_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(txtUserName.Text)) { MessageBox.Show("请输入用户名!"); return; } if (string.IsNullOrEmpty(txtPassword.Password)) { MessageBox.Show("请输入密码!"); return; } string domain = this.txtDomain.Text;//读取域信息 string roleName = System.Configuration.ConfigurationManager.AppSettings["role"].ToString(); string loginName = txtUserName.Text; string userName = ""; string ADPath = "LDAP://" + domain;; bool isRole = AdHelper.IsExistUser(ADPath, roleName, loginName, out userName); bool isTrueUser = AdHelper.IsDomainUser(domain, loginName, txtPassword.Password); bool result = isRole && isTrueUser; //result = true; if (result) { CurrentLoginUserName = userName; this.DialogResult = true; } else { if (!isRole) { MessageBox.Show("用户不存在或者不属于指定的用户组!"); } else if (!isTrueUser) { MessageBox.Show("登录密码错误!"); } return; } }
public ActionResult AdminAuth(AdminAutentification model) { var domainAuth = new AdHelper(); if (domainAuth.IsAuthenticated(model.Login, model.Password)) { // авторизовываем как обычного пользователя, но с добавление ID Администратора CurrentUser = DB.Account.Find(model.IdProducerUser); var adminId = DB.Account.Single(x => x.Login == model.Login).Id; Autentificate(adminId); } if (CurrentUser != null) { return(RedirectToAction("Index", "Profile")); } model.Password = ""; ErrorMessage("Пароль указан неверно"); return(View("AdminAuth", model)); }
public ActionResult Index(string login, string password) { var Login_ = login.Split(new Char[] { '@' }).First(); login = Login_; var DomainAuth = new AdHelper(); if (DomainAuth.IsAuthenticated(login, password)) { var X = DB.Account.FirstOrDefault(x => x.Login == login && x.TypeUser == 1); if (X == null) { AddAdminUserInBD(login); // добавление администратора } FormsAuthentication.SetAuthCookie(login, true); return(RedirectToAction("Index", "Home")); } ErrorMessage("Неверно введён логин или пароль"); return(RedirectToAction("Index", "Registration")); }
public HRController(IConfiguration Configuration) { _Configuration = Configuration; adHelper = new AdHelper(_Configuration); }
//public string SpecialistCategorySysName { get; set; } //public virtual SpecialistCategory SpecialistCategory { get; set; } public static IEnumerable <KeyValuePair <string, string> > GetProgrammers() { var list = AdHelper.GetSpecialistList(AdGroup.TaskTrackerProg); return(list); }